diff --git a/common/pkg/config/feature.go b/common/pkg/config/feature.go index ed3b06cf1..90254bac7 100644 --- a/common/pkg/config/feature.go +++ b/common/pkg/config/feature.go @@ -50,6 +50,11 @@ var ( FeatureFileManager Feature = NewFeature("file_manager", true) // File Manager feature enabled by default ) +// SetFeatureEnabled sets the enabled state for a feature. Intended for tests. +func SetFeatureEnabled(f Feature, enabled bool) { + features[f] = enabled +} + // logFeatureStates logs the enabled/disabled state of all registered features. func logFeatureStates() { for f, enabled := range features { diff --git a/controlplane-api/cmd/config/config.go b/controlplane-api/cmd/config/config.go index 5c4fe77d1..93c5c4415 100644 --- a/controlplane-api/cmd/config/config.go +++ b/controlplane-api/cmd/config/config.go @@ -21,8 +21,9 @@ type ServerConfig struct { } type KubernetesConfig struct { - Enabled bool `yaml:"enabled"` - Kubeconfig string `yaml:"kubeconfig"` // optional, defaults to in-cluster config + Enabled bool `yaml:"enabled"` + Kubeconfig string `yaml:"kubeconfig"` // optional, defaults to in-cluster config + Environment string `yaml:"environment"` // environment scope for the scoped client } type DatabaseConfig struct { @@ -56,7 +57,7 @@ type LogConfig struct { func DefaultConfig() *ServerConfig { return &ServerConfig{ Database: DatabaseConfig{ - URL: "postgres://localhost:5432/controlplane?sslmode=disable", + URL: "postgres://controlplane:controlplane@localhost:5432/controlplane?sslmode=disable", }, Server: HTTPServerConfig{ Address: ":8443", @@ -75,6 +76,10 @@ func DefaultConfig() *ServerConfig { Log: LogConfig{ Level: "info", }, + Kubernetes: KubernetesConfig{ + Enabled: true, + Environment: "poc", // TODO: for now, this is fine. Needs to be refined later + }, } } diff --git a/controlplane-api/cmd/main.go b/controlplane-api/cmd/main.go index e7b2fb79c..263364b0b 100644 --- a/controlplane-api/cmd/main.go +++ b/controlplane-api/cmd/main.go @@ -20,6 +20,7 @@ import ( cserver "github.com/telekom/controlplane/common-server/pkg/server" "github.com/telekom/controlplane/common-server/pkg/server/middleware/security" "github.com/telekom/controlplane/common-server/pkg/server/serve" + cc "github.com/telekom/controlplane/common/pkg/client" "github.com/vektah/gqlparser/v2/ast" "go.uber.org/zap" "go.uber.org/zap/zapcore" @@ -41,8 +42,10 @@ import ( gqlcontroller "github.com/telekom/controlplane/controlplane-api/internal/graphql" "github.com/telekom/controlplane/controlplane-api/internal/interceptor" "github.com/telekom/controlplane/controlplane-api/internal/resolvers" + "github.com/telekom/controlplane/controlplane-api/internal/secrets" "github.com/telekom/controlplane/controlplane-api/internal/service" organizationv1 "github.com/telekom/controlplane/organization/api/v1" + secretsapi "github.com/telekom/controlplane/secret-manager/api" ) var configFile string @@ -76,18 +79,19 @@ func main() { log.Error(err, "failed to create Kubernetes client") os.Exit(1) } + scopedClient := cc.NewScopedClient(k8sClient, cfg.Kubernetes.Environment) services = service.Services{ - Team: service.NewTeamK8sService(k8sClient), - Application: service.NewApplicationK8sService(k8sClient), - Approval: service.NewApprovalK8sService(k8sClient), + Team: service.NewTeamK8sService(scopedClient), + Application: service.NewApplicationK8sService(scopedClient), + Approval: service.NewApprovalK8sService(scopedClient), } log.Info("Kubernetes integration enabled") } else { log.Info("Kubernetes integration disabled, mutations will be unavailable") } - srv := newGraphQLServer(client, services, cfg.Security.Enabled) - + secretResolver := secrets.NewResolver(secretsapi.NewSecrets()) + srv := newGraphQLServer(client, services, secretResolver, cfg.Security.Enabled) appCfg := cserver.NewAppConfig() appCfg.CtxLog = log appCfg.EnableCors = true @@ -176,8 +180,8 @@ func newK8sClient(cfg config.KubernetesConfig) (client.Client, error) { return client.New(restConfig, client.Options{Scheme: scheme}) } -func newGraphQLServer(entClient *ent.Client, services service.Services, securityEnabled bool) *handler.Server { - srv := handler.New(resolvers.NewSchema(entClient, services)) +func newGraphQLServer(entClient *ent.Client, services service.Services, secretResolver *secrets.Resolver, securityEnabled bool) *handler.Server { + srv := handler.New(resolvers.NewSchema(entClient, services, secretResolver)) srv.AddTransport(transport.Options{}) srv.AddTransport(transport.GET{}) srv.AddTransport(transport.POST{}) @@ -187,8 +191,10 @@ func newGraphQLServer(entClient *ent.Client, services service.Services, security srv.Use(extension.AutomaticPersistedQuery{ Cache: lru.New[string](100), }) + srv.SetErrorPresenter(gqlcontroller.ErrorPresenter) srv.AroundOperations(gqlcontroller.ViewerFromBusinessContext(entClient, securityEnabled)) + srv.AroundOperations(gqlcontroller.LogMutationUser()) return srv } diff --git a/controlplane-api/config/default/deployment_patch.yaml b/controlplane-api/config/default/deployment_patch.yaml index 826d0012f..852d2998e 100644 --- a/controlplane-api/config/default/deployment_patch.yaml +++ b/controlplane-api/config/default/deployment_patch.yaml @@ -15,3 +15,37 @@ name: cert-volume mountPath: /etc/tls readOnly: true + +# [SECRET_MANAGER] This patch will configure the necessary service account token projection for the secret manager client +- op: add + path: /spec/template/spec/volumes/0 + value: + name: secretmgr-token + projected: + sources: + - serviceAccountToken: + path: token + expirationSeconds: 600 + audience: secret-manager +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: secretmgr-token + mountPath: /var/run/secrets/secretmgr + readOnly: true + +# This patch will add the trust-manager bundle to the deployment +# Only if trust-manager is installed, see https://cert-manager.io/docs/trust/trust-manager +- op: add + path: /spec/template/spec/volumes/0 + value: + name: trust-bundle + configMap: + name: secret-manager-trust-bundle + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: trust-bundle + mountPath: /var/run/secrets/trust-bundle + readOnly: true diff --git a/controlplane-api/config/default/kustomization.yaml b/controlplane-api/config/default/kustomization.yaml index f9d61f6d4..993457dbb 100644 --- a/controlplane-api/config/default/kustomization.yaml +++ b/controlplane-api/config/default/kustomization.yaml @@ -42,10 +42,14 @@ configMapGenerator: patches: # This is only needed when using the cert-manager to issue certificates. + # [SECRET_MANAGER] The following patch will add the secret manager to the deployment. - path: deployment_patch.yaml target: kind: Deployment name: controlplane-api + - path: namespace_patch.yaml + target: + kind: Namespace # This is only needed when using the cert-manager to issue certificates. replacements: diff --git a/controlplane-api/config/default/namespace_patch.yaml b/controlplane-api/config/default/namespace_patch.yaml new file mode 100644 index 000000000..afe44a1da --- /dev/null +++ b/controlplane-api/config/default/namespace_patch.yaml @@ -0,0 +1,8 @@ +# Copyright 2025 Deutsche Telekom IT GmbH +# +# SPDX-License-Identifier: Apache-2.0 + +# This patch is only needed when you want to use the network policy +- op: add + path: /metadata/labels/cp.ei.telekom.de~1secret-manager + value: "enabled" diff --git a/controlplane-api/ent.graphql b/controlplane-api/ent.graphql index 5fa1c7bb8..fc9115a6c 100644 --- a/controlplane-api/ent.graphql +++ b/controlplane-api/ent.graphql @@ -1,7 +1,6 @@ -# Copyright 2026 Deutsche Telekom IT GmbH +# SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH # # SPDX-License-Identifier: Apache-2.0 - directive @goField(forceResolver: Boolean, name: String, omittable: Boolean) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION directive @goModel(model: String, models: [String!], forceGenerate: Boolean) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION type ApiExposure implements Node { @@ -512,7 +511,11 @@ type Application implements Node { name: String! clientID: String clientSecret: String - issuerURL: String + rotatedClientSecret: String + rotatedExpiresAt: Time + currentExpiresAt: Time + secretRotationPhase: ApplicationSecretRotationPhase! + secretRotationMessage: String zone: Zone! exposedApis( """ @@ -576,6 +579,68 @@ type Application implements Node { """ where: ApiSubscriptionWhereInput ): ApiSubscriptionConnection! + exposedEvents( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for EventExposures returned from the connection. + """ + orderBy: EventExposureOrder + + """ + Filtering options for EventExposures returned from the connection. + """ + where: EventExposureWhereInput + ): EventExposureConnection! + subscribedEvents( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for EventSubscriptions returned from the connection. + """ + orderBy: EventSubscriptionOrder + + """ + Filtering options for EventSubscriptions returned from the connection. + """ + where: EventSubscriptionWhereInput + ): EventSubscriptionConnection! } """ A connection to a list of items. @@ -629,6 +694,16 @@ enum ApplicationOrderField { NAME } """ +ApplicationSecretRotationPhase is enum for the field secret_rotation_phase +""" +enum ApplicationSecretRotationPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/application.SecretRotationPhase") { + DONE + ROTATING + GRACE_PERIOD_ACTIVE + GRACE_PERIOD_EXPIRING + FAILED +} +""" ApplicationStatusPhase is enum for the field status_phase """ enum ApplicationStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/application.StatusPhase") { @@ -774,41 +849,56 @@ input ApplicationWhereInput { clientIDEqualFold: String clientIDContainsFold: String """ - client_secret field predicates - """ - clientSecret: String - clientSecretNEQ: String - clientSecretIn: [String!] - clientSecretNotIn: [String!] - clientSecretGT: String - clientSecretGTE: String - clientSecretLT: String - clientSecretLTE: String - clientSecretContains: String - clientSecretHasPrefix: String - clientSecretHasSuffix: String - clientSecretIsNil: Boolean - clientSecretNotNil: Boolean - clientSecretEqualFold: String - clientSecretContainsFold: String - """ - issuer_url field predicates - """ - issuerURL: String - issuerURLNEQ: String - issuerURLIn: [String!] - issuerURLNotIn: [String!] - issuerURLGT: String - issuerURLGTE: String - issuerURLLT: String - issuerURLLTE: String - issuerURLContains: String - issuerURLHasPrefix: String - issuerURLHasSuffix: String - issuerURLIsNil: Boolean - issuerURLNotNil: Boolean - issuerURLEqualFold: String - issuerURLContainsFold: String + rotated_expires_at field predicates + """ + rotatedExpiresAt: Time + rotatedExpiresAtNEQ: Time + rotatedExpiresAtIn: [Time!] + rotatedExpiresAtNotIn: [Time!] + rotatedExpiresAtGT: Time + rotatedExpiresAtGTE: Time + rotatedExpiresAtLT: Time + rotatedExpiresAtLTE: Time + rotatedExpiresAtIsNil: Boolean + rotatedExpiresAtNotNil: Boolean + """ + current_expires_at field predicates + """ + currentExpiresAt: Time + currentExpiresAtNEQ: Time + currentExpiresAtIn: [Time!] + currentExpiresAtNotIn: [Time!] + currentExpiresAtGT: Time + currentExpiresAtGTE: Time + currentExpiresAtLT: Time + currentExpiresAtLTE: Time + currentExpiresAtIsNil: Boolean + currentExpiresAtNotNil: Boolean + """ + secret_rotation_phase field predicates + """ + secretRotationPhase: ApplicationSecretRotationPhase + secretRotationPhaseNEQ: ApplicationSecretRotationPhase + secretRotationPhaseIn: [ApplicationSecretRotationPhase!] + secretRotationPhaseNotIn: [ApplicationSecretRotationPhase!] + """ + secret_rotation_message field predicates + """ + secretRotationMessage: String + secretRotationMessageNEQ: String + secretRotationMessageIn: [String!] + secretRotationMessageNotIn: [String!] + secretRotationMessageGT: String + secretRotationMessageGTE: String + secretRotationMessageLT: String + secretRotationMessageLTE: String + secretRotationMessageContains: String + secretRotationMessageHasPrefix: String + secretRotationMessageHasSuffix: String + secretRotationMessageIsNil: Boolean + secretRotationMessageNotNil: Boolean + secretRotationMessageEqualFold: String + secretRotationMessageContainsFold: String """ zone edge predicates """ @@ -829,6 +919,16 @@ input ApplicationWhereInput { """ hasSubscribedApis: Boolean hasSubscribedApisWith: [ApiSubscriptionWhereInput!] + """ + exposed_events edge predicates + """ + hasExposedEvents: Boolean + hasExposedEventsWith: [EventExposureWhereInput!] + """ + subscribed_events edge predicates + """ + hasSubscribedEvents: Boolean + hasSubscribedEventsWith: [EventSubscriptionWhereInput!] } type Approval implements Node { id: ID! @@ -1161,6 +1261,11 @@ input ApprovalRequestWhereInput { """ hasAPISubscription: Boolean hasAPISubscriptionWith: [ApiSubscriptionWhereInput!] + """ + event_subscription edge predicates + """ + hasEventSubscription: Boolean + hasEventSubscriptionWith: [EventSubscriptionWhereInput!] } """ ApprovalState is enum for the field state @@ -1359,29 +1464,106 @@ input ApprovalWhereInput { """ hasAPISubscription: Boolean hasAPISubscriptionWith: [ApiSubscriptionWhereInput!] + """ + event_subscription edge predicates + """ + hasEventSubscription: Boolean + hasEventSubscriptionWith: [EventSubscriptionWhereInput!] } """ Define a Relay Cursor type: https://relay.dev/graphql/connections.htm#sec-Cursor """ scalar Cursor -type Group implements Node { +type EventExposure implements Node { id: ID! + createdAt: Time! + lastModifiedAt: Time! + statusPhase: EventExposureStatusPhase + statusMessage: String environment: String namespace: String! - name: String! - displayName: String! - description: String! - teams: [Team!] + eventType: String! + visibility: EventExposureVisibility! + active: Boolean + approvalConfig: ApprovalConfig! + owner: Application! } """ -GroupWhereInput is used for filtering Group objects. +A connection to a list of items. +""" +type EventExposureConnection { + """ + A list of edges. + """ + edges: [EventExposureEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +An edge in a connection. +""" +type EventExposureEdge { + """ + The item at the end of the edge. + """ + node: EventExposure + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} +""" +Ordering options for EventExposure connections +""" +input EventExposureOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order EventExposures. + """ + field: EventExposureOrderField! +} +""" +Properties by which EventExposure connections can be ordered. +""" +enum EventExposureOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +EventExposureStatusPhase is enum for the field status_phase +""" +enum EventExposureStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/eventexposure.StatusPhase") { + READY + PENDING + ERROR + UNKNOWN +} +""" +EventExposureVisibility is enum for the field visibility +""" +enum EventExposureVisibility @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/eventexposure.Visibility") { + WORLD + ZONE + ENTERPRISE +} +""" +EventExposureWhereInput is used for filtering EventExposure objects. Input was generated by ent. """ -input GroupWhereInput { - not: GroupWhereInput - and: [GroupWhereInput!] - or: [GroupWhereInput!] +input EventExposureWhereInput { + not: EventExposureWhereInput + and: [EventExposureWhereInput!] + or: [EventExposureWhereInput!] """ id field predicates """ @@ -1394,6 +1576,55 @@ input GroupWhereInput { idLT: ID idLTE: ID """ + created_at field predicates + """ + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """ + last_modified_at field predicates + """ + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """ + status_phase field predicates + """ + statusPhase: EventExposureStatusPhase + statusPhaseNEQ: EventExposureStatusPhase + statusPhaseIn: [EventExposureStatusPhase!] + statusPhaseNotIn: [EventExposureStatusPhase!] + statusPhaseIsNil: Boolean + statusPhaseNotNil: Boolean + """ + status_message field predicates + """ + statusMessage: String + statusMessageNEQ: String + statusMessageIn: [String!] + statusMessageNotIn: [String!] + statusMessageGT: String + statusMessageGTE: String + statusMessageLT: String + statusMessageLTE: String + statusMessageContains: String + statusMessageHasPrefix: String + statusMessageHasSuffix: String + statusMessageIsNil: Boolean + statusMessageNotNil: Boolean + statusMessageEqualFold: String + statusMessageContainsFold: String + """ environment field predicates """ environment: String @@ -1428,62 +1659,427 @@ input GroupWhereInput { namespaceEqualFold: String namespaceContainsFold: String """ - name field predicates + event_type field predicates + """ + eventType: String + eventTypeNEQ: String + eventTypeIn: [String!] + eventTypeNotIn: [String!] + eventTypeGT: String + eventTypeGTE: String + eventTypeLT: String + eventTypeLTE: String + eventTypeContains: String + eventTypeHasPrefix: String + eventTypeHasSuffix: String + eventTypeEqualFold: String + eventTypeContainsFold: String """ - name: String - nameNEQ: String - nameIn: [String!] - nameNotIn: [String!] - nameGT: String - nameGTE: String - nameLT: String - nameLTE: String - nameContains: String - nameHasPrefix: String - nameHasSuffix: String - nameEqualFold: String - nameContainsFold: String + visibility field predicates """ - display_name field predicates + visibility: EventExposureVisibility + visibilityNEQ: EventExposureVisibility + visibilityIn: [EventExposureVisibility!] + visibilityNotIn: [EventExposureVisibility!] """ - displayName: String - displayNameNEQ: String - displayNameIn: [String!] - displayNameNotIn: [String!] - displayNameGT: String - displayNameGTE: String - displayNameLT: String - displayNameLTE: String - displayNameContains: String - displayNameHasPrefix: String - displayNameHasSuffix: String - displayNameEqualFold: String - displayNameContainsFold: String + active field predicates """ - description field predicates + active: Boolean + activeNEQ: Boolean + activeIsNil: Boolean + activeNotNil: Boolean """ - description: String - descriptionNEQ: String - descriptionIn: [String!] - descriptionNotIn: [String!] - descriptionGT: String - descriptionGTE: String - descriptionLT: String - descriptionLTE: String - descriptionContains: String - descriptionHasPrefix: String - descriptionHasSuffix: String - descriptionEqualFold: String - descriptionContainsFold: String + owner edge predicates """ - teams edge predicates + hasOwner: Boolean + hasOwnerWith: [ApplicationWhereInput!] """ - hasTeams: Boolean - hasTeamsWith: [TeamWhereInput!] + subscriptions edge predicates + """ + hasSubscriptions: Boolean + hasSubscriptionsWith: [EventSubscriptionWhereInput!] } -type Member implements Node { +type EventSubscription implements Node { id: ID! - environment: String + createdAt: Time! + lastModifiedAt: Time! + statusPhase: EventSubscriptionStatusPhase + statusMessage: String + environment: String + namespace: String! + name: String! + eventType: String! + deliveryType: EventSubscriptionDeliveryType! + callbackURL: String + owner: Application! + approval: Approval + approvalRequests: [ApprovalRequest!] +} +""" +A connection to a list of items. +""" +type EventSubscriptionConnection { + """ + A list of edges. + """ + edges: [EventSubscriptionEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +EventSubscriptionDeliveryType is enum for the field delivery_type +""" +enum EventSubscriptionDeliveryType @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription.DeliveryType") { + CALLBACK + SERVER_SENT_EVENT +} +""" +An edge in a connection. +""" +type EventSubscriptionEdge { + """ + The item at the end of the edge. + """ + node: EventSubscription + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} +""" +Ordering options for EventSubscription connections +""" +input EventSubscriptionOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order EventSubscriptions. + """ + field: EventSubscriptionOrderField! +} +""" +Properties by which EventSubscription connections can be ordered. +""" +enum EventSubscriptionOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +EventSubscriptionStatusPhase is enum for the field status_phase +""" +enum EventSubscriptionStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription.StatusPhase") { + READY + PENDING + ERROR + UNKNOWN +} +""" +EventSubscriptionWhereInput is used for filtering EventSubscription objects. +Input was generated by ent. +""" +input EventSubscriptionWhereInput { + not: EventSubscriptionWhereInput + and: [EventSubscriptionWhereInput!] + or: [EventSubscriptionWhereInput!] + """ + id field predicates + """ + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """ + created_at field predicates + """ + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """ + last_modified_at field predicates + """ + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """ + status_phase field predicates + """ + statusPhase: EventSubscriptionStatusPhase + statusPhaseNEQ: EventSubscriptionStatusPhase + statusPhaseIn: [EventSubscriptionStatusPhase!] + statusPhaseNotIn: [EventSubscriptionStatusPhase!] + statusPhaseIsNil: Boolean + statusPhaseNotNil: Boolean + """ + status_message field predicates + """ + statusMessage: String + statusMessageNEQ: String + statusMessageIn: [String!] + statusMessageNotIn: [String!] + statusMessageGT: String + statusMessageGTE: String + statusMessageLT: String + statusMessageLTE: String + statusMessageContains: String + statusMessageHasPrefix: String + statusMessageHasSuffix: String + statusMessageIsNil: Boolean + statusMessageNotNil: Boolean + statusMessageEqualFold: String + statusMessageContainsFold: String + """ + environment field predicates + """ + environment: String + environmentNEQ: String + environmentIn: [String!] + environmentNotIn: [String!] + environmentGT: String + environmentGTE: String + environmentLT: String + environmentLTE: String + environmentContains: String + environmentHasPrefix: String + environmentHasSuffix: String + environmentIsNil: Boolean + environmentNotNil: Boolean + environmentEqualFold: String + environmentContainsFold: String + """ + namespace field predicates + """ + namespace: String + namespaceNEQ: String + namespaceIn: [String!] + namespaceNotIn: [String!] + namespaceGT: String + namespaceGTE: String + namespaceLT: String + namespaceLTE: String + namespaceContains: String + namespaceHasPrefix: String + namespaceHasSuffix: String + namespaceEqualFold: String + namespaceContainsFold: String + """ + name field predicates + """ + name: String + nameNEQ: String + nameIn: [String!] + nameNotIn: [String!] + nameGT: String + nameGTE: String + nameLT: String + nameLTE: String + nameContains: String + nameHasPrefix: String + nameHasSuffix: String + nameEqualFold: String + nameContainsFold: String + """ + event_type field predicates + """ + eventType: String + eventTypeNEQ: String + eventTypeIn: [String!] + eventTypeNotIn: [String!] + eventTypeGT: String + eventTypeGTE: String + eventTypeLT: String + eventTypeLTE: String + eventTypeContains: String + eventTypeHasPrefix: String + eventTypeHasSuffix: String + eventTypeEqualFold: String + eventTypeContainsFold: String + """ + delivery_type field predicates + """ + deliveryType: EventSubscriptionDeliveryType + deliveryTypeNEQ: EventSubscriptionDeliveryType + deliveryTypeIn: [EventSubscriptionDeliveryType!] + deliveryTypeNotIn: [EventSubscriptionDeliveryType!] + """ + callback_url field predicates + """ + callbackURL: String + callbackURLNEQ: String + callbackURLIn: [String!] + callbackURLNotIn: [String!] + callbackURLGT: String + callbackURLGTE: String + callbackURLLT: String + callbackURLLTE: String + callbackURLContains: String + callbackURLHasPrefix: String + callbackURLHasSuffix: String + callbackURLIsNil: Boolean + callbackURLNotNil: Boolean + callbackURLEqualFold: String + callbackURLContainsFold: String + """ + owner edge predicates + """ + hasOwner: Boolean + hasOwnerWith: [ApplicationWhereInput!] + """ + target edge predicates + """ + hasTarget: Boolean + hasTargetWith: [EventExposureWhereInput!] + """ + approval edge predicates + """ + hasApproval: Boolean + hasApprovalWith: [ApprovalWhereInput!] + """ + approval_requests edge predicates + """ + hasApprovalRequests: Boolean + hasApprovalRequestsWith: [ApprovalRequestWhereInput!] +} +type Group implements Node { + id: ID! + environment: String + namespace: String! + name: String! + displayName: String! + description: String! + teams: [Team!] +} +""" +GroupWhereInput is used for filtering Group objects. +Input was generated by ent. +""" +input GroupWhereInput { + not: GroupWhereInput + and: [GroupWhereInput!] + or: [GroupWhereInput!] + """ + id field predicates + """ + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """ + environment field predicates + """ + environment: String + environmentNEQ: String + environmentIn: [String!] + environmentNotIn: [String!] + environmentGT: String + environmentGTE: String + environmentLT: String + environmentLTE: String + environmentContains: String + environmentHasPrefix: String + environmentHasSuffix: String + environmentIsNil: Boolean + environmentNotNil: Boolean + environmentEqualFold: String + environmentContainsFold: String + """ + namespace field predicates + """ + namespace: String + namespaceNEQ: String + namespaceIn: [String!] + namespaceNotIn: [String!] + namespaceGT: String + namespaceGTE: String + namespaceLT: String + namespaceLTE: String + namespaceContains: String + namespaceHasPrefix: String + namespaceHasSuffix: String + namespaceEqualFold: String + namespaceContainsFold: String + """ + name field predicates + """ + name: String + nameNEQ: String + nameIn: [String!] + nameNotIn: [String!] + nameGT: String + nameGTE: String + nameLT: String + nameLTE: String + nameContains: String + nameHasPrefix: String + nameHasSuffix: String + nameEqualFold: String + nameContainsFold: String + """ + display_name field predicates + """ + displayName: String + displayNameNEQ: String + displayNameIn: [String!] + displayNameNotIn: [String!] + displayNameGT: String + displayNameGTE: String + displayNameLT: String + displayNameLTE: String + displayNameContains: String + displayNameHasPrefix: String + displayNameHasSuffix: String + displayNameEqualFold: String + displayNameContainsFold: String + """ + description field predicates + """ + description: String + descriptionNEQ: String + descriptionIn: [String!] + descriptionNotIn: [String!] + descriptionGT: String + descriptionGTE: String + descriptionLT: String + descriptionLTE: String + descriptionContains: String + descriptionHasPrefix: String + descriptionHasSuffix: String + descriptionEqualFold: String + descriptionContainsFold: String + """ + teams edge predicates + """ + hasTeams: Boolean + hasTeamsWith: [TeamWhereInput!] +} +type Member implements Node { + id: ID! + environment: String name: String! email: String! team: Team @@ -1782,6 +2378,68 @@ type Query { """ where: ApprovalRequestWhereInput ): ApprovalRequestConnection! + eventExposures( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for EventExposures returned from the connection. + """ + orderBy: EventExposureOrder + + """ + Filtering options for EventExposures returned from the connection. + """ + where: EventExposureWhereInput + ): EventExposureConnection! + eventSubscriptions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for EventSubscriptions returned from the connection. + """ + orderBy: EventSubscriptionOrder + + """ + Filtering options for EventSubscriptions returned from the connection. + """ + where: EventSubscriptionWhereInput + ): EventSubscriptionConnection! teams( """ Returns the elements in the list that come after the specified cursor. @@ -1826,7 +2484,7 @@ type Team implements Node { name: String! email: String! category: TeamCategory! - roverTokenRef: String + teamToken: String group: Group members: [Member!] applications( @@ -2070,23 +2728,23 @@ input TeamWhereInput { categoryIn: [TeamCategory!] categoryNotIn: [TeamCategory!] """ - rover_token_ref field predicates - """ - roverTokenRef: String - roverTokenRefNEQ: String - roverTokenRefIn: [String!] - roverTokenRefNotIn: [String!] - roverTokenRefGT: String - roverTokenRefGTE: String - roverTokenRefLT: String - roverTokenRefLTE: String - roverTokenRefContains: String - roverTokenRefHasPrefix: String - roverTokenRefHasSuffix: String - roverTokenRefIsNil: Boolean - roverTokenRefNotNil: Boolean - roverTokenRefEqualFold: String - roverTokenRefContainsFold: String + team_token field predicates + """ + teamToken: String + teamTokenNEQ: String + teamTokenIn: [String!] + teamTokenNotIn: [String!] + teamTokenGT: String + teamTokenGTE: String + teamTokenLT: String + teamTokenLTE: String + teamTokenContains: String + teamTokenHasPrefix: String + teamTokenHasSuffix: String + teamTokenIsNil: Boolean + teamTokenNotNil: Boolean + teamTokenEqualFold: String + teamTokenContainsFold: String """ group edge predicates """ @@ -2112,6 +2770,7 @@ type Zone implements Node { environment: String name: String! gatewayURL: String + issuerURL: String visibility: ZoneVisibility! applications: [Application!] } @@ -2194,6 +2853,24 @@ input ZoneWhereInput { gatewayURLEqualFold: String gatewayURLContainsFold: String """ + issuer_url field predicates + """ + issuerURL: String + issuerURLNEQ: String + issuerURLIn: [String!] + issuerURLNotIn: [String!] + issuerURLGT: String + issuerURLGTE: String + issuerURLLT: String + issuerURLLTE: String + issuerURLContains: String + issuerURLHasPrefix: String + issuerURLHasSuffix: String + issuerURLIsNil: Boolean + issuerURLNotNil: Boolean + issuerURLEqualFold: String + issuerURLContainsFold: String + """ visibility field predicates """ visibility: ZoneVisibility diff --git a/controlplane-api/ent/apiexposure.go b/controlplane-api/ent/apiexposure.go index c68236cc6..d191597a4 100644 --- a/controlplane-api/ent/apiexposure.go +++ b/controlplane-api/ent/apiexposure.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/apiexposure/apiexposure.go b/controlplane-api/ent/apiexposure/apiexposure.go index 66ef14d39..90f94b4f1 100644 --- a/controlplane-api/ent/apiexposure/apiexposure.go +++ b/controlplane-api/ent/apiexposure/apiexposure.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package apiexposure diff --git a/controlplane-api/ent/apiexposure/where.go b/controlplane-api/ent/apiexposure/where.go index c50429f53..cf8f968bd 100644 --- a/controlplane-api/ent/apiexposure/where.go +++ b/controlplane-api/ent/apiexposure/where.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package apiexposure diff --git a/controlplane-api/ent/apiexposure_create.go b/controlplane-api/ent/apiexposure_create.go index 1e6125b67..2c4408eb7 100644 --- a/controlplane-api/ent/apiexposure_create.go +++ b/controlplane-api/ent/apiexposure_create.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/apiexposure_delete.go b/controlplane-api/ent/apiexposure_delete.go index 8fe957219..2ce9ec538 100644 --- a/controlplane-api/ent/apiexposure_delete.go +++ b/controlplane-api/ent/apiexposure_delete.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/apiexposure_query.go b/controlplane-api/ent/apiexposure_query.go index 9a9fe5379..f8380264d 100644 --- a/controlplane-api/ent/apiexposure_query.go +++ b/controlplane-api/ent/apiexposure_query.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/apiexposure_update.go b/controlplane-api/ent/apiexposure_update.go index 7b476f2b5..3977b7d5b 100644 --- a/controlplane-api/ent/apiexposure_update.go +++ b/controlplane-api/ent/apiexposure_update.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/apisubscription.go b/controlplane-api/ent/apisubscription.go index 80f595210..bbc39bf1d 100644 --- a/controlplane-api/ent/apisubscription.go +++ b/controlplane-api/ent/apisubscription.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/apisubscription/apisubscription.go b/controlplane-api/ent/apisubscription/apisubscription.go index 2e908eb31..c0af6cdf1 100644 --- a/controlplane-api/ent/apisubscription/apisubscription.go +++ b/controlplane-api/ent/apisubscription/apisubscription.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package apisubscription diff --git a/controlplane-api/ent/apisubscription/where.go b/controlplane-api/ent/apisubscription/where.go index 7c3114dfa..d21dca625 100644 --- a/controlplane-api/ent/apisubscription/where.go +++ b/controlplane-api/ent/apisubscription/where.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package apisubscription diff --git a/controlplane-api/ent/apisubscription_create.go b/controlplane-api/ent/apisubscription_create.go index 2da9f91cd..9ee9fbd49 100644 --- a/controlplane-api/ent/apisubscription_create.go +++ b/controlplane-api/ent/apisubscription_create.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/apisubscription_delete.go b/controlplane-api/ent/apisubscription_delete.go index c903d5937..daa1ebfb2 100644 --- a/controlplane-api/ent/apisubscription_delete.go +++ b/controlplane-api/ent/apisubscription_delete.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/apisubscription_query.go b/controlplane-api/ent/apisubscription_query.go index 730e5b269..0a07ec9ff 100644 --- a/controlplane-api/ent/apisubscription_query.go +++ b/controlplane-api/ent/apisubscription_query.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/apisubscription_update.go b/controlplane-api/ent/apisubscription_update.go index a02d45cde..1ddba9961 100644 --- a/controlplane-api/ent/apisubscription_update.go +++ b/controlplane-api/ent/apisubscription_update.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/application.go b/controlplane-api/ent/application.go index 0e6ba606a..ff86f749a 100644 --- a/controlplane-api/ent/application.go +++ b/controlplane-api/ent/application.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -41,8 +40,16 @@ type Application struct { ClientID *string `json:"client_id,omitempty"` // ClientSecret holds the value of the "client_secret" field. ClientSecret *string `json:"client_secret,omitempty"` - // IssuerURL holds the value of the "issuer_url" field. - IssuerURL *string `json:"issuer_url,omitempty"` + // RotatedClientSecret holds the value of the "rotated_client_secret" field. + RotatedClientSecret *string `json:"rotated_client_secret,omitempty"` + // RotatedExpiresAt holds the value of the "rotated_expires_at" field. + RotatedExpiresAt *time.Time `json:"rotated_expires_at,omitempty"` + // CurrentExpiresAt holds the value of the "current_expires_at" field. + CurrentExpiresAt *time.Time `json:"current_expires_at,omitempty"` + // SecretRotationPhase holds the value of the "secret_rotation_phase" field. + SecretRotationPhase application.SecretRotationPhase `json:"secret_rotation_phase,omitempty"` + // SecretRotationMessage holds the value of the "secret_rotation_message" field. + SecretRotationMessage *string `json:"secret_rotation_message,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ApplicationQuery when eager-loading is set. Edges ApplicationEdges `json:"edges"` @@ -61,14 +68,20 @@ type ApplicationEdges struct { ExposedApis []*ApiExposure `json:"exposed_apis,omitempty"` // SubscribedApis holds the value of the subscribed_apis edge. SubscribedApis []*ApiSubscription `json:"subscribed_apis,omitempty"` + // ExposedEvents holds the value of the exposed_events edge. + ExposedEvents []*EventExposure `json:"exposed_events,omitempty"` + // SubscribedEvents holds the value of the subscribed_events edge. + SubscribedEvents []*EventSubscription `json:"subscribed_events,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [4]bool + loadedTypes [6]bool // totalCount holds the count of the edges above. - totalCount [3]map[string]int + totalCount [5]map[string]int - namedExposedApis map[string][]*ApiExposure - namedSubscribedApis map[string][]*ApiSubscription + namedExposedApis map[string][]*ApiExposure + namedSubscribedApis map[string][]*ApiSubscription + namedExposedEvents map[string][]*EventExposure + namedSubscribedEvents map[string][]*EventSubscription } // ZoneOrErr returns the Zone value or an error if the edge @@ -111,6 +124,24 @@ func (e ApplicationEdges) SubscribedApisOrErr() ([]*ApiSubscription, error) { return nil, &NotLoadedError{edge: "subscribed_apis"} } +// ExposedEventsOrErr returns the ExposedEvents value or an error if the edge +// was not loaded in eager-loading. +func (e ApplicationEdges) ExposedEventsOrErr() ([]*EventExposure, error) { + if e.loadedTypes[4] { + return e.ExposedEvents, nil + } + return nil, &NotLoadedError{edge: "exposed_events"} +} + +// SubscribedEventsOrErr returns the SubscribedEvents value or an error if the edge +// was not loaded in eager-loading. +func (e ApplicationEdges) SubscribedEventsOrErr() ([]*EventSubscription, error) { + if e.loadedTypes[5] { + return e.SubscribedEvents, nil + } + return nil, &NotLoadedError{edge: "subscribed_events"} +} + // scanValues returns the types for scanning values from sql.Rows. func (*Application) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) @@ -118,9 +149,9 @@ func (*Application) scanValues(columns []string) ([]any, error) { switch columns[i] { case application.FieldID: values[i] = new(sql.NullInt64) - case application.FieldStatusPhase, application.FieldStatusMessage, application.FieldEnvironment, application.FieldNamespace, application.FieldName, application.FieldClientID, application.FieldClientSecret, application.FieldIssuerURL: + case application.FieldStatusPhase, application.FieldStatusMessage, application.FieldEnvironment, application.FieldNamespace, application.FieldName, application.FieldClientID, application.FieldClientSecret, application.FieldRotatedClientSecret, application.FieldSecretRotationPhase, application.FieldSecretRotationMessage: values[i] = new(sql.NullString) - case application.FieldCreatedAt, application.FieldLastModifiedAt: + case application.FieldCreatedAt, application.FieldLastModifiedAt, application.FieldRotatedExpiresAt, application.FieldCurrentExpiresAt: values[i] = new(sql.NullTime) case application.ForeignKeys[0]: // team_applications values[i] = new(sql.NullInt64) @@ -206,12 +237,39 @@ func (_m *Application) assignValues(columns []string, values []any) error { _m.ClientSecret = new(string) *_m.ClientSecret = value.String } - case application.FieldIssuerURL: + case application.FieldRotatedClientSecret: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field rotated_client_secret", values[i]) + } else if value.Valid { + _m.RotatedClientSecret = new(string) + *_m.RotatedClientSecret = value.String + } + case application.FieldRotatedExpiresAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field rotated_expires_at", values[i]) + } else if value.Valid { + _m.RotatedExpiresAt = new(time.Time) + *_m.RotatedExpiresAt = value.Time + } + case application.FieldCurrentExpiresAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field current_expires_at", values[i]) + } else if value.Valid { + _m.CurrentExpiresAt = new(time.Time) + *_m.CurrentExpiresAt = value.Time + } + case application.FieldSecretRotationPhase: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field secret_rotation_phase", values[i]) + } else if value.Valid { + _m.SecretRotationPhase = application.SecretRotationPhase(value.String) + } + case application.FieldSecretRotationMessage: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field issuer_url", values[i]) + return fmt.Errorf("unexpected type %T for field secret_rotation_message", values[i]) } else if value.Valid { - _m.IssuerURL = new(string) - *_m.IssuerURL = value.String + _m.SecretRotationMessage = new(string) + *_m.SecretRotationMessage = value.String } case application.ForeignKeys[0]: if value, ok := values[i].(*sql.NullInt64); !ok { @@ -260,6 +318,16 @@ func (_m *Application) QuerySubscribedApis() *ApiSubscriptionQuery { return NewApplicationClient(_m.config).QuerySubscribedApis(_m) } +// QueryExposedEvents queries the "exposed_events" edge of the Application entity. +func (_m *Application) QueryExposedEvents() *EventExposureQuery { + return NewApplicationClient(_m.config).QueryExposedEvents(_m) +} + +// QuerySubscribedEvents queries the "subscribed_events" edge of the Application entity. +func (_m *Application) QuerySubscribedEvents() *EventSubscriptionQuery { + return NewApplicationClient(_m.config).QuerySubscribedEvents(_m) +} + // Update returns a builder for updating this Application. // Note that you need to call Application.Unwrap() before calling this method if this Application // was returned from a transaction, and the transaction was committed or rolled back. @@ -320,8 +388,26 @@ func (_m *Application) String() string { builder.WriteString(*v) } builder.WriteString(", ") - if v := _m.IssuerURL; v != nil { - builder.WriteString("issuer_url=") + if v := _m.RotatedClientSecret; v != nil { + builder.WriteString("rotated_client_secret=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := _m.RotatedExpiresAt; v != nil { + builder.WriteString("rotated_expires_at=") + builder.WriteString(v.Format(time.ANSIC)) + } + builder.WriteString(", ") + if v := _m.CurrentExpiresAt; v != nil { + builder.WriteString("current_expires_at=") + builder.WriteString(v.Format(time.ANSIC)) + } + builder.WriteString(", ") + builder.WriteString("secret_rotation_phase=") + builder.WriteString(fmt.Sprintf("%v", _m.SecretRotationPhase)) + builder.WriteString(", ") + if v := _m.SecretRotationMessage; v != nil { + builder.WriteString("secret_rotation_message=") builder.WriteString(*v) } builder.WriteByte(')') @@ -376,5 +462,53 @@ func (_m *Application) appendNamedSubscribedApis(name string, edges ...*ApiSubsc } } +// NamedExposedEvents returns the ExposedEvents named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *Application) NamedExposedEvents(name string) ([]*EventExposure, error) { + if _m.Edges.namedExposedEvents == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedExposedEvents[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *Application) appendNamedExposedEvents(name string, edges ...*EventExposure) { + if _m.Edges.namedExposedEvents == nil { + _m.Edges.namedExposedEvents = make(map[string][]*EventExposure) + } + if len(edges) == 0 { + _m.Edges.namedExposedEvents[name] = []*EventExposure{} + } else { + _m.Edges.namedExposedEvents[name] = append(_m.Edges.namedExposedEvents[name], edges...) + } +} + +// NamedSubscribedEvents returns the SubscribedEvents named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *Application) NamedSubscribedEvents(name string) ([]*EventSubscription, error) { + if _m.Edges.namedSubscribedEvents == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedSubscribedEvents[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *Application) appendNamedSubscribedEvents(name string, edges ...*EventSubscription) { + if _m.Edges.namedSubscribedEvents == nil { + _m.Edges.namedSubscribedEvents = make(map[string][]*EventSubscription) + } + if len(edges) == 0 { + _m.Edges.namedSubscribedEvents[name] = []*EventSubscription{} + } else { + _m.Edges.namedSubscribedEvents[name] = append(_m.Edges.namedSubscribedEvents[name], edges...) + } +} + // Applications is a parsable slice of Application. type Applications []*Application diff --git a/controlplane-api/ent/application/application.go b/controlplane-api/ent/application/application.go index d54a33fc3..e3f27a5be 100644 --- a/controlplane-api/ent/application/application.go +++ b/controlplane-api/ent/application/application.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package application @@ -40,8 +39,16 @@ const ( FieldClientID = "client_id" // FieldClientSecret holds the string denoting the client_secret field in the database. FieldClientSecret = "client_secret" - // FieldIssuerURL holds the string denoting the issuer_url field in the database. - FieldIssuerURL = "issuer_url" + // FieldRotatedClientSecret holds the string denoting the rotated_client_secret field in the database. + FieldRotatedClientSecret = "rotated_client_secret" + // FieldRotatedExpiresAt holds the string denoting the rotated_expires_at field in the database. + FieldRotatedExpiresAt = "rotated_expires_at" + // FieldCurrentExpiresAt holds the string denoting the current_expires_at field in the database. + FieldCurrentExpiresAt = "current_expires_at" + // FieldSecretRotationPhase holds the string denoting the secret_rotation_phase field in the database. + FieldSecretRotationPhase = "secret_rotation_phase" + // FieldSecretRotationMessage holds the string denoting the secret_rotation_message field in the database. + FieldSecretRotationMessage = "secret_rotation_message" // EdgeZone holds the string denoting the zone edge name in mutations. EdgeZone = "zone" // EdgeOwnerTeam holds the string denoting the owner_team edge name in mutations. @@ -50,6 +57,10 @@ const ( EdgeExposedApis = "exposed_apis" // EdgeSubscribedApis holds the string denoting the subscribed_apis edge name in mutations. EdgeSubscribedApis = "subscribed_apis" + // EdgeExposedEvents holds the string denoting the exposed_events edge name in mutations. + EdgeExposedEvents = "exposed_events" + // EdgeSubscribedEvents holds the string denoting the subscribed_events edge name in mutations. + EdgeSubscribedEvents = "subscribed_events" // Table holds the table name of the application in the database. Table = "applications" // ZoneTable is the table that holds the zone relation/edge. @@ -80,6 +91,20 @@ const ( SubscribedApisInverseTable = "api_subscriptions" // SubscribedApisColumn is the table column denoting the subscribed_apis relation/edge. SubscribedApisColumn = "application_subscribed_apis" + // ExposedEventsTable is the table that holds the exposed_events relation/edge. + ExposedEventsTable = "event_exposures" + // ExposedEventsInverseTable is the table name for the EventExposure entity. + // It exists in this package in order to avoid circular dependency with the "eventexposure" package. + ExposedEventsInverseTable = "event_exposures" + // ExposedEventsColumn is the table column denoting the exposed_events relation/edge. + ExposedEventsColumn = "application_exposed_events" + // SubscribedEventsTable is the table that holds the subscribed_events relation/edge. + SubscribedEventsTable = "event_subscriptions" + // SubscribedEventsInverseTable is the table name for the EventSubscription entity. + // It exists in this package in order to avoid circular dependency with the "eventsubscription" package. + SubscribedEventsInverseTable = "event_subscriptions" + // SubscribedEventsColumn is the table column denoting the subscribed_events relation/edge. + SubscribedEventsColumn = "application_subscribed_events" ) // Columns holds all SQL columns for application fields. @@ -94,7 +119,11 @@ var Columns = []string{ FieldName, FieldClientID, FieldClientSecret, - FieldIssuerURL, + FieldRotatedClientSecret, + FieldRotatedExpiresAt, + FieldCurrentExpiresAt, + FieldSecretRotationPhase, + FieldSecretRotationMessage, } // ForeignKeys holds the SQL foreign-keys that are owned by the "applications" @@ -141,6 +170,8 @@ var ( ClientIDValidator func(string) error // ClientSecretValidator is a validator for the "client_secret" field. It is called by the builders before save. ClientSecretValidator func(string) error + // RotatedClientSecretValidator is a validator for the "rotated_client_secret" field. It is called by the builders before save. + RotatedClientSecretValidator func(string) error ) // StatusPhase defines the type for the "status_phase" enum field. @@ -168,6 +199,35 @@ func StatusPhaseValidator(sp StatusPhase) error { } } +// SecretRotationPhase defines the type for the "secret_rotation_phase" enum field. +type SecretRotationPhase string + +// SecretRotationPhaseDONE is the default value of the SecretRotationPhase enum. +const DefaultSecretRotationPhase = SecretRotationPhaseDONE + +// SecretRotationPhase values. +const ( + SecretRotationPhaseDONE SecretRotationPhase = "DONE" + SecretRotationPhaseROTATING SecretRotationPhase = "ROTATING" + SecretRotationPhaseGRACE_PERIOD_ACTIVE SecretRotationPhase = "GRACE_PERIOD_ACTIVE" + SecretRotationPhaseGRACE_PERIOD_EXPIRING SecretRotationPhase = "GRACE_PERIOD_EXPIRING" + SecretRotationPhaseFAILED SecretRotationPhase = "FAILED" +) + +func (srp SecretRotationPhase) String() string { + return string(srp) +} + +// SecretRotationPhaseValidator is a validator for the "secret_rotation_phase" field enum values. It is called by the builders before save. +func SecretRotationPhaseValidator(srp SecretRotationPhase) error { + switch srp { + case SecretRotationPhaseDONE, SecretRotationPhaseROTATING, SecretRotationPhaseGRACE_PERIOD_ACTIVE, SecretRotationPhaseGRACE_PERIOD_EXPIRING, SecretRotationPhaseFAILED: + return nil + default: + return fmt.Errorf("application: invalid enum value for secret_rotation_phase field: %q", srp) + } +} + // OrderOption defines the ordering options for the Application queries. type OrderOption func(*sql.Selector) @@ -221,9 +281,29 @@ func ByClientSecret(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldClientSecret, opts...).ToFunc() } -// ByIssuerURL orders the results by the issuer_url field. -func ByIssuerURL(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldIssuerURL, opts...).ToFunc() +// ByRotatedClientSecret orders the results by the rotated_client_secret field. +func ByRotatedClientSecret(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldRotatedClientSecret, opts...).ToFunc() +} + +// ByRotatedExpiresAt orders the results by the rotated_expires_at field. +func ByRotatedExpiresAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldRotatedExpiresAt, opts...).ToFunc() +} + +// ByCurrentExpiresAt orders the results by the current_expires_at field. +func ByCurrentExpiresAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCurrentExpiresAt, opts...).ToFunc() +} + +// BySecretRotationPhase orders the results by the secret_rotation_phase field. +func BySecretRotationPhase(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSecretRotationPhase, opts...).ToFunc() +} + +// BySecretRotationMessage orders the results by the secret_rotation_message field. +func BySecretRotationMessage(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSecretRotationMessage, opts...).ToFunc() } // ByZoneField orders the results by zone field. @@ -267,6 +347,34 @@ func BySubscribedApis(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { sqlgraph.OrderByNeighborTerms(s, newSubscribedApisStep(), append([]sql.OrderTerm{term}, terms...)...) } } + +// ByExposedEventsCount orders the results by exposed_events count. +func ByExposedEventsCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newExposedEventsStep(), opts...) + } +} + +// ByExposedEvents orders the results by exposed_events terms. +func ByExposedEvents(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newExposedEventsStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} + +// BySubscribedEventsCount orders the results by subscribed_events count. +func BySubscribedEventsCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newSubscribedEventsStep(), opts...) + } +} + +// BySubscribedEvents orders the results by subscribed_events terms. +func BySubscribedEvents(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newSubscribedEventsStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} func newZoneStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), @@ -295,6 +403,20 @@ func newSubscribedApisStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.O2M, false, SubscribedApisTable, SubscribedApisColumn), ) } +func newExposedEventsStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(ExposedEventsInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ExposedEventsTable, ExposedEventsColumn), + ) +} +func newSubscribedEventsStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(SubscribedEventsInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, SubscribedEventsTable, SubscribedEventsColumn), + ) +} // MarshalGQL implements graphql.Marshaler interface. func (e StatusPhase) MarshalGQL(w io.Writer) { @@ -313,3 +435,21 @@ func (e *StatusPhase) UnmarshalGQL(val interface{}) error { } return nil } + +// MarshalGQL implements graphql.Marshaler interface. +func (e SecretRotationPhase) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(e.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (e *SecretRotationPhase) UnmarshalGQL(val interface{}) error { + str, ok := val.(string) + if !ok { + return fmt.Errorf("enum %T must be a string", val) + } + *e = SecretRotationPhase(str) + if err := SecretRotationPhaseValidator(*e); err != nil { + return fmt.Errorf("%s is not a valid SecretRotationPhase", str) + } + return nil +} diff --git a/controlplane-api/ent/application/where.go b/controlplane-api/ent/application/where.go index 63f33827b..ed5bf83e6 100644 --- a/controlplane-api/ent/application/where.go +++ b/controlplane-api/ent/application/where.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package application @@ -99,9 +98,24 @@ func ClientSecret(v string) predicate.Application { return predicate.Application(sql.FieldEQ(FieldClientSecret, v)) } -// IssuerURL applies equality check predicate on the "issuer_url" field. It's identical to IssuerURLEQ. -func IssuerURL(v string) predicate.Application { - return predicate.Application(sql.FieldEQ(FieldIssuerURL, v)) +// RotatedClientSecret applies equality check predicate on the "rotated_client_secret" field. It's identical to RotatedClientSecretEQ. +func RotatedClientSecret(v string) predicate.Application { + return predicate.Application(sql.FieldEQ(FieldRotatedClientSecret, v)) +} + +// RotatedExpiresAt applies equality check predicate on the "rotated_expires_at" field. It's identical to RotatedExpiresAtEQ. +func RotatedExpiresAt(v time.Time) predicate.Application { + return predicate.Application(sql.FieldEQ(FieldRotatedExpiresAt, v)) +} + +// CurrentExpiresAt applies equality check predicate on the "current_expires_at" field. It's identical to CurrentExpiresAtEQ. +func CurrentExpiresAt(v time.Time) predicate.Application { + return predicate.Application(sql.FieldEQ(FieldCurrentExpiresAt, v)) +} + +// SecretRotationMessage applies equality check predicate on the "secret_rotation_message" field. It's identical to SecretRotationMessageEQ. +func SecretRotationMessage(v string) predicate.Application { + return predicate.Application(sql.FieldEQ(FieldSecretRotationMessage, v)) } // CreatedAtEQ applies the EQ predicate on the "created_at" field. @@ -644,79 +658,274 @@ func ClientSecretContainsFold(v string) predicate.Application { return predicate.Application(sql.FieldContainsFold(FieldClientSecret, v)) } -// IssuerURLEQ applies the EQ predicate on the "issuer_url" field. -func IssuerURLEQ(v string) predicate.Application { - return predicate.Application(sql.FieldEQ(FieldIssuerURL, v)) +// RotatedClientSecretEQ applies the EQ predicate on the "rotated_client_secret" field. +func RotatedClientSecretEQ(v string) predicate.Application { + return predicate.Application(sql.FieldEQ(FieldRotatedClientSecret, v)) +} + +// RotatedClientSecretNEQ applies the NEQ predicate on the "rotated_client_secret" field. +func RotatedClientSecretNEQ(v string) predicate.Application { + return predicate.Application(sql.FieldNEQ(FieldRotatedClientSecret, v)) +} + +// RotatedClientSecretIn applies the In predicate on the "rotated_client_secret" field. +func RotatedClientSecretIn(vs ...string) predicate.Application { + return predicate.Application(sql.FieldIn(FieldRotatedClientSecret, vs...)) +} + +// RotatedClientSecretNotIn applies the NotIn predicate on the "rotated_client_secret" field. +func RotatedClientSecretNotIn(vs ...string) predicate.Application { + return predicate.Application(sql.FieldNotIn(FieldRotatedClientSecret, vs...)) +} + +// RotatedClientSecretGT applies the GT predicate on the "rotated_client_secret" field. +func RotatedClientSecretGT(v string) predicate.Application { + return predicate.Application(sql.FieldGT(FieldRotatedClientSecret, v)) +} + +// RotatedClientSecretGTE applies the GTE predicate on the "rotated_client_secret" field. +func RotatedClientSecretGTE(v string) predicate.Application { + return predicate.Application(sql.FieldGTE(FieldRotatedClientSecret, v)) +} + +// RotatedClientSecretLT applies the LT predicate on the "rotated_client_secret" field. +func RotatedClientSecretLT(v string) predicate.Application { + return predicate.Application(sql.FieldLT(FieldRotatedClientSecret, v)) +} + +// RotatedClientSecretLTE applies the LTE predicate on the "rotated_client_secret" field. +func RotatedClientSecretLTE(v string) predicate.Application { + return predicate.Application(sql.FieldLTE(FieldRotatedClientSecret, v)) +} + +// RotatedClientSecretContains applies the Contains predicate on the "rotated_client_secret" field. +func RotatedClientSecretContains(v string) predicate.Application { + return predicate.Application(sql.FieldContains(FieldRotatedClientSecret, v)) +} + +// RotatedClientSecretHasPrefix applies the HasPrefix predicate on the "rotated_client_secret" field. +func RotatedClientSecretHasPrefix(v string) predicate.Application { + return predicate.Application(sql.FieldHasPrefix(FieldRotatedClientSecret, v)) +} + +// RotatedClientSecretHasSuffix applies the HasSuffix predicate on the "rotated_client_secret" field. +func RotatedClientSecretHasSuffix(v string) predicate.Application { + return predicate.Application(sql.FieldHasSuffix(FieldRotatedClientSecret, v)) +} + +// RotatedClientSecretIsNil applies the IsNil predicate on the "rotated_client_secret" field. +func RotatedClientSecretIsNil() predicate.Application { + return predicate.Application(sql.FieldIsNull(FieldRotatedClientSecret)) +} + +// RotatedClientSecretNotNil applies the NotNil predicate on the "rotated_client_secret" field. +func RotatedClientSecretNotNil() predicate.Application { + return predicate.Application(sql.FieldNotNull(FieldRotatedClientSecret)) +} + +// RotatedClientSecretEqualFold applies the EqualFold predicate on the "rotated_client_secret" field. +func RotatedClientSecretEqualFold(v string) predicate.Application { + return predicate.Application(sql.FieldEqualFold(FieldRotatedClientSecret, v)) +} + +// RotatedClientSecretContainsFold applies the ContainsFold predicate on the "rotated_client_secret" field. +func RotatedClientSecretContainsFold(v string) predicate.Application { + return predicate.Application(sql.FieldContainsFold(FieldRotatedClientSecret, v)) +} + +// RotatedExpiresAtEQ applies the EQ predicate on the "rotated_expires_at" field. +func RotatedExpiresAtEQ(v time.Time) predicate.Application { + return predicate.Application(sql.FieldEQ(FieldRotatedExpiresAt, v)) +} + +// RotatedExpiresAtNEQ applies the NEQ predicate on the "rotated_expires_at" field. +func RotatedExpiresAtNEQ(v time.Time) predicate.Application { + return predicate.Application(sql.FieldNEQ(FieldRotatedExpiresAt, v)) +} + +// RotatedExpiresAtIn applies the In predicate on the "rotated_expires_at" field. +func RotatedExpiresAtIn(vs ...time.Time) predicate.Application { + return predicate.Application(sql.FieldIn(FieldRotatedExpiresAt, vs...)) +} + +// RotatedExpiresAtNotIn applies the NotIn predicate on the "rotated_expires_at" field. +func RotatedExpiresAtNotIn(vs ...time.Time) predicate.Application { + return predicate.Application(sql.FieldNotIn(FieldRotatedExpiresAt, vs...)) +} + +// RotatedExpiresAtGT applies the GT predicate on the "rotated_expires_at" field. +func RotatedExpiresAtGT(v time.Time) predicate.Application { + return predicate.Application(sql.FieldGT(FieldRotatedExpiresAt, v)) } -// IssuerURLNEQ applies the NEQ predicate on the "issuer_url" field. -func IssuerURLNEQ(v string) predicate.Application { - return predicate.Application(sql.FieldNEQ(FieldIssuerURL, v)) +// RotatedExpiresAtGTE applies the GTE predicate on the "rotated_expires_at" field. +func RotatedExpiresAtGTE(v time.Time) predicate.Application { + return predicate.Application(sql.FieldGTE(FieldRotatedExpiresAt, v)) } -// IssuerURLIn applies the In predicate on the "issuer_url" field. -func IssuerURLIn(vs ...string) predicate.Application { - return predicate.Application(sql.FieldIn(FieldIssuerURL, vs...)) +// RotatedExpiresAtLT applies the LT predicate on the "rotated_expires_at" field. +func RotatedExpiresAtLT(v time.Time) predicate.Application { + return predicate.Application(sql.FieldLT(FieldRotatedExpiresAt, v)) } -// IssuerURLNotIn applies the NotIn predicate on the "issuer_url" field. -func IssuerURLNotIn(vs ...string) predicate.Application { - return predicate.Application(sql.FieldNotIn(FieldIssuerURL, vs...)) +// RotatedExpiresAtLTE applies the LTE predicate on the "rotated_expires_at" field. +func RotatedExpiresAtLTE(v time.Time) predicate.Application { + return predicate.Application(sql.FieldLTE(FieldRotatedExpiresAt, v)) } -// IssuerURLGT applies the GT predicate on the "issuer_url" field. -func IssuerURLGT(v string) predicate.Application { - return predicate.Application(sql.FieldGT(FieldIssuerURL, v)) +// RotatedExpiresAtIsNil applies the IsNil predicate on the "rotated_expires_at" field. +func RotatedExpiresAtIsNil() predicate.Application { + return predicate.Application(sql.FieldIsNull(FieldRotatedExpiresAt)) } -// IssuerURLGTE applies the GTE predicate on the "issuer_url" field. -func IssuerURLGTE(v string) predicate.Application { - return predicate.Application(sql.FieldGTE(FieldIssuerURL, v)) +// RotatedExpiresAtNotNil applies the NotNil predicate on the "rotated_expires_at" field. +func RotatedExpiresAtNotNil() predicate.Application { + return predicate.Application(sql.FieldNotNull(FieldRotatedExpiresAt)) } -// IssuerURLLT applies the LT predicate on the "issuer_url" field. -func IssuerURLLT(v string) predicate.Application { - return predicate.Application(sql.FieldLT(FieldIssuerURL, v)) +// CurrentExpiresAtEQ applies the EQ predicate on the "current_expires_at" field. +func CurrentExpiresAtEQ(v time.Time) predicate.Application { + return predicate.Application(sql.FieldEQ(FieldCurrentExpiresAt, v)) } -// IssuerURLLTE applies the LTE predicate on the "issuer_url" field. -func IssuerURLLTE(v string) predicate.Application { - return predicate.Application(sql.FieldLTE(FieldIssuerURL, v)) +// CurrentExpiresAtNEQ applies the NEQ predicate on the "current_expires_at" field. +func CurrentExpiresAtNEQ(v time.Time) predicate.Application { + return predicate.Application(sql.FieldNEQ(FieldCurrentExpiresAt, v)) } -// IssuerURLContains applies the Contains predicate on the "issuer_url" field. -func IssuerURLContains(v string) predicate.Application { - return predicate.Application(sql.FieldContains(FieldIssuerURL, v)) +// CurrentExpiresAtIn applies the In predicate on the "current_expires_at" field. +func CurrentExpiresAtIn(vs ...time.Time) predicate.Application { + return predicate.Application(sql.FieldIn(FieldCurrentExpiresAt, vs...)) } -// IssuerURLHasPrefix applies the HasPrefix predicate on the "issuer_url" field. -func IssuerURLHasPrefix(v string) predicate.Application { - return predicate.Application(sql.FieldHasPrefix(FieldIssuerURL, v)) +// CurrentExpiresAtNotIn applies the NotIn predicate on the "current_expires_at" field. +func CurrentExpiresAtNotIn(vs ...time.Time) predicate.Application { + return predicate.Application(sql.FieldNotIn(FieldCurrentExpiresAt, vs...)) } -// IssuerURLHasSuffix applies the HasSuffix predicate on the "issuer_url" field. -func IssuerURLHasSuffix(v string) predicate.Application { - return predicate.Application(sql.FieldHasSuffix(FieldIssuerURL, v)) +// CurrentExpiresAtGT applies the GT predicate on the "current_expires_at" field. +func CurrentExpiresAtGT(v time.Time) predicate.Application { + return predicate.Application(sql.FieldGT(FieldCurrentExpiresAt, v)) } -// IssuerURLIsNil applies the IsNil predicate on the "issuer_url" field. -func IssuerURLIsNil() predicate.Application { - return predicate.Application(sql.FieldIsNull(FieldIssuerURL)) +// CurrentExpiresAtGTE applies the GTE predicate on the "current_expires_at" field. +func CurrentExpiresAtGTE(v time.Time) predicate.Application { + return predicate.Application(sql.FieldGTE(FieldCurrentExpiresAt, v)) } -// IssuerURLNotNil applies the NotNil predicate on the "issuer_url" field. -func IssuerURLNotNil() predicate.Application { - return predicate.Application(sql.FieldNotNull(FieldIssuerURL)) +// CurrentExpiresAtLT applies the LT predicate on the "current_expires_at" field. +func CurrentExpiresAtLT(v time.Time) predicate.Application { + return predicate.Application(sql.FieldLT(FieldCurrentExpiresAt, v)) } -// IssuerURLEqualFold applies the EqualFold predicate on the "issuer_url" field. -func IssuerURLEqualFold(v string) predicate.Application { - return predicate.Application(sql.FieldEqualFold(FieldIssuerURL, v)) +// CurrentExpiresAtLTE applies the LTE predicate on the "current_expires_at" field. +func CurrentExpiresAtLTE(v time.Time) predicate.Application { + return predicate.Application(sql.FieldLTE(FieldCurrentExpiresAt, v)) } -// IssuerURLContainsFold applies the ContainsFold predicate on the "issuer_url" field. -func IssuerURLContainsFold(v string) predicate.Application { - return predicate.Application(sql.FieldContainsFold(FieldIssuerURL, v)) +// CurrentExpiresAtIsNil applies the IsNil predicate on the "current_expires_at" field. +func CurrentExpiresAtIsNil() predicate.Application { + return predicate.Application(sql.FieldIsNull(FieldCurrentExpiresAt)) +} + +// CurrentExpiresAtNotNil applies the NotNil predicate on the "current_expires_at" field. +func CurrentExpiresAtNotNil() predicate.Application { + return predicate.Application(sql.FieldNotNull(FieldCurrentExpiresAt)) +} + +// SecretRotationPhaseEQ applies the EQ predicate on the "secret_rotation_phase" field. +func SecretRotationPhaseEQ(v SecretRotationPhase) predicate.Application { + return predicate.Application(sql.FieldEQ(FieldSecretRotationPhase, v)) +} + +// SecretRotationPhaseNEQ applies the NEQ predicate on the "secret_rotation_phase" field. +func SecretRotationPhaseNEQ(v SecretRotationPhase) predicate.Application { + return predicate.Application(sql.FieldNEQ(FieldSecretRotationPhase, v)) +} + +// SecretRotationPhaseIn applies the In predicate on the "secret_rotation_phase" field. +func SecretRotationPhaseIn(vs ...SecretRotationPhase) predicate.Application { + return predicate.Application(sql.FieldIn(FieldSecretRotationPhase, vs...)) +} + +// SecretRotationPhaseNotIn applies the NotIn predicate on the "secret_rotation_phase" field. +func SecretRotationPhaseNotIn(vs ...SecretRotationPhase) predicate.Application { + return predicate.Application(sql.FieldNotIn(FieldSecretRotationPhase, vs...)) +} + +// SecretRotationMessageEQ applies the EQ predicate on the "secret_rotation_message" field. +func SecretRotationMessageEQ(v string) predicate.Application { + return predicate.Application(sql.FieldEQ(FieldSecretRotationMessage, v)) +} + +// SecretRotationMessageNEQ applies the NEQ predicate on the "secret_rotation_message" field. +func SecretRotationMessageNEQ(v string) predicate.Application { + return predicate.Application(sql.FieldNEQ(FieldSecretRotationMessage, v)) +} + +// SecretRotationMessageIn applies the In predicate on the "secret_rotation_message" field. +func SecretRotationMessageIn(vs ...string) predicate.Application { + return predicate.Application(sql.FieldIn(FieldSecretRotationMessage, vs...)) +} + +// SecretRotationMessageNotIn applies the NotIn predicate on the "secret_rotation_message" field. +func SecretRotationMessageNotIn(vs ...string) predicate.Application { + return predicate.Application(sql.FieldNotIn(FieldSecretRotationMessage, vs...)) +} + +// SecretRotationMessageGT applies the GT predicate on the "secret_rotation_message" field. +func SecretRotationMessageGT(v string) predicate.Application { + return predicate.Application(sql.FieldGT(FieldSecretRotationMessage, v)) +} + +// SecretRotationMessageGTE applies the GTE predicate on the "secret_rotation_message" field. +func SecretRotationMessageGTE(v string) predicate.Application { + return predicate.Application(sql.FieldGTE(FieldSecretRotationMessage, v)) +} + +// SecretRotationMessageLT applies the LT predicate on the "secret_rotation_message" field. +func SecretRotationMessageLT(v string) predicate.Application { + return predicate.Application(sql.FieldLT(FieldSecretRotationMessage, v)) +} + +// SecretRotationMessageLTE applies the LTE predicate on the "secret_rotation_message" field. +func SecretRotationMessageLTE(v string) predicate.Application { + return predicate.Application(sql.FieldLTE(FieldSecretRotationMessage, v)) +} + +// SecretRotationMessageContains applies the Contains predicate on the "secret_rotation_message" field. +func SecretRotationMessageContains(v string) predicate.Application { + return predicate.Application(sql.FieldContains(FieldSecretRotationMessage, v)) +} + +// SecretRotationMessageHasPrefix applies the HasPrefix predicate on the "secret_rotation_message" field. +func SecretRotationMessageHasPrefix(v string) predicate.Application { + return predicate.Application(sql.FieldHasPrefix(FieldSecretRotationMessage, v)) +} + +// SecretRotationMessageHasSuffix applies the HasSuffix predicate on the "secret_rotation_message" field. +func SecretRotationMessageHasSuffix(v string) predicate.Application { + return predicate.Application(sql.FieldHasSuffix(FieldSecretRotationMessage, v)) +} + +// SecretRotationMessageIsNil applies the IsNil predicate on the "secret_rotation_message" field. +func SecretRotationMessageIsNil() predicate.Application { + return predicate.Application(sql.FieldIsNull(FieldSecretRotationMessage)) +} + +// SecretRotationMessageNotNil applies the NotNil predicate on the "secret_rotation_message" field. +func SecretRotationMessageNotNil() predicate.Application { + return predicate.Application(sql.FieldNotNull(FieldSecretRotationMessage)) +} + +// SecretRotationMessageEqualFold applies the EqualFold predicate on the "secret_rotation_message" field. +func SecretRotationMessageEqualFold(v string) predicate.Application { + return predicate.Application(sql.FieldEqualFold(FieldSecretRotationMessage, v)) +} + +// SecretRotationMessageContainsFold applies the ContainsFold predicate on the "secret_rotation_message" field. +func SecretRotationMessageContainsFold(v string) predicate.Application { + return predicate.Application(sql.FieldContainsFold(FieldSecretRotationMessage, v)) } // HasZone applies the HasEdge predicate on the "zone" edge. @@ -811,6 +1020,52 @@ func HasSubscribedApisWith(preds ...predicate.ApiSubscription) predicate.Applica }) } +// HasExposedEvents applies the HasEdge predicate on the "exposed_events" edge. +func HasExposedEvents() predicate.Application { + return predicate.Application(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ExposedEventsTable, ExposedEventsColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasExposedEventsWith applies the HasEdge predicate on the "exposed_events" edge with a given conditions (other predicates). +func HasExposedEventsWith(preds ...predicate.EventExposure) predicate.Application { + return predicate.Application(func(s *sql.Selector) { + step := newExposedEventsStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasSubscribedEvents applies the HasEdge predicate on the "subscribed_events" edge. +func HasSubscribedEvents() predicate.Application { + return predicate.Application(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, SubscribedEventsTable, SubscribedEventsColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasSubscribedEventsWith applies the HasEdge predicate on the "subscribed_events" edge with a given conditions (other predicates). +func HasSubscribedEventsWith(preds ...predicate.EventSubscription) predicate.Application { + return predicate.Application(func(s *sql.Selector) { + step := newSubscribedEventsStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.Application) predicate.Application { return predicate.Application(sql.AndPredicates(predicates...)) diff --git a/controlplane-api/ent/application_create.go b/controlplane-api/ent/application_create.go index 9959e021e..c953cb4f5 100644 --- a/controlplane-api/ent/application_create.go +++ b/controlplane-api/ent/application_create.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -18,6 +17,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/team" "github.com/telekom/controlplane/controlplane-api/ent/zone" ) @@ -140,16 +141,72 @@ func (_c *ApplicationCreate) SetNillableClientSecret(v *string) *ApplicationCrea return _c } -// SetIssuerURL sets the "issuer_url" field. -func (_c *ApplicationCreate) SetIssuerURL(v string) *ApplicationCreate { - _c.mutation.SetIssuerURL(v) +// SetRotatedClientSecret sets the "rotated_client_secret" field. +func (_c *ApplicationCreate) SetRotatedClientSecret(v string) *ApplicationCreate { + _c.mutation.SetRotatedClientSecret(v) + return _c +} + +// SetNillableRotatedClientSecret sets the "rotated_client_secret" field if the given value is not nil. +func (_c *ApplicationCreate) SetNillableRotatedClientSecret(v *string) *ApplicationCreate { + if v != nil { + _c.SetRotatedClientSecret(*v) + } + return _c +} + +// SetRotatedExpiresAt sets the "rotated_expires_at" field. +func (_c *ApplicationCreate) SetRotatedExpiresAt(v time.Time) *ApplicationCreate { + _c.mutation.SetRotatedExpiresAt(v) + return _c +} + +// SetNillableRotatedExpiresAt sets the "rotated_expires_at" field if the given value is not nil. +func (_c *ApplicationCreate) SetNillableRotatedExpiresAt(v *time.Time) *ApplicationCreate { + if v != nil { + _c.SetRotatedExpiresAt(*v) + } + return _c +} + +// SetCurrentExpiresAt sets the "current_expires_at" field. +func (_c *ApplicationCreate) SetCurrentExpiresAt(v time.Time) *ApplicationCreate { + _c.mutation.SetCurrentExpiresAt(v) + return _c +} + +// SetNillableCurrentExpiresAt sets the "current_expires_at" field if the given value is not nil. +func (_c *ApplicationCreate) SetNillableCurrentExpiresAt(v *time.Time) *ApplicationCreate { + if v != nil { + _c.SetCurrentExpiresAt(*v) + } + return _c +} + +// SetSecretRotationPhase sets the "secret_rotation_phase" field. +func (_c *ApplicationCreate) SetSecretRotationPhase(v application.SecretRotationPhase) *ApplicationCreate { + _c.mutation.SetSecretRotationPhase(v) + return _c +} + +// SetNillableSecretRotationPhase sets the "secret_rotation_phase" field if the given value is not nil. +func (_c *ApplicationCreate) SetNillableSecretRotationPhase(v *application.SecretRotationPhase) *ApplicationCreate { + if v != nil { + _c.SetSecretRotationPhase(*v) + } + return _c +} + +// SetSecretRotationMessage sets the "secret_rotation_message" field. +func (_c *ApplicationCreate) SetSecretRotationMessage(v string) *ApplicationCreate { + _c.mutation.SetSecretRotationMessage(v) return _c } -// SetNillableIssuerURL sets the "issuer_url" field if the given value is not nil. -func (_c *ApplicationCreate) SetNillableIssuerURL(v *string) *ApplicationCreate { +// SetNillableSecretRotationMessage sets the "secret_rotation_message" field if the given value is not nil. +func (_c *ApplicationCreate) SetNillableSecretRotationMessage(v *string) *ApplicationCreate { if v != nil { - _c.SetIssuerURL(*v) + _c.SetSecretRotationMessage(*v) } return _c } @@ -206,6 +263,36 @@ func (_c *ApplicationCreate) AddSubscribedApis(v ...*ApiSubscription) *Applicati return _c.AddSubscribedAPIIDs(ids...) } +// AddExposedEventIDs adds the "exposed_events" edge to the EventExposure entity by IDs. +func (_c *ApplicationCreate) AddExposedEventIDs(ids ...int) *ApplicationCreate { + _c.mutation.AddExposedEventIDs(ids...) + return _c +} + +// AddExposedEvents adds the "exposed_events" edges to the EventExposure entity. +func (_c *ApplicationCreate) AddExposedEvents(v ...*EventExposure) *ApplicationCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _c.AddExposedEventIDs(ids...) +} + +// AddSubscribedEventIDs adds the "subscribed_events" edge to the EventSubscription entity by IDs. +func (_c *ApplicationCreate) AddSubscribedEventIDs(ids ...int) *ApplicationCreate { + _c.mutation.AddSubscribedEventIDs(ids...) + return _c +} + +// AddSubscribedEvents adds the "subscribed_events" edges to the EventSubscription entity. +func (_c *ApplicationCreate) AddSubscribedEvents(v ...*EventSubscription) *ApplicationCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _c.AddSubscribedEventIDs(ids...) +} + // Mutation returns the ApplicationMutation object of the builder. func (_c *ApplicationCreate) Mutation() *ApplicationMutation { return _c.mutation @@ -257,6 +344,10 @@ func (_c *ApplicationCreate) defaults() error { v := application.DefaultLastModifiedAt() _c.mutation.SetLastModifiedAt(v) } + if _, ok := _c.mutation.SecretRotationPhase(); !ok { + v := application.DefaultSecretRotationPhase + _c.mutation.SetSecretRotationPhase(v) + } return nil } @@ -299,6 +390,19 @@ func (_c *ApplicationCreate) check() error { return &ValidationError{Name: "client_secret", err: fmt.Errorf(`ent: validator failed for field "Application.client_secret": %w`, err)} } } + if v, ok := _c.mutation.RotatedClientSecret(); ok { + if err := application.RotatedClientSecretValidator(v); err != nil { + return &ValidationError{Name: "rotated_client_secret", err: fmt.Errorf(`ent: validator failed for field "Application.rotated_client_secret": %w`, err)} + } + } + if _, ok := _c.mutation.SecretRotationPhase(); !ok { + return &ValidationError{Name: "secret_rotation_phase", err: errors.New(`ent: missing required field "Application.secret_rotation_phase"`)} + } + if v, ok := _c.mutation.SecretRotationPhase(); ok { + if err := application.SecretRotationPhaseValidator(v); err != nil { + return &ValidationError{Name: "secret_rotation_phase", err: fmt.Errorf(`ent: validator failed for field "Application.secret_rotation_phase": %w`, err)} + } + } if len(_c.mutation.ZoneIDs()) == 0 { return &ValidationError{Name: "zone", err: errors.New(`ent: missing required edge "Application.zone"`)} } @@ -368,9 +472,25 @@ func (_c *ApplicationCreate) createSpec() (*Application, *sqlgraph.CreateSpec) { _spec.SetField(application.FieldClientSecret, field.TypeString, value) _node.ClientSecret = &value } - if value, ok := _c.mutation.IssuerURL(); ok { - _spec.SetField(application.FieldIssuerURL, field.TypeString, value) - _node.IssuerURL = &value + if value, ok := _c.mutation.RotatedClientSecret(); ok { + _spec.SetField(application.FieldRotatedClientSecret, field.TypeString, value) + _node.RotatedClientSecret = &value + } + if value, ok := _c.mutation.RotatedExpiresAt(); ok { + _spec.SetField(application.FieldRotatedExpiresAt, field.TypeTime, value) + _node.RotatedExpiresAt = &value + } + if value, ok := _c.mutation.CurrentExpiresAt(); ok { + _spec.SetField(application.FieldCurrentExpiresAt, field.TypeTime, value) + _node.CurrentExpiresAt = &value + } + if value, ok := _c.mutation.SecretRotationPhase(); ok { + _spec.SetField(application.FieldSecretRotationPhase, field.TypeEnum, value) + _node.SecretRotationPhase = value + } + if value, ok := _c.mutation.SecretRotationMessage(); ok { + _spec.SetField(application.FieldSecretRotationMessage, field.TypeString, value) + _node.SecretRotationMessage = &value } if nodes := _c.mutation.ZoneIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -438,6 +558,38 @@ func (_c *ApplicationCreate) createSpec() (*Application, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } + if nodes := _c.mutation.ExposedEventsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.ExposedEventsTable, + Columns: []string{application.ExposedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := _c.mutation.SubscribedEventsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.SubscribedEventsTable, + Columns: []string{application.SubscribedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } return _node, _spec } @@ -616,21 +768,87 @@ func (u *ApplicationUpsert) ClearClientSecret() *ApplicationUpsert { return u } -// SetIssuerURL sets the "issuer_url" field. -func (u *ApplicationUpsert) SetIssuerURL(v string) *ApplicationUpsert { - u.Set(application.FieldIssuerURL, v) +// SetRotatedClientSecret sets the "rotated_client_secret" field. +func (u *ApplicationUpsert) SetRotatedClientSecret(v string) *ApplicationUpsert { + u.Set(application.FieldRotatedClientSecret, v) + return u +} + +// UpdateRotatedClientSecret sets the "rotated_client_secret" field to the value that was provided on create. +func (u *ApplicationUpsert) UpdateRotatedClientSecret() *ApplicationUpsert { + u.SetExcluded(application.FieldRotatedClientSecret) + return u +} + +// ClearRotatedClientSecret clears the value of the "rotated_client_secret" field. +func (u *ApplicationUpsert) ClearRotatedClientSecret() *ApplicationUpsert { + u.SetNull(application.FieldRotatedClientSecret) + return u +} + +// SetRotatedExpiresAt sets the "rotated_expires_at" field. +func (u *ApplicationUpsert) SetRotatedExpiresAt(v time.Time) *ApplicationUpsert { + u.Set(application.FieldRotatedExpiresAt, v) + return u +} + +// UpdateRotatedExpiresAt sets the "rotated_expires_at" field to the value that was provided on create. +func (u *ApplicationUpsert) UpdateRotatedExpiresAt() *ApplicationUpsert { + u.SetExcluded(application.FieldRotatedExpiresAt) + return u +} + +// ClearRotatedExpiresAt clears the value of the "rotated_expires_at" field. +func (u *ApplicationUpsert) ClearRotatedExpiresAt() *ApplicationUpsert { + u.SetNull(application.FieldRotatedExpiresAt) + return u +} + +// SetCurrentExpiresAt sets the "current_expires_at" field. +func (u *ApplicationUpsert) SetCurrentExpiresAt(v time.Time) *ApplicationUpsert { + u.Set(application.FieldCurrentExpiresAt, v) return u } -// UpdateIssuerURL sets the "issuer_url" field to the value that was provided on create. -func (u *ApplicationUpsert) UpdateIssuerURL() *ApplicationUpsert { - u.SetExcluded(application.FieldIssuerURL) +// UpdateCurrentExpiresAt sets the "current_expires_at" field to the value that was provided on create. +func (u *ApplicationUpsert) UpdateCurrentExpiresAt() *ApplicationUpsert { + u.SetExcluded(application.FieldCurrentExpiresAt) return u } -// ClearIssuerURL clears the value of the "issuer_url" field. -func (u *ApplicationUpsert) ClearIssuerURL() *ApplicationUpsert { - u.SetNull(application.FieldIssuerURL) +// ClearCurrentExpiresAt clears the value of the "current_expires_at" field. +func (u *ApplicationUpsert) ClearCurrentExpiresAt() *ApplicationUpsert { + u.SetNull(application.FieldCurrentExpiresAt) + return u +} + +// SetSecretRotationPhase sets the "secret_rotation_phase" field. +func (u *ApplicationUpsert) SetSecretRotationPhase(v application.SecretRotationPhase) *ApplicationUpsert { + u.Set(application.FieldSecretRotationPhase, v) + return u +} + +// UpdateSecretRotationPhase sets the "secret_rotation_phase" field to the value that was provided on create. +func (u *ApplicationUpsert) UpdateSecretRotationPhase() *ApplicationUpsert { + u.SetExcluded(application.FieldSecretRotationPhase) + return u +} + +// SetSecretRotationMessage sets the "secret_rotation_message" field. +func (u *ApplicationUpsert) SetSecretRotationMessage(v string) *ApplicationUpsert { + u.Set(application.FieldSecretRotationMessage, v) + return u +} + +// UpdateSecretRotationMessage sets the "secret_rotation_message" field to the value that was provided on create. +func (u *ApplicationUpsert) UpdateSecretRotationMessage() *ApplicationUpsert { + u.SetExcluded(application.FieldSecretRotationMessage) + return u +} + +// ClearSecretRotationMessage clears the value of the "secret_rotation_message" field. +func (u *ApplicationUpsert) ClearSecretRotationMessage() *ApplicationUpsert { + u.SetNull(application.FieldSecretRotationMessage) return u } @@ -826,24 +1044,101 @@ func (u *ApplicationUpsertOne) ClearClientSecret() *ApplicationUpsertOne { }) } -// SetIssuerURL sets the "issuer_url" field. -func (u *ApplicationUpsertOne) SetIssuerURL(v string) *ApplicationUpsertOne { +// SetRotatedClientSecret sets the "rotated_client_secret" field. +func (u *ApplicationUpsertOne) SetRotatedClientSecret(v string) *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.SetRotatedClientSecret(v) + }) +} + +// UpdateRotatedClientSecret sets the "rotated_client_secret" field to the value that was provided on create. +func (u *ApplicationUpsertOne) UpdateRotatedClientSecret() *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.UpdateRotatedClientSecret() + }) +} + +// ClearRotatedClientSecret clears the value of the "rotated_client_secret" field. +func (u *ApplicationUpsertOne) ClearRotatedClientSecret() *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.ClearRotatedClientSecret() + }) +} + +// SetRotatedExpiresAt sets the "rotated_expires_at" field. +func (u *ApplicationUpsertOne) SetRotatedExpiresAt(v time.Time) *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.SetRotatedExpiresAt(v) + }) +} + +// UpdateRotatedExpiresAt sets the "rotated_expires_at" field to the value that was provided on create. +func (u *ApplicationUpsertOne) UpdateRotatedExpiresAt() *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.UpdateRotatedExpiresAt() + }) +} + +// ClearRotatedExpiresAt clears the value of the "rotated_expires_at" field. +func (u *ApplicationUpsertOne) ClearRotatedExpiresAt() *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.ClearRotatedExpiresAt() + }) +} + +// SetCurrentExpiresAt sets the "current_expires_at" field. +func (u *ApplicationUpsertOne) SetCurrentExpiresAt(v time.Time) *ApplicationUpsertOne { return u.Update(func(s *ApplicationUpsert) { - s.SetIssuerURL(v) + s.SetCurrentExpiresAt(v) }) } -// UpdateIssuerURL sets the "issuer_url" field to the value that was provided on create. -func (u *ApplicationUpsertOne) UpdateIssuerURL() *ApplicationUpsertOne { +// UpdateCurrentExpiresAt sets the "current_expires_at" field to the value that was provided on create. +func (u *ApplicationUpsertOne) UpdateCurrentExpiresAt() *ApplicationUpsertOne { return u.Update(func(s *ApplicationUpsert) { - s.UpdateIssuerURL() + s.UpdateCurrentExpiresAt() }) } -// ClearIssuerURL clears the value of the "issuer_url" field. -func (u *ApplicationUpsertOne) ClearIssuerURL() *ApplicationUpsertOne { +// ClearCurrentExpiresAt clears the value of the "current_expires_at" field. +func (u *ApplicationUpsertOne) ClearCurrentExpiresAt() *ApplicationUpsertOne { return u.Update(func(s *ApplicationUpsert) { - s.ClearIssuerURL() + s.ClearCurrentExpiresAt() + }) +} + +// SetSecretRotationPhase sets the "secret_rotation_phase" field. +func (u *ApplicationUpsertOne) SetSecretRotationPhase(v application.SecretRotationPhase) *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.SetSecretRotationPhase(v) + }) +} + +// UpdateSecretRotationPhase sets the "secret_rotation_phase" field to the value that was provided on create. +func (u *ApplicationUpsertOne) UpdateSecretRotationPhase() *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.UpdateSecretRotationPhase() + }) +} + +// SetSecretRotationMessage sets the "secret_rotation_message" field. +func (u *ApplicationUpsertOne) SetSecretRotationMessage(v string) *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.SetSecretRotationMessage(v) + }) +} + +// UpdateSecretRotationMessage sets the "secret_rotation_message" field to the value that was provided on create. +func (u *ApplicationUpsertOne) UpdateSecretRotationMessage() *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.UpdateSecretRotationMessage() + }) +} + +// ClearSecretRotationMessage clears the value of the "secret_rotation_message" field. +func (u *ApplicationUpsertOne) ClearSecretRotationMessage() *ApplicationUpsertOne { + return u.Update(func(s *ApplicationUpsert) { + s.ClearSecretRotationMessage() }) } @@ -1205,24 +1500,101 @@ func (u *ApplicationUpsertBulk) ClearClientSecret() *ApplicationUpsertBulk { }) } -// SetIssuerURL sets the "issuer_url" field. -func (u *ApplicationUpsertBulk) SetIssuerURL(v string) *ApplicationUpsertBulk { +// SetRotatedClientSecret sets the "rotated_client_secret" field. +func (u *ApplicationUpsertBulk) SetRotatedClientSecret(v string) *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.SetRotatedClientSecret(v) + }) +} + +// UpdateRotatedClientSecret sets the "rotated_client_secret" field to the value that was provided on create. +func (u *ApplicationUpsertBulk) UpdateRotatedClientSecret() *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.UpdateRotatedClientSecret() + }) +} + +// ClearRotatedClientSecret clears the value of the "rotated_client_secret" field. +func (u *ApplicationUpsertBulk) ClearRotatedClientSecret() *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.ClearRotatedClientSecret() + }) +} + +// SetRotatedExpiresAt sets the "rotated_expires_at" field. +func (u *ApplicationUpsertBulk) SetRotatedExpiresAt(v time.Time) *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.SetRotatedExpiresAt(v) + }) +} + +// UpdateRotatedExpiresAt sets the "rotated_expires_at" field to the value that was provided on create. +func (u *ApplicationUpsertBulk) UpdateRotatedExpiresAt() *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.UpdateRotatedExpiresAt() + }) +} + +// ClearRotatedExpiresAt clears the value of the "rotated_expires_at" field. +func (u *ApplicationUpsertBulk) ClearRotatedExpiresAt() *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.ClearRotatedExpiresAt() + }) +} + +// SetCurrentExpiresAt sets the "current_expires_at" field. +func (u *ApplicationUpsertBulk) SetCurrentExpiresAt(v time.Time) *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.SetCurrentExpiresAt(v) + }) +} + +// UpdateCurrentExpiresAt sets the "current_expires_at" field to the value that was provided on create. +func (u *ApplicationUpsertBulk) UpdateCurrentExpiresAt() *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.UpdateCurrentExpiresAt() + }) +} + +// ClearCurrentExpiresAt clears the value of the "current_expires_at" field. +func (u *ApplicationUpsertBulk) ClearCurrentExpiresAt() *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.ClearCurrentExpiresAt() + }) +} + +// SetSecretRotationPhase sets the "secret_rotation_phase" field. +func (u *ApplicationUpsertBulk) SetSecretRotationPhase(v application.SecretRotationPhase) *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.SetSecretRotationPhase(v) + }) +} + +// UpdateSecretRotationPhase sets the "secret_rotation_phase" field to the value that was provided on create. +func (u *ApplicationUpsertBulk) UpdateSecretRotationPhase() *ApplicationUpsertBulk { + return u.Update(func(s *ApplicationUpsert) { + s.UpdateSecretRotationPhase() + }) +} + +// SetSecretRotationMessage sets the "secret_rotation_message" field. +func (u *ApplicationUpsertBulk) SetSecretRotationMessage(v string) *ApplicationUpsertBulk { return u.Update(func(s *ApplicationUpsert) { - s.SetIssuerURL(v) + s.SetSecretRotationMessage(v) }) } -// UpdateIssuerURL sets the "issuer_url" field to the value that was provided on create. -func (u *ApplicationUpsertBulk) UpdateIssuerURL() *ApplicationUpsertBulk { +// UpdateSecretRotationMessage sets the "secret_rotation_message" field to the value that was provided on create. +func (u *ApplicationUpsertBulk) UpdateSecretRotationMessage() *ApplicationUpsertBulk { return u.Update(func(s *ApplicationUpsert) { - s.UpdateIssuerURL() + s.UpdateSecretRotationMessage() }) } -// ClearIssuerURL clears the value of the "issuer_url" field. -func (u *ApplicationUpsertBulk) ClearIssuerURL() *ApplicationUpsertBulk { +// ClearSecretRotationMessage clears the value of the "secret_rotation_message" field. +func (u *ApplicationUpsertBulk) ClearSecretRotationMessage() *ApplicationUpsertBulk { return u.Update(func(s *ApplicationUpsert) { - s.ClearIssuerURL() + s.ClearSecretRotationMessage() }) } diff --git a/controlplane-api/ent/application_delete.go b/controlplane-api/ent/application_delete.go index 76197d91d..d7b29f2cb 100644 --- a/controlplane-api/ent/application_delete.go +++ b/controlplane-api/ent/application_delete.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/application_query.go b/controlplane-api/ent/application_query.go index 3aa2cd6ef..12328f4e9 100644 --- a/controlplane-api/ent/application_query.go +++ b/controlplane-api/ent/application_query.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -20,6 +19,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/predicate" "github.com/telekom/controlplane/controlplane-api/ent/team" "github.com/telekom/controlplane/controlplane-api/ent/zone" @@ -28,19 +29,23 @@ import ( // ApplicationQuery is the builder for querying Application entities. type ApplicationQuery struct { config - ctx *QueryContext - order []application.OrderOption - inters []Interceptor - predicates []predicate.Application - withZone *ZoneQuery - withOwnerTeam *TeamQuery - withExposedApis *ApiExposureQuery - withSubscribedApis *ApiSubscriptionQuery - withFKs bool - modifiers []func(*sql.Selector) - loadTotal []func(context.Context, []*Application) error - withNamedExposedApis map[string]*ApiExposureQuery - withNamedSubscribedApis map[string]*ApiSubscriptionQuery + ctx *QueryContext + order []application.OrderOption + inters []Interceptor + predicates []predicate.Application + withZone *ZoneQuery + withOwnerTeam *TeamQuery + withExposedApis *ApiExposureQuery + withSubscribedApis *ApiSubscriptionQuery + withExposedEvents *EventExposureQuery + withSubscribedEvents *EventSubscriptionQuery + withFKs bool + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*Application) error + withNamedExposedApis map[string]*ApiExposureQuery + withNamedSubscribedApis map[string]*ApiSubscriptionQuery + withNamedExposedEvents map[string]*EventExposureQuery + withNamedSubscribedEvents map[string]*EventSubscriptionQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -165,6 +170,50 @@ func (_q *ApplicationQuery) QuerySubscribedApis() *ApiSubscriptionQuery { return query } +// QueryExposedEvents chains the current query on the "exposed_events" edge. +func (_q *ApplicationQuery) QueryExposedEvents() *EventExposureQuery { + query := (&EventExposureClient{config: _q.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + selector := _q.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(application.Table, application.FieldID, selector), + sqlgraph.To(eventexposure.Table, eventexposure.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, application.ExposedEventsTable, application.ExposedEventsColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QuerySubscribedEvents chains the current query on the "subscribed_events" edge. +func (_q *ApplicationQuery) QuerySubscribedEvents() *EventSubscriptionQuery { + query := (&EventSubscriptionClient{config: _q.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + selector := _q.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(application.Table, application.FieldID, selector), + sqlgraph.To(eventsubscription.Table, eventsubscription.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, application.SubscribedEventsTable, application.SubscribedEventsColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + // First returns the first Application entity from the query. // Returns a *NotFoundError when no Application was found. func (_q *ApplicationQuery) First(ctx context.Context) (*Application, error) { @@ -352,15 +401,17 @@ func (_q *ApplicationQuery) Clone() *ApplicationQuery { return nil } return &ApplicationQuery{ - config: _q.config, - ctx: _q.ctx.Clone(), - order: append([]application.OrderOption{}, _q.order...), - inters: append([]Interceptor{}, _q.inters...), - predicates: append([]predicate.Application{}, _q.predicates...), - withZone: _q.withZone.Clone(), - withOwnerTeam: _q.withOwnerTeam.Clone(), - withExposedApis: _q.withExposedApis.Clone(), - withSubscribedApis: _q.withSubscribedApis.Clone(), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]application.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Application{}, _q.predicates...), + withZone: _q.withZone.Clone(), + withOwnerTeam: _q.withOwnerTeam.Clone(), + withExposedApis: _q.withExposedApis.Clone(), + withSubscribedApis: _q.withSubscribedApis.Clone(), + withExposedEvents: _q.withExposedEvents.Clone(), + withSubscribedEvents: _q.withSubscribedEvents.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, @@ -411,6 +462,28 @@ func (_q *ApplicationQuery) WithSubscribedApis(opts ...func(*ApiSubscriptionQuer return _q } +// WithExposedEvents tells the query-builder to eager-load the nodes that are connected to +// the "exposed_events" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *ApplicationQuery) WithExposedEvents(opts ...func(*EventExposureQuery)) *ApplicationQuery { + query := (&EventExposureClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withExposedEvents = query + return _q +} + +// WithSubscribedEvents tells the query-builder to eager-load the nodes that are connected to +// the "subscribed_events" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *ApplicationQuery) WithSubscribedEvents(opts ...func(*EventSubscriptionQuery)) *ApplicationQuery { + query := (&EventSubscriptionClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withSubscribedEvents = query + return _q +} + // GroupBy is used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // @@ -496,11 +569,13 @@ func (_q *ApplicationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]* nodes = []*Application{} withFKs = _q.withFKs _spec = _q.querySpec() - loadedTypes = [4]bool{ + loadedTypes = [6]bool{ _q.withZone != nil, _q.withOwnerTeam != nil, _q.withExposedApis != nil, _q.withSubscribedApis != nil, + _q.withExposedEvents != nil, + _q.withSubscribedEvents != nil, } ) if _q.withZone != nil || _q.withOwnerTeam != nil { @@ -556,6 +631,22 @@ func (_q *ApplicationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]* return nil, err } } + if query := _q.withExposedEvents; query != nil { + if err := _q.loadExposedEvents(ctx, query, nodes, + func(n *Application) { n.Edges.ExposedEvents = []*EventExposure{} }, + func(n *Application, e *EventExposure) { n.Edges.ExposedEvents = append(n.Edges.ExposedEvents, e) }); err != nil { + return nil, err + } + } + if query := _q.withSubscribedEvents; query != nil { + if err := _q.loadSubscribedEvents(ctx, query, nodes, + func(n *Application) { n.Edges.SubscribedEvents = []*EventSubscription{} }, + func(n *Application, e *EventSubscription) { + n.Edges.SubscribedEvents = append(n.Edges.SubscribedEvents, e) + }); err != nil { + return nil, err + } + } for name, query := range _q.withNamedExposedApis { if err := _q.loadExposedApis(ctx, query, nodes, func(n *Application) { n.appendNamedExposedApis(name) }, @@ -570,6 +661,20 @@ func (_q *ApplicationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]* return nil, err } } + for name, query := range _q.withNamedExposedEvents { + if err := _q.loadExposedEvents(ctx, query, nodes, + func(n *Application) { n.appendNamedExposedEvents(name) }, + func(n *Application, e *EventExposure) { n.appendNamedExposedEvents(name, e) }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedSubscribedEvents { + if err := _q.loadSubscribedEvents(ctx, query, nodes, + func(n *Application) { n.appendNamedSubscribedEvents(name) }, + func(n *Application, e *EventSubscription) { n.appendNamedSubscribedEvents(name, e) }); err != nil { + return nil, err + } + } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err @@ -704,6 +809,68 @@ func (_q *ApplicationQuery) loadSubscribedApis(ctx context.Context, query *ApiSu } return nil } +func (_q *ApplicationQuery) loadExposedEvents(ctx context.Context, query *EventExposureQuery, nodes []*Application, init func(*Application), assign func(*Application, *EventExposure)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*Application) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.EventExposure(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(application.ExposedEventsColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.application_exposed_events + if fk == nil { + return fmt.Errorf(`foreign-key "application_exposed_events" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "application_exposed_events" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} +func (_q *ApplicationQuery) loadSubscribedEvents(ctx context.Context, query *EventSubscriptionQuery, nodes []*Application, init func(*Application), assign func(*Application, *EventSubscription)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*Application) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.EventSubscription(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(application.SubscribedEventsColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.application_subscribed_events + if fk == nil { + return fmt.Errorf(`foreign-key "application_subscribed_events" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "application_subscribed_events" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} func (_q *ApplicationQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() @@ -817,6 +984,34 @@ func (_q *ApplicationQuery) WithNamedSubscribedApis(name string, opts ...func(*A return _q } +// WithNamedExposedEvents tells the query-builder to eager-load the nodes that are connected to the "exposed_events" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *ApplicationQuery) WithNamedExposedEvents(name string, opts ...func(*EventExposureQuery)) *ApplicationQuery { + query := (&EventExposureClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedExposedEvents == nil { + _q.withNamedExposedEvents = make(map[string]*EventExposureQuery) + } + _q.withNamedExposedEvents[name] = query + return _q +} + +// WithNamedSubscribedEvents tells the query-builder to eager-load the nodes that are connected to the "subscribed_events" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *ApplicationQuery) WithNamedSubscribedEvents(name string, opts ...func(*EventSubscriptionQuery)) *ApplicationQuery { + query := (&EventSubscriptionClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedSubscribedEvents == nil { + _q.withNamedSubscribedEvents = make(map[string]*EventSubscriptionQuery) + } + _q.withNamedSubscribedEvents[name] = query + return _q +} + // ApplicationGroupBy is the group-by builder for Application entities. type ApplicationGroupBy struct { selector diff --git a/controlplane-api/ent/application_update.go b/controlplane-api/ent/application_update.go index ada2349be..f58379406 100644 --- a/controlplane-api/ent/application_update.go +++ b/controlplane-api/ent/application_update.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -18,6 +17,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/predicate" "github.com/telekom/controlplane/controlplane-api/ent/team" "github.com/telekom/controlplane/controlplane-api/ent/zone" @@ -170,23 +171,97 @@ func (_u *ApplicationUpdate) ClearClientSecret() *ApplicationUpdate { return _u } -// SetIssuerURL sets the "issuer_url" field. -func (_u *ApplicationUpdate) SetIssuerURL(v string) *ApplicationUpdate { - _u.mutation.SetIssuerURL(v) +// SetRotatedClientSecret sets the "rotated_client_secret" field. +func (_u *ApplicationUpdate) SetRotatedClientSecret(v string) *ApplicationUpdate { + _u.mutation.SetRotatedClientSecret(v) return _u } -// SetNillableIssuerURL sets the "issuer_url" field if the given value is not nil. -func (_u *ApplicationUpdate) SetNillableIssuerURL(v *string) *ApplicationUpdate { +// SetNillableRotatedClientSecret sets the "rotated_client_secret" field if the given value is not nil. +func (_u *ApplicationUpdate) SetNillableRotatedClientSecret(v *string) *ApplicationUpdate { if v != nil { - _u.SetIssuerURL(*v) + _u.SetRotatedClientSecret(*v) } return _u } -// ClearIssuerURL clears the value of the "issuer_url" field. -func (_u *ApplicationUpdate) ClearIssuerURL() *ApplicationUpdate { - _u.mutation.ClearIssuerURL() +// ClearRotatedClientSecret clears the value of the "rotated_client_secret" field. +func (_u *ApplicationUpdate) ClearRotatedClientSecret() *ApplicationUpdate { + _u.mutation.ClearRotatedClientSecret() + return _u +} + +// SetRotatedExpiresAt sets the "rotated_expires_at" field. +func (_u *ApplicationUpdate) SetRotatedExpiresAt(v time.Time) *ApplicationUpdate { + _u.mutation.SetRotatedExpiresAt(v) + return _u +} + +// SetNillableRotatedExpiresAt sets the "rotated_expires_at" field if the given value is not nil. +func (_u *ApplicationUpdate) SetNillableRotatedExpiresAt(v *time.Time) *ApplicationUpdate { + if v != nil { + _u.SetRotatedExpiresAt(*v) + } + return _u +} + +// ClearRotatedExpiresAt clears the value of the "rotated_expires_at" field. +func (_u *ApplicationUpdate) ClearRotatedExpiresAt() *ApplicationUpdate { + _u.mutation.ClearRotatedExpiresAt() + return _u +} + +// SetCurrentExpiresAt sets the "current_expires_at" field. +func (_u *ApplicationUpdate) SetCurrentExpiresAt(v time.Time) *ApplicationUpdate { + _u.mutation.SetCurrentExpiresAt(v) + return _u +} + +// SetNillableCurrentExpiresAt sets the "current_expires_at" field if the given value is not nil. +func (_u *ApplicationUpdate) SetNillableCurrentExpiresAt(v *time.Time) *ApplicationUpdate { + if v != nil { + _u.SetCurrentExpiresAt(*v) + } + return _u +} + +// ClearCurrentExpiresAt clears the value of the "current_expires_at" field. +func (_u *ApplicationUpdate) ClearCurrentExpiresAt() *ApplicationUpdate { + _u.mutation.ClearCurrentExpiresAt() + return _u +} + +// SetSecretRotationPhase sets the "secret_rotation_phase" field. +func (_u *ApplicationUpdate) SetSecretRotationPhase(v application.SecretRotationPhase) *ApplicationUpdate { + _u.mutation.SetSecretRotationPhase(v) + return _u +} + +// SetNillableSecretRotationPhase sets the "secret_rotation_phase" field if the given value is not nil. +func (_u *ApplicationUpdate) SetNillableSecretRotationPhase(v *application.SecretRotationPhase) *ApplicationUpdate { + if v != nil { + _u.SetSecretRotationPhase(*v) + } + return _u +} + +// SetSecretRotationMessage sets the "secret_rotation_message" field. +func (_u *ApplicationUpdate) SetSecretRotationMessage(v string) *ApplicationUpdate { + _u.mutation.SetSecretRotationMessage(v) + return _u +} + +// SetNillableSecretRotationMessage sets the "secret_rotation_message" field if the given value is not nil. +func (_u *ApplicationUpdate) SetNillableSecretRotationMessage(v *string) *ApplicationUpdate { + if v != nil { + _u.SetSecretRotationMessage(*v) + } + return _u +} + +// ClearSecretRotationMessage clears the value of the "secret_rotation_message" field. +func (_u *ApplicationUpdate) ClearSecretRotationMessage() *ApplicationUpdate { + _u.mutation.ClearSecretRotationMessage() return _u } @@ -242,6 +317,36 @@ func (_u *ApplicationUpdate) AddSubscribedApis(v ...*ApiSubscription) *Applicati return _u.AddSubscribedAPIIDs(ids...) } +// AddExposedEventIDs adds the "exposed_events" edge to the EventExposure entity by IDs. +func (_u *ApplicationUpdate) AddExposedEventIDs(ids ...int) *ApplicationUpdate { + _u.mutation.AddExposedEventIDs(ids...) + return _u +} + +// AddExposedEvents adds the "exposed_events" edges to the EventExposure entity. +func (_u *ApplicationUpdate) AddExposedEvents(v ...*EventExposure) *ApplicationUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddExposedEventIDs(ids...) +} + +// AddSubscribedEventIDs adds the "subscribed_events" edge to the EventSubscription entity by IDs. +func (_u *ApplicationUpdate) AddSubscribedEventIDs(ids ...int) *ApplicationUpdate { + _u.mutation.AddSubscribedEventIDs(ids...) + return _u +} + +// AddSubscribedEvents adds the "subscribed_events" edges to the EventSubscription entity. +func (_u *ApplicationUpdate) AddSubscribedEvents(v ...*EventSubscription) *ApplicationUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddSubscribedEventIDs(ids...) +} + // Mutation returns the ApplicationMutation object of the builder. func (_u *ApplicationUpdate) Mutation() *ApplicationMutation { return _u.mutation @@ -301,6 +406,48 @@ func (_u *ApplicationUpdate) RemoveSubscribedApis(v ...*ApiSubscription) *Applic return _u.RemoveSubscribedAPIIDs(ids...) } +// ClearExposedEvents clears all "exposed_events" edges to the EventExposure entity. +func (_u *ApplicationUpdate) ClearExposedEvents() *ApplicationUpdate { + _u.mutation.ClearExposedEvents() + return _u +} + +// RemoveExposedEventIDs removes the "exposed_events" edge to EventExposure entities by IDs. +func (_u *ApplicationUpdate) RemoveExposedEventIDs(ids ...int) *ApplicationUpdate { + _u.mutation.RemoveExposedEventIDs(ids...) + return _u +} + +// RemoveExposedEvents removes "exposed_events" edges to EventExposure entities. +func (_u *ApplicationUpdate) RemoveExposedEvents(v ...*EventExposure) *ApplicationUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveExposedEventIDs(ids...) +} + +// ClearSubscribedEvents clears all "subscribed_events" edges to the EventSubscription entity. +func (_u *ApplicationUpdate) ClearSubscribedEvents() *ApplicationUpdate { + _u.mutation.ClearSubscribedEvents() + return _u +} + +// RemoveSubscribedEventIDs removes the "subscribed_events" edge to EventSubscription entities by IDs. +func (_u *ApplicationUpdate) RemoveSubscribedEventIDs(ids ...int) *ApplicationUpdate { + _u.mutation.RemoveSubscribedEventIDs(ids...) + return _u +} + +// RemoveSubscribedEvents removes "subscribed_events" edges to EventSubscription entities. +func (_u *ApplicationUpdate) RemoveSubscribedEvents(v ...*EventSubscription) *ApplicationUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveSubscribedEventIDs(ids...) +} + // Save executes the query and returns the number of nodes affected by the update operation. func (_u *ApplicationUpdate) Save(ctx context.Context) (int, error) { if err := _u.defaults(); err != nil { @@ -370,6 +517,16 @@ func (_u *ApplicationUpdate) check() error { return &ValidationError{Name: "client_secret", err: fmt.Errorf(`ent: validator failed for field "Application.client_secret": %w`, err)} } } + if v, ok := _u.mutation.RotatedClientSecret(); ok { + if err := application.RotatedClientSecretValidator(v); err != nil { + return &ValidationError{Name: "rotated_client_secret", err: fmt.Errorf(`ent: validator failed for field "Application.rotated_client_secret": %w`, err)} + } + } + if v, ok := _u.mutation.SecretRotationPhase(); ok { + if err := application.SecretRotationPhaseValidator(v); err != nil { + return &ValidationError{Name: "secret_rotation_phase", err: fmt.Errorf(`ent: validator failed for field "Application.secret_rotation_phase": %w`, err)} + } + } if _u.mutation.ZoneCleared() && len(_u.mutation.ZoneIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "Application.zone"`) } @@ -430,11 +587,32 @@ func (_u *ApplicationUpdate) sqlSave(ctx context.Context) (_node int, err error) if _u.mutation.ClientSecretCleared() { _spec.ClearField(application.FieldClientSecret, field.TypeString) } - if value, ok := _u.mutation.IssuerURL(); ok { - _spec.SetField(application.FieldIssuerURL, field.TypeString, value) + if value, ok := _u.mutation.RotatedClientSecret(); ok { + _spec.SetField(application.FieldRotatedClientSecret, field.TypeString, value) + } + if _u.mutation.RotatedClientSecretCleared() { + _spec.ClearField(application.FieldRotatedClientSecret, field.TypeString) + } + if value, ok := _u.mutation.RotatedExpiresAt(); ok { + _spec.SetField(application.FieldRotatedExpiresAt, field.TypeTime, value) + } + if _u.mutation.RotatedExpiresAtCleared() { + _spec.ClearField(application.FieldRotatedExpiresAt, field.TypeTime) } - if _u.mutation.IssuerURLCleared() { - _spec.ClearField(application.FieldIssuerURL, field.TypeString) + if value, ok := _u.mutation.CurrentExpiresAt(); ok { + _spec.SetField(application.FieldCurrentExpiresAt, field.TypeTime, value) + } + if _u.mutation.CurrentExpiresAtCleared() { + _spec.ClearField(application.FieldCurrentExpiresAt, field.TypeTime) + } + if value, ok := _u.mutation.SecretRotationPhase(); ok { + _spec.SetField(application.FieldSecretRotationPhase, field.TypeEnum, value) + } + if value, ok := _u.mutation.SecretRotationMessage(); ok { + _spec.SetField(application.FieldSecretRotationMessage, field.TypeString, value) + } + if _u.mutation.SecretRotationMessageCleared() { + _spec.ClearField(application.FieldSecretRotationMessage, field.TypeString) } if _u.mutation.ZoneCleared() { edge := &sqlgraph.EdgeSpec{ @@ -584,6 +762,96 @@ func (_u *ApplicationUpdate) sqlSave(ctx context.Context) (_node int, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.ExposedEventsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.ExposedEventsTable, + Columns: []string{application.ExposedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedExposedEventsIDs(); len(nodes) > 0 && !_u.mutation.ExposedEventsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.ExposedEventsTable, + Columns: []string{application.ExposedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.ExposedEventsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.ExposedEventsTable, + Columns: []string{application.ExposedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _u.mutation.SubscribedEventsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.SubscribedEventsTable, + Columns: []string{application.SubscribedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedSubscribedEventsIDs(); len(nodes) > 0 && !_u.mutation.SubscribedEventsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.SubscribedEventsTable, + Columns: []string{application.SubscribedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.SubscribedEventsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.SubscribedEventsTable, + Columns: []string{application.SubscribedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{application.Label} @@ -738,23 +1006,97 @@ func (_u *ApplicationUpdateOne) ClearClientSecret() *ApplicationUpdateOne { return _u } -// SetIssuerURL sets the "issuer_url" field. -func (_u *ApplicationUpdateOne) SetIssuerURL(v string) *ApplicationUpdateOne { - _u.mutation.SetIssuerURL(v) +// SetRotatedClientSecret sets the "rotated_client_secret" field. +func (_u *ApplicationUpdateOne) SetRotatedClientSecret(v string) *ApplicationUpdateOne { + _u.mutation.SetRotatedClientSecret(v) return _u } -// SetNillableIssuerURL sets the "issuer_url" field if the given value is not nil. -func (_u *ApplicationUpdateOne) SetNillableIssuerURL(v *string) *ApplicationUpdateOne { +// SetNillableRotatedClientSecret sets the "rotated_client_secret" field if the given value is not nil. +func (_u *ApplicationUpdateOne) SetNillableRotatedClientSecret(v *string) *ApplicationUpdateOne { if v != nil { - _u.SetIssuerURL(*v) + _u.SetRotatedClientSecret(*v) } return _u } -// ClearIssuerURL clears the value of the "issuer_url" field. -func (_u *ApplicationUpdateOne) ClearIssuerURL() *ApplicationUpdateOne { - _u.mutation.ClearIssuerURL() +// ClearRotatedClientSecret clears the value of the "rotated_client_secret" field. +func (_u *ApplicationUpdateOne) ClearRotatedClientSecret() *ApplicationUpdateOne { + _u.mutation.ClearRotatedClientSecret() + return _u +} + +// SetRotatedExpiresAt sets the "rotated_expires_at" field. +func (_u *ApplicationUpdateOne) SetRotatedExpiresAt(v time.Time) *ApplicationUpdateOne { + _u.mutation.SetRotatedExpiresAt(v) + return _u +} + +// SetNillableRotatedExpiresAt sets the "rotated_expires_at" field if the given value is not nil. +func (_u *ApplicationUpdateOne) SetNillableRotatedExpiresAt(v *time.Time) *ApplicationUpdateOne { + if v != nil { + _u.SetRotatedExpiresAt(*v) + } + return _u +} + +// ClearRotatedExpiresAt clears the value of the "rotated_expires_at" field. +func (_u *ApplicationUpdateOne) ClearRotatedExpiresAt() *ApplicationUpdateOne { + _u.mutation.ClearRotatedExpiresAt() + return _u +} + +// SetCurrentExpiresAt sets the "current_expires_at" field. +func (_u *ApplicationUpdateOne) SetCurrentExpiresAt(v time.Time) *ApplicationUpdateOne { + _u.mutation.SetCurrentExpiresAt(v) + return _u +} + +// SetNillableCurrentExpiresAt sets the "current_expires_at" field if the given value is not nil. +func (_u *ApplicationUpdateOne) SetNillableCurrentExpiresAt(v *time.Time) *ApplicationUpdateOne { + if v != nil { + _u.SetCurrentExpiresAt(*v) + } + return _u +} + +// ClearCurrentExpiresAt clears the value of the "current_expires_at" field. +func (_u *ApplicationUpdateOne) ClearCurrentExpiresAt() *ApplicationUpdateOne { + _u.mutation.ClearCurrentExpiresAt() + return _u +} + +// SetSecretRotationPhase sets the "secret_rotation_phase" field. +func (_u *ApplicationUpdateOne) SetSecretRotationPhase(v application.SecretRotationPhase) *ApplicationUpdateOne { + _u.mutation.SetSecretRotationPhase(v) + return _u +} + +// SetNillableSecretRotationPhase sets the "secret_rotation_phase" field if the given value is not nil. +func (_u *ApplicationUpdateOne) SetNillableSecretRotationPhase(v *application.SecretRotationPhase) *ApplicationUpdateOne { + if v != nil { + _u.SetSecretRotationPhase(*v) + } + return _u +} + +// SetSecretRotationMessage sets the "secret_rotation_message" field. +func (_u *ApplicationUpdateOne) SetSecretRotationMessage(v string) *ApplicationUpdateOne { + _u.mutation.SetSecretRotationMessage(v) + return _u +} + +// SetNillableSecretRotationMessage sets the "secret_rotation_message" field if the given value is not nil. +func (_u *ApplicationUpdateOne) SetNillableSecretRotationMessage(v *string) *ApplicationUpdateOne { + if v != nil { + _u.SetSecretRotationMessage(*v) + } + return _u +} + +// ClearSecretRotationMessage clears the value of the "secret_rotation_message" field. +func (_u *ApplicationUpdateOne) ClearSecretRotationMessage() *ApplicationUpdateOne { + _u.mutation.ClearSecretRotationMessage() return _u } @@ -810,6 +1152,36 @@ func (_u *ApplicationUpdateOne) AddSubscribedApis(v ...*ApiSubscription) *Applic return _u.AddSubscribedAPIIDs(ids...) } +// AddExposedEventIDs adds the "exposed_events" edge to the EventExposure entity by IDs. +func (_u *ApplicationUpdateOne) AddExposedEventIDs(ids ...int) *ApplicationUpdateOne { + _u.mutation.AddExposedEventIDs(ids...) + return _u +} + +// AddExposedEvents adds the "exposed_events" edges to the EventExposure entity. +func (_u *ApplicationUpdateOne) AddExposedEvents(v ...*EventExposure) *ApplicationUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddExposedEventIDs(ids...) +} + +// AddSubscribedEventIDs adds the "subscribed_events" edge to the EventSubscription entity by IDs. +func (_u *ApplicationUpdateOne) AddSubscribedEventIDs(ids ...int) *ApplicationUpdateOne { + _u.mutation.AddSubscribedEventIDs(ids...) + return _u +} + +// AddSubscribedEvents adds the "subscribed_events" edges to the EventSubscription entity. +func (_u *ApplicationUpdateOne) AddSubscribedEvents(v ...*EventSubscription) *ApplicationUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddSubscribedEventIDs(ids...) +} + // Mutation returns the ApplicationMutation object of the builder. func (_u *ApplicationUpdateOne) Mutation() *ApplicationMutation { return _u.mutation @@ -869,6 +1241,48 @@ func (_u *ApplicationUpdateOne) RemoveSubscribedApis(v ...*ApiSubscription) *App return _u.RemoveSubscribedAPIIDs(ids...) } +// ClearExposedEvents clears all "exposed_events" edges to the EventExposure entity. +func (_u *ApplicationUpdateOne) ClearExposedEvents() *ApplicationUpdateOne { + _u.mutation.ClearExposedEvents() + return _u +} + +// RemoveExposedEventIDs removes the "exposed_events" edge to EventExposure entities by IDs. +func (_u *ApplicationUpdateOne) RemoveExposedEventIDs(ids ...int) *ApplicationUpdateOne { + _u.mutation.RemoveExposedEventIDs(ids...) + return _u +} + +// RemoveExposedEvents removes "exposed_events" edges to EventExposure entities. +func (_u *ApplicationUpdateOne) RemoveExposedEvents(v ...*EventExposure) *ApplicationUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveExposedEventIDs(ids...) +} + +// ClearSubscribedEvents clears all "subscribed_events" edges to the EventSubscription entity. +func (_u *ApplicationUpdateOne) ClearSubscribedEvents() *ApplicationUpdateOne { + _u.mutation.ClearSubscribedEvents() + return _u +} + +// RemoveSubscribedEventIDs removes the "subscribed_events" edge to EventSubscription entities by IDs. +func (_u *ApplicationUpdateOne) RemoveSubscribedEventIDs(ids ...int) *ApplicationUpdateOne { + _u.mutation.RemoveSubscribedEventIDs(ids...) + return _u +} + +// RemoveSubscribedEvents removes "subscribed_events" edges to EventSubscription entities. +func (_u *ApplicationUpdateOne) RemoveSubscribedEvents(v ...*EventSubscription) *ApplicationUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveSubscribedEventIDs(ids...) +} + // Where appends a list predicates to the ApplicationUpdate builder. func (_u *ApplicationUpdateOne) Where(ps ...predicate.Application) *ApplicationUpdateOne { _u.mutation.Where(ps...) @@ -951,6 +1365,16 @@ func (_u *ApplicationUpdateOne) check() error { return &ValidationError{Name: "client_secret", err: fmt.Errorf(`ent: validator failed for field "Application.client_secret": %w`, err)} } } + if v, ok := _u.mutation.RotatedClientSecret(); ok { + if err := application.RotatedClientSecretValidator(v); err != nil { + return &ValidationError{Name: "rotated_client_secret", err: fmt.Errorf(`ent: validator failed for field "Application.rotated_client_secret": %w`, err)} + } + } + if v, ok := _u.mutation.SecretRotationPhase(); ok { + if err := application.SecretRotationPhaseValidator(v); err != nil { + return &ValidationError{Name: "secret_rotation_phase", err: fmt.Errorf(`ent: validator failed for field "Application.secret_rotation_phase": %w`, err)} + } + } if _u.mutation.ZoneCleared() && len(_u.mutation.ZoneIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "Application.zone"`) } @@ -1028,11 +1452,32 @@ func (_u *ApplicationUpdateOne) sqlSave(ctx context.Context) (_node *Application if _u.mutation.ClientSecretCleared() { _spec.ClearField(application.FieldClientSecret, field.TypeString) } - if value, ok := _u.mutation.IssuerURL(); ok { - _spec.SetField(application.FieldIssuerURL, field.TypeString, value) + if value, ok := _u.mutation.RotatedClientSecret(); ok { + _spec.SetField(application.FieldRotatedClientSecret, field.TypeString, value) + } + if _u.mutation.RotatedClientSecretCleared() { + _spec.ClearField(application.FieldRotatedClientSecret, field.TypeString) + } + if value, ok := _u.mutation.RotatedExpiresAt(); ok { + _spec.SetField(application.FieldRotatedExpiresAt, field.TypeTime, value) + } + if _u.mutation.RotatedExpiresAtCleared() { + _spec.ClearField(application.FieldRotatedExpiresAt, field.TypeTime) } - if _u.mutation.IssuerURLCleared() { - _spec.ClearField(application.FieldIssuerURL, field.TypeString) + if value, ok := _u.mutation.CurrentExpiresAt(); ok { + _spec.SetField(application.FieldCurrentExpiresAt, field.TypeTime, value) + } + if _u.mutation.CurrentExpiresAtCleared() { + _spec.ClearField(application.FieldCurrentExpiresAt, field.TypeTime) + } + if value, ok := _u.mutation.SecretRotationPhase(); ok { + _spec.SetField(application.FieldSecretRotationPhase, field.TypeEnum, value) + } + if value, ok := _u.mutation.SecretRotationMessage(); ok { + _spec.SetField(application.FieldSecretRotationMessage, field.TypeString, value) + } + if _u.mutation.SecretRotationMessageCleared() { + _spec.ClearField(application.FieldSecretRotationMessage, field.TypeString) } if _u.mutation.ZoneCleared() { edge := &sqlgraph.EdgeSpec{ @@ -1182,6 +1627,96 @@ func (_u *ApplicationUpdateOne) sqlSave(ctx context.Context) (_node *Application } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.ExposedEventsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.ExposedEventsTable, + Columns: []string{application.ExposedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedExposedEventsIDs(); len(nodes) > 0 && !_u.mutation.ExposedEventsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.ExposedEventsTable, + Columns: []string{application.ExposedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.ExposedEventsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.ExposedEventsTable, + Columns: []string{application.ExposedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _u.mutation.SubscribedEventsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.SubscribedEventsTable, + Columns: []string{application.SubscribedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedSubscribedEventsIDs(); len(nodes) > 0 && !_u.mutation.SubscribedEventsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.SubscribedEventsTable, + Columns: []string{application.SubscribedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.SubscribedEventsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: application.SubscribedEventsTable, + Columns: []string{application.SubscribedEventsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } _node = &Application{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/controlplane-api/ent/approval.go b/controlplane-api/ent/approval.go index 9b6c0c979..d731523fd 100644 --- a/controlplane-api/ent/approval.go +++ b/controlplane-api/ent/approval.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -16,6 +15,7 @@ import ( "entgo.io/ent/dialect/sql" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approval" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/pkg/model" ) @@ -56,18 +56,21 @@ type Approval struct { State approval.State `json:"state,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ApprovalQuery when eager-loading is set. - Edges ApprovalEdges `json:"edges"` - api_subscription_approval *int - selectValues sql.SelectValues + Edges ApprovalEdges `json:"edges"` + api_subscription_approval *int + event_subscription_approval *int + selectValues sql.SelectValues } // ApprovalEdges holds the relations/edges for other nodes in the graph. type ApprovalEdges struct { // APISubscription holds the value of the api_subscription edge. APISubscription *ApiSubscription `json:"api_subscription,omitempty"` + // EventSubscription holds the value of the event_subscription edge. + EventSubscription *EventSubscription `json:"event_subscription,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [1]bool + loadedTypes [2]bool } // APISubscriptionOrErr returns the APISubscription value or an error if the edge @@ -81,6 +84,17 @@ func (e ApprovalEdges) APISubscriptionOrErr() (*ApiSubscription, error) { return nil, &NotLoadedError{edge: "api_subscription"} } +// EventSubscriptionOrErr returns the EventSubscription value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e ApprovalEdges) EventSubscriptionOrErr() (*EventSubscription, error) { + if e.EventSubscription != nil { + return e.EventSubscription, nil + } else if e.loadedTypes[1] { + return nil, &NotFoundError{label: eventsubscription.Label} + } + return nil, &NotLoadedError{edge: "event_subscription"} +} + // scanValues returns the types for scanning values from sql.Rows. func (*Approval) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) @@ -96,6 +110,8 @@ func (*Approval) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullTime) case approval.ForeignKeys[0]: // api_subscription_approval values[i] = new(sql.NullInt64) + case approval.ForeignKeys[1]: // event_subscription_approval + values[i] = new(sql.NullInt64) default: values[i] = new(sql.UnknownType) } @@ -225,6 +241,13 @@ func (_m *Approval) assignValues(columns []string, values []any) error { _m.api_subscription_approval = new(int) *_m.api_subscription_approval = int(value.Int64) } + case approval.ForeignKeys[1]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field event_subscription_approval", value) + } else if value.Valid { + _m.event_subscription_approval = new(int) + *_m.event_subscription_approval = int(value.Int64) + } default: _m.selectValues.Set(columns[i], values[i]) } @@ -243,6 +266,11 @@ func (_m *Approval) QueryAPISubscription() *ApiSubscriptionQuery { return NewApprovalClient(_m.config).QueryAPISubscription(_m) } +// QueryEventSubscription queries the "event_subscription" edge of the Approval entity. +func (_m *Approval) QueryEventSubscription() *EventSubscriptionQuery { + return NewApprovalClient(_m.config).QueryEventSubscription(_m) +} + // Update returns a builder for updating this Approval. // Note that you need to call Approval.Unwrap() before calling this method if this Approval // was returned from a transaction, and the transaction was committed or rolled back. diff --git a/controlplane-api/ent/approval/approval.go b/controlplane-api/ent/approval/approval.go index fa1b3e5d6..c5ce026bb 100644 --- a/controlplane-api/ent/approval/approval.go +++ b/controlplane-api/ent/approval/approval.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package approval @@ -55,6 +54,8 @@ const ( FieldState = "state" // EdgeAPISubscription holds the string denoting the api_subscription edge name in mutations. EdgeAPISubscription = "api_subscription" + // EdgeEventSubscription holds the string denoting the event_subscription edge name in mutations. + EdgeEventSubscription = "event_subscription" // Table holds the table name of the approval in the database. Table = "approvals" // APISubscriptionTable is the table that holds the api_subscription relation/edge. @@ -64,6 +65,13 @@ const ( APISubscriptionInverseTable = "api_subscriptions" // APISubscriptionColumn is the table column denoting the api_subscription relation/edge. APISubscriptionColumn = "api_subscription_approval" + // EventSubscriptionTable is the table that holds the event_subscription relation/edge. + EventSubscriptionTable = "approvals" + // EventSubscriptionInverseTable is the table name for the EventSubscription entity. + // It exists in this package in order to avoid circular dependency with the "eventsubscription" package. + EventSubscriptionInverseTable = "event_subscriptions" + // EventSubscriptionColumn is the table column denoting the event_subscription relation/edge. + EventSubscriptionColumn = "event_subscription_approval" ) // Columns holds all SQL columns for approval fields. @@ -90,6 +98,7 @@ var Columns = []string{ // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "api_subscription_approval", + "event_subscription_approval", } // ValidColumn reports if the column name is valid (part of the table columns). @@ -284,6 +293,13 @@ func ByAPISubscriptionField(field string, opts ...sql.OrderTermOption) OrderOpti sqlgraph.OrderByNeighborTerms(s, newAPISubscriptionStep(), sql.OrderByField(field, opts...)) } } + +// ByEventSubscriptionField orders the results by event_subscription field. +func ByEventSubscriptionField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newEventSubscriptionStep(), sql.OrderByField(field, opts...)) + } +} func newAPISubscriptionStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), @@ -291,6 +307,13 @@ func newAPISubscriptionStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.O2O, true, APISubscriptionTable, APISubscriptionColumn), ) } +func newEventSubscriptionStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(EventSubscriptionInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2O, true, EventSubscriptionTable, EventSubscriptionColumn), + ) +} // MarshalGQL implements graphql.Marshaler interface. func (e StatusPhase) MarshalGQL(w io.Writer) { diff --git a/controlplane-api/ent/approval/where.go b/controlplane-api/ent/approval/where.go index dbffd7e4a..1f62bb928 100644 --- a/controlplane-api/ent/approval/where.go +++ b/controlplane-api/ent/approval/where.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package approval @@ -692,6 +691,29 @@ func HasAPISubscriptionWith(preds ...predicate.ApiSubscription) predicate.Approv }) } +// HasEventSubscription applies the HasEdge predicate on the "event_subscription" edge. +func HasEventSubscription() predicate.Approval { + return predicate.Approval(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2O, true, EventSubscriptionTable, EventSubscriptionColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasEventSubscriptionWith applies the HasEdge predicate on the "event_subscription" edge with a given conditions (other predicates). +func HasEventSubscriptionWith(preds ...predicate.EventSubscription) predicate.Approval { + return predicate.Approval(func(s *sql.Selector) { + step := newEventSubscriptionStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.Approval) predicate.Approval { return predicate.Approval(sql.AndPredicates(predicates...)) diff --git a/controlplane-api/ent/approval_create.go b/controlplane-api/ent/approval_create.go index 01623de15..e8fdaa85b 100644 --- a/controlplane-api/ent/approval_create.go +++ b/controlplane-api/ent/approval_create.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -17,6 +16,7 @@ import ( "entgo.io/ent/schema/field" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approval" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/pkg/model" ) @@ -193,6 +193,25 @@ func (_c *ApprovalCreate) SetAPISubscription(v *ApiSubscription) *ApprovalCreate return _c.SetAPISubscriptionID(v.ID) } +// SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID. +func (_c *ApprovalCreate) SetEventSubscriptionID(id int) *ApprovalCreate { + _c.mutation.SetEventSubscriptionID(id) + return _c +} + +// SetNillableEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID if the given value is not nil. +func (_c *ApprovalCreate) SetNillableEventSubscriptionID(id *int) *ApprovalCreate { + if id != nil { + _c = _c.SetEventSubscriptionID(*id) + } + return _c +} + +// SetEventSubscription sets the "event_subscription" edge to the EventSubscription entity. +func (_c *ApprovalCreate) SetEventSubscription(v *EventSubscription) *ApprovalCreate { + return _c.SetEventSubscriptionID(v.ID) +} + // Mutation returns the ApprovalMutation object of the builder. func (_c *ApprovalCreate) Mutation() *ApprovalMutation { return _c.mutation @@ -433,6 +452,23 @@ func (_c *ApprovalCreate) createSpec() (*Approval, *sqlgraph.CreateSpec) { _node.api_subscription_approval = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } + if nodes := _c.mutation.EventSubscriptionIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: true, + Table: approval.EventSubscriptionTable, + Columns: []string{approval.EventSubscriptionColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.event_subscription_approval = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } return _node, _spec } diff --git a/controlplane-api/ent/approval_delete.go b/controlplane-api/ent/approval_delete.go index e354b5624..3426d500b 100644 --- a/controlplane-api/ent/approval_delete.go +++ b/controlplane-api/ent/approval_delete.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/approval_query.go b/controlplane-api/ent/approval_query.go index 09b8035e3..035ce7edb 100644 --- a/controlplane-api/ent/approval_query.go +++ b/controlplane-api/ent/approval_query.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -18,20 +17,22 @@ import ( "entgo.io/ent/schema/field" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approval" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/predicate" ) // ApprovalQuery is the builder for querying Approval entities. type ApprovalQuery struct { config - ctx *QueryContext - order []approval.OrderOption - inters []Interceptor - predicates []predicate.Approval - withAPISubscription *ApiSubscriptionQuery - withFKs bool - modifiers []func(*sql.Selector) - loadTotal []func(context.Context, []*Approval) error + ctx *QueryContext + order []approval.OrderOption + inters []Interceptor + predicates []predicate.Approval + withAPISubscription *ApiSubscriptionQuery + withEventSubscription *EventSubscriptionQuery + withFKs bool + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*Approval) error // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -90,6 +91,28 @@ func (_q *ApprovalQuery) QueryAPISubscription() *ApiSubscriptionQuery { return query } +// QueryEventSubscription chains the current query on the "event_subscription" edge. +func (_q *ApprovalQuery) QueryEventSubscription() *EventSubscriptionQuery { + query := (&EventSubscriptionClient{config: _q.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + selector := _q.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(approval.Table, approval.FieldID, selector), + sqlgraph.To(eventsubscription.Table, eventsubscription.FieldID), + sqlgraph.Edge(sqlgraph.O2O, true, approval.EventSubscriptionTable, approval.EventSubscriptionColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + // First returns the first Approval entity from the query. // Returns a *NotFoundError when no Approval was found. func (_q *ApprovalQuery) First(ctx context.Context) (*Approval, error) { @@ -277,12 +300,13 @@ func (_q *ApprovalQuery) Clone() *ApprovalQuery { return nil } return &ApprovalQuery{ - config: _q.config, - ctx: _q.ctx.Clone(), - order: append([]approval.OrderOption{}, _q.order...), - inters: append([]Interceptor{}, _q.inters...), - predicates: append([]predicate.Approval{}, _q.predicates...), - withAPISubscription: _q.withAPISubscription.Clone(), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]approval.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Approval{}, _q.predicates...), + withAPISubscription: _q.withAPISubscription.Clone(), + withEventSubscription: _q.withEventSubscription.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, @@ -300,6 +324,17 @@ func (_q *ApprovalQuery) WithAPISubscription(opts ...func(*ApiSubscriptionQuery) return _q } +// WithEventSubscription tells the query-builder to eager-load the nodes that are connected to +// the "event_subscription" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *ApprovalQuery) WithEventSubscription(opts ...func(*EventSubscriptionQuery)) *ApprovalQuery { + query := (&EventSubscriptionClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withEventSubscription = query + return _q +} + // GroupBy is used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // @@ -385,11 +420,12 @@ func (_q *ApprovalQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*App nodes = []*Approval{} withFKs = _q.withFKs _spec = _q.querySpec() - loadedTypes = [1]bool{ + loadedTypes = [2]bool{ _q.withAPISubscription != nil, + _q.withEventSubscription != nil, } ) - if _q.withAPISubscription != nil { + if _q.withAPISubscription != nil || _q.withEventSubscription != nil { withFKs = true } if withFKs { @@ -422,6 +458,12 @@ func (_q *ApprovalQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*App return nil, err } } + if query := _q.withEventSubscription; query != nil { + if err := _q.loadEventSubscription(ctx, query, nodes, nil, + func(n *Approval, e *EventSubscription) { n.Edges.EventSubscription = e }); err != nil { + return nil, err + } + } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err @@ -462,6 +504,38 @@ func (_q *ApprovalQuery) loadAPISubscription(ctx context.Context, query *ApiSubs } return nil } +func (_q *ApprovalQuery) loadEventSubscription(ctx context.Context, query *EventSubscriptionQuery, nodes []*Approval, init func(*Approval), assign func(*Approval, *EventSubscription)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*Approval) + for i := range nodes { + if nodes[i].event_subscription_approval == nil { + continue + } + fk := *nodes[i].event_subscription_approval + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(eventsubscription.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "event_subscription_approval" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} func (_q *ApprovalQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() diff --git a/controlplane-api/ent/approval_update.go b/controlplane-api/ent/approval_update.go index 73ce521f8..9e6d823cd 100644 --- a/controlplane-api/ent/approval_update.go +++ b/controlplane-api/ent/approval_update.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -18,6 +17,7 @@ import ( "entgo.io/ent/schema/field" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approval" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/predicate" "github.com/telekom/controlplane/controlplane-api/pkg/model" ) @@ -262,6 +262,25 @@ func (_u *ApprovalUpdate) SetAPISubscription(v *ApiSubscription) *ApprovalUpdate return _u.SetAPISubscriptionID(v.ID) } +// SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID. +func (_u *ApprovalUpdate) SetEventSubscriptionID(id int) *ApprovalUpdate { + _u.mutation.SetEventSubscriptionID(id) + return _u +} + +// SetNillableEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID if the given value is not nil. +func (_u *ApprovalUpdate) SetNillableEventSubscriptionID(id *int) *ApprovalUpdate { + if id != nil { + _u = _u.SetEventSubscriptionID(*id) + } + return _u +} + +// SetEventSubscription sets the "event_subscription" edge to the EventSubscription entity. +func (_u *ApprovalUpdate) SetEventSubscription(v *EventSubscription) *ApprovalUpdate { + return _u.SetEventSubscriptionID(v.ID) +} + // Mutation returns the ApprovalMutation object of the builder. func (_u *ApprovalUpdate) Mutation() *ApprovalMutation { return _u.mutation @@ -273,6 +292,12 @@ func (_u *ApprovalUpdate) ClearAPISubscription() *ApprovalUpdate { return _u } +// ClearEventSubscription clears the "event_subscription" edge to the EventSubscription entity. +func (_u *ApprovalUpdate) ClearEventSubscription() *ApprovalUpdate { + _u.mutation.ClearEventSubscription() + return _u +} + // Save executes the query and returns the number of nodes affected by the update operation. func (_u *ApprovalUpdate) Save(ctx context.Context) (int, error) { if err := _u.defaults(); err != nil { @@ -460,6 +485,35 @@ func (_u *ApprovalUpdate) sqlSave(ctx context.Context) (_node int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.EventSubscriptionCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: true, + Table: approval.EventSubscriptionTable, + Columns: []string{approval.EventSubscriptionColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.EventSubscriptionIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: true, + Table: approval.EventSubscriptionTable, + Columns: []string{approval.EventSubscriptionColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{approval.Label} @@ -707,6 +761,25 @@ func (_u *ApprovalUpdateOne) SetAPISubscription(v *ApiSubscription) *ApprovalUpd return _u.SetAPISubscriptionID(v.ID) } +// SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID. +func (_u *ApprovalUpdateOne) SetEventSubscriptionID(id int) *ApprovalUpdateOne { + _u.mutation.SetEventSubscriptionID(id) + return _u +} + +// SetNillableEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID if the given value is not nil. +func (_u *ApprovalUpdateOne) SetNillableEventSubscriptionID(id *int) *ApprovalUpdateOne { + if id != nil { + _u = _u.SetEventSubscriptionID(*id) + } + return _u +} + +// SetEventSubscription sets the "event_subscription" edge to the EventSubscription entity. +func (_u *ApprovalUpdateOne) SetEventSubscription(v *EventSubscription) *ApprovalUpdateOne { + return _u.SetEventSubscriptionID(v.ID) +} + // Mutation returns the ApprovalMutation object of the builder. func (_u *ApprovalUpdateOne) Mutation() *ApprovalMutation { return _u.mutation @@ -718,6 +791,12 @@ func (_u *ApprovalUpdateOne) ClearAPISubscription() *ApprovalUpdateOne { return _u } +// ClearEventSubscription clears the "event_subscription" edge to the EventSubscription entity. +func (_u *ApprovalUpdateOne) ClearEventSubscription() *ApprovalUpdateOne { + _u.mutation.ClearEventSubscription() + return _u +} + // Where appends a list predicates to the ApprovalUpdate builder. func (_u *ApprovalUpdateOne) Where(ps ...predicate.Approval) *ApprovalUpdateOne { _u.mutation.Where(ps...) @@ -935,6 +1014,35 @@ func (_u *ApprovalUpdateOne) sqlSave(ctx context.Context) (_node *Approval, err } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.EventSubscriptionCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: true, + Table: approval.EventSubscriptionTable, + Columns: []string{approval.EventSubscriptionColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.EventSubscriptionIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: true, + Table: approval.EventSubscriptionTable, + Columns: []string{approval.EventSubscriptionColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } _node = &Approval{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/controlplane-api/ent/approvalrequest.go b/controlplane-api/ent/approvalrequest.go index 67dbb116c..be13fb9b8 100644 --- a/controlplane-api/ent/approvalrequest.go +++ b/controlplane-api/ent/approvalrequest.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -16,6 +15,7 @@ import ( "entgo.io/ent/dialect/sql" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/pkg/model" ) @@ -56,18 +56,21 @@ type ApprovalRequest struct { State approvalrequest.State `json:"state,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ApprovalRequestQuery when eager-loading is set. - Edges ApprovalRequestEdges `json:"edges"` - api_subscription_approval_requests *int - selectValues sql.SelectValues + Edges ApprovalRequestEdges `json:"edges"` + api_subscription_approval_requests *int + event_subscription_approval_requests *int + selectValues sql.SelectValues } // ApprovalRequestEdges holds the relations/edges for other nodes in the graph. type ApprovalRequestEdges struct { // APISubscription holds the value of the api_subscription edge. APISubscription *ApiSubscription `json:"api_subscription,omitempty"` + // EventSubscription holds the value of the event_subscription edge. + EventSubscription *EventSubscription `json:"event_subscription,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [1]bool + loadedTypes [2]bool } // APISubscriptionOrErr returns the APISubscription value or an error if the edge @@ -81,6 +84,17 @@ func (e ApprovalRequestEdges) APISubscriptionOrErr() (*ApiSubscription, error) { return nil, &NotLoadedError{edge: "api_subscription"} } +// EventSubscriptionOrErr returns the EventSubscription value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e ApprovalRequestEdges) EventSubscriptionOrErr() (*EventSubscription, error) { + if e.EventSubscription != nil { + return e.EventSubscription, nil + } else if e.loadedTypes[1] { + return nil, &NotFoundError{label: eventsubscription.Label} + } + return nil, &NotLoadedError{edge: "event_subscription"} +} + // scanValues returns the types for scanning values from sql.Rows. func (*ApprovalRequest) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) @@ -96,6 +110,8 @@ func (*ApprovalRequest) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullTime) case approvalrequest.ForeignKeys[0]: // api_subscription_approval_requests values[i] = new(sql.NullInt64) + case approvalrequest.ForeignKeys[1]: // event_subscription_approval_requests + values[i] = new(sql.NullInt64) default: values[i] = new(sql.UnknownType) } @@ -225,6 +241,13 @@ func (_m *ApprovalRequest) assignValues(columns []string, values []any) error { _m.api_subscription_approval_requests = new(int) *_m.api_subscription_approval_requests = int(value.Int64) } + case approvalrequest.ForeignKeys[1]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field event_subscription_approval_requests", value) + } else if value.Valid { + _m.event_subscription_approval_requests = new(int) + *_m.event_subscription_approval_requests = int(value.Int64) + } default: _m.selectValues.Set(columns[i], values[i]) } @@ -243,6 +266,11 @@ func (_m *ApprovalRequest) QueryAPISubscription() *ApiSubscriptionQuery { return NewApprovalRequestClient(_m.config).QueryAPISubscription(_m) } +// QueryEventSubscription queries the "event_subscription" edge of the ApprovalRequest entity. +func (_m *ApprovalRequest) QueryEventSubscription() *EventSubscriptionQuery { + return NewApprovalRequestClient(_m.config).QueryEventSubscription(_m) +} + // Update returns a builder for updating this ApprovalRequest. // Note that you need to call ApprovalRequest.Unwrap() before calling this method if this ApprovalRequest // was returned from a transaction, and the transaction was committed or rolled back. diff --git a/controlplane-api/ent/approvalrequest/approvalrequest.go b/controlplane-api/ent/approvalrequest/approvalrequest.go index c1bf4f311..742227bfd 100644 --- a/controlplane-api/ent/approvalrequest/approvalrequest.go +++ b/controlplane-api/ent/approvalrequest/approvalrequest.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package approvalrequest @@ -55,6 +54,8 @@ const ( FieldState = "state" // EdgeAPISubscription holds the string denoting the api_subscription edge name in mutations. EdgeAPISubscription = "api_subscription" + // EdgeEventSubscription holds the string denoting the event_subscription edge name in mutations. + EdgeEventSubscription = "event_subscription" // Table holds the table name of the approvalrequest in the database. Table = "approval_requests" // APISubscriptionTable is the table that holds the api_subscription relation/edge. @@ -64,6 +65,13 @@ const ( APISubscriptionInverseTable = "api_subscriptions" // APISubscriptionColumn is the table column denoting the api_subscription relation/edge. APISubscriptionColumn = "api_subscription_approval_requests" + // EventSubscriptionTable is the table that holds the event_subscription relation/edge. + EventSubscriptionTable = "approval_requests" + // EventSubscriptionInverseTable is the table name for the EventSubscription entity. + // It exists in this package in order to avoid circular dependency with the "eventsubscription" package. + EventSubscriptionInverseTable = "event_subscriptions" + // EventSubscriptionColumn is the table column denoting the event_subscription relation/edge. + EventSubscriptionColumn = "event_subscription_approval_requests" ) // Columns holds all SQL columns for approvalrequest fields. @@ -90,6 +98,7 @@ var Columns = []string{ // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "api_subscription_approval_requests", + "event_subscription_approval_requests", } // ValidColumn reports if the column name is valid (part of the table columns). @@ -282,6 +291,13 @@ func ByAPISubscriptionField(field string, opts ...sql.OrderTermOption) OrderOpti sqlgraph.OrderByNeighborTerms(s, newAPISubscriptionStep(), sql.OrderByField(field, opts...)) } } + +// ByEventSubscriptionField orders the results by event_subscription field. +func ByEventSubscriptionField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newEventSubscriptionStep(), sql.OrderByField(field, opts...)) + } +} func newAPISubscriptionStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), @@ -289,6 +305,13 @@ func newAPISubscriptionStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.M2O, true, APISubscriptionTable, APISubscriptionColumn), ) } +func newEventSubscriptionStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(EventSubscriptionInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, EventSubscriptionTable, EventSubscriptionColumn), + ) +} // MarshalGQL implements graphql.Marshaler interface. func (e StatusPhase) MarshalGQL(w io.Writer) { diff --git a/controlplane-api/ent/approvalrequest/where.go b/controlplane-api/ent/approvalrequest/where.go index b2eba9835..c5838707c 100644 --- a/controlplane-api/ent/approvalrequest/where.go +++ b/controlplane-api/ent/approvalrequest/where.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package approvalrequest @@ -692,6 +691,29 @@ func HasAPISubscriptionWith(preds ...predicate.ApiSubscription) predicate.Approv }) } +// HasEventSubscription applies the HasEdge predicate on the "event_subscription" edge. +func HasEventSubscription() predicate.ApprovalRequest { + return predicate.ApprovalRequest(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, EventSubscriptionTable, EventSubscriptionColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasEventSubscriptionWith applies the HasEdge predicate on the "event_subscription" edge with a given conditions (other predicates). +func HasEventSubscriptionWith(preds ...predicate.EventSubscription) predicate.ApprovalRequest { + return predicate.ApprovalRequest(func(s *sql.Selector) { + step := newEventSubscriptionStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.ApprovalRequest) predicate.ApprovalRequest { return predicate.ApprovalRequest(sql.AndPredicates(predicates...)) diff --git a/controlplane-api/ent/approvalrequest_create.go b/controlplane-api/ent/approvalrequest_create.go index 978f51115..7675903e3 100644 --- a/controlplane-api/ent/approvalrequest_create.go +++ b/controlplane-api/ent/approvalrequest_create.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -17,6 +16,7 @@ import ( "entgo.io/ent/schema/field" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/pkg/model" ) @@ -193,6 +193,25 @@ func (_c *ApprovalRequestCreate) SetAPISubscription(v *ApiSubscription) *Approva return _c.SetAPISubscriptionID(v.ID) } +// SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID. +func (_c *ApprovalRequestCreate) SetEventSubscriptionID(id int) *ApprovalRequestCreate { + _c.mutation.SetEventSubscriptionID(id) + return _c +} + +// SetNillableEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID if the given value is not nil. +func (_c *ApprovalRequestCreate) SetNillableEventSubscriptionID(id *int) *ApprovalRequestCreate { + if id != nil { + _c = _c.SetEventSubscriptionID(*id) + } + return _c +} + +// SetEventSubscription sets the "event_subscription" edge to the EventSubscription entity. +func (_c *ApprovalRequestCreate) SetEventSubscription(v *EventSubscription) *ApprovalRequestCreate { + return _c.SetEventSubscriptionID(v.ID) +} + // Mutation returns the ApprovalRequestMutation object of the builder. func (_c *ApprovalRequestCreate) Mutation() *ApprovalRequestMutation { return _c.mutation @@ -433,6 +452,23 @@ func (_c *ApprovalRequestCreate) createSpec() (*ApprovalRequest, *sqlgraph.Creat _node.api_subscription_approval_requests = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } + if nodes := _c.mutation.EventSubscriptionIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: approvalrequest.EventSubscriptionTable, + Columns: []string{approvalrequest.EventSubscriptionColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.event_subscription_approval_requests = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } return _node, _spec } diff --git a/controlplane-api/ent/approvalrequest_delete.go b/controlplane-api/ent/approvalrequest_delete.go index c633cd837..f5fcb2d73 100644 --- a/controlplane-api/ent/approvalrequest_delete.go +++ b/controlplane-api/ent/approvalrequest_delete.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/approvalrequest_query.go b/controlplane-api/ent/approvalrequest_query.go index 09c50d36e..6742999f9 100644 --- a/controlplane-api/ent/approvalrequest_query.go +++ b/controlplane-api/ent/approvalrequest_query.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -18,20 +17,22 @@ import ( "entgo.io/ent/schema/field" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/predicate" ) // ApprovalRequestQuery is the builder for querying ApprovalRequest entities. type ApprovalRequestQuery struct { config - ctx *QueryContext - order []approvalrequest.OrderOption - inters []Interceptor - predicates []predicate.ApprovalRequest - withAPISubscription *ApiSubscriptionQuery - withFKs bool - modifiers []func(*sql.Selector) - loadTotal []func(context.Context, []*ApprovalRequest) error + ctx *QueryContext + order []approvalrequest.OrderOption + inters []Interceptor + predicates []predicate.ApprovalRequest + withAPISubscription *ApiSubscriptionQuery + withEventSubscription *EventSubscriptionQuery + withFKs bool + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*ApprovalRequest) error // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -90,6 +91,28 @@ func (_q *ApprovalRequestQuery) QueryAPISubscription() *ApiSubscriptionQuery { return query } +// QueryEventSubscription chains the current query on the "event_subscription" edge. +func (_q *ApprovalRequestQuery) QueryEventSubscription() *EventSubscriptionQuery { + query := (&EventSubscriptionClient{config: _q.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + selector := _q.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(approvalrequest.Table, approvalrequest.FieldID, selector), + sqlgraph.To(eventsubscription.Table, eventsubscription.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, approvalrequest.EventSubscriptionTable, approvalrequest.EventSubscriptionColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + // First returns the first ApprovalRequest entity from the query. // Returns a *NotFoundError when no ApprovalRequest was found. func (_q *ApprovalRequestQuery) First(ctx context.Context) (*ApprovalRequest, error) { @@ -277,12 +300,13 @@ func (_q *ApprovalRequestQuery) Clone() *ApprovalRequestQuery { return nil } return &ApprovalRequestQuery{ - config: _q.config, - ctx: _q.ctx.Clone(), - order: append([]approvalrequest.OrderOption{}, _q.order...), - inters: append([]Interceptor{}, _q.inters...), - predicates: append([]predicate.ApprovalRequest{}, _q.predicates...), - withAPISubscription: _q.withAPISubscription.Clone(), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]approvalrequest.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.ApprovalRequest{}, _q.predicates...), + withAPISubscription: _q.withAPISubscription.Clone(), + withEventSubscription: _q.withEventSubscription.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, @@ -300,6 +324,17 @@ func (_q *ApprovalRequestQuery) WithAPISubscription(opts ...func(*ApiSubscriptio return _q } +// WithEventSubscription tells the query-builder to eager-load the nodes that are connected to +// the "event_subscription" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *ApprovalRequestQuery) WithEventSubscription(opts ...func(*EventSubscriptionQuery)) *ApprovalRequestQuery { + query := (&EventSubscriptionClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withEventSubscription = query + return _q +} + // GroupBy is used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // @@ -385,11 +420,12 @@ func (_q *ApprovalRequestQuery) sqlAll(ctx context.Context, hooks ...queryHook) nodes = []*ApprovalRequest{} withFKs = _q.withFKs _spec = _q.querySpec() - loadedTypes = [1]bool{ + loadedTypes = [2]bool{ _q.withAPISubscription != nil, + _q.withEventSubscription != nil, } ) - if _q.withAPISubscription != nil { + if _q.withAPISubscription != nil || _q.withEventSubscription != nil { withFKs = true } if withFKs { @@ -422,6 +458,12 @@ func (_q *ApprovalRequestQuery) sqlAll(ctx context.Context, hooks ...queryHook) return nil, err } } + if query := _q.withEventSubscription; query != nil { + if err := _q.loadEventSubscription(ctx, query, nodes, nil, + func(n *ApprovalRequest, e *EventSubscription) { n.Edges.EventSubscription = e }); err != nil { + return nil, err + } + } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err @@ -462,6 +504,38 @@ func (_q *ApprovalRequestQuery) loadAPISubscription(ctx context.Context, query * } return nil } +func (_q *ApprovalRequestQuery) loadEventSubscription(ctx context.Context, query *EventSubscriptionQuery, nodes []*ApprovalRequest, init func(*ApprovalRequest), assign func(*ApprovalRequest, *EventSubscription)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*ApprovalRequest) + for i := range nodes { + if nodes[i].event_subscription_approval_requests == nil { + continue + } + fk := *nodes[i].event_subscription_approval_requests + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(eventsubscription.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "event_subscription_approval_requests" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} func (_q *ApprovalRequestQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() diff --git a/controlplane-api/ent/approvalrequest_update.go b/controlplane-api/ent/approvalrequest_update.go index 4024f5071..cd3631b80 100644 --- a/controlplane-api/ent/approvalrequest_update.go +++ b/controlplane-api/ent/approvalrequest_update.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -18,6 +17,7 @@ import ( "entgo.io/ent/schema/field" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/predicate" "github.com/telekom/controlplane/controlplane-api/pkg/model" ) @@ -262,6 +262,25 @@ func (_u *ApprovalRequestUpdate) SetAPISubscription(v *ApiSubscription) *Approva return _u.SetAPISubscriptionID(v.ID) } +// SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID. +func (_u *ApprovalRequestUpdate) SetEventSubscriptionID(id int) *ApprovalRequestUpdate { + _u.mutation.SetEventSubscriptionID(id) + return _u +} + +// SetNillableEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID if the given value is not nil. +func (_u *ApprovalRequestUpdate) SetNillableEventSubscriptionID(id *int) *ApprovalRequestUpdate { + if id != nil { + _u = _u.SetEventSubscriptionID(*id) + } + return _u +} + +// SetEventSubscription sets the "event_subscription" edge to the EventSubscription entity. +func (_u *ApprovalRequestUpdate) SetEventSubscription(v *EventSubscription) *ApprovalRequestUpdate { + return _u.SetEventSubscriptionID(v.ID) +} + // Mutation returns the ApprovalRequestMutation object of the builder. func (_u *ApprovalRequestUpdate) Mutation() *ApprovalRequestMutation { return _u.mutation @@ -273,6 +292,12 @@ func (_u *ApprovalRequestUpdate) ClearAPISubscription() *ApprovalRequestUpdate { return _u } +// ClearEventSubscription clears the "event_subscription" edge to the EventSubscription entity. +func (_u *ApprovalRequestUpdate) ClearEventSubscription() *ApprovalRequestUpdate { + _u.mutation.ClearEventSubscription() + return _u +} + // Save executes the query and returns the number of nodes affected by the update operation. func (_u *ApprovalRequestUpdate) Save(ctx context.Context) (int, error) { if err := _u.defaults(); err != nil { @@ -460,6 +485,35 @@ func (_u *ApprovalRequestUpdate) sqlSave(ctx context.Context) (_node int, err er } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.EventSubscriptionCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: approvalrequest.EventSubscriptionTable, + Columns: []string{approvalrequest.EventSubscriptionColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.EventSubscriptionIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: approvalrequest.EventSubscriptionTable, + Columns: []string{approvalrequest.EventSubscriptionColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{approvalrequest.Label} @@ -707,6 +761,25 @@ func (_u *ApprovalRequestUpdateOne) SetAPISubscription(v *ApiSubscription) *Appr return _u.SetAPISubscriptionID(v.ID) } +// SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID. +func (_u *ApprovalRequestUpdateOne) SetEventSubscriptionID(id int) *ApprovalRequestUpdateOne { + _u.mutation.SetEventSubscriptionID(id) + return _u +} + +// SetNillableEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by ID if the given value is not nil. +func (_u *ApprovalRequestUpdateOne) SetNillableEventSubscriptionID(id *int) *ApprovalRequestUpdateOne { + if id != nil { + _u = _u.SetEventSubscriptionID(*id) + } + return _u +} + +// SetEventSubscription sets the "event_subscription" edge to the EventSubscription entity. +func (_u *ApprovalRequestUpdateOne) SetEventSubscription(v *EventSubscription) *ApprovalRequestUpdateOne { + return _u.SetEventSubscriptionID(v.ID) +} + // Mutation returns the ApprovalRequestMutation object of the builder. func (_u *ApprovalRequestUpdateOne) Mutation() *ApprovalRequestMutation { return _u.mutation @@ -718,6 +791,12 @@ func (_u *ApprovalRequestUpdateOne) ClearAPISubscription() *ApprovalRequestUpdat return _u } +// ClearEventSubscription clears the "event_subscription" edge to the EventSubscription entity. +func (_u *ApprovalRequestUpdateOne) ClearEventSubscription() *ApprovalRequestUpdateOne { + _u.mutation.ClearEventSubscription() + return _u +} + // Where appends a list predicates to the ApprovalRequestUpdate builder. func (_u *ApprovalRequestUpdateOne) Where(ps ...predicate.ApprovalRequest) *ApprovalRequestUpdateOne { _u.mutation.Where(ps...) @@ -935,6 +1014,35 @@ func (_u *ApprovalRequestUpdateOne) sqlSave(ctx context.Context) (_node *Approva } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.EventSubscriptionCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: approvalrequest.EventSubscriptionTable, + Columns: []string{approvalrequest.EventSubscriptionColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.EventSubscriptionIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: approvalrequest.EventSubscriptionTable, + Columns: []string{approvalrequest.EventSubscriptionColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } _node = &ApprovalRequest{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/controlplane-api/ent/client.go b/controlplane-api/ent/client.go index 0359a50a6..d5559cd8b 100644 --- a/controlplane-api/ent/client.go +++ b/controlplane-api/ent/client.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -24,6 +23,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" @@ -45,6 +46,10 @@ type Client struct { Approval *ApprovalClient // ApprovalRequest is the client for interacting with the ApprovalRequest builders. ApprovalRequest *ApprovalRequestClient + // EventExposure is the client for interacting with the EventExposure builders. + EventExposure *EventExposureClient + // EventSubscription is the client for interacting with the EventSubscription builders. + EventSubscription *EventSubscriptionClient // Group is the client for interacting with the Group builders. Group *GroupClient // Member is the client for interacting with the Member builders. @@ -71,6 +76,8 @@ func (c *Client) init() { c.Application = NewApplicationClient(c.config) c.Approval = NewApprovalClient(c.config) c.ApprovalRequest = NewApprovalRequestClient(c.config) + c.EventExposure = NewEventExposureClient(c.config) + c.EventSubscription = NewEventSubscriptionClient(c.config) c.Group = NewGroupClient(c.config) c.Member = NewMemberClient(c.config) c.Team = NewTeamClient(c.config) @@ -165,17 +172,19 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { cfg := c.config cfg.driver = tx return &Tx{ - ctx: ctx, - config: cfg, - ApiExposure: NewApiExposureClient(cfg), - ApiSubscription: NewApiSubscriptionClient(cfg), - Application: NewApplicationClient(cfg), - Approval: NewApprovalClient(cfg), - ApprovalRequest: NewApprovalRequestClient(cfg), - Group: NewGroupClient(cfg), - Member: NewMemberClient(cfg), - Team: NewTeamClient(cfg), - Zone: NewZoneClient(cfg), + ctx: ctx, + config: cfg, + ApiExposure: NewApiExposureClient(cfg), + ApiSubscription: NewApiSubscriptionClient(cfg), + Application: NewApplicationClient(cfg), + Approval: NewApprovalClient(cfg), + ApprovalRequest: NewApprovalRequestClient(cfg), + EventExposure: NewEventExposureClient(cfg), + EventSubscription: NewEventSubscriptionClient(cfg), + Group: NewGroupClient(cfg), + Member: NewMemberClient(cfg), + Team: NewTeamClient(cfg), + Zone: NewZoneClient(cfg), }, nil } @@ -193,17 +202,19 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) cfg := c.config cfg.driver = &txDriver{tx: tx, drv: c.driver} return &Tx{ - ctx: ctx, - config: cfg, - ApiExposure: NewApiExposureClient(cfg), - ApiSubscription: NewApiSubscriptionClient(cfg), - Application: NewApplicationClient(cfg), - Approval: NewApprovalClient(cfg), - ApprovalRequest: NewApprovalRequestClient(cfg), - Group: NewGroupClient(cfg), - Member: NewMemberClient(cfg), - Team: NewTeamClient(cfg), - Zone: NewZoneClient(cfg), + ctx: ctx, + config: cfg, + ApiExposure: NewApiExposureClient(cfg), + ApiSubscription: NewApiSubscriptionClient(cfg), + Application: NewApplicationClient(cfg), + Approval: NewApprovalClient(cfg), + ApprovalRequest: NewApprovalRequestClient(cfg), + EventExposure: NewEventExposureClient(cfg), + EventSubscription: NewEventSubscriptionClient(cfg), + Group: NewGroupClient(cfg), + Member: NewMemberClient(cfg), + Team: NewTeamClient(cfg), + Zone: NewZoneClient(cfg), }, nil } @@ -234,7 +245,7 @@ func (c *Client) Close() error { func (c *Client) Use(hooks ...Hook) { for _, n := range []interface{ Use(...Hook) }{ c.ApiExposure, c.ApiSubscription, c.Application, c.Approval, c.ApprovalRequest, - c.Group, c.Member, c.Team, c.Zone, + c.EventExposure, c.EventSubscription, c.Group, c.Member, c.Team, c.Zone, } { n.Use(hooks...) } @@ -245,7 +256,7 @@ func (c *Client) Use(hooks ...Hook) { func (c *Client) Intercept(interceptors ...Interceptor) { for _, n := range []interface{ Intercept(...Interceptor) }{ c.ApiExposure, c.ApiSubscription, c.Application, c.Approval, c.ApprovalRequest, - c.Group, c.Member, c.Team, c.Zone, + c.EventExposure, c.EventSubscription, c.Group, c.Member, c.Team, c.Zone, } { n.Intercept(interceptors...) } @@ -264,6 +275,10 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { return c.Approval.mutate(ctx, m) case *ApprovalRequestMutation: return c.ApprovalRequest.mutate(ctx, m) + case *EventExposureMutation: + return c.EventExposure.mutate(ctx, m) + case *EventSubscriptionMutation: + return c.EventSubscription.mutate(ctx, m) case *GroupMutation: return c.Group.mutate(ctx, m) case *MemberMutation: @@ -829,6 +844,38 @@ func (c *ApplicationClient) QuerySubscribedApis(_m *Application) *ApiSubscriptio return query } +// QueryExposedEvents queries the exposed_events edge of a Application. +func (c *ApplicationClient) QueryExposedEvents(_m *Application) *EventExposureQuery { + query := (&EventExposureClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(application.Table, application.FieldID, id), + sqlgraph.To(eventexposure.Table, eventexposure.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, application.ExposedEventsTable, application.ExposedEventsColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QuerySubscribedEvents queries the subscribed_events edge of a Application. +func (c *ApplicationClient) QuerySubscribedEvents(_m *Application) *EventSubscriptionQuery { + query := (&EventSubscriptionClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(application.Table, application.FieldID, id), + sqlgraph.To(eventsubscription.Table, eventsubscription.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, application.SubscribedEventsTable, application.SubscribedEventsColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *ApplicationClient) Hooks() []Hook { hooks := c.hooks.Application @@ -979,6 +1026,22 @@ func (c *ApprovalClient) QueryAPISubscription(_m *Approval) *ApiSubscriptionQuer return query } +// QueryEventSubscription queries the event_subscription edge of a Approval. +func (c *ApprovalClient) QueryEventSubscription(_m *Approval) *EventSubscriptionQuery { + query := (&EventSubscriptionClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(approval.Table, approval.FieldID, id), + sqlgraph.To(eventsubscription.Table, eventsubscription.FieldID), + sqlgraph.Edge(sqlgraph.O2O, true, approval.EventSubscriptionTable, approval.EventSubscriptionColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *ApprovalClient) Hooks() []Hook { hooks := c.hooks.Approval @@ -1129,6 +1192,22 @@ func (c *ApprovalRequestClient) QueryAPISubscription(_m *ApprovalRequest) *ApiSu return query } +// QueryEventSubscription queries the event_subscription edge of a ApprovalRequest. +func (c *ApprovalRequestClient) QueryEventSubscription(_m *ApprovalRequest) *EventSubscriptionQuery { + query := (&EventSubscriptionClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(approvalrequest.Table, approvalrequest.FieldID, id), + sqlgraph.To(eventsubscription.Table, eventsubscription.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, approvalrequest.EventSubscriptionTable, approvalrequest.EventSubscriptionColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *ApprovalRequestClient) Hooks() []Hook { hooks := c.hooks.ApprovalRequest @@ -1155,6 +1234,370 @@ func (c *ApprovalRequestClient) mutate(ctx context.Context, m *ApprovalRequestMu } } +// EventExposureClient is a client for the EventExposure schema. +type EventExposureClient struct { + config +} + +// NewEventExposureClient returns a client for the EventExposure from the given config. +func NewEventExposureClient(c config) *EventExposureClient { + return &EventExposureClient{config: c} +} + +// Use adds a list of mutation hooks to the hooks stack. +// A call to `Use(f, g, h)` equals to `eventexposure.Hooks(f(g(h())))`. +func (c *EventExposureClient) Use(hooks ...Hook) { + c.hooks.EventExposure = append(c.hooks.EventExposure, hooks...) +} + +// Intercept adds a list of query interceptors to the interceptors stack. +// A call to `Intercept(f, g, h)` equals to `eventexposure.Intercept(f(g(h())))`. +func (c *EventExposureClient) Intercept(interceptors ...Interceptor) { + c.inters.EventExposure = append(c.inters.EventExposure, interceptors...) +} + +// Create returns a builder for creating a EventExposure entity. +func (c *EventExposureClient) Create() *EventExposureCreate { + mutation := newEventExposureMutation(c.config, OpCreate) + return &EventExposureCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// CreateBulk returns a builder for creating a bulk of EventExposure entities. +func (c *EventExposureClient) CreateBulk(builders ...*EventExposureCreate) *EventExposureCreateBulk { + return &EventExposureCreateBulk{config: c.config, builders: builders} +} + +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *EventExposureClient) MapCreateBulk(slice any, setFunc func(*EventExposureCreate, int)) *EventExposureCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &EventExposureCreateBulk{err: fmt.Errorf("calling to EventExposureClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*EventExposureCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &EventExposureCreateBulk{config: c.config, builders: builders} +} + +// Update returns an update builder for EventExposure. +func (c *EventExposureClient) Update() *EventExposureUpdate { + mutation := newEventExposureMutation(c.config, OpUpdate) + return &EventExposureUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOne returns an update builder for the given entity. +func (c *EventExposureClient) UpdateOne(_m *EventExposure) *EventExposureUpdateOne { + mutation := newEventExposureMutation(c.config, OpUpdateOne, withEventExposure(_m)) + return &EventExposureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOneID returns an update builder for the given id. +func (c *EventExposureClient) UpdateOneID(id int) *EventExposureUpdateOne { + mutation := newEventExposureMutation(c.config, OpUpdateOne, withEventExposureID(id)) + return &EventExposureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// Delete returns a delete builder for EventExposure. +func (c *EventExposureClient) Delete() *EventExposureDelete { + mutation := newEventExposureMutation(c.config, OpDelete) + return &EventExposureDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// DeleteOne returns a builder for deleting the given entity. +func (c *EventExposureClient) DeleteOne(_m *EventExposure) *EventExposureDeleteOne { + return c.DeleteOneID(_m.ID) +} + +// DeleteOneID returns a builder for deleting the given entity by its id. +func (c *EventExposureClient) DeleteOneID(id int) *EventExposureDeleteOne { + builder := c.Delete().Where(eventexposure.ID(id)) + builder.mutation.id = &id + builder.mutation.op = OpDeleteOne + return &EventExposureDeleteOne{builder} +} + +// Query returns a query builder for EventExposure. +func (c *EventExposureClient) Query() *EventExposureQuery { + return &EventExposureQuery{ + config: c.config, + ctx: &QueryContext{Type: TypeEventExposure}, + inters: c.Interceptors(), + } +} + +// Get returns a EventExposure entity by its id. +func (c *EventExposureClient) Get(ctx context.Context, id int) (*EventExposure, error) { + return c.Query().Where(eventexposure.ID(id)).Only(ctx) +} + +// GetX is like Get, but panics if an error occurs. +func (c *EventExposureClient) GetX(ctx context.Context, id int) *EventExposure { + obj, err := c.Get(ctx, id) + if err != nil { + panic(err) + } + return obj +} + +// QueryOwner queries the owner edge of a EventExposure. +func (c *EventExposureClient) QueryOwner(_m *EventExposure) *ApplicationQuery { + query := (&ApplicationClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(eventexposure.Table, eventexposure.FieldID, id), + sqlgraph.To(application.Table, application.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, eventexposure.OwnerTable, eventexposure.OwnerColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QuerySubscriptions queries the subscriptions edge of a EventExposure. +func (c *EventExposureClient) QuerySubscriptions(_m *EventExposure) *EventSubscriptionQuery { + query := (&EventSubscriptionClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(eventexposure.Table, eventexposure.FieldID, id), + sqlgraph.To(eventsubscription.Table, eventsubscription.FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, eventexposure.SubscriptionsTable, eventexposure.SubscriptionsColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// Hooks returns the client hooks. +func (c *EventExposureClient) Hooks() []Hook { + hooks := c.hooks.EventExposure + return append(hooks[:len(hooks):len(hooks)], eventexposure.Hooks[:]...) +} + +// Interceptors returns the client interceptors. +func (c *EventExposureClient) Interceptors() []Interceptor { + return c.inters.EventExposure +} + +func (c *EventExposureClient) mutate(ctx context.Context, m *EventExposureMutation) (Value, error) { + switch m.Op() { + case OpCreate: + return (&EventExposureCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdate: + return (&EventExposureUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdateOne: + return (&EventExposureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpDelete, OpDeleteOne: + return (&EventExposureDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) + default: + return nil, fmt.Errorf("ent: unknown EventExposure mutation op: %q", m.Op()) + } +} + +// EventSubscriptionClient is a client for the EventSubscription schema. +type EventSubscriptionClient struct { + config +} + +// NewEventSubscriptionClient returns a client for the EventSubscription from the given config. +func NewEventSubscriptionClient(c config) *EventSubscriptionClient { + return &EventSubscriptionClient{config: c} +} + +// Use adds a list of mutation hooks to the hooks stack. +// A call to `Use(f, g, h)` equals to `eventsubscription.Hooks(f(g(h())))`. +func (c *EventSubscriptionClient) Use(hooks ...Hook) { + c.hooks.EventSubscription = append(c.hooks.EventSubscription, hooks...) +} + +// Intercept adds a list of query interceptors to the interceptors stack. +// A call to `Intercept(f, g, h)` equals to `eventsubscription.Intercept(f(g(h())))`. +func (c *EventSubscriptionClient) Intercept(interceptors ...Interceptor) { + c.inters.EventSubscription = append(c.inters.EventSubscription, interceptors...) +} + +// Create returns a builder for creating a EventSubscription entity. +func (c *EventSubscriptionClient) Create() *EventSubscriptionCreate { + mutation := newEventSubscriptionMutation(c.config, OpCreate) + return &EventSubscriptionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// CreateBulk returns a builder for creating a bulk of EventSubscription entities. +func (c *EventSubscriptionClient) CreateBulk(builders ...*EventSubscriptionCreate) *EventSubscriptionCreateBulk { + return &EventSubscriptionCreateBulk{config: c.config, builders: builders} +} + +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *EventSubscriptionClient) MapCreateBulk(slice any, setFunc func(*EventSubscriptionCreate, int)) *EventSubscriptionCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &EventSubscriptionCreateBulk{err: fmt.Errorf("calling to EventSubscriptionClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*EventSubscriptionCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &EventSubscriptionCreateBulk{config: c.config, builders: builders} +} + +// Update returns an update builder for EventSubscription. +func (c *EventSubscriptionClient) Update() *EventSubscriptionUpdate { + mutation := newEventSubscriptionMutation(c.config, OpUpdate) + return &EventSubscriptionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOne returns an update builder for the given entity. +func (c *EventSubscriptionClient) UpdateOne(_m *EventSubscription) *EventSubscriptionUpdateOne { + mutation := newEventSubscriptionMutation(c.config, OpUpdateOne, withEventSubscription(_m)) + return &EventSubscriptionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOneID returns an update builder for the given id. +func (c *EventSubscriptionClient) UpdateOneID(id int) *EventSubscriptionUpdateOne { + mutation := newEventSubscriptionMutation(c.config, OpUpdateOne, withEventSubscriptionID(id)) + return &EventSubscriptionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// Delete returns a delete builder for EventSubscription. +func (c *EventSubscriptionClient) Delete() *EventSubscriptionDelete { + mutation := newEventSubscriptionMutation(c.config, OpDelete) + return &EventSubscriptionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// DeleteOne returns a builder for deleting the given entity. +func (c *EventSubscriptionClient) DeleteOne(_m *EventSubscription) *EventSubscriptionDeleteOne { + return c.DeleteOneID(_m.ID) +} + +// DeleteOneID returns a builder for deleting the given entity by its id. +func (c *EventSubscriptionClient) DeleteOneID(id int) *EventSubscriptionDeleteOne { + builder := c.Delete().Where(eventsubscription.ID(id)) + builder.mutation.id = &id + builder.mutation.op = OpDeleteOne + return &EventSubscriptionDeleteOne{builder} +} + +// Query returns a query builder for EventSubscription. +func (c *EventSubscriptionClient) Query() *EventSubscriptionQuery { + return &EventSubscriptionQuery{ + config: c.config, + ctx: &QueryContext{Type: TypeEventSubscription}, + inters: c.Interceptors(), + } +} + +// Get returns a EventSubscription entity by its id. +func (c *EventSubscriptionClient) Get(ctx context.Context, id int) (*EventSubscription, error) { + return c.Query().Where(eventsubscription.ID(id)).Only(ctx) +} + +// GetX is like Get, but panics if an error occurs. +func (c *EventSubscriptionClient) GetX(ctx context.Context, id int) *EventSubscription { + obj, err := c.Get(ctx, id) + if err != nil { + panic(err) + } + return obj +} + +// QueryOwner queries the owner edge of a EventSubscription. +func (c *EventSubscriptionClient) QueryOwner(_m *EventSubscription) *ApplicationQuery { + query := (&ApplicationClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(eventsubscription.Table, eventsubscription.FieldID, id), + sqlgraph.To(application.Table, application.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, eventsubscription.OwnerTable, eventsubscription.OwnerColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryTarget queries the target edge of a EventSubscription. +func (c *EventSubscriptionClient) QueryTarget(_m *EventSubscription) *EventExposureQuery { + query := (&EventExposureClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(eventsubscription.Table, eventsubscription.FieldID, id), + sqlgraph.To(eventexposure.Table, eventexposure.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, eventsubscription.TargetTable, eventsubscription.TargetColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryApproval queries the approval edge of a EventSubscription. +func (c *EventSubscriptionClient) QueryApproval(_m *EventSubscription) *ApprovalQuery { + query := (&ApprovalClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(eventsubscription.Table, eventsubscription.FieldID, id), + sqlgraph.To(approval.Table, approval.FieldID), + sqlgraph.Edge(sqlgraph.O2O, false, eventsubscription.ApprovalTable, eventsubscription.ApprovalColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryApprovalRequests queries the approval_requests edge of a EventSubscription. +func (c *EventSubscriptionClient) QueryApprovalRequests(_m *EventSubscription) *ApprovalRequestQuery { + query := (&ApprovalRequestClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(eventsubscription.Table, eventsubscription.FieldID, id), + sqlgraph.To(approvalrequest.Table, approvalrequest.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, eventsubscription.ApprovalRequestsTable, eventsubscription.ApprovalRequestsColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// Hooks returns the client hooks. +func (c *EventSubscriptionClient) Hooks() []Hook { + hooks := c.hooks.EventSubscription + return append(hooks[:len(hooks):len(hooks)], eventsubscription.Hooks[:]...) +} + +// Interceptors returns the client interceptors. +func (c *EventSubscriptionClient) Interceptors() []Interceptor { + return c.inters.EventSubscription +} + +func (c *EventSubscriptionClient) mutate(ctx context.Context, m *EventSubscriptionMutation) (Value, error) { + switch m.Op() { + case OpCreate: + return (&EventSubscriptionCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdate: + return (&EventSubscriptionUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdateOne: + return (&EventSubscriptionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpDelete, OpDeleteOne: + return (&EventSubscriptionDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) + default: + return nil, fmt.Errorf("ent: unknown EventSubscription mutation op: %q", m.Op()) + } +} + // GroupClient is a client for the Group schema. type GroupClient struct { config @@ -1790,11 +2233,11 @@ func (c *ZoneClient) mutate(ctx context.Context, m *ZoneMutation) (Value, error) // hooks and interceptors per client, for fast access. type ( hooks struct { - ApiExposure, ApiSubscription, Application, Approval, ApprovalRequest, Group, - Member, Team, Zone []ent.Hook + ApiExposure, ApiSubscription, Application, Approval, ApprovalRequest, + EventExposure, EventSubscription, Group, Member, Team, Zone []ent.Hook } inters struct { - ApiExposure, ApiSubscription, Application, Approval, ApprovalRequest, Group, - Member, Team, Zone []ent.Interceptor + ApiExposure, ApiSubscription, Application, Approval, ApprovalRequest, + EventExposure, EventSubscription, Group, Member, Team, Zone []ent.Interceptor } ) diff --git a/controlplane-api/ent/ent.go b/controlplane-api/ent/ent.go index 50468148f..9253fdc6a 100644 --- a/controlplane-api/ent/ent.go +++ b/controlplane-api/ent/ent.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -21,6 +20,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" @@ -85,15 +86,17 @@ var ( func checkColumn(t, c string) error { initCheck.Do(func() { columnCheck = sql.NewColumnCheck(map[string]func(string) bool{ - apiexposure.Table: apiexposure.ValidColumn, - apisubscription.Table: apisubscription.ValidColumn, - application.Table: application.ValidColumn, - approval.Table: approval.ValidColumn, - approvalrequest.Table: approvalrequest.ValidColumn, - group.Table: group.ValidColumn, - member.Table: member.ValidColumn, - team.Table: team.ValidColumn, - zone.Table: zone.ValidColumn, + apiexposure.Table: apiexposure.ValidColumn, + apisubscription.Table: apisubscription.ValidColumn, + application.Table: application.ValidColumn, + approval.Table: approval.ValidColumn, + approvalrequest.Table: approvalrequest.ValidColumn, + eventexposure.Table: eventexposure.ValidColumn, + eventsubscription.Table: eventsubscription.ValidColumn, + group.Table: group.ValidColumn, + member.Table: member.ValidColumn, + team.Table: team.ValidColumn, + zone.Table: zone.ValidColumn, }) }) return columnCheck(t, c) diff --git a/controlplane-api/ent/enttest/enttest.go b/controlplane-api/ent/enttest/enttest.go index 4838888d0..8e41aed66 100644 --- a/controlplane-api/ent/enttest/enttest.go +++ b/controlplane-api/ent/enttest/enttest.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package enttest diff --git a/controlplane-api/ent/eventexposure.go b/controlplane-api/ent/eventexposure.go new file mode 100644 index 000000000..f59435632 --- /dev/null +++ b/controlplane-api/ent/eventexposure.go @@ -0,0 +1,311 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "encoding/json" + "fmt" + "strings" + "time" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/pkg/model" +) + +// EventExposure is the model entity for the EventExposure schema. +type EventExposure struct { + config `json:"-"` + // ID of the ent. + ID int `json:"id,omitempty"` + // CreatedAt holds the value of the "created_at" field. + CreatedAt time.Time `json:"created_at,omitempty"` + // LastModifiedAt holds the value of the "last_modified_at" field. + LastModifiedAt time.Time `json:"last_modified_at,omitempty"` + // StatusPhase holds the value of the "status_phase" field. + StatusPhase *eventexposure.StatusPhase `json:"status_phase,omitempty"` + // StatusMessage holds the value of the "status_message" field. + StatusMessage *string `json:"status_message,omitempty"` + // Environment holds the value of the "environment" field. + Environment *string `json:"environment,omitempty"` + // Namespace holds the value of the "namespace" field. + Namespace string `json:"namespace,omitempty"` + // EventType holds the value of the "event_type" field. + EventType string `json:"event_type,omitempty"` + // Visibility holds the value of the "visibility" field. + Visibility eventexposure.Visibility `json:"visibility,omitempty"` + // Active holds the value of the "active" field. + Active *bool `json:"active,omitempty"` + // ApprovalConfig holds the value of the "approval_config" field. + ApprovalConfig model.ApprovalConfig `json:"approval_config,omitempty"` + // Edges holds the relations/edges for other nodes in the graph. + // The values are being populated by the EventExposureQuery when eager-loading is set. + Edges EventExposureEdges `json:"edges"` + application_exposed_events *int + selectValues sql.SelectValues +} + +// EventExposureEdges holds the relations/edges for other nodes in the graph. +type EventExposureEdges struct { + // Owner holds the value of the owner edge. + Owner *Application `json:"owner,omitempty"` + // Subscriptions holds the value of the subscriptions edge. + Subscriptions []*EventSubscription `json:"subscriptions,omitempty"` + // loadedTypes holds the information for reporting if a + // type was loaded (or requested) in eager-loading or not. + loadedTypes [2]bool + // totalCount holds the count of the edges above. + totalCount [1]map[string]int + + namedSubscriptions map[string][]*EventSubscription +} + +// OwnerOrErr returns the Owner value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e EventExposureEdges) OwnerOrErr() (*Application, error) { + if e.Owner != nil { + return e.Owner, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: application.Label} + } + return nil, &NotLoadedError{edge: "owner"} +} + +// SubscriptionsOrErr returns the Subscriptions value or an error if the edge +// was not loaded in eager-loading. +func (e EventExposureEdges) SubscriptionsOrErr() ([]*EventSubscription, error) { + if e.loadedTypes[1] { + return e.Subscriptions, nil + } + return nil, &NotLoadedError{edge: "subscriptions"} +} + +// scanValues returns the types for scanning values from sql.Rows. +func (*EventExposure) scanValues(columns []string) ([]any, error) { + values := make([]any, len(columns)) + for i := range columns { + switch columns[i] { + case eventexposure.FieldApprovalConfig: + values[i] = new([]byte) + case eventexposure.FieldActive: + values[i] = new(sql.NullBool) + case eventexposure.FieldID: + values[i] = new(sql.NullInt64) + case eventexposure.FieldStatusPhase, eventexposure.FieldStatusMessage, eventexposure.FieldEnvironment, eventexposure.FieldNamespace, eventexposure.FieldEventType, eventexposure.FieldVisibility: + values[i] = new(sql.NullString) + case eventexposure.FieldCreatedAt, eventexposure.FieldLastModifiedAt: + values[i] = new(sql.NullTime) + case eventexposure.ForeignKeys[0]: // application_exposed_events + values[i] = new(sql.NullInt64) + default: + values[i] = new(sql.UnknownType) + } + } + return values, nil +} + +// assignValues assigns the values that were returned from sql.Rows (after scanning) +// to the EventExposure fields. +func (_m *EventExposure) assignValues(columns []string, values []any) error { + if m, n := len(values), len(columns); m < n { + return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) + } + for i := range columns { + switch columns[i] { + case eventexposure.FieldID: + value, ok := values[i].(*sql.NullInt64) + if !ok { + return fmt.Errorf("unexpected type %T for field id", value) + } + _m.ID = int(value.Int64) + case eventexposure.FieldCreatedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field created_at", values[i]) + } else if value.Valid { + _m.CreatedAt = value.Time + } + case eventexposure.FieldLastModifiedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field last_modified_at", values[i]) + } else if value.Valid { + _m.LastModifiedAt = value.Time + } + case eventexposure.FieldStatusPhase: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field status_phase", values[i]) + } else if value.Valid { + _m.StatusPhase = new(eventexposure.StatusPhase) + *_m.StatusPhase = eventexposure.StatusPhase(value.String) + } + case eventexposure.FieldStatusMessage: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field status_message", values[i]) + } else if value.Valid { + _m.StatusMessage = new(string) + *_m.StatusMessage = value.String + } + case eventexposure.FieldEnvironment: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field environment", values[i]) + } else if value.Valid { + _m.Environment = new(string) + *_m.Environment = value.String + } + case eventexposure.FieldNamespace: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field namespace", values[i]) + } else if value.Valid { + _m.Namespace = value.String + } + case eventexposure.FieldEventType: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field event_type", values[i]) + } else if value.Valid { + _m.EventType = value.String + } + case eventexposure.FieldVisibility: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field visibility", values[i]) + } else if value.Valid { + _m.Visibility = eventexposure.Visibility(value.String) + } + case eventexposure.FieldActive: + if value, ok := values[i].(*sql.NullBool); !ok { + return fmt.Errorf("unexpected type %T for field active", values[i]) + } else if value.Valid { + _m.Active = new(bool) + *_m.Active = value.Bool + } + case eventexposure.FieldApprovalConfig: + if value, ok := values[i].(*[]byte); !ok { + return fmt.Errorf("unexpected type %T for field approval_config", values[i]) + } else if value != nil && len(*value) > 0 { + if err := json.Unmarshal(*value, &_m.ApprovalConfig); err != nil { + return fmt.Errorf("unmarshal field approval_config: %w", err) + } + } + case eventexposure.ForeignKeys[0]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field application_exposed_events", value) + } else if value.Valid { + _m.application_exposed_events = new(int) + *_m.application_exposed_events = int(value.Int64) + } + default: + _m.selectValues.Set(columns[i], values[i]) + } + } + return nil +} + +// Value returns the ent.Value that was dynamically selected and assigned to the EventExposure. +// This includes values selected through modifiers, order, etc. +func (_m *EventExposure) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) +} + +// QueryOwner queries the "owner" edge of the EventExposure entity. +func (_m *EventExposure) QueryOwner() *ApplicationQuery { + return NewEventExposureClient(_m.config).QueryOwner(_m) +} + +// QuerySubscriptions queries the "subscriptions" edge of the EventExposure entity. +func (_m *EventExposure) QuerySubscriptions() *EventSubscriptionQuery { + return NewEventExposureClient(_m.config).QuerySubscriptions(_m) +} + +// Update returns a builder for updating this EventExposure. +// Note that you need to call EventExposure.Unwrap() before calling this method if this EventExposure +// was returned from a transaction, and the transaction was committed or rolled back. +func (_m *EventExposure) Update() *EventExposureUpdateOne { + return NewEventExposureClient(_m.config).UpdateOne(_m) +} + +// Unwrap unwraps the EventExposure entity that was returned from a transaction after it was closed, +// so that all future queries will be executed through the driver which created the transaction. +func (_m *EventExposure) Unwrap() *EventExposure { + _tx, ok := _m.config.driver.(*txDriver) + if !ok { + panic("ent: EventExposure is not a transactional entity") + } + _m.config.driver = _tx.drv + return _m +} + +// String implements the fmt.Stringer. +func (_m *EventExposure) String() string { + var builder strings.Builder + builder.WriteString("EventExposure(") + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) + builder.WriteString("created_at=") + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) + builder.WriteString(", ") + builder.WriteString("last_modified_at=") + builder.WriteString(_m.LastModifiedAt.Format(time.ANSIC)) + builder.WriteString(", ") + if v := _m.StatusPhase; v != nil { + builder.WriteString("status_phase=") + builder.WriteString(fmt.Sprintf("%v", *v)) + } + builder.WriteString(", ") + if v := _m.StatusMessage; v != nil { + builder.WriteString("status_message=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := _m.Environment; v != nil { + builder.WriteString("environment=") + builder.WriteString(*v) + } + builder.WriteString(", ") + builder.WriteString("namespace=") + builder.WriteString(_m.Namespace) + builder.WriteString(", ") + builder.WriteString("event_type=") + builder.WriteString(_m.EventType) + builder.WriteString(", ") + builder.WriteString("visibility=") + builder.WriteString(fmt.Sprintf("%v", _m.Visibility)) + builder.WriteString(", ") + if v := _m.Active; v != nil { + builder.WriteString("active=") + builder.WriteString(fmt.Sprintf("%v", *v)) + } + builder.WriteString(", ") + builder.WriteString("approval_config=") + builder.WriteString(fmt.Sprintf("%v", _m.ApprovalConfig)) + builder.WriteByte(')') + return builder.String() +} + +// NamedSubscriptions returns the Subscriptions named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *EventExposure) NamedSubscriptions(name string) ([]*EventSubscription, error) { + if _m.Edges.namedSubscriptions == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedSubscriptions[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *EventExposure) appendNamedSubscriptions(name string, edges ...*EventSubscription) { + if _m.Edges.namedSubscriptions == nil { + _m.Edges.namedSubscriptions = make(map[string][]*EventSubscription) + } + if len(edges) == 0 { + _m.Edges.namedSubscriptions[name] = []*EventSubscription{} + } else { + _m.Edges.namedSubscriptions[name] = append(_m.Edges.namedSubscriptions[name], edges...) + } +} + +// EventExposures is a parsable slice of EventExposure. +type EventExposures []*EventExposure diff --git a/controlplane-api/ent/eventexposure/eventexposure.go b/controlplane-api/ent/eventexposure/eventexposure.go new file mode 100644 index 000000000..70f6d6e73 --- /dev/null +++ b/controlplane-api/ent/eventexposure/eventexposure.go @@ -0,0 +1,301 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package eventexposure + +import ( + "fmt" + "io" + "strconv" + "time" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "github.com/telekom/controlplane/controlplane-api/pkg/model" +) + +const ( + // Label holds the string label denoting the eventexposure type in the database. + Label = "event_exposure" + // FieldID holds the string denoting the id field in the database. + FieldID = "id" + // FieldCreatedAt holds the string denoting the created_at field in the database. + FieldCreatedAt = "created_at" + // FieldLastModifiedAt holds the string denoting the last_modified_at field in the database. + FieldLastModifiedAt = "last_modified_at" + // FieldStatusPhase holds the string denoting the status_phase field in the database. + FieldStatusPhase = "status_phase" + // FieldStatusMessage holds the string denoting the status_message field in the database. + FieldStatusMessage = "status_message" + // FieldEnvironment holds the string denoting the environment field in the database. + FieldEnvironment = "environment" + // FieldNamespace holds the string denoting the namespace field in the database. + FieldNamespace = "namespace" + // FieldEventType holds the string denoting the event_type field in the database. + FieldEventType = "event_type" + // FieldVisibility holds the string denoting the visibility field in the database. + FieldVisibility = "visibility" + // FieldActive holds the string denoting the active field in the database. + FieldActive = "active" + // FieldApprovalConfig holds the string denoting the approval_config field in the database. + FieldApprovalConfig = "approval_config" + // EdgeOwner holds the string denoting the owner edge name in mutations. + EdgeOwner = "owner" + // EdgeSubscriptions holds the string denoting the subscriptions edge name in mutations. + EdgeSubscriptions = "subscriptions" + // Table holds the table name of the eventexposure in the database. + Table = "event_exposures" + // OwnerTable is the table that holds the owner relation/edge. + OwnerTable = "event_exposures" + // OwnerInverseTable is the table name for the Application entity. + // It exists in this package in order to avoid circular dependency with the "application" package. + OwnerInverseTable = "applications" + // OwnerColumn is the table column denoting the owner relation/edge. + OwnerColumn = "application_exposed_events" + // SubscriptionsTable is the table that holds the subscriptions relation/edge. + SubscriptionsTable = "event_subscriptions" + // SubscriptionsInverseTable is the table name for the EventSubscription entity. + // It exists in this package in order to avoid circular dependency with the "eventsubscription" package. + SubscriptionsInverseTable = "event_subscriptions" + // SubscriptionsColumn is the table column denoting the subscriptions relation/edge. + SubscriptionsColumn = "event_subscription_target" +) + +// Columns holds all SQL columns for eventexposure fields. +var Columns = []string{ + FieldID, + FieldCreatedAt, + FieldLastModifiedAt, + FieldStatusPhase, + FieldStatusMessage, + FieldEnvironment, + FieldNamespace, + FieldEventType, + FieldVisibility, + FieldActive, + FieldApprovalConfig, +} + +// ForeignKeys holds the SQL foreign-keys that are owned by the "event_exposures" +// table and are not defined as standalone fields in the schema. +var ForeignKeys = []string{ + "application_exposed_events", +} + +// ValidColumn reports if the column name is valid (part of the table columns). +func ValidColumn(column string) bool { + for i := range Columns { + if column == Columns[i] { + return true + } + } + for i := range ForeignKeys { + if column == ForeignKeys[i] { + return true + } + } + return false +} + +// Note that the variables below are initialized by the runtime +// package on the initialization of the application. Therefore, +// it should be imported in the main as follows: +// +// import _ "github.com/telekom/controlplane/controlplane-api/ent/runtime" +var ( + Hooks [1]ent.Hook + Policy ent.Policy + // DefaultCreatedAt holds the default value on creation for the "created_at" field. + DefaultCreatedAt func() time.Time + // DefaultLastModifiedAt holds the default value on creation for the "last_modified_at" field. + DefaultLastModifiedAt func() time.Time + // UpdateDefaultLastModifiedAt holds the default value on update for the "last_modified_at" field. + UpdateDefaultLastModifiedAt func() time.Time + // NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. + NamespaceValidator func(string) error + // EventTypeValidator is a validator for the "event_type" field. It is called by the builders before save. + EventTypeValidator func(string) error + // DefaultActive holds the default value on creation for the "active" field. + DefaultActive bool + // DefaultApprovalConfig holds the default value on creation for the "approval_config" field. + DefaultApprovalConfig model.ApprovalConfig +) + +// StatusPhase defines the type for the "status_phase" enum field. +type StatusPhase string + +// StatusPhase values. +const ( + StatusPhaseReady StatusPhase = "READY" + StatusPhasePending StatusPhase = "PENDING" + StatusPhaseError StatusPhase = "ERROR" + StatusPhaseUnknown StatusPhase = "UNKNOWN" +) + +func (sp StatusPhase) String() string { + return string(sp) +} + +// StatusPhaseValidator is a validator for the "status_phase" field enum values. It is called by the builders before save. +func StatusPhaseValidator(sp StatusPhase) error { + switch sp { + case StatusPhaseReady, StatusPhasePending, StatusPhaseError, StatusPhaseUnknown: + return nil + default: + return fmt.Errorf("eventexposure: invalid enum value for status_phase field: %q", sp) + } +} + +// Visibility defines the type for the "visibility" enum field. +type Visibility string + +// VisibilityEnterprise is the default value of the Visibility enum. +const DefaultVisibility = VisibilityEnterprise + +// Visibility values. +const ( + VisibilityWorld Visibility = "WORLD" + VisibilityZone Visibility = "ZONE" + VisibilityEnterprise Visibility = "ENTERPRISE" +) + +func (v Visibility) String() string { + return string(v) +} + +// VisibilityValidator is a validator for the "visibility" field enum values. It is called by the builders before save. +func VisibilityValidator(v Visibility) error { + switch v { + case VisibilityWorld, VisibilityZone, VisibilityEnterprise: + return nil + default: + return fmt.Errorf("eventexposure: invalid enum value for visibility field: %q", v) + } +} + +// OrderOption defines the ordering options for the EventExposure queries. +type OrderOption func(*sql.Selector) + +// ByID orders the results by the id field. +func ByID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldID, opts...).ToFunc() +} + +// ByCreatedAt orders the results by the created_at field. +func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() +} + +// ByLastModifiedAt orders the results by the last_modified_at field. +func ByLastModifiedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldLastModifiedAt, opts...).ToFunc() +} + +// ByStatusPhase orders the results by the status_phase field. +func ByStatusPhase(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldStatusPhase, opts...).ToFunc() +} + +// ByStatusMessage orders the results by the status_message field. +func ByStatusMessage(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldStatusMessage, opts...).ToFunc() +} + +// ByEnvironment orders the results by the environment field. +func ByEnvironment(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldEnvironment, opts...).ToFunc() +} + +// ByNamespace orders the results by the namespace field. +func ByNamespace(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldNamespace, opts...).ToFunc() +} + +// ByEventType orders the results by the event_type field. +func ByEventType(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldEventType, opts...).ToFunc() +} + +// ByVisibility orders the results by the visibility field. +func ByVisibility(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldVisibility, opts...).ToFunc() +} + +// ByActive orders the results by the active field. +func ByActive(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldActive, opts...).ToFunc() +} + +// ByOwnerField orders the results by owner field. +func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...)) + } +} + +// BySubscriptionsCount orders the results by subscriptions count. +func BySubscriptionsCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newSubscriptionsStep(), opts...) + } +} + +// BySubscriptions orders the results by subscriptions terms. +func BySubscriptions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newSubscriptionsStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} +func newOwnerStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(OwnerInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn), + ) +} +func newSubscriptionsStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(SubscriptionsInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, SubscriptionsTable, SubscriptionsColumn), + ) +} + +// MarshalGQL implements graphql.Marshaler interface. +func (e StatusPhase) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(e.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (e *StatusPhase) UnmarshalGQL(val interface{}) error { + str, ok := val.(string) + if !ok { + return fmt.Errorf("enum %T must be a string", val) + } + *e = StatusPhase(str) + if err := StatusPhaseValidator(*e); err != nil { + return fmt.Errorf("%s is not a valid StatusPhase", str) + } + return nil +} + +// MarshalGQL implements graphql.Marshaler interface. +func (e Visibility) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(e.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (e *Visibility) UnmarshalGQL(val interface{}) error { + str, ok := val.(string) + if !ok { + return fmt.Errorf("enum %T must be a string", val) + } + *e = Visibility(str) + if err := VisibilityValidator(*e); err != nil { + return fmt.Errorf("%s is not a valid Visibility", str) + } + return nil +} diff --git a/controlplane-api/ent/eventexposure/where.go b/controlplane-api/ent/eventexposure/where.go new file mode 100644 index 000000000..8d6263ed7 --- /dev/null +++ b/controlplane-api/ent/eventexposure/where.go @@ -0,0 +1,585 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package eventexposure + +import ( + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" +) + +// ID filters vertices based on their ID field. +func ID(id int) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldID, id)) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id int) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldID, id)) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id int) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNEQ(FieldID, id)) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...int) predicate.EventExposure { + return predicate.EventExposure(sql.FieldIn(FieldID, ids...)) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...int) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotIn(FieldID, ids...)) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id int) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGT(FieldID, id)) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id int) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGTE(FieldID, id)) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id int) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLT(FieldID, id)) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id int) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLTE(FieldID, id)) +} + +// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. +func CreatedAt(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldCreatedAt, v)) +} + +// LastModifiedAt applies equality check predicate on the "last_modified_at" field. It's identical to LastModifiedAtEQ. +func LastModifiedAt(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// StatusMessage applies equality check predicate on the "status_message" field. It's identical to StatusMessageEQ. +func StatusMessage(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldStatusMessage, v)) +} + +// Environment applies equality check predicate on the "environment" field. It's identical to EnvironmentEQ. +func Environment(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldEnvironment, v)) +} + +// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ. +func Namespace(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldNamespace, v)) +} + +// EventType applies equality check predicate on the "event_type" field. It's identical to EventTypeEQ. +func EventType(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldEventType, v)) +} + +// Active applies equality check predicate on the "active" field. It's identical to ActiveEQ. +func Active(v bool) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldActive, v)) +} + +// CreatedAtEQ applies the EQ predicate on the "created_at" field. +func CreatedAtEQ(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldCreatedAt, v)) +} + +// CreatedAtNEQ applies the NEQ predicate on the "created_at" field. +func CreatedAtNEQ(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNEQ(FieldCreatedAt, v)) +} + +// CreatedAtIn applies the In predicate on the "created_at" field. +func CreatedAtIn(vs ...time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldIn(FieldCreatedAt, vs...)) +} + +// CreatedAtNotIn applies the NotIn predicate on the "created_at" field. +func CreatedAtNotIn(vs ...time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotIn(FieldCreatedAt, vs...)) +} + +// CreatedAtGT applies the GT predicate on the "created_at" field. +func CreatedAtGT(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGT(FieldCreatedAt, v)) +} + +// CreatedAtGTE applies the GTE predicate on the "created_at" field. +func CreatedAtGTE(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGTE(FieldCreatedAt, v)) +} + +// CreatedAtLT applies the LT predicate on the "created_at" field. +func CreatedAtLT(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLT(FieldCreatedAt, v)) +} + +// CreatedAtLTE applies the LTE predicate on the "created_at" field. +func CreatedAtLTE(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLTE(FieldCreatedAt, v)) +} + +// LastModifiedAtEQ applies the EQ predicate on the "last_modified_at" field. +func LastModifiedAtEQ(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtNEQ applies the NEQ predicate on the "last_modified_at" field. +func LastModifiedAtNEQ(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtIn applies the In predicate on the "last_modified_at" field. +func LastModifiedAtIn(vs ...time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtNotIn applies the NotIn predicate on the "last_modified_at" field. +func LastModifiedAtNotIn(vs ...time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtGT applies the GT predicate on the "last_modified_at" field. +func LastModifiedAtGT(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtGTE applies the GTE predicate on the "last_modified_at" field. +func LastModifiedAtGTE(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGTE(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLT applies the LT predicate on the "last_modified_at" field. +func LastModifiedAtLT(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLTE applies the LTE predicate on the "last_modified_at" field. +func LastModifiedAtLTE(v time.Time) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLTE(FieldLastModifiedAt, v)) +} + +// StatusPhaseEQ applies the EQ predicate on the "status_phase" field. +func StatusPhaseEQ(v StatusPhase) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldStatusPhase, v)) +} + +// StatusPhaseNEQ applies the NEQ predicate on the "status_phase" field. +func StatusPhaseNEQ(v StatusPhase) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNEQ(FieldStatusPhase, v)) +} + +// StatusPhaseIn applies the In predicate on the "status_phase" field. +func StatusPhaseIn(vs ...StatusPhase) predicate.EventExposure { + return predicate.EventExposure(sql.FieldIn(FieldStatusPhase, vs...)) +} + +// StatusPhaseNotIn applies the NotIn predicate on the "status_phase" field. +func StatusPhaseNotIn(vs ...StatusPhase) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotIn(FieldStatusPhase, vs...)) +} + +// StatusPhaseIsNil applies the IsNil predicate on the "status_phase" field. +func StatusPhaseIsNil() predicate.EventExposure { + return predicate.EventExposure(sql.FieldIsNull(FieldStatusPhase)) +} + +// StatusPhaseNotNil applies the NotNil predicate on the "status_phase" field. +func StatusPhaseNotNil() predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotNull(FieldStatusPhase)) +} + +// StatusMessageEQ applies the EQ predicate on the "status_message" field. +func StatusMessageEQ(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldStatusMessage, v)) +} + +// StatusMessageNEQ applies the NEQ predicate on the "status_message" field. +func StatusMessageNEQ(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNEQ(FieldStatusMessage, v)) +} + +// StatusMessageIn applies the In predicate on the "status_message" field. +func StatusMessageIn(vs ...string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldIn(FieldStatusMessage, vs...)) +} + +// StatusMessageNotIn applies the NotIn predicate on the "status_message" field. +func StatusMessageNotIn(vs ...string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotIn(FieldStatusMessage, vs...)) +} + +// StatusMessageGT applies the GT predicate on the "status_message" field. +func StatusMessageGT(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGT(FieldStatusMessage, v)) +} + +// StatusMessageGTE applies the GTE predicate on the "status_message" field. +func StatusMessageGTE(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGTE(FieldStatusMessage, v)) +} + +// StatusMessageLT applies the LT predicate on the "status_message" field. +func StatusMessageLT(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLT(FieldStatusMessage, v)) +} + +// StatusMessageLTE applies the LTE predicate on the "status_message" field. +func StatusMessageLTE(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLTE(FieldStatusMessage, v)) +} + +// StatusMessageContains applies the Contains predicate on the "status_message" field. +func StatusMessageContains(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldContains(FieldStatusMessage, v)) +} + +// StatusMessageHasPrefix applies the HasPrefix predicate on the "status_message" field. +func StatusMessageHasPrefix(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldHasPrefix(FieldStatusMessage, v)) +} + +// StatusMessageHasSuffix applies the HasSuffix predicate on the "status_message" field. +func StatusMessageHasSuffix(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldHasSuffix(FieldStatusMessage, v)) +} + +// StatusMessageIsNil applies the IsNil predicate on the "status_message" field. +func StatusMessageIsNil() predicate.EventExposure { + return predicate.EventExposure(sql.FieldIsNull(FieldStatusMessage)) +} + +// StatusMessageNotNil applies the NotNil predicate on the "status_message" field. +func StatusMessageNotNil() predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotNull(FieldStatusMessage)) +} + +// StatusMessageEqualFold applies the EqualFold predicate on the "status_message" field. +func StatusMessageEqualFold(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEqualFold(FieldStatusMessage, v)) +} + +// StatusMessageContainsFold applies the ContainsFold predicate on the "status_message" field. +func StatusMessageContainsFold(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldContainsFold(FieldStatusMessage, v)) +} + +// EnvironmentEQ applies the EQ predicate on the "environment" field. +func EnvironmentEQ(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldEnvironment, v)) +} + +// EnvironmentNEQ applies the NEQ predicate on the "environment" field. +func EnvironmentNEQ(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNEQ(FieldEnvironment, v)) +} + +// EnvironmentIn applies the In predicate on the "environment" field. +func EnvironmentIn(vs ...string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldIn(FieldEnvironment, vs...)) +} + +// EnvironmentNotIn applies the NotIn predicate on the "environment" field. +func EnvironmentNotIn(vs ...string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotIn(FieldEnvironment, vs...)) +} + +// EnvironmentGT applies the GT predicate on the "environment" field. +func EnvironmentGT(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGT(FieldEnvironment, v)) +} + +// EnvironmentGTE applies the GTE predicate on the "environment" field. +func EnvironmentGTE(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGTE(FieldEnvironment, v)) +} + +// EnvironmentLT applies the LT predicate on the "environment" field. +func EnvironmentLT(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLT(FieldEnvironment, v)) +} + +// EnvironmentLTE applies the LTE predicate on the "environment" field. +func EnvironmentLTE(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLTE(FieldEnvironment, v)) +} + +// EnvironmentContains applies the Contains predicate on the "environment" field. +func EnvironmentContains(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldContains(FieldEnvironment, v)) +} + +// EnvironmentHasPrefix applies the HasPrefix predicate on the "environment" field. +func EnvironmentHasPrefix(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldHasPrefix(FieldEnvironment, v)) +} + +// EnvironmentHasSuffix applies the HasSuffix predicate on the "environment" field. +func EnvironmentHasSuffix(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldHasSuffix(FieldEnvironment, v)) +} + +// EnvironmentIsNil applies the IsNil predicate on the "environment" field. +func EnvironmentIsNil() predicate.EventExposure { + return predicate.EventExposure(sql.FieldIsNull(FieldEnvironment)) +} + +// EnvironmentNotNil applies the NotNil predicate on the "environment" field. +func EnvironmentNotNil() predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotNull(FieldEnvironment)) +} + +// EnvironmentEqualFold applies the EqualFold predicate on the "environment" field. +func EnvironmentEqualFold(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEqualFold(FieldEnvironment, v)) +} + +// EnvironmentContainsFold applies the ContainsFold predicate on the "environment" field. +func EnvironmentContainsFold(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldContainsFold(FieldEnvironment, v)) +} + +// NamespaceEQ applies the EQ predicate on the "namespace" field. +func NamespaceEQ(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldNamespace, v)) +} + +// NamespaceNEQ applies the NEQ predicate on the "namespace" field. +func NamespaceNEQ(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNEQ(FieldNamespace, v)) +} + +// NamespaceIn applies the In predicate on the "namespace" field. +func NamespaceIn(vs ...string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldIn(FieldNamespace, vs...)) +} + +// NamespaceNotIn applies the NotIn predicate on the "namespace" field. +func NamespaceNotIn(vs ...string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotIn(FieldNamespace, vs...)) +} + +// NamespaceGT applies the GT predicate on the "namespace" field. +func NamespaceGT(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGT(FieldNamespace, v)) +} + +// NamespaceGTE applies the GTE predicate on the "namespace" field. +func NamespaceGTE(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGTE(FieldNamespace, v)) +} + +// NamespaceLT applies the LT predicate on the "namespace" field. +func NamespaceLT(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLT(FieldNamespace, v)) +} + +// NamespaceLTE applies the LTE predicate on the "namespace" field. +func NamespaceLTE(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLTE(FieldNamespace, v)) +} + +// NamespaceContains applies the Contains predicate on the "namespace" field. +func NamespaceContains(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldContains(FieldNamespace, v)) +} + +// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field. +func NamespaceHasPrefix(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldHasPrefix(FieldNamespace, v)) +} + +// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field. +func NamespaceHasSuffix(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldHasSuffix(FieldNamespace, v)) +} + +// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field. +func NamespaceEqualFold(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEqualFold(FieldNamespace, v)) +} + +// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field. +func NamespaceContainsFold(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldContainsFold(FieldNamespace, v)) +} + +// EventTypeEQ applies the EQ predicate on the "event_type" field. +func EventTypeEQ(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldEventType, v)) +} + +// EventTypeNEQ applies the NEQ predicate on the "event_type" field. +func EventTypeNEQ(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNEQ(FieldEventType, v)) +} + +// EventTypeIn applies the In predicate on the "event_type" field. +func EventTypeIn(vs ...string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldIn(FieldEventType, vs...)) +} + +// EventTypeNotIn applies the NotIn predicate on the "event_type" field. +func EventTypeNotIn(vs ...string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotIn(FieldEventType, vs...)) +} + +// EventTypeGT applies the GT predicate on the "event_type" field. +func EventTypeGT(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGT(FieldEventType, v)) +} + +// EventTypeGTE applies the GTE predicate on the "event_type" field. +func EventTypeGTE(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldGTE(FieldEventType, v)) +} + +// EventTypeLT applies the LT predicate on the "event_type" field. +func EventTypeLT(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLT(FieldEventType, v)) +} + +// EventTypeLTE applies the LTE predicate on the "event_type" field. +func EventTypeLTE(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldLTE(FieldEventType, v)) +} + +// EventTypeContains applies the Contains predicate on the "event_type" field. +func EventTypeContains(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldContains(FieldEventType, v)) +} + +// EventTypeHasPrefix applies the HasPrefix predicate on the "event_type" field. +func EventTypeHasPrefix(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldHasPrefix(FieldEventType, v)) +} + +// EventTypeHasSuffix applies the HasSuffix predicate on the "event_type" field. +func EventTypeHasSuffix(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldHasSuffix(FieldEventType, v)) +} + +// EventTypeEqualFold applies the EqualFold predicate on the "event_type" field. +func EventTypeEqualFold(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEqualFold(FieldEventType, v)) +} + +// EventTypeContainsFold applies the ContainsFold predicate on the "event_type" field. +func EventTypeContainsFold(v string) predicate.EventExposure { + return predicate.EventExposure(sql.FieldContainsFold(FieldEventType, v)) +} + +// VisibilityEQ applies the EQ predicate on the "visibility" field. +func VisibilityEQ(v Visibility) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldVisibility, v)) +} + +// VisibilityNEQ applies the NEQ predicate on the "visibility" field. +func VisibilityNEQ(v Visibility) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNEQ(FieldVisibility, v)) +} + +// VisibilityIn applies the In predicate on the "visibility" field. +func VisibilityIn(vs ...Visibility) predicate.EventExposure { + return predicate.EventExposure(sql.FieldIn(FieldVisibility, vs...)) +} + +// VisibilityNotIn applies the NotIn predicate on the "visibility" field. +func VisibilityNotIn(vs ...Visibility) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotIn(FieldVisibility, vs...)) +} + +// ActiveEQ applies the EQ predicate on the "active" field. +func ActiveEQ(v bool) predicate.EventExposure { + return predicate.EventExposure(sql.FieldEQ(FieldActive, v)) +} + +// ActiveNEQ applies the NEQ predicate on the "active" field. +func ActiveNEQ(v bool) predicate.EventExposure { + return predicate.EventExposure(sql.FieldNEQ(FieldActive, v)) +} + +// ActiveIsNil applies the IsNil predicate on the "active" field. +func ActiveIsNil() predicate.EventExposure { + return predicate.EventExposure(sql.FieldIsNull(FieldActive)) +} + +// ActiveNotNil applies the NotNil predicate on the "active" field. +func ActiveNotNil() predicate.EventExposure { + return predicate.EventExposure(sql.FieldNotNull(FieldActive)) +} + +// HasOwner applies the HasEdge predicate on the "owner" edge. +func HasOwner() predicate.EventExposure { + return predicate.EventExposure(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates). +func HasOwnerWith(preds ...predicate.Application) predicate.EventExposure { + return predicate.EventExposure(func(s *sql.Selector) { + step := newOwnerStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasSubscriptions applies the HasEdge predicate on the "subscriptions" edge. +func HasSubscriptions() predicate.EventExposure { + return predicate.EventExposure(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, SubscriptionsTable, SubscriptionsColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasSubscriptionsWith applies the HasEdge predicate on the "subscriptions" edge with a given conditions (other predicates). +func HasSubscriptionsWith(preds ...predicate.EventSubscription) predicate.EventExposure { + return predicate.EventExposure(func(s *sql.Selector) { + step := newSubscriptionsStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// And groups predicates with the AND operator between them. +func And(predicates ...predicate.EventExposure) predicate.EventExposure { + return predicate.EventExposure(sql.AndPredicates(predicates...)) +} + +// Or groups predicates with the OR operator between them. +func Or(predicates ...predicate.EventExposure) predicate.EventExposure { + return predicate.EventExposure(sql.OrPredicates(predicates...)) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.EventExposure) predicate.EventExposure { + return predicate.EventExposure(sql.NotPredicates(p)) +} diff --git a/controlplane-api/ent/eventexposure_create.go b/controlplane-api/ent/eventexposure_create.go new file mode 100644 index 000000000..0d3315e09 --- /dev/null +++ b/controlplane-api/ent/eventexposure_create.go @@ -0,0 +1,1159 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "fmt" + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" + "github.com/telekom/controlplane/controlplane-api/pkg/model" +) + +// EventExposureCreate is the builder for creating a EventExposure entity. +type EventExposureCreate struct { + config + mutation *EventExposureMutation + hooks []Hook + conflict []sql.ConflictOption +} + +// SetCreatedAt sets the "created_at" field. +func (_c *EventExposureCreate) SetCreatedAt(v time.Time) *EventExposureCreate { + _c.mutation.SetCreatedAt(v) + return _c +} + +// SetNillableCreatedAt sets the "created_at" field if the given value is not nil. +func (_c *EventExposureCreate) SetNillableCreatedAt(v *time.Time) *EventExposureCreate { + if v != nil { + _c.SetCreatedAt(*v) + } + return _c +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_c *EventExposureCreate) SetLastModifiedAt(v time.Time) *EventExposureCreate { + _c.mutation.SetLastModifiedAt(v) + return _c +} + +// SetNillableLastModifiedAt sets the "last_modified_at" field if the given value is not nil. +func (_c *EventExposureCreate) SetNillableLastModifiedAt(v *time.Time) *EventExposureCreate { + if v != nil { + _c.SetLastModifiedAt(*v) + } + return _c +} + +// SetStatusPhase sets the "status_phase" field. +func (_c *EventExposureCreate) SetStatusPhase(v eventexposure.StatusPhase) *EventExposureCreate { + _c.mutation.SetStatusPhase(v) + return _c +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_c *EventExposureCreate) SetNillableStatusPhase(v *eventexposure.StatusPhase) *EventExposureCreate { + if v != nil { + _c.SetStatusPhase(*v) + } + return _c +} + +// SetStatusMessage sets the "status_message" field. +func (_c *EventExposureCreate) SetStatusMessage(v string) *EventExposureCreate { + _c.mutation.SetStatusMessage(v) + return _c +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_c *EventExposureCreate) SetNillableStatusMessage(v *string) *EventExposureCreate { + if v != nil { + _c.SetStatusMessage(*v) + } + return _c +} + +// SetEnvironment sets the "environment" field. +func (_c *EventExposureCreate) SetEnvironment(v string) *EventExposureCreate { + _c.mutation.SetEnvironment(v) + return _c +} + +// SetNillableEnvironment sets the "environment" field if the given value is not nil. +func (_c *EventExposureCreate) SetNillableEnvironment(v *string) *EventExposureCreate { + if v != nil { + _c.SetEnvironment(*v) + } + return _c +} + +// SetNamespace sets the "namespace" field. +func (_c *EventExposureCreate) SetNamespace(v string) *EventExposureCreate { + _c.mutation.SetNamespace(v) + return _c +} + +// SetEventType sets the "event_type" field. +func (_c *EventExposureCreate) SetEventType(v string) *EventExposureCreate { + _c.mutation.SetEventType(v) + return _c +} + +// SetVisibility sets the "visibility" field. +func (_c *EventExposureCreate) SetVisibility(v eventexposure.Visibility) *EventExposureCreate { + _c.mutation.SetVisibility(v) + return _c +} + +// SetNillableVisibility sets the "visibility" field if the given value is not nil. +func (_c *EventExposureCreate) SetNillableVisibility(v *eventexposure.Visibility) *EventExposureCreate { + if v != nil { + _c.SetVisibility(*v) + } + return _c +} + +// SetActive sets the "active" field. +func (_c *EventExposureCreate) SetActive(v bool) *EventExposureCreate { + _c.mutation.SetActive(v) + return _c +} + +// SetNillableActive sets the "active" field if the given value is not nil. +func (_c *EventExposureCreate) SetNillableActive(v *bool) *EventExposureCreate { + if v != nil { + _c.SetActive(*v) + } + return _c +} + +// SetApprovalConfig sets the "approval_config" field. +func (_c *EventExposureCreate) SetApprovalConfig(v model.ApprovalConfig) *EventExposureCreate { + _c.mutation.SetApprovalConfig(v) + return _c +} + +// SetNillableApprovalConfig sets the "approval_config" field if the given value is not nil. +func (_c *EventExposureCreate) SetNillableApprovalConfig(v *model.ApprovalConfig) *EventExposureCreate { + if v != nil { + _c.SetApprovalConfig(*v) + } + return _c +} + +// SetOwnerID sets the "owner" edge to the Application entity by ID. +func (_c *EventExposureCreate) SetOwnerID(id int) *EventExposureCreate { + _c.mutation.SetOwnerID(id) + return _c +} + +// SetOwner sets the "owner" edge to the Application entity. +func (_c *EventExposureCreate) SetOwner(v *Application) *EventExposureCreate { + return _c.SetOwnerID(v.ID) +} + +// AddSubscriptionIDs adds the "subscriptions" edge to the EventSubscription entity by IDs. +func (_c *EventExposureCreate) AddSubscriptionIDs(ids ...int) *EventExposureCreate { + _c.mutation.AddSubscriptionIDs(ids...) + return _c +} + +// AddSubscriptions adds the "subscriptions" edges to the EventSubscription entity. +func (_c *EventExposureCreate) AddSubscriptions(v ...*EventSubscription) *EventExposureCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _c.AddSubscriptionIDs(ids...) +} + +// Mutation returns the EventExposureMutation object of the builder. +func (_c *EventExposureCreate) Mutation() *EventExposureMutation { + return _c.mutation +} + +// Save creates the EventExposure in the database. +func (_c *EventExposureCreate) Save(ctx context.Context) (*EventExposure, error) { + if err := _c.defaults(); err != nil { + return nil, err + } + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) +} + +// SaveX calls Save and panics if Save returns an error. +func (_c *EventExposureCreate) SaveX(ctx context.Context) *EventExposure { + v, err := _c.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (_c *EventExposureCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_c *EventExposureCreate) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (_c *EventExposureCreate) defaults() error { + if _, ok := _c.mutation.CreatedAt(); !ok { + if eventexposure.DefaultCreatedAt == nil { + return fmt.Errorf("ent: uninitialized eventexposure.DefaultCreatedAt (forgotten import ent/runtime?)") + } + v := eventexposure.DefaultCreatedAt() + _c.mutation.SetCreatedAt(v) + } + if _, ok := _c.mutation.LastModifiedAt(); !ok { + if eventexposure.DefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized eventexposure.DefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := eventexposure.DefaultLastModifiedAt() + _c.mutation.SetLastModifiedAt(v) + } + if _, ok := _c.mutation.Visibility(); !ok { + v := eventexposure.DefaultVisibility + _c.mutation.SetVisibility(v) + } + if _, ok := _c.mutation.Active(); !ok { + v := eventexposure.DefaultActive + _c.mutation.SetActive(v) + } + if _, ok := _c.mutation.ApprovalConfig(); !ok { + v := eventexposure.DefaultApprovalConfig + _c.mutation.SetApprovalConfig(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_c *EventExposureCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { + return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "EventExposure.created_at"`)} + } + if _, ok := _c.mutation.LastModifiedAt(); !ok { + return &ValidationError{Name: "last_modified_at", err: errors.New(`ent: missing required field "EventExposure.last_modified_at"`)} + } + if v, ok := _c.mutation.StatusPhase(); ok { + if err := eventexposure.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "EventExposure.status_phase": %w`, err)} + } + } + if _, ok := _c.mutation.Namespace(); !ok { + return &ValidationError{Name: "namespace", err: errors.New(`ent: missing required field "EventExposure.namespace"`)} + } + if v, ok := _c.mutation.Namespace(); ok { + if err := eventexposure.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "EventExposure.namespace": %w`, err)} + } + } + if _, ok := _c.mutation.EventType(); !ok { + return &ValidationError{Name: "event_type", err: errors.New(`ent: missing required field "EventExposure.event_type"`)} + } + if v, ok := _c.mutation.EventType(); ok { + if err := eventexposure.EventTypeValidator(v); err != nil { + return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "EventExposure.event_type": %w`, err)} + } + } + if _, ok := _c.mutation.Visibility(); !ok { + return &ValidationError{Name: "visibility", err: errors.New(`ent: missing required field "EventExposure.visibility"`)} + } + if v, ok := _c.mutation.Visibility(); ok { + if err := eventexposure.VisibilityValidator(v); err != nil { + return &ValidationError{Name: "visibility", err: fmt.Errorf(`ent: validator failed for field "EventExposure.visibility": %w`, err)} + } + } + if _, ok := _c.mutation.ApprovalConfig(); !ok { + return &ValidationError{Name: "approval_config", err: errors.New(`ent: missing required field "EventExposure.approval_config"`)} + } + if len(_c.mutation.OwnerIDs()) == 0 { + return &ValidationError{Name: "owner", err: errors.New(`ent: missing required edge "EventExposure.owner"`)} + } + return nil +} + +func (_c *EventExposureCreate) sqlSave(ctx context.Context) (*EventExposure, error) { + if err := _c.check(); err != nil { + return nil, err + } + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + id := _spec.ID.Value.(int64) + _node.ID = int(id) + _c.mutation.id = &_node.ID + _c.mutation.done = true + return _node, nil +} + +func (_c *EventExposureCreate) createSpec() (*EventExposure, *sqlgraph.CreateSpec) { + var ( + _node = &EventExposure{config: _c.config} + _spec = sqlgraph.NewCreateSpec(eventexposure.Table, sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt)) + ) + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { + _spec.SetField(eventexposure.FieldCreatedAt, field.TypeTime, value) + _node.CreatedAt = value + } + if value, ok := _c.mutation.LastModifiedAt(); ok { + _spec.SetField(eventexposure.FieldLastModifiedAt, field.TypeTime, value) + _node.LastModifiedAt = value + } + if value, ok := _c.mutation.StatusPhase(); ok { + _spec.SetField(eventexposure.FieldStatusPhase, field.TypeEnum, value) + _node.StatusPhase = &value + } + if value, ok := _c.mutation.StatusMessage(); ok { + _spec.SetField(eventexposure.FieldStatusMessage, field.TypeString, value) + _node.StatusMessage = &value + } + if value, ok := _c.mutation.Environment(); ok { + _spec.SetField(eventexposure.FieldEnvironment, field.TypeString, value) + _node.Environment = &value + } + if value, ok := _c.mutation.Namespace(); ok { + _spec.SetField(eventexposure.FieldNamespace, field.TypeString, value) + _node.Namespace = value + } + if value, ok := _c.mutation.EventType(); ok { + _spec.SetField(eventexposure.FieldEventType, field.TypeString, value) + _node.EventType = value + } + if value, ok := _c.mutation.Visibility(); ok { + _spec.SetField(eventexposure.FieldVisibility, field.TypeEnum, value) + _node.Visibility = value + } + if value, ok := _c.mutation.Active(); ok { + _spec.SetField(eventexposure.FieldActive, field.TypeBool, value) + _node.Active = &value + } + if value, ok := _c.mutation.ApprovalConfig(); ok { + _spec.SetField(eventexposure.FieldApprovalConfig, field.TypeJSON, value) + _node.ApprovalConfig = value + } + if nodes := _c.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventexposure.OwnerTable, + Columns: []string{eventexposure.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(application.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.application_exposed_events = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := _c.mutation.SubscriptionsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: eventexposure.SubscriptionsTable, + Columns: []string{eventexposure.SubscriptionsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } + return _node, _spec +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.EventExposure.Create(). +// SetCreatedAt(v). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.EventExposureUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (_c *EventExposureCreate) OnConflict(opts ...sql.ConflictOption) *EventExposureUpsertOne { + _c.conflict = opts + return &EventExposureUpsertOne{ + create: _c, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.EventExposure.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (_c *EventExposureCreate) OnConflictColumns(columns ...string) *EventExposureUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) + return &EventExposureUpsertOne{ + create: _c, + } +} + +type ( + // EventExposureUpsertOne is the builder for "upsert"-ing + // one EventExposure node. + EventExposureUpsertOne struct { + create *EventExposureCreate + } + + // EventExposureUpsert is the "OnConflict" setter. + EventExposureUpsert struct { + *sql.UpdateSet + } +) + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *EventExposureUpsert) SetLastModifiedAt(v time.Time) *EventExposureUpsert { + u.Set(eventexposure.FieldLastModifiedAt, v) + return u +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *EventExposureUpsert) UpdateLastModifiedAt() *EventExposureUpsert { + u.SetExcluded(eventexposure.FieldLastModifiedAt) + return u +} + +// SetStatusPhase sets the "status_phase" field. +func (u *EventExposureUpsert) SetStatusPhase(v eventexposure.StatusPhase) *EventExposureUpsert { + u.Set(eventexposure.FieldStatusPhase, v) + return u +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *EventExposureUpsert) UpdateStatusPhase() *EventExposureUpsert { + u.SetExcluded(eventexposure.FieldStatusPhase) + return u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *EventExposureUpsert) ClearStatusPhase() *EventExposureUpsert { + u.SetNull(eventexposure.FieldStatusPhase) + return u +} + +// SetStatusMessage sets the "status_message" field. +func (u *EventExposureUpsert) SetStatusMessage(v string) *EventExposureUpsert { + u.Set(eventexposure.FieldStatusMessage, v) + return u +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *EventExposureUpsert) UpdateStatusMessage() *EventExposureUpsert { + u.SetExcluded(eventexposure.FieldStatusMessage) + return u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *EventExposureUpsert) ClearStatusMessage() *EventExposureUpsert { + u.SetNull(eventexposure.FieldStatusMessage) + return u +} + +// SetEnvironment sets the "environment" field. +func (u *EventExposureUpsert) SetEnvironment(v string) *EventExposureUpsert { + u.Set(eventexposure.FieldEnvironment, v) + return u +} + +// UpdateEnvironment sets the "environment" field to the value that was provided on create. +func (u *EventExposureUpsert) UpdateEnvironment() *EventExposureUpsert { + u.SetExcluded(eventexposure.FieldEnvironment) + return u +} + +// ClearEnvironment clears the value of the "environment" field. +func (u *EventExposureUpsert) ClearEnvironment() *EventExposureUpsert { + u.SetNull(eventexposure.FieldEnvironment) + return u +} + +// SetNamespace sets the "namespace" field. +func (u *EventExposureUpsert) SetNamespace(v string) *EventExposureUpsert { + u.Set(eventexposure.FieldNamespace, v) + return u +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *EventExposureUpsert) UpdateNamespace() *EventExposureUpsert { + u.SetExcluded(eventexposure.FieldNamespace) + return u +} + +// SetEventType sets the "event_type" field. +func (u *EventExposureUpsert) SetEventType(v string) *EventExposureUpsert { + u.Set(eventexposure.FieldEventType, v) + return u +} + +// UpdateEventType sets the "event_type" field to the value that was provided on create. +func (u *EventExposureUpsert) UpdateEventType() *EventExposureUpsert { + u.SetExcluded(eventexposure.FieldEventType) + return u +} + +// SetVisibility sets the "visibility" field. +func (u *EventExposureUpsert) SetVisibility(v eventexposure.Visibility) *EventExposureUpsert { + u.Set(eventexposure.FieldVisibility, v) + return u +} + +// UpdateVisibility sets the "visibility" field to the value that was provided on create. +func (u *EventExposureUpsert) UpdateVisibility() *EventExposureUpsert { + u.SetExcluded(eventexposure.FieldVisibility) + return u +} + +// SetActive sets the "active" field. +func (u *EventExposureUpsert) SetActive(v bool) *EventExposureUpsert { + u.Set(eventexposure.FieldActive, v) + return u +} + +// UpdateActive sets the "active" field to the value that was provided on create. +func (u *EventExposureUpsert) UpdateActive() *EventExposureUpsert { + u.SetExcluded(eventexposure.FieldActive) + return u +} + +// ClearActive clears the value of the "active" field. +func (u *EventExposureUpsert) ClearActive() *EventExposureUpsert { + u.SetNull(eventexposure.FieldActive) + return u +} + +// SetApprovalConfig sets the "approval_config" field. +func (u *EventExposureUpsert) SetApprovalConfig(v model.ApprovalConfig) *EventExposureUpsert { + u.Set(eventexposure.FieldApprovalConfig, v) + return u +} + +// UpdateApprovalConfig sets the "approval_config" field to the value that was provided on create. +func (u *EventExposureUpsert) UpdateApprovalConfig() *EventExposureUpsert { + u.SetExcluded(eventexposure.FieldApprovalConfig) + return u +} + +// UpdateNewValues updates the mutable fields using the new values that were set on create. +// Using this option is equivalent to using: +// +// client.EventExposure.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *EventExposureUpsertOne) UpdateNewValues() *EventExposureUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + if _, exists := u.create.mutation.CreatedAt(); exists { + s.SetIgnore(eventexposure.FieldCreatedAt) + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.EventExposure.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *EventExposureUpsertOne) Ignore() *EventExposureUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *EventExposureUpsertOne) DoNothing() *EventExposureUpsertOne { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the EventExposureCreate.OnConflict +// documentation for more info. +func (u *EventExposureUpsertOne) Update(set func(*EventExposureUpsert)) *EventExposureUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&EventExposureUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *EventExposureUpsertOne) SetLastModifiedAt(v time.Time) *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *EventExposureUpsertOne) UpdateLastModifiedAt() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetStatusPhase sets the "status_phase" field. +func (u *EventExposureUpsertOne) SetStatusPhase(v eventexposure.StatusPhase) *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.SetStatusPhase(v) + }) +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *EventExposureUpsertOne) UpdateStatusPhase() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateStatusPhase() + }) +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *EventExposureUpsertOne) ClearStatusPhase() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.ClearStatusPhase() + }) +} + +// SetStatusMessage sets the "status_message" field. +func (u *EventExposureUpsertOne) SetStatusMessage(v string) *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.SetStatusMessage(v) + }) +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *EventExposureUpsertOne) UpdateStatusMessage() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateStatusMessage() + }) +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *EventExposureUpsertOne) ClearStatusMessage() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.ClearStatusMessage() + }) +} + +// SetEnvironment sets the "environment" field. +func (u *EventExposureUpsertOne) SetEnvironment(v string) *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.SetEnvironment(v) + }) +} + +// UpdateEnvironment sets the "environment" field to the value that was provided on create. +func (u *EventExposureUpsertOne) UpdateEnvironment() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateEnvironment() + }) +} + +// ClearEnvironment clears the value of the "environment" field. +func (u *EventExposureUpsertOne) ClearEnvironment() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.ClearEnvironment() + }) +} + +// SetNamespace sets the "namespace" field. +func (u *EventExposureUpsertOne) SetNamespace(v string) *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.SetNamespace(v) + }) +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *EventExposureUpsertOne) UpdateNamespace() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateNamespace() + }) +} + +// SetEventType sets the "event_type" field. +func (u *EventExposureUpsertOne) SetEventType(v string) *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.SetEventType(v) + }) +} + +// UpdateEventType sets the "event_type" field to the value that was provided on create. +func (u *EventExposureUpsertOne) UpdateEventType() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateEventType() + }) +} + +// SetVisibility sets the "visibility" field. +func (u *EventExposureUpsertOne) SetVisibility(v eventexposure.Visibility) *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.SetVisibility(v) + }) +} + +// UpdateVisibility sets the "visibility" field to the value that was provided on create. +func (u *EventExposureUpsertOne) UpdateVisibility() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateVisibility() + }) +} + +// SetActive sets the "active" field. +func (u *EventExposureUpsertOne) SetActive(v bool) *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.SetActive(v) + }) +} + +// UpdateActive sets the "active" field to the value that was provided on create. +func (u *EventExposureUpsertOne) UpdateActive() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateActive() + }) +} + +// ClearActive clears the value of the "active" field. +func (u *EventExposureUpsertOne) ClearActive() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.ClearActive() + }) +} + +// SetApprovalConfig sets the "approval_config" field. +func (u *EventExposureUpsertOne) SetApprovalConfig(v model.ApprovalConfig) *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.SetApprovalConfig(v) + }) +} + +// UpdateApprovalConfig sets the "approval_config" field to the value that was provided on create. +func (u *EventExposureUpsertOne) UpdateApprovalConfig() *EventExposureUpsertOne { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateApprovalConfig() + }) +} + +// Exec executes the query. +func (u *EventExposureUpsertOne) Exec(ctx context.Context) error { + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for EventExposureCreate.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *EventExposureUpsertOne) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} + +// Exec executes the UPSERT query and returns the inserted/updated ID. +func (u *EventExposureUpsertOne) ID(ctx context.Context) (id int, err error) { + node, err := u.create.Save(ctx) + if err != nil { + return id, err + } + return node.ID, nil +} + +// IDX is like ID, but panics if an error occurs. +func (u *EventExposureUpsertOne) IDX(ctx context.Context) int { + id, err := u.ID(ctx) + if err != nil { + panic(err) + } + return id +} + +// EventExposureCreateBulk is the builder for creating many EventExposure entities in bulk. +type EventExposureCreateBulk struct { + config + err error + builders []*EventExposureCreate + conflict []sql.ConflictOption +} + +// Save creates the EventExposure entities in the database. +func (_c *EventExposureCreateBulk) Save(ctx context.Context) ([]*EventExposure, error) { + if _c.err != nil { + return nil, _c.err + } + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*EventExposure, len(_c.builders)) + mutators := make([]Mutator, len(_c.builders)) + for i := range _c.builders { + func(i int, root context.Context) { + builder := _c.builders[i] + builder.defaults() + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*EventExposureMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err := builder.check(); err != nil { + return nil, err + } + builder.mutation = mutation + var err error + nodes[i], specs[i] = builder.createSpec() + if i < len(mutators)-1 { + _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) + } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} + spec.OnConflict = _c.conflict + // Invoke the actual operation on the latest mutation in the chain. + if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + } + } + if err != nil { + return nil, err + } + mutation.id = &nodes[i].ID + if specs[i].ID.Value != nil { + id := specs[i].ID.Value.(int64) + nodes[i].ID = int(id) + } + mutation.done = true + return nodes[i], nil + }) + for i := len(builder.hooks) - 1; i >= 0; i-- { + mut = builder.hooks[i](mut) + } + mutators[i] = mut + }(i, ctx) + } + if len(mutators) > 0 { + if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { + return nil, err + } + } + return nodes, nil +} + +// SaveX is like Save, but panics if an error occurs. +func (_c *EventExposureCreateBulk) SaveX(ctx context.Context) []*EventExposure { + v, err := _c.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (_c *EventExposureCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_c *EventExposureCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { + panic(err) + } +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.EventExposure.CreateBulk(builders...). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.EventExposureUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (_c *EventExposureCreateBulk) OnConflict(opts ...sql.ConflictOption) *EventExposureUpsertBulk { + _c.conflict = opts + return &EventExposureUpsertBulk{ + create: _c, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.EventExposure.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (_c *EventExposureCreateBulk) OnConflictColumns(columns ...string) *EventExposureUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) + return &EventExposureUpsertBulk{ + create: _c, + } +} + +// EventExposureUpsertBulk is the builder for "upsert"-ing +// a bulk of EventExposure nodes. +type EventExposureUpsertBulk struct { + create *EventExposureCreateBulk +} + +// UpdateNewValues updates the mutable fields using the new values that +// were set on create. Using this option is equivalent to using: +// +// client.EventExposure.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *EventExposureUpsertBulk) UpdateNewValues() *EventExposureUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + for _, b := range u.create.builders { + if _, exists := b.mutation.CreatedAt(); exists { + s.SetIgnore(eventexposure.FieldCreatedAt) + } + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.EventExposure.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *EventExposureUpsertBulk) Ignore() *EventExposureUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *EventExposureUpsertBulk) DoNothing() *EventExposureUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the EventExposureCreateBulk.OnConflict +// documentation for more info. +func (u *EventExposureUpsertBulk) Update(set func(*EventExposureUpsert)) *EventExposureUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&EventExposureUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *EventExposureUpsertBulk) SetLastModifiedAt(v time.Time) *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *EventExposureUpsertBulk) UpdateLastModifiedAt() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetStatusPhase sets the "status_phase" field. +func (u *EventExposureUpsertBulk) SetStatusPhase(v eventexposure.StatusPhase) *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.SetStatusPhase(v) + }) +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *EventExposureUpsertBulk) UpdateStatusPhase() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateStatusPhase() + }) +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *EventExposureUpsertBulk) ClearStatusPhase() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.ClearStatusPhase() + }) +} + +// SetStatusMessage sets the "status_message" field. +func (u *EventExposureUpsertBulk) SetStatusMessage(v string) *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.SetStatusMessage(v) + }) +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *EventExposureUpsertBulk) UpdateStatusMessage() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateStatusMessage() + }) +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *EventExposureUpsertBulk) ClearStatusMessage() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.ClearStatusMessage() + }) +} + +// SetEnvironment sets the "environment" field. +func (u *EventExposureUpsertBulk) SetEnvironment(v string) *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.SetEnvironment(v) + }) +} + +// UpdateEnvironment sets the "environment" field to the value that was provided on create. +func (u *EventExposureUpsertBulk) UpdateEnvironment() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateEnvironment() + }) +} + +// ClearEnvironment clears the value of the "environment" field. +func (u *EventExposureUpsertBulk) ClearEnvironment() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.ClearEnvironment() + }) +} + +// SetNamespace sets the "namespace" field. +func (u *EventExposureUpsertBulk) SetNamespace(v string) *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.SetNamespace(v) + }) +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *EventExposureUpsertBulk) UpdateNamespace() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateNamespace() + }) +} + +// SetEventType sets the "event_type" field. +func (u *EventExposureUpsertBulk) SetEventType(v string) *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.SetEventType(v) + }) +} + +// UpdateEventType sets the "event_type" field to the value that was provided on create. +func (u *EventExposureUpsertBulk) UpdateEventType() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateEventType() + }) +} + +// SetVisibility sets the "visibility" field. +func (u *EventExposureUpsertBulk) SetVisibility(v eventexposure.Visibility) *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.SetVisibility(v) + }) +} + +// UpdateVisibility sets the "visibility" field to the value that was provided on create. +func (u *EventExposureUpsertBulk) UpdateVisibility() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateVisibility() + }) +} + +// SetActive sets the "active" field. +func (u *EventExposureUpsertBulk) SetActive(v bool) *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.SetActive(v) + }) +} + +// UpdateActive sets the "active" field to the value that was provided on create. +func (u *EventExposureUpsertBulk) UpdateActive() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateActive() + }) +} + +// ClearActive clears the value of the "active" field. +func (u *EventExposureUpsertBulk) ClearActive() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.ClearActive() + }) +} + +// SetApprovalConfig sets the "approval_config" field. +func (u *EventExposureUpsertBulk) SetApprovalConfig(v model.ApprovalConfig) *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.SetApprovalConfig(v) + }) +} + +// UpdateApprovalConfig sets the "approval_config" field to the value that was provided on create. +func (u *EventExposureUpsertBulk) UpdateApprovalConfig() *EventExposureUpsertBulk { + return u.Update(func(s *EventExposureUpsert) { + s.UpdateApprovalConfig() + }) +} + +// Exec executes the query. +func (u *EventExposureUpsertBulk) Exec(ctx context.Context) error { + if u.create.err != nil { + return u.create.err + } + for i, b := range u.create.builders { + if len(b.conflict) != 0 { + return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the EventExposureCreateBulk instead", i) + } + } + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for EventExposureCreateBulk.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *EventExposureUpsertBulk) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/controlplane-api/ent/eventexposure_delete.go b/controlplane-api/ent/eventexposure_delete.go new file mode 100644 index 000000000..2d984b254 --- /dev/null +++ b/controlplane-api/ent/eventexposure_delete.go @@ -0,0 +1,91 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" +) + +// EventExposureDelete is the builder for deleting a EventExposure entity. +type EventExposureDelete struct { + config + hooks []Hook + mutation *EventExposureMutation +} + +// Where appends a list predicates to the EventExposureDelete builder. +func (_d *EventExposureDelete) Where(ps ...predicate.EventExposure) *EventExposureDelete { + _d.mutation.Where(ps...) + return _d +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (_d *EventExposureDelete) Exec(ctx context.Context) (int, error) { + return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) +} + +// ExecX is like Exec, but panics if an error occurs. +func (_d *EventExposureDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (_d *EventExposureDelete) sqlExec(ctx context.Context) (int, error) { + _spec := sqlgraph.NewDeleteSpec(eventexposure.Table, sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt)) + if ps := _d.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + _d.mutation.done = true + return affected, err +} + +// EventExposureDeleteOne is the builder for deleting a single EventExposure entity. +type EventExposureDeleteOne struct { + _d *EventExposureDelete +} + +// Where appends a list predicates to the EventExposureDelete builder. +func (_d *EventExposureDeleteOne) Where(ps ...predicate.EventExposure) *EventExposureDeleteOne { + _d._d.mutation.Where(ps...) + return _d +} + +// Exec executes the deletion query. +func (_d *EventExposureDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{eventexposure.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (_d *EventExposureDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/controlplane-api/ent/eventexposure_query.go b/controlplane-api/ent/eventexposure_query.go new file mode 100644 index 000000000..d56094d28 --- /dev/null +++ b/controlplane-api/ent/eventexposure_query.go @@ -0,0 +1,735 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "database/sql/driver" + "errors" + "fmt" + "math" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" +) + +// EventExposureQuery is the builder for querying EventExposure entities. +type EventExposureQuery struct { + config + ctx *QueryContext + order []eventexposure.OrderOption + inters []Interceptor + predicates []predicate.EventExposure + withOwner *ApplicationQuery + withSubscriptions *EventSubscriptionQuery + withFKs bool + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*EventExposure) error + withNamedSubscriptions map[string]*EventSubscriptionQuery + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Where adds a new predicate for the EventExposureQuery builder. +func (_q *EventExposureQuery) Where(ps ...predicate.EventExposure) *EventExposureQuery { + _q.predicates = append(_q.predicates, ps...) + return _q +} + +// Limit the number of records to be returned by this query. +func (_q *EventExposureQuery) Limit(limit int) *EventExposureQuery { + _q.ctx.Limit = &limit + return _q +} + +// Offset to start from. +func (_q *EventExposureQuery) Offset(offset int) *EventExposureQuery { + _q.ctx.Offset = &offset + return _q +} + +// Unique configures the query builder to filter duplicate records on query. +// By default, unique is set to true, and can be disabled using this method. +func (_q *EventExposureQuery) Unique(unique bool) *EventExposureQuery { + _q.ctx.Unique = &unique + return _q +} + +// Order specifies how the records should be ordered. +func (_q *EventExposureQuery) Order(o ...eventexposure.OrderOption) *EventExposureQuery { + _q.order = append(_q.order, o...) + return _q +} + +// QueryOwner chains the current query on the "owner" edge. +func (_q *EventExposureQuery) QueryOwner() *ApplicationQuery { + query := (&ApplicationClient{config: _q.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + selector := _q.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(eventexposure.Table, eventexposure.FieldID, selector), + sqlgraph.To(application.Table, application.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, eventexposure.OwnerTable, eventexposure.OwnerColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QuerySubscriptions chains the current query on the "subscriptions" edge. +func (_q *EventExposureQuery) QuerySubscriptions() *EventSubscriptionQuery { + query := (&EventSubscriptionClient{config: _q.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + selector := _q.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(eventexposure.Table, eventexposure.FieldID, selector), + sqlgraph.To(eventsubscription.Table, eventsubscription.FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, eventexposure.SubscriptionsTable, eventexposure.SubscriptionsColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// First returns the first EventExposure entity from the query. +// Returns a *NotFoundError when no EventExposure was found. +func (_q *EventExposureQuery) First(ctx context.Context) (*EventExposure, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) + if err != nil { + return nil, err + } + if len(nodes) == 0 { + return nil, &NotFoundError{eventexposure.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (_q *EventExposureQuery) FirstX(ctx context.Context) *EventExposure { + node, err := _q.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first EventExposure ID from the query. +// Returns a *NotFoundError when no EventExposure ID was found. +func (_q *EventExposureQuery) FirstID(ctx context.Context) (id int, err error) { + var ids []int + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { + return + } + if len(ids) == 0 { + err = &NotFoundError{eventexposure.Label} + return + } + return ids[0], nil +} + +// FirstIDX is like FirstID, but panics if an error occurs. +func (_q *EventExposureQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns a single EventExposure entity found by the query, ensuring it only returns one. +// Returns a *NotSingularError when more than one EventExposure entity is found. +// Returns a *NotFoundError when no EventExposure entities are found. +func (_q *EventExposureQuery) Only(ctx context.Context) (*EventExposure, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) + if err != nil { + return nil, err + } + switch len(nodes) { + case 1: + return nodes[0], nil + case 0: + return nil, &NotFoundError{eventexposure.Label} + default: + return nil, &NotSingularError{eventexposure.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (_q *EventExposureQuery) OnlyX(ctx context.Context) *EventExposure { + node, err := _q.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID is like Only, but returns the only EventExposure ID in the query. +// Returns a *NotSingularError when more than one EventExposure ID is found. +// Returns a *NotFoundError when no entities are found. +func (_q *EventExposureQuery) OnlyID(ctx context.Context) (id int, err error) { + var ids []int + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { + return + } + switch len(ids) { + case 1: + id = ids[0] + case 0: + err = &NotFoundError{eventexposure.Label} + default: + err = &NotSingularError{eventexposure.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (_q *EventExposureQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) + if err != nil { + panic(err) + } + return id +} + +// All executes the query and returns a list of EventExposures. +func (_q *EventExposureQuery) All(ctx context.Context) ([]*EventExposure, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + qr := querierAll[[]*EventExposure, *EventExposureQuery]() + return withInterceptors[[]*EventExposure](ctx, _q, qr, _q.inters) +} + +// AllX is like All, but panics if an error occurs. +func (_q *EventExposureQuery) AllX(ctx context.Context) []*EventExposure { + nodes, err := _q.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of EventExposure IDs. +func (_q *EventExposureQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) + } + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(eventexposure.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (_q *EventExposureQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) + if err != nil { + panic(err) + } + return ids +} + +// Count returns the count of the given query. +func (_q *EventExposureQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { + return 0, err + } + return withInterceptors[int](ctx, _q, querierCount[*EventExposureQuery](), _q.inters) +} + +// CountX is like Count, but panics if an error occurs. +func (_q *EventExposureQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) + if err != nil { + panic(err) + } + return count +} + +// Exist returns true if the query has elements in the graph. +func (_q *EventExposureQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { + case IsNotFound(err): + return false, nil + case err != nil: + return false, fmt.Errorf("ent: check existence: %w", err) + default: + return true, nil + } +} + +// ExistX is like Exist, but panics if an error occurs. +func (_q *EventExposureQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the EventExposureQuery builder, including all associated steps. It can be +// used to prepare common query builders and use them differently after the clone is made. +func (_q *EventExposureQuery) Clone() *EventExposureQuery { + if _q == nil { + return nil + } + return &EventExposureQuery{ + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]eventexposure.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.EventExposure{}, _q.predicates...), + withOwner: _q.withOwner.Clone(), + withSubscriptions: _q.withSubscriptions.Clone(), + // clone intermediate query. + sql: _q.sql.Clone(), + path: _q.path, + } +} + +// WithOwner tells the query-builder to eager-load the nodes that are connected to +// the "owner" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *EventExposureQuery) WithOwner(opts ...func(*ApplicationQuery)) *EventExposureQuery { + query := (&ApplicationClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withOwner = query + return _q +} + +// WithSubscriptions tells the query-builder to eager-load the nodes that are connected to +// the "subscriptions" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *EventExposureQuery) WithSubscriptions(opts ...func(*EventSubscriptionQuery)) *EventExposureQuery { + query := (&EventSubscriptionClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withSubscriptions = query + return _q +} + +// GroupBy is used to group vertices by one or more fields/columns. +// It is often used with aggregate functions, like: count, max, mean, min, sum. +// +// Example: +// +// var v []struct { +// CreatedAt time.Time `json:"created_at,omitempty"` +// Count int `json:"count,omitempty"` +// } +// +// client.EventExposure.Query(). +// GroupBy(eventexposure.FieldCreatedAt). +// Aggregate(ent.Count()). +// Scan(ctx, &v) +func (_q *EventExposureQuery) GroupBy(field string, fields ...string) *EventExposureGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &EventExposureGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields + grbuild.label = eventexposure.Label + grbuild.scan = grbuild.Scan + return grbuild +} + +// Select allows the selection one or more fields/columns for the given query, +// instead of selecting all fields in the entity. +// +// Example: +// +// var v []struct { +// CreatedAt time.Time `json:"created_at,omitempty"` +// } +// +// client.EventExposure.Query(). +// Select(eventexposure.FieldCreatedAt). +// Scan(ctx, &v) +func (_q *EventExposureQuery) Select(fields ...string) *EventExposureSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &EventExposureSelect{EventExposureQuery: _q} + sbuild.label = eventexposure.Label + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan + return sbuild +} + +// Aggregate returns a EventExposureSelect configured with the given aggregations. +func (_q *EventExposureQuery) Aggregate(fns ...AggregateFunc) *EventExposureSelect { + return _q.Select().Aggregate(fns...) +} + +func (_q *EventExposureQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { + if inter == nil { + return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") + } + if trv, ok := inter.(Traverser); ok { + if err := trv.Traverse(ctx, _q); err != nil { + return err + } + } + } + for _, f := range _q.ctx.Fields { + if !eventexposure.ValidColumn(f) { + return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + } + if _q.path != nil { + prev, err := _q.path(ctx) + if err != nil { + return err + } + _q.sql = prev + } + if eventexposure.Policy == nil { + return errors.New("ent: uninitialized eventexposure.Policy (forgotten import ent/runtime?)") + } + if err := eventexposure.Policy.EvalQuery(ctx, _q); err != nil { + return err + } + return nil +} + +func (_q *EventExposureQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*EventExposure, error) { + var ( + nodes = []*EventExposure{} + withFKs = _q.withFKs + _spec = _q.querySpec() + loadedTypes = [2]bool{ + _q.withOwner != nil, + _q.withSubscriptions != nil, + } + ) + if _q.withOwner != nil { + withFKs = true + } + if withFKs { + _spec.Node.Columns = append(_spec.Node.Columns, eventexposure.ForeignKeys...) + } + _spec.ScanValues = func(columns []string) ([]any, error) { + return (*EventExposure).scanValues(nil, columns) + } + _spec.Assign = func(columns []string, values []any) error { + node := &EventExposure{config: _q.config} + nodes = append(nodes, node) + node.Edges.loadedTypes = loadedTypes + return node.assignValues(columns, values) + } + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } + for i := range hooks { + hooks[i](ctx, _spec) + } + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { + return nil, err + } + if len(nodes) == 0 { + return nodes, nil + } + if query := _q.withOwner; query != nil { + if err := _q.loadOwner(ctx, query, nodes, nil, + func(n *EventExposure, e *Application) { n.Edges.Owner = e }); err != nil { + return nil, err + } + } + if query := _q.withSubscriptions; query != nil { + if err := _q.loadSubscriptions(ctx, query, nodes, + func(n *EventExposure) { n.Edges.Subscriptions = []*EventSubscription{} }, + func(n *EventExposure, e *EventSubscription) { n.Edges.Subscriptions = append(n.Edges.Subscriptions, e) }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedSubscriptions { + if err := _q.loadSubscriptions(ctx, query, nodes, + func(n *EventExposure) { n.appendNamedSubscriptions(name) }, + func(n *EventExposure, e *EventSubscription) { n.appendNamedSubscriptions(name, e) }); err != nil { + return nil, err + } + } + for i := range _q.loadTotal { + if err := _q.loadTotal[i](ctx, nodes); err != nil { + return nil, err + } + } + return nodes, nil +} + +func (_q *EventExposureQuery) loadOwner(ctx context.Context, query *ApplicationQuery, nodes []*EventExposure, init func(*EventExposure), assign func(*EventExposure, *Application)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*EventExposure) + for i := range nodes { + if nodes[i].application_exposed_events == nil { + continue + } + fk := *nodes[i].application_exposed_events + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(application.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "application_exposed_events" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (_q *EventExposureQuery) loadSubscriptions(ctx context.Context, query *EventSubscriptionQuery, nodes []*EventExposure, init func(*EventExposure), assign func(*EventExposure, *EventSubscription)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*EventExposure) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.EventSubscription(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(eventexposure.SubscriptionsColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.event_subscription_target + if fk == nil { + return fmt.Errorf(`foreign-key "event_subscription_target" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "event_subscription_target" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} + +func (_q *EventExposureQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique + } + return sqlgraph.CountNodes(ctx, _q.driver, _spec) +} + +func (_q *EventExposureQuery) querySpec() *sqlgraph.QuerySpec { + _spec := sqlgraph.NewQuerySpec(eventexposure.Table, eventexposure.Columns, sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt)) + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { + _spec.Unique = *unique + } else if _q.path != nil { + _spec.Unique = true + } + if fields := _q.ctx.Fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, eventexposure.FieldID) + for i := range fields { + if fields[i] != eventexposure.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) + } + } + } + if ps := _q.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if limit := _q.ctx.Limit; limit != nil { + _spec.Limit = *limit + } + if offset := _q.ctx.Offset; offset != nil { + _spec.Offset = *offset + } + if ps := _q.order; len(ps) > 0 { + _spec.Order = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + return _spec +} + +func (_q *EventExposureQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) + t1 := builder.Table(eventexposure.Table) + columns := _q.ctx.Fields + if len(columns) == 0 { + columns = eventexposure.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) + if _q.sql != nil { + selector = _q.sql + selector.Select(selector.Columns(columns...)...) + } + if _q.ctx.Unique != nil && *_q.ctx.Unique { + selector.Distinct() + } + for _, p := range _q.predicates { + p(selector) + } + for _, p := range _q.order { + p(selector) + } + if offset := _q.ctx.Offset; offset != nil { + // limit is mandatory for offset clause. We start + // with default value, and override it below if needed. + selector.Offset(*offset).Limit(math.MaxInt32) + } + if limit := _q.ctx.Limit; limit != nil { + selector.Limit(*limit) + } + return selector +} + +// WithNamedSubscriptions tells the query-builder to eager-load the nodes that are connected to the "subscriptions" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *EventExposureQuery) WithNamedSubscriptions(name string, opts ...func(*EventSubscriptionQuery)) *EventExposureQuery { + query := (&EventSubscriptionClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedSubscriptions == nil { + _q.withNamedSubscriptions = make(map[string]*EventSubscriptionQuery) + } + _q.withNamedSubscriptions[name] = query + return _q +} + +// EventExposureGroupBy is the group-by builder for EventExposure entities. +type EventExposureGroupBy struct { + selector + build *EventExposureQuery +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (_g *EventExposureGroupBy) Aggregate(fns ...AggregateFunc) *EventExposureGroupBy { + _g.fns = append(_g.fns, fns...) + return _g +} + +// Scan applies the selector query and scans the result into the given value. +func (_g *EventExposureGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*EventExposureQuery, *EventExposureGroupBy](ctx, _g.build, _g, _g.build.inters, v) +} + +func (_g *EventExposureGroupBy) sqlScan(ctx context.Context, root *EventExposureQuery, v any) error { + selector := root.sqlQuery(ctx).Select() + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { + aggregation = append(aggregation, fn(selector)) + } + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) + } + selector.GroupBy(selector.Columns(*_g.flds...)...) + if err := selector.Err(); err != nil { + return err + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} + +// EventExposureSelect is the builder for selecting fields of EventExposure entities. +type EventExposureSelect struct { + *EventExposureQuery + selector +} + +// Aggregate adds the given aggregation functions to the selector query. +func (_s *EventExposureSelect) Aggregate(fns ...AggregateFunc) *EventExposureSelect { + _s.fns = append(_s.fns, fns...) + return _s +} + +// Scan applies the selector query and scans the result into the given value. +func (_s *EventExposureSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*EventExposureQuery, *EventExposureSelect](ctx, _s.EventExposureQuery, _s, _s.inters, v) +} + +func (_s *EventExposureSelect) sqlScan(ctx context.Context, root *EventExposureQuery, v any) error { + selector := root.sqlQuery(ctx) + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { + aggregation = append(aggregation, fn(selector)) + } + switch n := len(*_s.selector.flds); { + case n == 0 && len(aggregation) > 0: + selector.Select(aggregation...) + case n != 0 && len(aggregation) > 0: + selector.AppendSelect(aggregation...) + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := _s.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} diff --git a/controlplane-api/ent/eventexposure_update.go b/controlplane-api/ent/eventexposure_update.go new file mode 100644 index 000000000..327e270b1 --- /dev/null +++ b/controlplane-api/ent/eventexposure_update.go @@ -0,0 +1,890 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "fmt" + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" + "github.com/telekom/controlplane/controlplane-api/pkg/model" +) + +// EventExposureUpdate is the builder for updating EventExposure entities. +type EventExposureUpdate struct { + config + hooks []Hook + mutation *EventExposureMutation +} + +// Where appends a list predicates to the EventExposureUpdate builder. +func (_u *EventExposureUpdate) Where(ps ...predicate.EventExposure) *EventExposureUpdate { + _u.mutation.Where(ps...) + return _u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_u *EventExposureUpdate) SetLastModifiedAt(v time.Time) *EventExposureUpdate { + _u.mutation.SetLastModifiedAt(v) + return _u +} + +// SetStatusPhase sets the "status_phase" field. +func (_u *EventExposureUpdate) SetStatusPhase(v eventexposure.StatusPhase) *EventExposureUpdate { + _u.mutation.SetStatusPhase(v) + return _u +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_u *EventExposureUpdate) SetNillableStatusPhase(v *eventexposure.StatusPhase) *EventExposureUpdate { + if v != nil { + _u.SetStatusPhase(*v) + } + return _u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (_u *EventExposureUpdate) ClearStatusPhase() *EventExposureUpdate { + _u.mutation.ClearStatusPhase() + return _u +} + +// SetStatusMessage sets the "status_message" field. +func (_u *EventExposureUpdate) SetStatusMessage(v string) *EventExposureUpdate { + _u.mutation.SetStatusMessage(v) + return _u +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_u *EventExposureUpdate) SetNillableStatusMessage(v *string) *EventExposureUpdate { + if v != nil { + _u.SetStatusMessage(*v) + } + return _u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (_u *EventExposureUpdate) ClearStatusMessage() *EventExposureUpdate { + _u.mutation.ClearStatusMessage() + return _u +} + +// SetEnvironment sets the "environment" field. +func (_u *EventExposureUpdate) SetEnvironment(v string) *EventExposureUpdate { + _u.mutation.SetEnvironment(v) + return _u +} + +// SetNillableEnvironment sets the "environment" field if the given value is not nil. +func (_u *EventExposureUpdate) SetNillableEnvironment(v *string) *EventExposureUpdate { + if v != nil { + _u.SetEnvironment(*v) + } + return _u +} + +// ClearEnvironment clears the value of the "environment" field. +func (_u *EventExposureUpdate) ClearEnvironment() *EventExposureUpdate { + _u.mutation.ClearEnvironment() + return _u +} + +// SetNamespace sets the "namespace" field. +func (_u *EventExposureUpdate) SetNamespace(v string) *EventExposureUpdate { + _u.mutation.SetNamespace(v) + return _u +} + +// SetNillableNamespace sets the "namespace" field if the given value is not nil. +func (_u *EventExposureUpdate) SetNillableNamespace(v *string) *EventExposureUpdate { + if v != nil { + _u.SetNamespace(*v) + } + return _u +} + +// SetEventType sets the "event_type" field. +func (_u *EventExposureUpdate) SetEventType(v string) *EventExposureUpdate { + _u.mutation.SetEventType(v) + return _u +} + +// SetNillableEventType sets the "event_type" field if the given value is not nil. +func (_u *EventExposureUpdate) SetNillableEventType(v *string) *EventExposureUpdate { + if v != nil { + _u.SetEventType(*v) + } + return _u +} + +// SetVisibility sets the "visibility" field. +func (_u *EventExposureUpdate) SetVisibility(v eventexposure.Visibility) *EventExposureUpdate { + _u.mutation.SetVisibility(v) + return _u +} + +// SetNillableVisibility sets the "visibility" field if the given value is not nil. +func (_u *EventExposureUpdate) SetNillableVisibility(v *eventexposure.Visibility) *EventExposureUpdate { + if v != nil { + _u.SetVisibility(*v) + } + return _u +} + +// SetActive sets the "active" field. +func (_u *EventExposureUpdate) SetActive(v bool) *EventExposureUpdate { + _u.mutation.SetActive(v) + return _u +} + +// SetNillableActive sets the "active" field if the given value is not nil. +func (_u *EventExposureUpdate) SetNillableActive(v *bool) *EventExposureUpdate { + if v != nil { + _u.SetActive(*v) + } + return _u +} + +// ClearActive clears the value of the "active" field. +func (_u *EventExposureUpdate) ClearActive() *EventExposureUpdate { + _u.mutation.ClearActive() + return _u +} + +// SetApprovalConfig sets the "approval_config" field. +func (_u *EventExposureUpdate) SetApprovalConfig(v model.ApprovalConfig) *EventExposureUpdate { + _u.mutation.SetApprovalConfig(v) + return _u +} + +// SetNillableApprovalConfig sets the "approval_config" field if the given value is not nil. +func (_u *EventExposureUpdate) SetNillableApprovalConfig(v *model.ApprovalConfig) *EventExposureUpdate { + if v != nil { + _u.SetApprovalConfig(*v) + } + return _u +} + +// SetOwnerID sets the "owner" edge to the Application entity by ID. +func (_u *EventExposureUpdate) SetOwnerID(id int) *EventExposureUpdate { + _u.mutation.SetOwnerID(id) + return _u +} + +// SetOwner sets the "owner" edge to the Application entity. +func (_u *EventExposureUpdate) SetOwner(v *Application) *EventExposureUpdate { + return _u.SetOwnerID(v.ID) +} + +// AddSubscriptionIDs adds the "subscriptions" edge to the EventSubscription entity by IDs. +func (_u *EventExposureUpdate) AddSubscriptionIDs(ids ...int) *EventExposureUpdate { + _u.mutation.AddSubscriptionIDs(ids...) + return _u +} + +// AddSubscriptions adds the "subscriptions" edges to the EventSubscription entity. +func (_u *EventExposureUpdate) AddSubscriptions(v ...*EventSubscription) *EventExposureUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddSubscriptionIDs(ids...) +} + +// Mutation returns the EventExposureMutation object of the builder. +func (_u *EventExposureUpdate) Mutation() *EventExposureMutation { + return _u.mutation +} + +// ClearOwner clears the "owner" edge to the Application entity. +func (_u *EventExposureUpdate) ClearOwner() *EventExposureUpdate { + _u.mutation.ClearOwner() + return _u +} + +// ClearSubscriptions clears all "subscriptions" edges to the EventSubscription entity. +func (_u *EventExposureUpdate) ClearSubscriptions() *EventExposureUpdate { + _u.mutation.ClearSubscriptions() + return _u +} + +// RemoveSubscriptionIDs removes the "subscriptions" edge to EventSubscription entities by IDs. +func (_u *EventExposureUpdate) RemoveSubscriptionIDs(ids ...int) *EventExposureUpdate { + _u.mutation.RemoveSubscriptionIDs(ids...) + return _u +} + +// RemoveSubscriptions removes "subscriptions" edges to EventSubscription entities. +func (_u *EventExposureUpdate) RemoveSubscriptions(v ...*EventSubscription) *EventExposureUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveSubscriptionIDs(ids...) +} + +// Save executes the query and returns the number of nodes affected by the update operation. +func (_u *EventExposureUpdate) Save(ctx context.Context) (int, error) { + if err := _u.defaults(); err != nil { + return 0, err + } + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (_u *EventExposureUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (_u *EventExposureUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_u *EventExposureUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (_u *EventExposureUpdate) defaults() error { + if _, ok := _u.mutation.LastModifiedAt(); !ok { + if eventexposure.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized eventexposure.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := eventexposure.UpdateDefaultLastModifiedAt() + _u.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_u *EventExposureUpdate) check() error { + if v, ok := _u.mutation.StatusPhase(); ok { + if err := eventexposure.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "EventExposure.status_phase": %w`, err)} + } + } + if v, ok := _u.mutation.Namespace(); ok { + if err := eventexposure.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "EventExposure.namespace": %w`, err)} + } + } + if v, ok := _u.mutation.EventType(); ok { + if err := eventexposure.EventTypeValidator(v); err != nil { + return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "EventExposure.event_type": %w`, err)} + } + } + if v, ok := _u.mutation.Visibility(); ok { + if err := eventexposure.VisibilityValidator(v); err != nil { + return &ValidationError{Name: "visibility", err: fmt.Errorf(`ent: validator failed for field "EventExposure.visibility": %w`, err)} + } + } + if _u.mutation.OwnerCleared() && len(_u.mutation.OwnerIDs()) > 0 { + return errors.New(`ent: clearing a required unique edge "EventExposure.owner"`) + } + return nil +} + +func (_u *EventExposureUpdate) sqlSave(ctx context.Context) (_node int, err error) { + if err := _u.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(eventexposure.Table, eventexposure.Columns, sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt)) + if ps := _u.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := _u.mutation.LastModifiedAt(); ok { + _spec.SetField(eventexposure.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := _u.mutation.StatusPhase(); ok { + _spec.SetField(eventexposure.FieldStatusPhase, field.TypeEnum, value) + } + if _u.mutation.StatusPhaseCleared() { + _spec.ClearField(eventexposure.FieldStatusPhase, field.TypeEnum) + } + if value, ok := _u.mutation.StatusMessage(); ok { + _spec.SetField(eventexposure.FieldStatusMessage, field.TypeString, value) + } + if _u.mutation.StatusMessageCleared() { + _spec.ClearField(eventexposure.FieldStatusMessage, field.TypeString) + } + if value, ok := _u.mutation.Environment(); ok { + _spec.SetField(eventexposure.FieldEnvironment, field.TypeString, value) + } + if _u.mutation.EnvironmentCleared() { + _spec.ClearField(eventexposure.FieldEnvironment, field.TypeString) + } + if value, ok := _u.mutation.Namespace(); ok { + _spec.SetField(eventexposure.FieldNamespace, field.TypeString, value) + } + if value, ok := _u.mutation.EventType(); ok { + _spec.SetField(eventexposure.FieldEventType, field.TypeString, value) + } + if value, ok := _u.mutation.Visibility(); ok { + _spec.SetField(eventexposure.FieldVisibility, field.TypeEnum, value) + } + if value, ok := _u.mutation.Active(); ok { + _spec.SetField(eventexposure.FieldActive, field.TypeBool, value) + } + if _u.mutation.ActiveCleared() { + _spec.ClearField(eventexposure.FieldActive, field.TypeBool) + } + if value, ok := _u.mutation.ApprovalConfig(); ok { + _spec.SetField(eventexposure.FieldApprovalConfig, field.TypeJSON, value) + } + if _u.mutation.OwnerCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventexposure.OwnerTable, + Columns: []string{eventexposure.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(application.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventexposure.OwnerTable, + Columns: []string{eventexposure.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(application.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _u.mutation.SubscriptionsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: eventexposure.SubscriptionsTable, + Columns: []string{eventexposure.SubscriptionsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedSubscriptionsIDs(); len(nodes) > 0 && !_u.mutation.SubscriptionsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: eventexposure.SubscriptionsTable, + Columns: []string{eventexposure.SubscriptionsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.SubscriptionsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: eventexposure.SubscriptionsTable, + Columns: []string{eventexposure.SubscriptionsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{eventexposure.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return 0, err + } + _u.mutation.done = true + return _node, nil +} + +// EventExposureUpdateOne is the builder for updating a single EventExposure entity. +type EventExposureUpdateOne struct { + config + fields []string + hooks []Hook + mutation *EventExposureMutation +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_u *EventExposureUpdateOne) SetLastModifiedAt(v time.Time) *EventExposureUpdateOne { + _u.mutation.SetLastModifiedAt(v) + return _u +} + +// SetStatusPhase sets the "status_phase" field. +func (_u *EventExposureUpdateOne) SetStatusPhase(v eventexposure.StatusPhase) *EventExposureUpdateOne { + _u.mutation.SetStatusPhase(v) + return _u +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_u *EventExposureUpdateOne) SetNillableStatusPhase(v *eventexposure.StatusPhase) *EventExposureUpdateOne { + if v != nil { + _u.SetStatusPhase(*v) + } + return _u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (_u *EventExposureUpdateOne) ClearStatusPhase() *EventExposureUpdateOne { + _u.mutation.ClearStatusPhase() + return _u +} + +// SetStatusMessage sets the "status_message" field. +func (_u *EventExposureUpdateOne) SetStatusMessage(v string) *EventExposureUpdateOne { + _u.mutation.SetStatusMessage(v) + return _u +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_u *EventExposureUpdateOne) SetNillableStatusMessage(v *string) *EventExposureUpdateOne { + if v != nil { + _u.SetStatusMessage(*v) + } + return _u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (_u *EventExposureUpdateOne) ClearStatusMessage() *EventExposureUpdateOne { + _u.mutation.ClearStatusMessage() + return _u +} + +// SetEnvironment sets the "environment" field. +func (_u *EventExposureUpdateOne) SetEnvironment(v string) *EventExposureUpdateOne { + _u.mutation.SetEnvironment(v) + return _u +} + +// SetNillableEnvironment sets the "environment" field if the given value is not nil. +func (_u *EventExposureUpdateOne) SetNillableEnvironment(v *string) *EventExposureUpdateOne { + if v != nil { + _u.SetEnvironment(*v) + } + return _u +} + +// ClearEnvironment clears the value of the "environment" field. +func (_u *EventExposureUpdateOne) ClearEnvironment() *EventExposureUpdateOne { + _u.mutation.ClearEnvironment() + return _u +} + +// SetNamespace sets the "namespace" field. +func (_u *EventExposureUpdateOne) SetNamespace(v string) *EventExposureUpdateOne { + _u.mutation.SetNamespace(v) + return _u +} + +// SetNillableNamespace sets the "namespace" field if the given value is not nil. +func (_u *EventExposureUpdateOne) SetNillableNamespace(v *string) *EventExposureUpdateOne { + if v != nil { + _u.SetNamespace(*v) + } + return _u +} + +// SetEventType sets the "event_type" field. +func (_u *EventExposureUpdateOne) SetEventType(v string) *EventExposureUpdateOne { + _u.mutation.SetEventType(v) + return _u +} + +// SetNillableEventType sets the "event_type" field if the given value is not nil. +func (_u *EventExposureUpdateOne) SetNillableEventType(v *string) *EventExposureUpdateOne { + if v != nil { + _u.SetEventType(*v) + } + return _u +} + +// SetVisibility sets the "visibility" field. +func (_u *EventExposureUpdateOne) SetVisibility(v eventexposure.Visibility) *EventExposureUpdateOne { + _u.mutation.SetVisibility(v) + return _u +} + +// SetNillableVisibility sets the "visibility" field if the given value is not nil. +func (_u *EventExposureUpdateOne) SetNillableVisibility(v *eventexposure.Visibility) *EventExposureUpdateOne { + if v != nil { + _u.SetVisibility(*v) + } + return _u +} + +// SetActive sets the "active" field. +func (_u *EventExposureUpdateOne) SetActive(v bool) *EventExposureUpdateOne { + _u.mutation.SetActive(v) + return _u +} + +// SetNillableActive sets the "active" field if the given value is not nil. +func (_u *EventExposureUpdateOne) SetNillableActive(v *bool) *EventExposureUpdateOne { + if v != nil { + _u.SetActive(*v) + } + return _u +} + +// ClearActive clears the value of the "active" field. +func (_u *EventExposureUpdateOne) ClearActive() *EventExposureUpdateOne { + _u.mutation.ClearActive() + return _u +} + +// SetApprovalConfig sets the "approval_config" field. +func (_u *EventExposureUpdateOne) SetApprovalConfig(v model.ApprovalConfig) *EventExposureUpdateOne { + _u.mutation.SetApprovalConfig(v) + return _u +} + +// SetNillableApprovalConfig sets the "approval_config" field if the given value is not nil. +func (_u *EventExposureUpdateOne) SetNillableApprovalConfig(v *model.ApprovalConfig) *EventExposureUpdateOne { + if v != nil { + _u.SetApprovalConfig(*v) + } + return _u +} + +// SetOwnerID sets the "owner" edge to the Application entity by ID. +func (_u *EventExposureUpdateOne) SetOwnerID(id int) *EventExposureUpdateOne { + _u.mutation.SetOwnerID(id) + return _u +} + +// SetOwner sets the "owner" edge to the Application entity. +func (_u *EventExposureUpdateOne) SetOwner(v *Application) *EventExposureUpdateOne { + return _u.SetOwnerID(v.ID) +} + +// AddSubscriptionIDs adds the "subscriptions" edge to the EventSubscription entity by IDs. +func (_u *EventExposureUpdateOne) AddSubscriptionIDs(ids ...int) *EventExposureUpdateOne { + _u.mutation.AddSubscriptionIDs(ids...) + return _u +} + +// AddSubscriptions adds the "subscriptions" edges to the EventSubscription entity. +func (_u *EventExposureUpdateOne) AddSubscriptions(v ...*EventSubscription) *EventExposureUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddSubscriptionIDs(ids...) +} + +// Mutation returns the EventExposureMutation object of the builder. +func (_u *EventExposureUpdateOne) Mutation() *EventExposureMutation { + return _u.mutation +} + +// ClearOwner clears the "owner" edge to the Application entity. +func (_u *EventExposureUpdateOne) ClearOwner() *EventExposureUpdateOne { + _u.mutation.ClearOwner() + return _u +} + +// ClearSubscriptions clears all "subscriptions" edges to the EventSubscription entity. +func (_u *EventExposureUpdateOne) ClearSubscriptions() *EventExposureUpdateOne { + _u.mutation.ClearSubscriptions() + return _u +} + +// RemoveSubscriptionIDs removes the "subscriptions" edge to EventSubscription entities by IDs. +func (_u *EventExposureUpdateOne) RemoveSubscriptionIDs(ids ...int) *EventExposureUpdateOne { + _u.mutation.RemoveSubscriptionIDs(ids...) + return _u +} + +// RemoveSubscriptions removes "subscriptions" edges to EventSubscription entities. +func (_u *EventExposureUpdateOne) RemoveSubscriptions(v ...*EventSubscription) *EventExposureUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveSubscriptionIDs(ids...) +} + +// Where appends a list predicates to the EventExposureUpdate builder. +func (_u *EventExposureUpdateOne) Where(ps ...predicate.EventExposure) *EventExposureUpdateOne { + _u.mutation.Where(ps...) + return _u +} + +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (_u *EventExposureUpdateOne) Select(field string, fields ...string) *EventExposureUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u +} + +// Save executes the query and returns the updated EventExposure entity. +func (_u *EventExposureUpdateOne) Save(ctx context.Context) (*EventExposure, error) { + if err := _u.defaults(); err != nil { + return nil, err + } + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (_u *EventExposureUpdateOne) SaveX(ctx context.Context) *EventExposure { + node, err := _u.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (_u *EventExposureUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_u *EventExposureUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (_u *EventExposureUpdateOne) defaults() error { + if _, ok := _u.mutation.LastModifiedAt(); !ok { + if eventexposure.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized eventexposure.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := eventexposure.UpdateDefaultLastModifiedAt() + _u.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_u *EventExposureUpdateOne) check() error { + if v, ok := _u.mutation.StatusPhase(); ok { + if err := eventexposure.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "EventExposure.status_phase": %w`, err)} + } + } + if v, ok := _u.mutation.Namespace(); ok { + if err := eventexposure.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "EventExposure.namespace": %w`, err)} + } + } + if v, ok := _u.mutation.EventType(); ok { + if err := eventexposure.EventTypeValidator(v); err != nil { + return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "EventExposure.event_type": %w`, err)} + } + } + if v, ok := _u.mutation.Visibility(); ok { + if err := eventexposure.VisibilityValidator(v); err != nil { + return &ValidationError{Name: "visibility", err: fmt.Errorf(`ent: validator failed for field "EventExposure.visibility": %w`, err)} + } + } + if _u.mutation.OwnerCleared() && len(_u.mutation.OwnerIDs()) > 0 { + return errors.New(`ent: clearing a required unique edge "EventExposure.owner"`) + } + return nil +} + +func (_u *EventExposureUpdateOne) sqlSave(ctx context.Context) (_node *EventExposure, err error) { + if err := _u.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(eventexposure.Table, eventexposure.Columns, sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt)) + id, ok := _u.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "EventExposure.id" for update`)} + } + _spec.Node.ID.Value = id + if fields := _u.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, eventexposure.FieldID) + for _, f := range fields { + if !eventexposure.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != eventexposure.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } + if ps := _u.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := _u.mutation.LastModifiedAt(); ok { + _spec.SetField(eventexposure.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := _u.mutation.StatusPhase(); ok { + _spec.SetField(eventexposure.FieldStatusPhase, field.TypeEnum, value) + } + if _u.mutation.StatusPhaseCleared() { + _spec.ClearField(eventexposure.FieldStatusPhase, field.TypeEnum) + } + if value, ok := _u.mutation.StatusMessage(); ok { + _spec.SetField(eventexposure.FieldStatusMessage, field.TypeString, value) + } + if _u.mutation.StatusMessageCleared() { + _spec.ClearField(eventexposure.FieldStatusMessage, field.TypeString) + } + if value, ok := _u.mutation.Environment(); ok { + _spec.SetField(eventexposure.FieldEnvironment, field.TypeString, value) + } + if _u.mutation.EnvironmentCleared() { + _spec.ClearField(eventexposure.FieldEnvironment, field.TypeString) + } + if value, ok := _u.mutation.Namespace(); ok { + _spec.SetField(eventexposure.FieldNamespace, field.TypeString, value) + } + if value, ok := _u.mutation.EventType(); ok { + _spec.SetField(eventexposure.FieldEventType, field.TypeString, value) + } + if value, ok := _u.mutation.Visibility(); ok { + _spec.SetField(eventexposure.FieldVisibility, field.TypeEnum, value) + } + if value, ok := _u.mutation.Active(); ok { + _spec.SetField(eventexposure.FieldActive, field.TypeBool, value) + } + if _u.mutation.ActiveCleared() { + _spec.ClearField(eventexposure.FieldActive, field.TypeBool) + } + if value, ok := _u.mutation.ApprovalConfig(); ok { + _spec.SetField(eventexposure.FieldApprovalConfig, field.TypeJSON, value) + } + if _u.mutation.OwnerCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventexposure.OwnerTable, + Columns: []string{eventexposure.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(application.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventexposure.OwnerTable, + Columns: []string{eventexposure.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(application.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _u.mutation.SubscriptionsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: eventexposure.SubscriptionsTable, + Columns: []string{eventexposure.SubscriptionsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedSubscriptionsIDs(); len(nodes) > 0 && !_u.mutation.SubscriptionsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: eventexposure.SubscriptionsTable, + Columns: []string{eventexposure.SubscriptionsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.SubscriptionsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: eventexposure.SubscriptionsTable, + Columns: []string{eventexposure.SubscriptionsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + _node = &EventExposure{config: _u.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues + if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{eventexposure.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + _u.mutation.done = true + return _node, nil +} diff --git a/controlplane-api/ent/eventsubscription.go b/controlplane-api/ent/eventsubscription.go new file mode 100644 index 000000000..9e7f32a4c --- /dev/null +++ b/controlplane-api/ent/eventsubscription.go @@ -0,0 +1,351 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "fmt" + "strings" + "time" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/approval" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" +) + +// EventSubscription is the model entity for the EventSubscription schema. +type EventSubscription struct { + config `json:"-"` + // ID of the ent. + ID int `json:"id,omitempty"` + // CreatedAt holds the value of the "created_at" field. + CreatedAt time.Time `json:"created_at,omitempty"` + // LastModifiedAt holds the value of the "last_modified_at" field. + LastModifiedAt time.Time `json:"last_modified_at,omitempty"` + // StatusPhase holds the value of the "status_phase" field. + StatusPhase *eventsubscription.StatusPhase `json:"status_phase,omitempty"` + // StatusMessage holds the value of the "status_message" field. + StatusMessage *string `json:"status_message,omitempty"` + // Environment holds the value of the "environment" field. + Environment *string `json:"environment,omitempty"` + // Namespace holds the value of the "namespace" field. + Namespace string `json:"namespace,omitempty"` + // Name holds the value of the "name" field. + Name string `json:"name,omitempty"` + // EventType holds the value of the "event_type" field. + EventType string `json:"event_type,omitempty"` + // DeliveryType holds the value of the "delivery_type" field. + DeliveryType eventsubscription.DeliveryType `json:"delivery_type,omitempty"` + // CallbackURL holds the value of the "callback_url" field. + CallbackURL *string `json:"callback_url,omitempty"` + // Edges holds the relations/edges for other nodes in the graph. + // The values are being populated by the EventSubscriptionQuery when eager-loading is set. + Edges EventSubscriptionEdges `json:"edges"` + application_subscribed_events *int + event_subscription_target *int + selectValues sql.SelectValues +} + +// EventSubscriptionEdges holds the relations/edges for other nodes in the graph. +type EventSubscriptionEdges struct { + // Owner holds the value of the owner edge. + Owner *Application `json:"owner,omitempty"` + // Target holds the value of the target edge. + Target *EventExposure `json:"target,omitempty"` + // Approval holds the value of the approval edge. + Approval *Approval `json:"approval,omitempty"` + // ApprovalRequests holds the value of the approval_requests edge. + ApprovalRequests []*ApprovalRequest `json:"approval_requests,omitempty"` + // loadedTypes holds the information for reporting if a + // type was loaded (or requested) in eager-loading or not. + loadedTypes [4]bool + // totalCount holds the count of the edges above. + totalCount [3]map[string]int + + namedApprovalRequests map[string][]*ApprovalRequest +} + +// OwnerOrErr returns the Owner value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e EventSubscriptionEdges) OwnerOrErr() (*Application, error) { + if e.Owner != nil { + return e.Owner, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: application.Label} + } + return nil, &NotLoadedError{edge: "owner"} +} + +// TargetOrErr returns the Target value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e EventSubscriptionEdges) TargetOrErr() (*EventExposure, error) { + if e.Target != nil { + return e.Target, nil + } else if e.loadedTypes[1] { + return nil, &NotFoundError{label: eventexposure.Label} + } + return nil, &NotLoadedError{edge: "target"} +} + +// ApprovalOrErr returns the Approval value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e EventSubscriptionEdges) ApprovalOrErr() (*Approval, error) { + if e.Approval != nil { + return e.Approval, nil + } else if e.loadedTypes[2] { + return nil, &NotFoundError{label: approval.Label} + } + return nil, &NotLoadedError{edge: "approval"} +} + +// ApprovalRequestsOrErr returns the ApprovalRequests value or an error if the edge +// was not loaded in eager-loading. +func (e EventSubscriptionEdges) ApprovalRequestsOrErr() ([]*ApprovalRequest, error) { + if e.loadedTypes[3] { + return e.ApprovalRequests, nil + } + return nil, &NotLoadedError{edge: "approval_requests"} +} + +// scanValues returns the types for scanning values from sql.Rows. +func (*EventSubscription) scanValues(columns []string) ([]any, error) { + values := make([]any, len(columns)) + for i := range columns { + switch columns[i] { + case eventsubscription.FieldID: + values[i] = new(sql.NullInt64) + case eventsubscription.FieldStatusPhase, eventsubscription.FieldStatusMessage, eventsubscription.FieldEnvironment, eventsubscription.FieldNamespace, eventsubscription.FieldName, eventsubscription.FieldEventType, eventsubscription.FieldDeliveryType, eventsubscription.FieldCallbackURL: + values[i] = new(sql.NullString) + case eventsubscription.FieldCreatedAt, eventsubscription.FieldLastModifiedAt: + values[i] = new(sql.NullTime) + case eventsubscription.ForeignKeys[0]: // application_subscribed_events + values[i] = new(sql.NullInt64) + case eventsubscription.ForeignKeys[1]: // event_subscription_target + values[i] = new(sql.NullInt64) + default: + values[i] = new(sql.UnknownType) + } + } + return values, nil +} + +// assignValues assigns the values that were returned from sql.Rows (after scanning) +// to the EventSubscription fields. +func (_m *EventSubscription) assignValues(columns []string, values []any) error { + if m, n := len(values), len(columns); m < n { + return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) + } + for i := range columns { + switch columns[i] { + case eventsubscription.FieldID: + value, ok := values[i].(*sql.NullInt64) + if !ok { + return fmt.Errorf("unexpected type %T for field id", value) + } + _m.ID = int(value.Int64) + case eventsubscription.FieldCreatedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field created_at", values[i]) + } else if value.Valid { + _m.CreatedAt = value.Time + } + case eventsubscription.FieldLastModifiedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field last_modified_at", values[i]) + } else if value.Valid { + _m.LastModifiedAt = value.Time + } + case eventsubscription.FieldStatusPhase: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field status_phase", values[i]) + } else if value.Valid { + _m.StatusPhase = new(eventsubscription.StatusPhase) + *_m.StatusPhase = eventsubscription.StatusPhase(value.String) + } + case eventsubscription.FieldStatusMessage: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field status_message", values[i]) + } else if value.Valid { + _m.StatusMessage = new(string) + *_m.StatusMessage = value.String + } + case eventsubscription.FieldEnvironment: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field environment", values[i]) + } else if value.Valid { + _m.Environment = new(string) + *_m.Environment = value.String + } + case eventsubscription.FieldNamespace: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field namespace", values[i]) + } else if value.Valid { + _m.Namespace = value.String + } + case eventsubscription.FieldName: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field name", values[i]) + } else if value.Valid { + _m.Name = value.String + } + case eventsubscription.FieldEventType: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field event_type", values[i]) + } else if value.Valid { + _m.EventType = value.String + } + case eventsubscription.FieldDeliveryType: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field delivery_type", values[i]) + } else if value.Valid { + _m.DeliveryType = eventsubscription.DeliveryType(value.String) + } + case eventsubscription.FieldCallbackURL: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field callback_url", values[i]) + } else if value.Valid { + _m.CallbackURL = new(string) + *_m.CallbackURL = value.String + } + case eventsubscription.ForeignKeys[0]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field application_subscribed_events", value) + } else if value.Valid { + _m.application_subscribed_events = new(int) + *_m.application_subscribed_events = int(value.Int64) + } + case eventsubscription.ForeignKeys[1]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field event_subscription_target", value) + } else if value.Valid { + _m.event_subscription_target = new(int) + *_m.event_subscription_target = int(value.Int64) + } + default: + _m.selectValues.Set(columns[i], values[i]) + } + } + return nil +} + +// Value returns the ent.Value that was dynamically selected and assigned to the EventSubscription. +// This includes values selected through modifiers, order, etc. +func (_m *EventSubscription) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) +} + +// QueryOwner queries the "owner" edge of the EventSubscription entity. +func (_m *EventSubscription) QueryOwner() *ApplicationQuery { + return NewEventSubscriptionClient(_m.config).QueryOwner(_m) +} + +// QueryTarget queries the "target" edge of the EventSubscription entity. +func (_m *EventSubscription) QueryTarget() *EventExposureQuery { + return NewEventSubscriptionClient(_m.config).QueryTarget(_m) +} + +// QueryApproval queries the "approval" edge of the EventSubscription entity. +func (_m *EventSubscription) QueryApproval() *ApprovalQuery { + return NewEventSubscriptionClient(_m.config).QueryApproval(_m) +} + +// QueryApprovalRequests queries the "approval_requests" edge of the EventSubscription entity. +func (_m *EventSubscription) QueryApprovalRequests() *ApprovalRequestQuery { + return NewEventSubscriptionClient(_m.config).QueryApprovalRequests(_m) +} + +// Update returns a builder for updating this EventSubscription. +// Note that you need to call EventSubscription.Unwrap() before calling this method if this EventSubscription +// was returned from a transaction, and the transaction was committed or rolled back. +func (_m *EventSubscription) Update() *EventSubscriptionUpdateOne { + return NewEventSubscriptionClient(_m.config).UpdateOne(_m) +} + +// Unwrap unwraps the EventSubscription entity that was returned from a transaction after it was closed, +// so that all future queries will be executed through the driver which created the transaction. +func (_m *EventSubscription) Unwrap() *EventSubscription { + _tx, ok := _m.config.driver.(*txDriver) + if !ok { + panic("ent: EventSubscription is not a transactional entity") + } + _m.config.driver = _tx.drv + return _m +} + +// String implements the fmt.Stringer. +func (_m *EventSubscription) String() string { + var builder strings.Builder + builder.WriteString("EventSubscription(") + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) + builder.WriteString("created_at=") + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) + builder.WriteString(", ") + builder.WriteString("last_modified_at=") + builder.WriteString(_m.LastModifiedAt.Format(time.ANSIC)) + builder.WriteString(", ") + if v := _m.StatusPhase; v != nil { + builder.WriteString("status_phase=") + builder.WriteString(fmt.Sprintf("%v", *v)) + } + builder.WriteString(", ") + if v := _m.StatusMessage; v != nil { + builder.WriteString("status_message=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := _m.Environment; v != nil { + builder.WriteString("environment=") + builder.WriteString(*v) + } + builder.WriteString(", ") + builder.WriteString("namespace=") + builder.WriteString(_m.Namespace) + builder.WriteString(", ") + builder.WriteString("name=") + builder.WriteString(_m.Name) + builder.WriteString(", ") + builder.WriteString("event_type=") + builder.WriteString(_m.EventType) + builder.WriteString(", ") + builder.WriteString("delivery_type=") + builder.WriteString(fmt.Sprintf("%v", _m.DeliveryType)) + builder.WriteString(", ") + if v := _m.CallbackURL; v != nil { + builder.WriteString("callback_url=") + builder.WriteString(*v) + } + builder.WriteByte(')') + return builder.String() +} + +// NamedApprovalRequests returns the ApprovalRequests named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *EventSubscription) NamedApprovalRequests(name string) ([]*ApprovalRequest, error) { + if _m.Edges.namedApprovalRequests == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedApprovalRequests[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *EventSubscription) appendNamedApprovalRequests(name string, edges ...*ApprovalRequest) { + if _m.Edges.namedApprovalRequests == nil { + _m.Edges.namedApprovalRequests = make(map[string][]*ApprovalRequest) + } + if len(edges) == 0 { + _m.Edges.namedApprovalRequests[name] = []*ApprovalRequest{} + } else { + _m.Edges.namedApprovalRequests[name] = append(_m.Edges.namedApprovalRequests[name], edges...) + } +} + +// EventSubscriptions is a parsable slice of EventSubscription. +type EventSubscriptions []*EventSubscription diff --git a/controlplane-api/ent/eventsubscription/eventsubscription.go b/controlplane-api/ent/eventsubscription/eventsubscription.go new file mode 100644 index 000000000..73e604abc --- /dev/null +++ b/controlplane-api/ent/eventsubscription/eventsubscription.go @@ -0,0 +1,349 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package eventsubscription + +import ( + "fmt" + "io" + "strconv" + "time" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" +) + +const ( + // Label holds the string label denoting the eventsubscription type in the database. + Label = "event_subscription" + // FieldID holds the string denoting the id field in the database. + FieldID = "id" + // FieldCreatedAt holds the string denoting the created_at field in the database. + FieldCreatedAt = "created_at" + // FieldLastModifiedAt holds the string denoting the last_modified_at field in the database. + FieldLastModifiedAt = "last_modified_at" + // FieldStatusPhase holds the string denoting the status_phase field in the database. + FieldStatusPhase = "status_phase" + // FieldStatusMessage holds the string denoting the status_message field in the database. + FieldStatusMessage = "status_message" + // FieldEnvironment holds the string denoting the environment field in the database. + FieldEnvironment = "environment" + // FieldNamespace holds the string denoting the namespace field in the database. + FieldNamespace = "namespace" + // FieldName holds the string denoting the name field in the database. + FieldName = "name" + // FieldEventType holds the string denoting the event_type field in the database. + FieldEventType = "event_type" + // FieldDeliveryType holds the string denoting the delivery_type field in the database. + FieldDeliveryType = "delivery_type" + // FieldCallbackURL holds the string denoting the callback_url field in the database. + FieldCallbackURL = "callback_url" + // EdgeOwner holds the string denoting the owner edge name in mutations. + EdgeOwner = "owner" + // EdgeTarget holds the string denoting the target edge name in mutations. + EdgeTarget = "target" + // EdgeApproval holds the string denoting the approval edge name in mutations. + EdgeApproval = "approval" + // EdgeApprovalRequests holds the string denoting the approval_requests edge name in mutations. + EdgeApprovalRequests = "approval_requests" + // Table holds the table name of the eventsubscription in the database. + Table = "event_subscriptions" + // OwnerTable is the table that holds the owner relation/edge. + OwnerTable = "event_subscriptions" + // OwnerInverseTable is the table name for the Application entity. + // It exists in this package in order to avoid circular dependency with the "application" package. + OwnerInverseTable = "applications" + // OwnerColumn is the table column denoting the owner relation/edge. + OwnerColumn = "application_subscribed_events" + // TargetTable is the table that holds the target relation/edge. + TargetTable = "event_subscriptions" + // TargetInverseTable is the table name for the EventExposure entity. + // It exists in this package in order to avoid circular dependency with the "eventexposure" package. + TargetInverseTable = "event_exposures" + // TargetColumn is the table column denoting the target relation/edge. + TargetColumn = "event_subscription_target" + // ApprovalTable is the table that holds the approval relation/edge. + ApprovalTable = "approvals" + // ApprovalInverseTable is the table name for the Approval entity. + // It exists in this package in order to avoid circular dependency with the "approval" package. + ApprovalInverseTable = "approvals" + // ApprovalColumn is the table column denoting the approval relation/edge. + ApprovalColumn = "event_subscription_approval" + // ApprovalRequestsTable is the table that holds the approval_requests relation/edge. + ApprovalRequestsTable = "approval_requests" + // ApprovalRequestsInverseTable is the table name for the ApprovalRequest entity. + // It exists in this package in order to avoid circular dependency with the "approvalrequest" package. + ApprovalRequestsInverseTable = "approval_requests" + // ApprovalRequestsColumn is the table column denoting the approval_requests relation/edge. + ApprovalRequestsColumn = "event_subscription_approval_requests" +) + +// Columns holds all SQL columns for eventsubscription fields. +var Columns = []string{ + FieldID, + FieldCreatedAt, + FieldLastModifiedAt, + FieldStatusPhase, + FieldStatusMessage, + FieldEnvironment, + FieldNamespace, + FieldName, + FieldEventType, + FieldDeliveryType, + FieldCallbackURL, +} + +// ForeignKeys holds the SQL foreign-keys that are owned by the "event_subscriptions" +// table and are not defined as standalone fields in the schema. +var ForeignKeys = []string{ + "application_subscribed_events", + "event_subscription_target", +} + +// ValidColumn reports if the column name is valid (part of the table columns). +func ValidColumn(column string) bool { + for i := range Columns { + if column == Columns[i] { + return true + } + } + for i := range ForeignKeys { + if column == ForeignKeys[i] { + return true + } + } + return false +} + +// Note that the variables below are initialized by the runtime +// package on the initialization of the application. Therefore, +// it should be imported in the main as follows: +// +// import _ "github.com/telekom/controlplane/controlplane-api/ent/runtime" +var ( + Hooks [1]ent.Hook + Policy ent.Policy + // DefaultCreatedAt holds the default value on creation for the "created_at" field. + DefaultCreatedAt func() time.Time + // DefaultLastModifiedAt holds the default value on creation for the "last_modified_at" field. + DefaultLastModifiedAt func() time.Time + // UpdateDefaultLastModifiedAt holds the default value on update for the "last_modified_at" field. + UpdateDefaultLastModifiedAt func() time.Time + // NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. + NamespaceValidator func(string) error + // NameValidator is a validator for the "name" field. It is called by the builders before save. + NameValidator func(string) error + // EventTypeValidator is a validator for the "event_type" field. It is called by the builders before save. + EventTypeValidator func(string) error +) + +// StatusPhase defines the type for the "status_phase" enum field. +type StatusPhase string + +// StatusPhase values. +const ( + StatusPhaseReady StatusPhase = "READY" + StatusPhasePending StatusPhase = "PENDING" + StatusPhaseError StatusPhase = "ERROR" + StatusPhaseUnknown StatusPhase = "UNKNOWN" +) + +func (sp StatusPhase) String() string { + return string(sp) +} + +// StatusPhaseValidator is a validator for the "status_phase" field enum values. It is called by the builders before save. +func StatusPhaseValidator(sp StatusPhase) error { + switch sp { + case StatusPhaseReady, StatusPhasePending, StatusPhaseError, StatusPhaseUnknown: + return nil + default: + return fmt.Errorf("eventsubscription: invalid enum value for status_phase field: %q", sp) + } +} + +// DeliveryType defines the type for the "delivery_type" enum field. +type DeliveryType string + +// DeliveryTypeCallback is the default value of the DeliveryType enum. +const DefaultDeliveryType = DeliveryTypeCallback + +// DeliveryType values. +const ( + DeliveryTypeCallback DeliveryType = "CALLBACK" + DeliveryTypeServerSentEvent DeliveryType = "SERVER_SENT_EVENT" +) + +func (dt DeliveryType) String() string { + return string(dt) +} + +// DeliveryTypeValidator is a validator for the "delivery_type" field enum values. It is called by the builders before save. +func DeliveryTypeValidator(dt DeliveryType) error { + switch dt { + case DeliveryTypeCallback, DeliveryTypeServerSentEvent: + return nil + default: + return fmt.Errorf("eventsubscription: invalid enum value for delivery_type field: %q", dt) + } +} + +// OrderOption defines the ordering options for the EventSubscription queries. +type OrderOption func(*sql.Selector) + +// ByID orders the results by the id field. +func ByID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldID, opts...).ToFunc() +} + +// ByCreatedAt orders the results by the created_at field. +func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() +} + +// ByLastModifiedAt orders the results by the last_modified_at field. +func ByLastModifiedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldLastModifiedAt, opts...).ToFunc() +} + +// ByStatusPhase orders the results by the status_phase field. +func ByStatusPhase(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldStatusPhase, opts...).ToFunc() +} + +// ByStatusMessage orders the results by the status_message field. +func ByStatusMessage(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldStatusMessage, opts...).ToFunc() +} + +// ByEnvironment orders the results by the environment field. +func ByEnvironment(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldEnvironment, opts...).ToFunc() +} + +// ByNamespace orders the results by the namespace field. +func ByNamespace(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldNamespace, opts...).ToFunc() +} + +// ByName orders the results by the name field. +func ByName(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldName, opts...).ToFunc() +} + +// ByEventType orders the results by the event_type field. +func ByEventType(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldEventType, opts...).ToFunc() +} + +// ByDeliveryType orders the results by the delivery_type field. +func ByDeliveryType(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldDeliveryType, opts...).ToFunc() +} + +// ByCallbackURL orders the results by the callback_url field. +func ByCallbackURL(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCallbackURL, opts...).ToFunc() +} + +// ByOwnerField orders the results by owner field. +func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...)) + } +} + +// ByTargetField orders the results by target field. +func ByTargetField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newTargetStep(), sql.OrderByField(field, opts...)) + } +} + +// ByApprovalField orders the results by approval field. +func ByApprovalField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newApprovalStep(), sql.OrderByField(field, opts...)) + } +} + +// ByApprovalRequestsCount orders the results by approval_requests count. +func ByApprovalRequestsCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newApprovalRequestsStep(), opts...) + } +} + +// ByApprovalRequests orders the results by approval_requests terms. +func ByApprovalRequests(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newApprovalRequestsStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} +func newOwnerStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(OwnerInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn), + ) +} +func newTargetStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(TargetInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, TargetTable, TargetColumn), + ) +} +func newApprovalStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(ApprovalInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2O, false, ApprovalTable, ApprovalColumn), + ) +} +func newApprovalRequestsStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(ApprovalRequestsInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ApprovalRequestsTable, ApprovalRequestsColumn), + ) +} + +// MarshalGQL implements graphql.Marshaler interface. +func (e StatusPhase) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(e.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (e *StatusPhase) UnmarshalGQL(val interface{}) error { + str, ok := val.(string) + if !ok { + return fmt.Errorf("enum %T must be a string", val) + } + *e = StatusPhase(str) + if err := StatusPhaseValidator(*e); err != nil { + return fmt.Errorf("%s is not a valid StatusPhase", str) + } + return nil +} + +// MarshalGQL implements graphql.Marshaler interface. +func (e DeliveryType) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(e.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (e *DeliveryType) UnmarshalGQL(val interface{}) error { + str, ok := val.(string) + if !ok { + return fmt.Errorf("enum %T must be a string", val) + } + *e = DeliveryType(str) + if err := DeliveryTypeValidator(*e); err != nil { + return fmt.Errorf("%s is not a valid DeliveryType", str) + } + return nil +} diff --git a/controlplane-api/ent/eventsubscription/where.go b/controlplane-api/ent/eventsubscription/where.go new file mode 100644 index 000000000..5fcb5f9f4 --- /dev/null +++ b/controlplane-api/ent/eventsubscription/where.go @@ -0,0 +1,756 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package eventsubscription + +import ( + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" +) + +// ID filters vertices based on their ID field. +func ID(id int) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldID, id)) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id int) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldID, id)) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id int) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldID, id)) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...int) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldID, ids...)) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...int) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldID, ids...)) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id int) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGT(FieldID, id)) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id int) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGTE(FieldID, id)) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id int) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLT(FieldID, id)) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id int) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLTE(FieldID, id)) +} + +// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. +func CreatedAt(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldCreatedAt, v)) +} + +// LastModifiedAt applies equality check predicate on the "last_modified_at" field. It's identical to LastModifiedAtEQ. +func LastModifiedAt(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// StatusMessage applies equality check predicate on the "status_message" field. It's identical to StatusMessageEQ. +func StatusMessage(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldStatusMessage, v)) +} + +// Environment applies equality check predicate on the "environment" field. It's identical to EnvironmentEQ. +func Environment(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldEnvironment, v)) +} + +// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ. +func Namespace(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldNamespace, v)) +} + +// Name applies equality check predicate on the "name" field. It's identical to NameEQ. +func Name(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldName, v)) +} + +// EventType applies equality check predicate on the "event_type" field. It's identical to EventTypeEQ. +func EventType(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldEventType, v)) +} + +// CallbackURL applies equality check predicate on the "callback_url" field. It's identical to CallbackURLEQ. +func CallbackURL(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldCallbackURL, v)) +} + +// CreatedAtEQ applies the EQ predicate on the "created_at" field. +func CreatedAtEQ(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldCreatedAt, v)) +} + +// CreatedAtNEQ applies the NEQ predicate on the "created_at" field. +func CreatedAtNEQ(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldCreatedAt, v)) +} + +// CreatedAtIn applies the In predicate on the "created_at" field. +func CreatedAtIn(vs ...time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldCreatedAt, vs...)) +} + +// CreatedAtNotIn applies the NotIn predicate on the "created_at" field. +func CreatedAtNotIn(vs ...time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldCreatedAt, vs...)) +} + +// CreatedAtGT applies the GT predicate on the "created_at" field. +func CreatedAtGT(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGT(FieldCreatedAt, v)) +} + +// CreatedAtGTE applies the GTE predicate on the "created_at" field. +func CreatedAtGTE(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGTE(FieldCreatedAt, v)) +} + +// CreatedAtLT applies the LT predicate on the "created_at" field. +func CreatedAtLT(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLT(FieldCreatedAt, v)) +} + +// CreatedAtLTE applies the LTE predicate on the "created_at" field. +func CreatedAtLTE(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLTE(FieldCreatedAt, v)) +} + +// LastModifiedAtEQ applies the EQ predicate on the "last_modified_at" field. +func LastModifiedAtEQ(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtNEQ applies the NEQ predicate on the "last_modified_at" field. +func LastModifiedAtNEQ(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtIn applies the In predicate on the "last_modified_at" field. +func LastModifiedAtIn(vs ...time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtNotIn applies the NotIn predicate on the "last_modified_at" field. +func LastModifiedAtNotIn(vs ...time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtGT applies the GT predicate on the "last_modified_at" field. +func LastModifiedAtGT(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtGTE applies the GTE predicate on the "last_modified_at" field. +func LastModifiedAtGTE(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGTE(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLT applies the LT predicate on the "last_modified_at" field. +func LastModifiedAtLT(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLTE applies the LTE predicate on the "last_modified_at" field. +func LastModifiedAtLTE(v time.Time) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLTE(FieldLastModifiedAt, v)) +} + +// StatusPhaseEQ applies the EQ predicate on the "status_phase" field. +func StatusPhaseEQ(v StatusPhase) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldStatusPhase, v)) +} + +// StatusPhaseNEQ applies the NEQ predicate on the "status_phase" field. +func StatusPhaseNEQ(v StatusPhase) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldStatusPhase, v)) +} + +// StatusPhaseIn applies the In predicate on the "status_phase" field. +func StatusPhaseIn(vs ...StatusPhase) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldStatusPhase, vs...)) +} + +// StatusPhaseNotIn applies the NotIn predicate on the "status_phase" field. +func StatusPhaseNotIn(vs ...StatusPhase) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldStatusPhase, vs...)) +} + +// StatusPhaseIsNil applies the IsNil predicate on the "status_phase" field. +func StatusPhaseIsNil() predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIsNull(FieldStatusPhase)) +} + +// StatusPhaseNotNil applies the NotNil predicate on the "status_phase" field. +func StatusPhaseNotNil() predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotNull(FieldStatusPhase)) +} + +// StatusMessageEQ applies the EQ predicate on the "status_message" field. +func StatusMessageEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldStatusMessage, v)) +} + +// StatusMessageNEQ applies the NEQ predicate on the "status_message" field. +func StatusMessageNEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldStatusMessage, v)) +} + +// StatusMessageIn applies the In predicate on the "status_message" field. +func StatusMessageIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldStatusMessage, vs...)) +} + +// StatusMessageNotIn applies the NotIn predicate on the "status_message" field. +func StatusMessageNotIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldStatusMessage, vs...)) +} + +// StatusMessageGT applies the GT predicate on the "status_message" field. +func StatusMessageGT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGT(FieldStatusMessage, v)) +} + +// StatusMessageGTE applies the GTE predicate on the "status_message" field. +func StatusMessageGTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGTE(FieldStatusMessage, v)) +} + +// StatusMessageLT applies the LT predicate on the "status_message" field. +func StatusMessageLT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLT(FieldStatusMessage, v)) +} + +// StatusMessageLTE applies the LTE predicate on the "status_message" field. +func StatusMessageLTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLTE(FieldStatusMessage, v)) +} + +// StatusMessageContains applies the Contains predicate on the "status_message" field. +func StatusMessageContains(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContains(FieldStatusMessage, v)) +} + +// StatusMessageHasPrefix applies the HasPrefix predicate on the "status_message" field. +func StatusMessageHasPrefix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasPrefix(FieldStatusMessage, v)) +} + +// StatusMessageHasSuffix applies the HasSuffix predicate on the "status_message" field. +func StatusMessageHasSuffix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasSuffix(FieldStatusMessage, v)) +} + +// StatusMessageIsNil applies the IsNil predicate on the "status_message" field. +func StatusMessageIsNil() predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIsNull(FieldStatusMessage)) +} + +// StatusMessageNotNil applies the NotNil predicate on the "status_message" field. +func StatusMessageNotNil() predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotNull(FieldStatusMessage)) +} + +// StatusMessageEqualFold applies the EqualFold predicate on the "status_message" field. +func StatusMessageEqualFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEqualFold(FieldStatusMessage, v)) +} + +// StatusMessageContainsFold applies the ContainsFold predicate on the "status_message" field. +func StatusMessageContainsFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContainsFold(FieldStatusMessage, v)) +} + +// EnvironmentEQ applies the EQ predicate on the "environment" field. +func EnvironmentEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldEnvironment, v)) +} + +// EnvironmentNEQ applies the NEQ predicate on the "environment" field. +func EnvironmentNEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldEnvironment, v)) +} + +// EnvironmentIn applies the In predicate on the "environment" field. +func EnvironmentIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldEnvironment, vs...)) +} + +// EnvironmentNotIn applies the NotIn predicate on the "environment" field. +func EnvironmentNotIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldEnvironment, vs...)) +} + +// EnvironmentGT applies the GT predicate on the "environment" field. +func EnvironmentGT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGT(FieldEnvironment, v)) +} + +// EnvironmentGTE applies the GTE predicate on the "environment" field. +func EnvironmentGTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGTE(FieldEnvironment, v)) +} + +// EnvironmentLT applies the LT predicate on the "environment" field. +func EnvironmentLT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLT(FieldEnvironment, v)) +} + +// EnvironmentLTE applies the LTE predicate on the "environment" field. +func EnvironmentLTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLTE(FieldEnvironment, v)) +} + +// EnvironmentContains applies the Contains predicate on the "environment" field. +func EnvironmentContains(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContains(FieldEnvironment, v)) +} + +// EnvironmentHasPrefix applies the HasPrefix predicate on the "environment" field. +func EnvironmentHasPrefix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasPrefix(FieldEnvironment, v)) +} + +// EnvironmentHasSuffix applies the HasSuffix predicate on the "environment" field. +func EnvironmentHasSuffix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasSuffix(FieldEnvironment, v)) +} + +// EnvironmentIsNil applies the IsNil predicate on the "environment" field. +func EnvironmentIsNil() predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIsNull(FieldEnvironment)) +} + +// EnvironmentNotNil applies the NotNil predicate on the "environment" field. +func EnvironmentNotNil() predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotNull(FieldEnvironment)) +} + +// EnvironmentEqualFold applies the EqualFold predicate on the "environment" field. +func EnvironmentEqualFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEqualFold(FieldEnvironment, v)) +} + +// EnvironmentContainsFold applies the ContainsFold predicate on the "environment" field. +func EnvironmentContainsFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContainsFold(FieldEnvironment, v)) +} + +// NamespaceEQ applies the EQ predicate on the "namespace" field. +func NamespaceEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldNamespace, v)) +} + +// NamespaceNEQ applies the NEQ predicate on the "namespace" field. +func NamespaceNEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldNamespace, v)) +} + +// NamespaceIn applies the In predicate on the "namespace" field. +func NamespaceIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldNamespace, vs...)) +} + +// NamespaceNotIn applies the NotIn predicate on the "namespace" field. +func NamespaceNotIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldNamespace, vs...)) +} + +// NamespaceGT applies the GT predicate on the "namespace" field. +func NamespaceGT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGT(FieldNamespace, v)) +} + +// NamespaceGTE applies the GTE predicate on the "namespace" field. +func NamespaceGTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGTE(FieldNamespace, v)) +} + +// NamespaceLT applies the LT predicate on the "namespace" field. +func NamespaceLT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLT(FieldNamespace, v)) +} + +// NamespaceLTE applies the LTE predicate on the "namespace" field. +func NamespaceLTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLTE(FieldNamespace, v)) +} + +// NamespaceContains applies the Contains predicate on the "namespace" field. +func NamespaceContains(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContains(FieldNamespace, v)) +} + +// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field. +func NamespaceHasPrefix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasPrefix(FieldNamespace, v)) +} + +// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field. +func NamespaceHasSuffix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasSuffix(FieldNamespace, v)) +} + +// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field. +func NamespaceEqualFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEqualFold(FieldNamespace, v)) +} + +// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field. +func NamespaceContainsFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContainsFold(FieldNamespace, v)) +} + +// NameEQ applies the EQ predicate on the "name" field. +func NameEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldName, v)) +} + +// NameNEQ applies the NEQ predicate on the "name" field. +func NameNEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldName, v)) +} + +// NameIn applies the In predicate on the "name" field. +func NameIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldName, vs...)) +} + +// NameNotIn applies the NotIn predicate on the "name" field. +func NameNotIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldName, vs...)) +} + +// NameGT applies the GT predicate on the "name" field. +func NameGT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGT(FieldName, v)) +} + +// NameGTE applies the GTE predicate on the "name" field. +func NameGTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGTE(FieldName, v)) +} + +// NameLT applies the LT predicate on the "name" field. +func NameLT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLT(FieldName, v)) +} + +// NameLTE applies the LTE predicate on the "name" field. +func NameLTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLTE(FieldName, v)) +} + +// NameContains applies the Contains predicate on the "name" field. +func NameContains(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContains(FieldName, v)) +} + +// NameHasPrefix applies the HasPrefix predicate on the "name" field. +func NameHasPrefix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasPrefix(FieldName, v)) +} + +// NameHasSuffix applies the HasSuffix predicate on the "name" field. +func NameHasSuffix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasSuffix(FieldName, v)) +} + +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEqualFold(FieldName, v)) +} + +// NameContainsFold applies the ContainsFold predicate on the "name" field. +func NameContainsFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContainsFold(FieldName, v)) +} + +// EventTypeEQ applies the EQ predicate on the "event_type" field. +func EventTypeEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldEventType, v)) +} + +// EventTypeNEQ applies the NEQ predicate on the "event_type" field. +func EventTypeNEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldEventType, v)) +} + +// EventTypeIn applies the In predicate on the "event_type" field. +func EventTypeIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldEventType, vs...)) +} + +// EventTypeNotIn applies the NotIn predicate on the "event_type" field. +func EventTypeNotIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldEventType, vs...)) +} + +// EventTypeGT applies the GT predicate on the "event_type" field. +func EventTypeGT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGT(FieldEventType, v)) +} + +// EventTypeGTE applies the GTE predicate on the "event_type" field. +func EventTypeGTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGTE(FieldEventType, v)) +} + +// EventTypeLT applies the LT predicate on the "event_type" field. +func EventTypeLT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLT(FieldEventType, v)) +} + +// EventTypeLTE applies the LTE predicate on the "event_type" field. +func EventTypeLTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLTE(FieldEventType, v)) +} + +// EventTypeContains applies the Contains predicate on the "event_type" field. +func EventTypeContains(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContains(FieldEventType, v)) +} + +// EventTypeHasPrefix applies the HasPrefix predicate on the "event_type" field. +func EventTypeHasPrefix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasPrefix(FieldEventType, v)) +} + +// EventTypeHasSuffix applies the HasSuffix predicate on the "event_type" field. +func EventTypeHasSuffix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasSuffix(FieldEventType, v)) +} + +// EventTypeEqualFold applies the EqualFold predicate on the "event_type" field. +func EventTypeEqualFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEqualFold(FieldEventType, v)) +} + +// EventTypeContainsFold applies the ContainsFold predicate on the "event_type" field. +func EventTypeContainsFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContainsFold(FieldEventType, v)) +} + +// DeliveryTypeEQ applies the EQ predicate on the "delivery_type" field. +func DeliveryTypeEQ(v DeliveryType) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldDeliveryType, v)) +} + +// DeliveryTypeNEQ applies the NEQ predicate on the "delivery_type" field. +func DeliveryTypeNEQ(v DeliveryType) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldDeliveryType, v)) +} + +// DeliveryTypeIn applies the In predicate on the "delivery_type" field. +func DeliveryTypeIn(vs ...DeliveryType) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldDeliveryType, vs...)) +} + +// DeliveryTypeNotIn applies the NotIn predicate on the "delivery_type" field. +func DeliveryTypeNotIn(vs ...DeliveryType) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldDeliveryType, vs...)) +} + +// CallbackURLEQ applies the EQ predicate on the "callback_url" field. +func CallbackURLEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEQ(FieldCallbackURL, v)) +} + +// CallbackURLNEQ applies the NEQ predicate on the "callback_url" field. +func CallbackURLNEQ(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNEQ(FieldCallbackURL, v)) +} + +// CallbackURLIn applies the In predicate on the "callback_url" field. +func CallbackURLIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIn(FieldCallbackURL, vs...)) +} + +// CallbackURLNotIn applies the NotIn predicate on the "callback_url" field. +func CallbackURLNotIn(vs ...string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotIn(FieldCallbackURL, vs...)) +} + +// CallbackURLGT applies the GT predicate on the "callback_url" field. +func CallbackURLGT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGT(FieldCallbackURL, v)) +} + +// CallbackURLGTE applies the GTE predicate on the "callback_url" field. +func CallbackURLGTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldGTE(FieldCallbackURL, v)) +} + +// CallbackURLLT applies the LT predicate on the "callback_url" field. +func CallbackURLLT(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLT(FieldCallbackURL, v)) +} + +// CallbackURLLTE applies the LTE predicate on the "callback_url" field. +func CallbackURLLTE(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldLTE(FieldCallbackURL, v)) +} + +// CallbackURLContains applies the Contains predicate on the "callback_url" field. +func CallbackURLContains(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContains(FieldCallbackURL, v)) +} + +// CallbackURLHasPrefix applies the HasPrefix predicate on the "callback_url" field. +func CallbackURLHasPrefix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasPrefix(FieldCallbackURL, v)) +} + +// CallbackURLHasSuffix applies the HasSuffix predicate on the "callback_url" field. +func CallbackURLHasSuffix(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldHasSuffix(FieldCallbackURL, v)) +} + +// CallbackURLIsNil applies the IsNil predicate on the "callback_url" field. +func CallbackURLIsNil() predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldIsNull(FieldCallbackURL)) +} + +// CallbackURLNotNil applies the NotNil predicate on the "callback_url" field. +func CallbackURLNotNil() predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldNotNull(FieldCallbackURL)) +} + +// CallbackURLEqualFold applies the EqualFold predicate on the "callback_url" field. +func CallbackURLEqualFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldEqualFold(FieldCallbackURL, v)) +} + +// CallbackURLContainsFold applies the ContainsFold predicate on the "callback_url" field. +func CallbackURLContainsFold(v string) predicate.EventSubscription { + return predicate.EventSubscription(sql.FieldContainsFold(FieldCallbackURL, v)) +} + +// HasOwner applies the HasEdge predicate on the "owner" edge. +func HasOwner() predicate.EventSubscription { + return predicate.EventSubscription(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates). +func HasOwnerWith(preds ...predicate.Application) predicate.EventSubscription { + return predicate.EventSubscription(func(s *sql.Selector) { + step := newOwnerStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasTarget applies the HasEdge predicate on the "target" edge. +func HasTarget() predicate.EventSubscription { + return predicate.EventSubscription(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, TargetTable, TargetColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasTargetWith applies the HasEdge predicate on the "target" edge with a given conditions (other predicates). +func HasTargetWith(preds ...predicate.EventExposure) predicate.EventSubscription { + return predicate.EventSubscription(func(s *sql.Selector) { + step := newTargetStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasApproval applies the HasEdge predicate on the "approval" edge. +func HasApproval() predicate.EventSubscription { + return predicate.EventSubscription(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2O, false, ApprovalTable, ApprovalColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasApprovalWith applies the HasEdge predicate on the "approval" edge with a given conditions (other predicates). +func HasApprovalWith(preds ...predicate.Approval) predicate.EventSubscription { + return predicate.EventSubscription(func(s *sql.Selector) { + step := newApprovalStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasApprovalRequests applies the HasEdge predicate on the "approval_requests" edge. +func HasApprovalRequests() predicate.EventSubscription { + return predicate.EventSubscription(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ApprovalRequestsTable, ApprovalRequestsColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasApprovalRequestsWith applies the HasEdge predicate on the "approval_requests" edge with a given conditions (other predicates). +func HasApprovalRequestsWith(preds ...predicate.ApprovalRequest) predicate.EventSubscription { + return predicate.EventSubscription(func(s *sql.Selector) { + step := newApprovalRequestsStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// And groups predicates with the AND operator between them. +func And(predicates ...predicate.EventSubscription) predicate.EventSubscription { + return predicate.EventSubscription(sql.AndPredicates(predicates...)) +} + +// Or groups predicates with the OR operator between them. +func Or(predicates ...predicate.EventSubscription) predicate.EventSubscription { + return predicate.EventSubscription(sql.OrPredicates(predicates...)) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.EventSubscription) predicate.EventSubscription { + return predicate.EventSubscription(sql.NotPredicates(p)) +} diff --git a/controlplane-api/ent/eventsubscription_create.go b/controlplane-api/ent/eventsubscription_create.go new file mode 100644 index 000000000..2039cea2b --- /dev/null +++ b/controlplane-api/ent/eventsubscription_create.go @@ -0,0 +1,1220 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "fmt" + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/approval" + "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" +) + +// EventSubscriptionCreate is the builder for creating a EventSubscription entity. +type EventSubscriptionCreate struct { + config + mutation *EventSubscriptionMutation + hooks []Hook + conflict []sql.ConflictOption +} + +// SetCreatedAt sets the "created_at" field. +func (_c *EventSubscriptionCreate) SetCreatedAt(v time.Time) *EventSubscriptionCreate { + _c.mutation.SetCreatedAt(v) + return _c +} + +// SetNillableCreatedAt sets the "created_at" field if the given value is not nil. +func (_c *EventSubscriptionCreate) SetNillableCreatedAt(v *time.Time) *EventSubscriptionCreate { + if v != nil { + _c.SetCreatedAt(*v) + } + return _c +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_c *EventSubscriptionCreate) SetLastModifiedAt(v time.Time) *EventSubscriptionCreate { + _c.mutation.SetLastModifiedAt(v) + return _c +} + +// SetNillableLastModifiedAt sets the "last_modified_at" field if the given value is not nil. +func (_c *EventSubscriptionCreate) SetNillableLastModifiedAt(v *time.Time) *EventSubscriptionCreate { + if v != nil { + _c.SetLastModifiedAt(*v) + } + return _c +} + +// SetStatusPhase sets the "status_phase" field. +func (_c *EventSubscriptionCreate) SetStatusPhase(v eventsubscription.StatusPhase) *EventSubscriptionCreate { + _c.mutation.SetStatusPhase(v) + return _c +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_c *EventSubscriptionCreate) SetNillableStatusPhase(v *eventsubscription.StatusPhase) *EventSubscriptionCreate { + if v != nil { + _c.SetStatusPhase(*v) + } + return _c +} + +// SetStatusMessage sets the "status_message" field. +func (_c *EventSubscriptionCreate) SetStatusMessage(v string) *EventSubscriptionCreate { + _c.mutation.SetStatusMessage(v) + return _c +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_c *EventSubscriptionCreate) SetNillableStatusMessage(v *string) *EventSubscriptionCreate { + if v != nil { + _c.SetStatusMessage(*v) + } + return _c +} + +// SetEnvironment sets the "environment" field. +func (_c *EventSubscriptionCreate) SetEnvironment(v string) *EventSubscriptionCreate { + _c.mutation.SetEnvironment(v) + return _c +} + +// SetNillableEnvironment sets the "environment" field if the given value is not nil. +func (_c *EventSubscriptionCreate) SetNillableEnvironment(v *string) *EventSubscriptionCreate { + if v != nil { + _c.SetEnvironment(*v) + } + return _c +} + +// SetNamespace sets the "namespace" field. +func (_c *EventSubscriptionCreate) SetNamespace(v string) *EventSubscriptionCreate { + _c.mutation.SetNamespace(v) + return _c +} + +// SetName sets the "name" field. +func (_c *EventSubscriptionCreate) SetName(v string) *EventSubscriptionCreate { + _c.mutation.SetName(v) + return _c +} + +// SetEventType sets the "event_type" field. +func (_c *EventSubscriptionCreate) SetEventType(v string) *EventSubscriptionCreate { + _c.mutation.SetEventType(v) + return _c +} + +// SetDeliveryType sets the "delivery_type" field. +func (_c *EventSubscriptionCreate) SetDeliveryType(v eventsubscription.DeliveryType) *EventSubscriptionCreate { + _c.mutation.SetDeliveryType(v) + return _c +} + +// SetNillableDeliveryType sets the "delivery_type" field if the given value is not nil. +func (_c *EventSubscriptionCreate) SetNillableDeliveryType(v *eventsubscription.DeliveryType) *EventSubscriptionCreate { + if v != nil { + _c.SetDeliveryType(*v) + } + return _c +} + +// SetCallbackURL sets the "callback_url" field. +func (_c *EventSubscriptionCreate) SetCallbackURL(v string) *EventSubscriptionCreate { + _c.mutation.SetCallbackURL(v) + return _c +} + +// SetNillableCallbackURL sets the "callback_url" field if the given value is not nil. +func (_c *EventSubscriptionCreate) SetNillableCallbackURL(v *string) *EventSubscriptionCreate { + if v != nil { + _c.SetCallbackURL(*v) + } + return _c +} + +// SetOwnerID sets the "owner" edge to the Application entity by ID. +func (_c *EventSubscriptionCreate) SetOwnerID(id int) *EventSubscriptionCreate { + _c.mutation.SetOwnerID(id) + return _c +} + +// SetOwner sets the "owner" edge to the Application entity. +func (_c *EventSubscriptionCreate) SetOwner(v *Application) *EventSubscriptionCreate { + return _c.SetOwnerID(v.ID) +} + +// SetTargetID sets the "target" edge to the EventExposure entity by ID. +func (_c *EventSubscriptionCreate) SetTargetID(id int) *EventSubscriptionCreate { + _c.mutation.SetTargetID(id) + return _c +} + +// SetNillableTargetID sets the "target" edge to the EventExposure entity by ID if the given value is not nil. +func (_c *EventSubscriptionCreate) SetNillableTargetID(id *int) *EventSubscriptionCreate { + if id != nil { + _c = _c.SetTargetID(*id) + } + return _c +} + +// SetTarget sets the "target" edge to the EventExposure entity. +func (_c *EventSubscriptionCreate) SetTarget(v *EventExposure) *EventSubscriptionCreate { + return _c.SetTargetID(v.ID) +} + +// SetApprovalID sets the "approval" edge to the Approval entity by ID. +func (_c *EventSubscriptionCreate) SetApprovalID(id int) *EventSubscriptionCreate { + _c.mutation.SetApprovalID(id) + return _c +} + +// SetNillableApprovalID sets the "approval" edge to the Approval entity by ID if the given value is not nil. +func (_c *EventSubscriptionCreate) SetNillableApprovalID(id *int) *EventSubscriptionCreate { + if id != nil { + _c = _c.SetApprovalID(*id) + } + return _c +} + +// SetApproval sets the "approval" edge to the Approval entity. +func (_c *EventSubscriptionCreate) SetApproval(v *Approval) *EventSubscriptionCreate { + return _c.SetApprovalID(v.ID) +} + +// AddApprovalRequestIDs adds the "approval_requests" edge to the ApprovalRequest entity by IDs. +func (_c *EventSubscriptionCreate) AddApprovalRequestIDs(ids ...int) *EventSubscriptionCreate { + _c.mutation.AddApprovalRequestIDs(ids...) + return _c +} + +// AddApprovalRequests adds the "approval_requests" edges to the ApprovalRequest entity. +func (_c *EventSubscriptionCreate) AddApprovalRequests(v ...*ApprovalRequest) *EventSubscriptionCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _c.AddApprovalRequestIDs(ids...) +} + +// Mutation returns the EventSubscriptionMutation object of the builder. +func (_c *EventSubscriptionCreate) Mutation() *EventSubscriptionMutation { + return _c.mutation +} + +// Save creates the EventSubscription in the database. +func (_c *EventSubscriptionCreate) Save(ctx context.Context) (*EventSubscription, error) { + if err := _c.defaults(); err != nil { + return nil, err + } + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) +} + +// SaveX calls Save and panics if Save returns an error. +func (_c *EventSubscriptionCreate) SaveX(ctx context.Context) *EventSubscription { + v, err := _c.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (_c *EventSubscriptionCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_c *EventSubscriptionCreate) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (_c *EventSubscriptionCreate) defaults() error { + if _, ok := _c.mutation.CreatedAt(); !ok { + if eventsubscription.DefaultCreatedAt == nil { + return fmt.Errorf("ent: uninitialized eventsubscription.DefaultCreatedAt (forgotten import ent/runtime?)") + } + v := eventsubscription.DefaultCreatedAt() + _c.mutation.SetCreatedAt(v) + } + if _, ok := _c.mutation.LastModifiedAt(); !ok { + if eventsubscription.DefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized eventsubscription.DefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := eventsubscription.DefaultLastModifiedAt() + _c.mutation.SetLastModifiedAt(v) + } + if _, ok := _c.mutation.DeliveryType(); !ok { + v := eventsubscription.DefaultDeliveryType + _c.mutation.SetDeliveryType(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_c *EventSubscriptionCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { + return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "EventSubscription.created_at"`)} + } + if _, ok := _c.mutation.LastModifiedAt(); !ok { + return &ValidationError{Name: "last_modified_at", err: errors.New(`ent: missing required field "EventSubscription.last_modified_at"`)} + } + if v, ok := _c.mutation.StatusPhase(); ok { + if err := eventsubscription.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.status_phase": %w`, err)} + } + } + if _, ok := _c.mutation.Namespace(); !ok { + return &ValidationError{Name: "namespace", err: errors.New(`ent: missing required field "EventSubscription.namespace"`)} + } + if v, ok := _c.mutation.Namespace(); ok { + if err := eventsubscription.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.namespace": %w`, err)} + } + } + if _, ok := _c.mutation.Name(); !ok { + return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "EventSubscription.name"`)} + } + if v, ok := _c.mutation.Name(); ok { + if err := eventsubscription.NameValidator(v); err != nil { + return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.name": %w`, err)} + } + } + if _, ok := _c.mutation.EventType(); !ok { + return &ValidationError{Name: "event_type", err: errors.New(`ent: missing required field "EventSubscription.event_type"`)} + } + if v, ok := _c.mutation.EventType(); ok { + if err := eventsubscription.EventTypeValidator(v); err != nil { + return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.event_type": %w`, err)} + } + } + if _, ok := _c.mutation.DeliveryType(); !ok { + return &ValidationError{Name: "delivery_type", err: errors.New(`ent: missing required field "EventSubscription.delivery_type"`)} + } + if v, ok := _c.mutation.DeliveryType(); ok { + if err := eventsubscription.DeliveryTypeValidator(v); err != nil { + return &ValidationError{Name: "delivery_type", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.delivery_type": %w`, err)} + } + } + if len(_c.mutation.OwnerIDs()) == 0 { + return &ValidationError{Name: "owner", err: errors.New(`ent: missing required edge "EventSubscription.owner"`)} + } + return nil +} + +func (_c *EventSubscriptionCreate) sqlSave(ctx context.Context) (*EventSubscription, error) { + if err := _c.check(); err != nil { + return nil, err + } + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + id := _spec.ID.Value.(int64) + _node.ID = int(id) + _c.mutation.id = &_node.ID + _c.mutation.done = true + return _node, nil +} + +func (_c *EventSubscriptionCreate) createSpec() (*EventSubscription, *sqlgraph.CreateSpec) { + var ( + _node = &EventSubscription{config: _c.config} + _spec = sqlgraph.NewCreateSpec(eventsubscription.Table, sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt)) + ) + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { + _spec.SetField(eventsubscription.FieldCreatedAt, field.TypeTime, value) + _node.CreatedAt = value + } + if value, ok := _c.mutation.LastModifiedAt(); ok { + _spec.SetField(eventsubscription.FieldLastModifiedAt, field.TypeTime, value) + _node.LastModifiedAt = value + } + if value, ok := _c.mutation.StatusPhase(); ok { + _spec.SetField(eventsubscription.FieldStatusPhase, field.TypeEnum, value) + _node.StatusPhase = &value + } + if value, ok := _c.mutation.StatusMessage(); ok { + _spec.SetField(eventsubscription.FieldStatusMessage, field.TypeString, value) + _node.StatusMessage = &value + } + if value, ok := _c.mutation.Environment(); ok { + _spec.SetField(eventsubscription.FieldEnvironment, field.TypeString, value) + _node.Environment = &value + } + if value, ok := _c.mutation.Namespace(); ok { + _spec.SetField(eventsubscription.FieldNamespace, field.TypeString, value) + _node.Namespace = value + } + if value, ok := _c.mutation.Name(); ok { + _spec.SetField(eventsubscription.FieldName, field.TypeString, value) + _node.Name = value + } + if value, ok := _c.mutation.EventType(); ok { + _spec.SetField(eventsubscription.FieldEventType, field.TypeString, value) + _node.EventType = value + } + if value, ok := _c.mutation.DeliveryType(); ok { + _spec.SetField(eventsubscription.FieldDeliveryType, field.TypeEnum, value) + _node.DeliveryType = value + } + if value, ok := _c.mutation.CallbackURL(); ok { + _spec.SetField(eventsubscription.FieldCallbackURL, field.TypeString, value) + _node.CallbackURL = &value + } + if nodes := _c.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventsubscription.OwnerTable, + Columns: []string{eventsubscription.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(application.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.application_subscribed_events = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := _c.mutation.TargetIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: eventsubscription.TargetTable, + Columns: []string{eventsubscription.TargetColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.event_subscription_target = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := _c.mutation.ApprovalIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: eventsubscription.ApprovalTable, + Columns: []string{eventsubscription.ApprovalColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approval.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := _c.mutation.ApprovalRequestsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventsubscription.ApprovalRequestsTable, + Columns: []string{eventsubscription.ApprovalRequestsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approvalrequest.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } + return _node, _spec +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.EventSubscription.Create(). +// SetCreatedAt(v). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.EventSubscriptionUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (_c *EventSubscriptionCreate) OnConflict(opts ...sql.ConflictOption) *EventSubscriptionUpsertOne { + _c.conflict = opts + return &EventSubscriptionUpsertOne{ + create: _c, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.EventSubscription.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (_c *EventSubscriptionCreate) OnConflictColumns(columns ...string) *EventSubscriptionUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) + return &EventSubscriptionUpsertOne{ + create: _c, + } +} + +type ( + // EventSubscriptionUpsertOne is the builder for "upsert"-ing + // one EventSubscription node. + EventSubscriptionUpsertOne struct { + create *EventSubscriptionCreate + } + + // EventSubscriptionUpsert is the "OnConflict" setter. + EventSubscriptionUpsert struct { + *sql.UpdateSet + } +) + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *EventSubscriptionUpsert) SetLastModifiedAt(v time.Time) *EventSubscriptionUpsert { + u.Set(eventsubscription.FieldLastModifiedAt, v) + return u +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *EventSubscriptionUpsert) UpdateLastModifiedAt() *EventSubscriptionUpsert { + u.SetExcluded(eventsubscription.FieldLastModifiedAt) + return u +} + +// SetStatusPhase sets the "status_phase" field. +func (u *EventSubscriptionUpsert) SetStatusPhase(v eventsubscription.StatusPhase) *EventSubscriptionUpsert { + u.Set(eventsubscription.FieldStatusPhase, v) + return u +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *EventSubscriptionUpsert) UpdateStatusPhase() *EventSubscriptionUpsert { + u.SetExcluded(eventsubscription.FieldStatusPhase) + return u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *EventSubscriptionUpsert) ClearStatusPhase() *EventSubscriptionUpsert { + u.SetNull(eventsubscription.FieldStatusPhase) + return u +} + +// SetStatusMessage sets the "status_message" field. +func (u *EventSubscriptionUpsert) SetStatusMessage(v string) *EventSubscriptionUpsert { + u.Set(eventsubscription.FieldStatusMessage, v) + return u +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *EventSubscriptionUpsert) UpdateStatusMessage() *EventSubscriptionUpsert { + u.SetExcluded(eventsubscription.FieldStatusMessage) + return u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *EventSubscriptionUpsert) ClearStatusMessage() *EventSubscriptionUpsert { + u.SetNull(eventsubscription.FieldStatusMessage) + return u +} + +// SetEnvironment sets the "environment" field. +func (u *EventSubscriptionUpsert) SetEnvironment(v string) *EventSubscriptionUpsert { + u.Set(eventsubscription.FieldEnvironment, v) + return u +} + +// UpdateEnvironment sets the "environment" field to the value that was provided on create. +func (u *EventSubscriptionUpsert) UpdateEnvironment() *EventSubscriptionUpsert { + u.SetExcluded(eventsubscription.FieldEnvironment) + return u +} + +// ClearEnvironment clears the value of the "environment" field. +func (u *EventSubscriptionUpsert) ClearEnvironment() *EventSubscriptionUpsert { + u.SetNull(eventsubscription.FieldEnvironment) + return u +} + +// SetNamespace sets the "namespace" field. +func (u *EventSubscriptionUpsert) SetNamespace(v string) *EventSubscriptionUpsert { + u.Set(eventsubscription.FieldNamespace, v) + return u +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *EventSubscriptionUpsert) UpdateNamespace() *EventSubscriptionUpsert { + u.SetExcluded(eventsubscription.FieldNamespace) + return u +} + +// SetName sets the "name" field. +func (u *EventSubscriptionUpsert) SetName(v string) *EventSubscriptionUpsert { + u.Set(eventsubscription.FieldName, v) + return u +} + +// UpdateName sets the "name" field to the value that was provided on create. +func (u *EventSubscriptionUpsert) UpdateName() *EventSubscriptionUpsert { + u.SetExcluded(eventsubscription.FieldName) + return u +} + +// SetEventType sets the "event_type" field. +func (u *EventSubscriptionUpsert) SetEventType(v string) *EventSubscriptionUpsert { + u.Set(eventsubscription.FieldEventType, v) + return u +} + +// UpdateEventType sets the "event_type" field to the value that was provided on create. +func (u *EventSubscriptionUpsert) UpdateEventType() *EventSubscriptionUpsert { + u.SetExcluded(eventsubscription.FieldEventType) + return u +} + +// SetDeliveryType sets the "delivery_type" field. +func (u *EventSubscriptionUpsert) SetDeliveryType(v eventsubscription.DeliveryType) *EventSubscriptionUpsert { + u.Set(eventsubscription.FieldDeliveryType, v) + return u +} + +// UpdateDeliveryType sets the "delivery_type" field to the value that was provided on create. +func (u *EventSubscriptionUpsert) UpdateDeliveryType() *EventSubscriptionUpsert { + u.SetExcluded(eventsubscription.FieldDeliveryType) + return u +} + +// SetCallbackURL sets the "callback_url" field. +func (u *EventSubscriptionUpsert) SetCallbackURL(v string) *EventSubscriptionUpsert { + u.Set(eventsubscription.FieldCallbackURL, v) + return u +} + +// UpdateCallbackURL sets the "callback_url" field to the value that was provided on create. +func (u *EventSubscriptionUpsert) UpdateCallbackURL() *EventSubscriptionUpsert { + u.SetExcluded(eventsubscription.FieldCallbackURL) + return u +} + +// ClearCallbackURL clears the value of the "callback_url" field. +func (u *EventSubscriptionUpsert) ClearCallbackURL() *EventSubscriptionUpsert { + u.SetNull(eventsubscription.FieldCallbackURL) + return u +} + +// UpdateNewValues updates the mutable fields using the new values that were set on create. +// Using this option is equivalent to using: +// +// client.EventSubscription.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *EventSubscriptionUpsertOne) UpdateNewValues() *EventSubscriptionUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + if _, exists := u.create.mutation.CreatedAt(); exists { + s.SetIgnore(eventsubscription.FieldCreatedAt) + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.EventSubscription.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *EventSubscriptionUpsertOne) Ignore() *EventSubscriptionUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *EventSubscriptionUpsertOne) DoNothing() *EventSubscriptionUpsertOne { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the EventSubscriptionCreate.OnConflict +// documentation for more info. +func (u *EventSubscriptionUpsertOne) Update(set func(*EventSubscriptionUpsert)) *EventSubscriptionUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&EventSubscriptionUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *EventSubscriptionUpsertOne) SetLastModifiedAt(v time.Time) *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *EventSubscriptionUpsertOne) UpdateLastModifiedAt() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetStatusPhase sets the "status_phase" field. +func (u *EventSubscriptionUpsertOne) SetStatusPhase(v eventsubscription.StatusPhase) *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetStatusPhase(v) + }) +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *EventSubscriptionUpsertOne) UpdateStatusPhase() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateStatusPhase() + }) +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *EventSubscriptionUpsertOne) ClearStatusPhase() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.ClearStatusPhase() + }) +} + +// SetStatusMessage sets the "status_message" field. +func (u *EventSubscriptionUpsertOne) SetStatusMessage(v string) *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetStatusMessage(v) + }) +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *EventSubscriptionUpsertOne) UpdateStatusMessage() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateStatusMessage() + }) +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *EventSubscriptionUpsertOne) ClearStatusMessage() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.ClearStatusMessage() + }) +} + +// SetEnvironment sets the "environment" field. +func (u *EventSubscriptionUpsertOne) SetEnvironment(v string) *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetEnvironment(v) + }) +} + +// UpdateEnvironment sets the "environment" field to the value that was provided on create. +func (u *EventSubscriptionUpsertOne) UpdateEnvironment() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateEnvironment() + }) +} + +// ClearEnvironment clears the value of the "environment" field. +func (u *EventSubscriptionUpsertOne) ClearEnvironment() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.ClearEnvironment() + }) +} + +// SetNamespace sets the "namespace" field. +func (u *EventSubscriptionUpsertOne) SetNamespace(v string) *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetNamespace(v) + }) +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *EventSubscriptionUpsertOne) UpdateNamespace() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateNamespace() + }) +} + +// SetName sets the "name" field. +func (u *EventSubscriptionUpsertOne) SetName(v string) *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetName(v) + }) +} + +// UpdateName sets the "name" field to the value that was provided on create. +func (u *EventSubscriptionUpsertOne) UpdateName() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateName() + }) +} + +// SetEventType sets the "event_type" field. +func (u *EventSubscriptionUpsertOne) SetEventType(v string) *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetEventType(v) + }) +} + +// UpdateEventType sets the "event_type" field to the value that was provided on create. +func (u *EventSubscriptionUpsertOne) UpdateEventType() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateEventType() + }) +} + +// SetDeliveryType sets the "delivery_type" field. +func (u *EventSubscriptionUpsertOne) SetDeliveryType(v eventsubscription.DeliveryType) *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetDeliveryType(v) + }) +} + +// UpdateDeliveryType sets the "delivery_type" field to the value that was provided on create. +func (u *EventSubscriptionUpsertOne) UpdateDeliveryType() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateDeliveryType() + }) +} + +// SetCallbackURL sets the "callback_url" field. +func (u *EventSubscriptionUpsertOne) SetCallbackURL(v string) *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetCallbackURL(v) + }) +} + +// UpdateCallbackURL sets the "callback_url" field to the value that was provided on create. +func (u *EventSubscriptionUpsertOne) UpdateCallbackURL() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateCallbackURL() + }) +} + +// ClearCallbackURL clears the value of the "callback_url" field. +func (u *EventSubscriptionUpsertOne) ClearCallbackURL() *EventSubscriptionUpsertOne { + return u.Update(func(s *EventSubscriptionUpsert) { + s.ClearCallbackURL() + }) +} + +// Exec executes the query. +func (u *EventSubscriptionUpsertOne) Exec(ctx context.Context) error { + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for EventSubscriptionCreate.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *EventSubscriptionUpsertOne) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} + +// Exec executes the UPSERT query and returns the inserted/updated ID. +func (u *EventSubscriptionUpsertOne) ID(ctx context.Context) (id int, err error) { + node, err := u.create.Save(ctx) + if err != nil { + return id, err + } + return node.ID, nil +} + +// IDX is like ID, but panics if an error occurs. +func (u *EventSubscriptionUpsertOne) IDX(ctx context.Context) int { + id, err := u.ID(ctx) + if err != nil { + panic(err) + } + return id +} + +// EventSubscriptionCreateBulk is the builder for creating many EventSubscription entities in bulk. +type EventSubscriptionCreateBulk struct { + config + err error + builders []*EventSubscriptionCreate + conflict []sql.ConflictOption +} + +// Save creates the EventSubscription entities in the database. +func (_c *EventSubscriptionCreateBulk) Save(ctx context.Context) ([]*EventSubscription, error) { + if _c.err != nil { + return nil, _c.err + } + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*EventSubscription, len(_c.builders)) + mutators := make([]Mutator, len(_c.builders)) + for i := range _c.builders { + func(i int, root context.Context) { + builder := _c.builders[i] + builder.defaults() + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*EventSubscriptionMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err := builder.check(); err != nil { + return nil, err + } + builder.mutation = mutation + var err error + nodes[i], specs[i] = builder.createSpec() + if i < len(mutators)-1 { + _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) + } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} + spec.OnConflict = _c.conflict + // Invoke the actual operation on the latest mutation in the chain. + if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + } + } + if err != nil { + return nil, err + } + mutation.id = &nodes[i].ID + if specs[i].ID.Value != nil { + id := specs[i].ID.Value.(int64) + nodes[i].ID = int(id) + } + mutation.done = true + return nodes[i], nil + }) + for i := len(builder.hooks) - 1; i >= 0; i-- { + mut = builder.hooks[i](mut) + } + mutators[i] = mut + }(i, ctx) + } + if len(mutators) > 0 { + if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { + return nil, err + } + } + return nodes, nil +} + +// SaveX is like Save, but panics if an error occurs. +func (_c *EventSubscriptionCreateBulk) SaveX(ctx context.Context) []*EventSubscription { + v, err := _c.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (_c *EventSubscriptionCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_c *EventSubscriptionCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { + panic(err) + } +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.EventSubscription.CreateBulk(builders...). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.EventSubscriptionUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (_c *EventSubscriptionCreateBulk) OnConflict(opts ...sql.ConflictOption) *EventSubscriptionUpsertBulk { + _c.conflict = opts + return &EventSubscriptionUpsertBulk{ + create: _c, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.EventSubscription.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (_c *EventSubscriptionCreateBulk) OnConflictColumns(columns ...string) *EventSubscriptionUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) + return &EventSubscriptionUpsertBulk{ + create: _c, + } +} + +// EventSubscriptionUpsertBulk is the builder for "upsert"-ing +// a bulk of EventSubscription nodes. +type EventSubscriptionUpsertBulk struct { + create *EventSubscriptionCreateBulk +} + +// UpdateNewValues updates the mutable fields using the new values that +// were set on create. Using this option is equivalent to using: +// +// client.EventSubscription.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *EventSubscriptionUpsertBulk) UpdateNewValues() *EventSubscriptionUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + for _, b := range u.create.builders { + if _, exists := b.mutation.CreatedAt(); exists { + s.SetIgnore(eventsubscription.FieldCreatedAt) + } + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.EventSubscription.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *EventSubscriptionUpsertBulk) Ignore() *EventSubscriptionUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *EventSubscriptionUpsertBulk) DoNothing() *EventSubscriptionUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the EventSubscriptionCreateBulk.OnConflict +// documentation for more info. +func (u *EventSubscriptionUpsertBulk) Update(set func(*EventSubscriptionUpsert)) *EventSubscriptionUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&EventSubscriptionUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *EventSubscriptionUpsertBulk) SetLastModifiedAt(v time.Time) *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *EventSubscriptionUpsertBulk) UpdateLastModifiedAt() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetStatusPhase sets the "status_phase" field. +func (u *EventSubscriptionUpsertBulk) SetStatusPhase(v eventsubscription.StatusPhase) *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetStatusPhase(v) + }) +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *EventSubscriptionUpsertBulk) UpdateStatusPhase() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateStatusPhase() + }) +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *EventSubscriptionUpsertBulk) ClearStatusPhase() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.ClearStatusPhase() + }) +} + +// SetStatusMessage sets the "status_message" field. +func (u *EventSubscriptionUpsertBulk) SetStatusMessage(v string) *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetStatusMessage(v) + }) +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *EventSubscriptionUpsertBulk) UpdateStatusMessage() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateStatusMessage() + }) +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *EventSubscriptionUpsertBulk) ClearStatusMessage() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.ClearStatusMessage() + }) +} + +// SetEnvironment sets the "environment" field. +func (u *EventSubscriptionUpsertBulk) SetEnvironment(v string) *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetEnvironment(v) + }) +} + +// UpdateEnvironment sets the "environment" field to the value that was provided on create. +func (u *EventSubscriptionUpsertBulk) UpdateEnvironment() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateEnvironment() + }) +} + +// ClearEnvironment clears the value of the "environment" field. +func (u *EventSubscriptionUpsertBulk) ClearEnvironment() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.ClearEnvironment() + }) +} + +// SetNamespace sets the "namespace" field. +func (u *EventSubscriptionUpsertBulk) SetNamespace(v string) *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetNamespace(v) + }) +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *EventSubscriptionUpsertBulk) UpdateNamespace() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateNamespace() + }) +} + +// SetName sets the "name" field. +func (u *EventSubscriptionUpsertBulk) SetName(v string) *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetName(v) + }) +} + +// UpdateName sets the "name" field to the value that was provided on create. +func (u *EventSubscriptionUpsertBulk) UpdateName() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateName() + }) +} + +// SetEventType sets the "event_type" field. +func (u *EventSubscriptionUpsertBulk) SetEventType(v string) *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetEventType(v) + }) +} + +// UpdateEventType sets the "event_type" field to the value that was provided on create. +func (u *EventSubscriptionUpsertBulk) UpdateEventType() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateEventType() + }) +} + +// SetDeliveryType sets the "delivery_type" field. +func (u *EventSubscriptionUpsertBulk) SetDeliveryType(v eventsubscription.DeliveryType) *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetDeliveryType(v) + }) +} + +// UpdateDeliveryType sets the "delivery_type" field to the value that was provided on create. +func (u *EventSubscriptionUpsertBulk) UpdateDeliveryType() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateDeliveryType() + }) +} + +// SetCallbackURL sets the "callback_url" field. +func (u *EventSubscriptionUpsertBulk) SetCallbackURL(v string) *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.SetCallbackURL(v) + }) +} + +// UpdateCallbackURL sets the "callback_url" field to the value that was provided on create. +func (u *EventSubscriptionUpsertBulk) UpdateCallbackURL() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.UpdateCallbackURL() + }) +} + +// ClearCallbackURL clears the value of the "callback_url" field. +func (u *EventSubscriptionUpsertBulk) ClearCallbackURL() *EventSubscriptionUpsertBulk { + return u.Update(func(s *EventSubscriptionUpsert) { + s.ClearCallbackURL() + }) +} + +// Exec executes the query. +func (u *EventSubscriptionUpsertBulk) Exec(ctx context.Context) error { + if u.create.err != nil { + return u.create.err + } + for i, b := range u.create.builders { + if len(b.conflict) != 0 { + return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the EventSubscriptionCreateBulk instead", i) + } + } + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for EventSubscriptionCreateBulk.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *EventSubscriptionUpsertBulk) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/controlplane-api/ent/eventsubscription_delete.go b/controlplane-api/ent/eventsubscription_delete.go new file mode 100644 index 000000000..8fa7adf22 --- /dev/null +++ b/controlplane-api/ent/eventsubscription_delete.go @@ -0,0 +1,91 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" +) + +// EventSubscriptionDelete is the builder for deleting a EventSubscription entity. +type EventSubscriptionDelete struct { + config + hooks []Hook + mutation *EventSubscriptionMutation +} + +// Where appends a list predicates to the EventSubscriptionDelete builder. +func (_d *EventSubscriptionDelete) Where(ps ...predicate.EventSubscription) *EventSubscriptionDelete { + _d.mutation.Where(ps...) + return _d +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (_d *EventSubscriptionDelete) Exec(ctx context.Context) (int, error) { + return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) +} + +// ExecX is like Exec, but panics if an error occurs. +func (_d *EventSubscriptionDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (_d *EventSubscriptionDelete) sqlExec(ctx context.Context) (int, error) { + _spec := sqlgraph.NewDeleteSpec(eventsubscription.Table, sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt)) + if ps := _d.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + _d.mutation.done = true + return affected, err +} + +// EventSubscriptionDeleteOne is the builder for deleting a single EventSubscription entity. +type EventSubscriptionDeleteOne struct { + _d *EventSubscriptionDelete +} + +// Where appends a list predicates to the EventSubscriptionDelete builder. +func (_d *EventSubscriptionDeleteOne) Where(ps ...predicate.EventSubscription) *EventSubscriptionDeleteOne { + _d._d.mutation.Where(ps...) + return _d +} + +// Exec executes the deletion query. +func (_d *EventSubscriptionDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{eventsubscription.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (_d *EventSubscriptionDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/controlplane-api/ent/eventsubscription_query.go b/controlplane-api/ent/eventsubscription_query.go new file mode 100644 index 000000000..6b3b45b5b --- /dev/null +++ b/controlplane-api/ent/eventsubscription_query.go @@ -0,0 +1,883 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "database/sql/driver" + "errors" + "fmt" + "math" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/approval" + "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" +) + +// EventSubscriptionQuery is the builder for querying EventSubscription entities. +type EventSubscriptionQuery struct { + config + ctx *QueryContext + order []eventsubscription.OrderOption + inters []Interceptor + predicates []predicate.EventSubscription + withOwner *ApplicationQuery + withTarget *EventExposureQuery + withApproval *ApprovalQuery + withApprovalRequests *ApprovalRequestQuery + withFKs bool + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*EventSubscription) error + withNamedApprovalRequests map[string]*ApprovalRequestQuery + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Where adds a new predicate for the EventSubscriptionQuery builder. +func (_q *EventSubscriptionQuery) Where(ps ...predicate.EventSubscription) *EventSubscriptionQuery { + _q.predicates = append(_q.predicates, ps...) + return _q +} + +// Limit the number of records to be returned by this query. +func (_q *EventSubscriptionQuery) Limit(limit int) *EventSubscriptionQuery { + _q.ctx.Limit = &limit + return _q +} + +// Offset to start from. +func (_q *EventSubscriptionQuery) Offset(offset int) *EventSubscriptionQuery { + _q.ctx.Offset = &offset + return _q +} + +// Unique configures the query builder to filter duplicate records on query. +// By default, unique is set to true, and can be disabled using this method. +func (_q *EventSubscriptionQuery) Unique(unique bool) *EventSubscriptionQuery { + _q.ctx.Unique = &unique + return _q +} + +// Order specifies how the records should be ordered. +func (_q *EventSubscriptionQuery) Order(o ...eventsubscription.OrderOption) *EventSubscriptionQuery { + _q.order = append(_q.order, o...) + return _q +} + +// QueryOwner chains the current query on the "owner" edge. +func (_q *EventSubscriptionQuery) QueryOwner() *ApplicationQuery { + query := (&ApplicationClient{config: _q.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + selector := _q.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(eventsubscription.Table, eventsubscription.FieldID, selector), + sqlgraph.To(application.Table, application.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, eventsubscription.OwnerTable, eventsubscription.OwnerColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryTarget chains the current query on the "target" edge. +func (_q *EventSubscriptionQuery) QueryTarget() *EventExposureQuery { + query := (&EventExposureClient{config: _q.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + selector := _q.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(eventsubscription.Table, eventsubscription.FieldID, selector), + sqlgraph.To(eventexposure.Table, eventexposure.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, eventsubscription.TargetTable, eventsubscription.TargetColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryApproval chains the current query on the "approval" edge. +func (_q *EventSubscriptionQuery) QueryApproval() *ApprovalQuery { + query := (&ApprovalClient{config: _q.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + selector := _q.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(eventsubscription.Table, eventsubscription.FieldID, selector), + sqlgraph.To(approval.Table, approval.FieldID), + sqlgraph.Edge(sqlgraph.O2O, false, eventsubscription.ApprovalTable, eventsubscription.ApprovalColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryApprovalRequests chains the current query on the "approval_requests" edge. +func (_q *EventSubscriptionQuery) QueryApprovalRequests() *ApprovalRequestQuery { + query := (&ApprovalRequestClient{config: _q.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + selector := _q.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(eventsubscription.Table, eventsubscription.FieldID, selector), + sqlgraph.To(approvalrequest.Table, approvalrequest.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, eventsubscription.ApprovalRequestsTable, eventsubscription.ApprovalRequestsColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// First returns the first EventSubscription entity from the query. +// Returns a *NotFoundError when no EventSubscription was found. +func (_q *EventSubscriptionQuery) First(ctx context.Context) (*EventSubscription, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) + if err != nil { + return nil, err + } + if len(nodes) == 0 { + return nil, &NotFoundError{eventsubscription.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (_q *EventSubscriptionQuery) FirstX(ctx context.Context) *EventSubscription { + node, err := _q.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first EventSubscription ID from the query. +// Returns a *NotFoundError when no EventSubscription ID was found. +func (_q *EventSubscriptionQuery) FirstID(ctx context.Context) (id int, err error) { + var ids []int + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { + return + } + if len(ids) == 0 { + err = &NotFoundError{eventsubscription.Label} + return + } + return ids[0], nil +} + +// FirstIDX is like FirstID, but panics if an error occurs. +func (_q *EventSubscriptionQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns a single EventSubscription entity found by the query, ensuring it only returns one. +// Returns a *NotSingularError when more than one EventSubscription entity is found. +// Returns a *NotFoundError when no EventSubscription entities are found. +func (_q *EventSubscriptionQuery) Only(ctx context.Context) (*EventSubscription, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) + if err != nil { + return nil, err + } + switch len(nodes) { + case 1: + return nodes[0], nil + case 0: + return nil, &NotFoundError{eventsubscription.Label} + default: + return nil, &NotSingularError{eventsubscription.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (_q *EventSubscriptionQuery) OnlyX(ctx context.Context) *EventSubscription { + node, err := _q.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID is like Only, but returns the only EventSubscription ID in the query. +// Returns a *NotSingularError when more than one EventSubscription ID is found. +// Returns a *NotFoundError when no entities are found. +func (_q *EventSubscriptionQuery) OnlyID(ctx context.Context) (id int, err error) { + var ids []int + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { + return + } + switch len(ids) { + case 1: + id = ids[0] + case 0: + err = &NotFoundError{eventsubscription.Label} + default: + err = &NotSingularError{eventsubscription.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (_q *EventSubscriptionQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) + if err != nil { + panic(err) + } + return id +} + +// All executes the query and returns a list of EventSubscriptions. +func (_q *EventSubscriptionQuery) All(ctx context.Context) ([]*EventSubscription, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + qr := querierAll[[]*EventSubscription, *EventSubscriptionQuery]() + return withInterceptors[[]*EventSubscription](ctx, _q, qr, _q.inters) +} + +// AllX is like All, but panics if an error occurs. +func (_q *EventSubscriptionQuery) AllX(ctx context.Context) []*EventSubscription { + nodes, err := _q.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of EventSubscription IDs. +func (_q *EventSubscriptionQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) + } + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(eventsubscription.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (_q *EventSubscriptionQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) + if err != nil { + panic(err) + } + return ids +} + +// Count returns the count of the given query. +func (_q *EventSubscriptionQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { + return 0, err + } + return withInterceptors[int](ctx, _q, querierCount[*EventSubscriptionQuery](), _q.inters) +} + +// CountX is like Count, but panics if an error occurs. +func (_q *EventSubscriptionQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) + if err != nil { + panic(err) + } + return count +} + +// Exist returns true if the query has elements in the graph. +func (_q *EventSubscriptionQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { + case IsNotFound(err): + return false, nil + case err != nil: + return false, fmt.Errorf("ent: check existence: %w", err) + default: + return true, nil + } +} + +// ExistX is like Exist, but panics if an error occurs. +func (_q *EventSubscriptionQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the EventSubscriptionQuery builder, including all associated steps. It can be +// used to prepare common query builders and use them differently after the clone is made. +func (_q *EventSubscriptionQuery) Clone() *EventSubscriptionQuery { + if _q == nil { + return nil + } + return &EventSubscriptionQuery{ + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]eventsubscription.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.EventSubscription{}, _q.predicates...), + withOwner: _q.withOwner.Clone(), + withTarget: _q.withTarget.Clone(), + withApproval: _q.withApproval.Clone(), + withApprovalRequests: _q.withApprovalRequests.Clone(), + // clone intermediate query. + sql: _q.sql.Clone(), + path: _q.path, + } +} + +// WithOwner tells the query-builder to eager-load the nodes that are connected to +// the "owner" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *EventSubscriptionQuery) WithOwner(opts ...func(*ApplicationQuery)) *EventSubscriptionQuery { + query := (&ApplicationClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withOwner = query + return _q +} + +// WithTarget tells the query-builder to eager-load the nodes that are connected to +// the "target" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *EventSubscriptionQuery) WithTarget(opts ...func(*EventExposureQuery)) *EventSubscriptionQuery { + query := (&EventExposureClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withTarget = query + return _q +} + +// WithApproval tells the query-builder to eager-load the nodes that are connected to +// the "approval" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *EventSubscriptionQuery) WithApproval(opts ...func(*ApprovalQuery)) *EventSubscriptionQuery { + query := (&ApprovalClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withApproval = query + return _q +} + +// WithApprovalRequests tells the query-builder to eager-load the nodes that are connected to +// the "approval_requests" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *EventSubscriptionQuery) WithApprovalRequests(opts ...func(*ApprovalRequestQuery)) *EventSubscriptionQuery { + query := (&ApprovalRequestClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withApprovalRequests = query + return _q +} + +// GroupBy is used to group vertices by one or more fields/columns. +// It is often used with aggregate functions, like: count, max, mean, min, sum. +// +// Example: +// +// var v []struct { +// CreatedAt time.Time `json:"created_at,omitempty"` +// Count int `json:"count,omitempty"` +// } +// +// client.EventSubscription.Query(). +// GroupBy(eventsubscription.FieldCreatedAt). +// Aggregate(ent.Count()). +// Scan(ctx, &v) +func (_q *EventSubscriptionQuery) GroupBy(field string, fields ...string) *EventSubscriptionGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &EventSubscriptionGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields + grbuild.label = eventsubscription.Label + grbuild.scan = grbuild.Scan + return grbuild +} + +// Select allows the selection one or more fields/columns for the given query, +// instead of selecting all fields in the entity. +// +// Example: +// +// var v []struct { +// CreatedAt time.Time `json:"created_at,omitempty"` +// } +// +// client.EventSubscription.Query(). +// Select(eventsubscription.FieldCreatedAt). +// Scan(ctx, &v) +func (_q *EventSubscriptionQuery) Select(fields ...string) *EventSubscriptionSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &EventSubscriptionSelect{EventSubscriptionQuery: _q} + sbuild.label = eventsubscription.Label + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan + return sbuild +} + +// Aggregate returns a EventSubscriptionSelect configured with the given aggregations. +func (_q *EventSubscriptionQuery) Aggregate(fns ...AggregateFunc) *EventSubscriptionSelect { + return _q.Select().Aggregate(fns...) +} + +func (_q *EventSubscriptionQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { + if inter == nil { + return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") + } + if trv, ok := inter.(Traverser); ok { + if err := trv.Traverse(ctx, _q); err != nil { + return err + } + } + } + for _, f := range _q.ctx.Fields { + if !eventsubscription.ValidColumn(f) { + return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + } + if _q.path != nil { + prev, err := _q.path(ctx) + if err != nil { + return err + } + _q.sql = prev + } + if eventsubscription.Policy == nil { + return errors.New("ent: uninitialized eventsubscription.Policy (forgotten import ent/runtime?)") + } + if err := eventsubscription.Policy.EvalQuery(ctx, _q); err != nil { + return err + } + return nil +} + +func (_q *EventSubscriptionQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*EventSubscription, error) { + var ( + nodes = []*EventSubscription{} + withFKs = _q.withFKs + _spec = _q.querySpec() + loadedTypes = [4]bool{ + _q.withOwner != nil, + _q.withTarget != nil, + _q.withApproval != nil, + _q.withApprovalRequests != nil, + } + ) + if _q.withOwner != nil || _q.withTarget != nil { + withFKs = true + } + if withFKs { + _spec.Node.Columns = append(_spec.Node.Columns, eventsubscription.ForeignKeys...) + } + _spec.ScanValues = func(columns []string) ([]any, error) { + return (*EventSubscription).scanValues(nil, columns) + } + _spec.Assign = func(columns []string, values []any) error { + node := &EventSubscription{config: _q.config} + nodes = append(nodes, node) + node.Edges.loadedTypes = loadedTypes + return node.assignValues(columns, values) + } + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } + for i := range hooks { + hooks[i](ctx, _spec) + } + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { + return nil, err + } + if len(nodes) == 0 { + return nodes, nil + } + if query := _q.withOwner; query != nil { + if err := _q.loadOwner(ctx, query, nodes, nil, + func(n *EventSubscription, e *Application) { n.Edges.Owner = e }); err != nil { + return nil, err + } + } + if query := _q.withTarget; query != nil { + if err := _q.loadTarget(ctx, query, nodes, nil, + func(n *EventSubscription, e *EventExposure) { n.Edges.Target = e }); err != nil { + return nil, err + } + } + if query := _q.withApproval; query != nil { + if err := _q.loadApproval(ctx, query, nodes, nil, + func(n *EventSubscription, e *Approval) { n.Edges.Approval = e }); err != nil { + return nil, err + } + } + if query := _q.withApprovalRequests; query != nil { + if err := _q.loadApprovalRequests(ctx, query, nodes, + func(n *EventSubscription) { n.Edges.ApprovalRequests = []*ApprovalRequest{} }, + func(n *EventSubscription, e *ApprovalRequest) { + n.Edges.ApprovalRequests = append(n.Edges.ApprovalRequests, e) + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedApprovalRequests { + if err := _q.loadApprovalRequests(ctx, query, nodes, + func(n *EventSubscription) { n.appendNamedApprovalRequests(name) }, + func(n *EventSubscription, e *ApprovalRequest) { n.appendNamedApprovalRequests(name, e) }); err != nil { + return nil, err + } + } + for i := range _q.loadTotal { + if err := _q.loadTotal[i](ctx, nodes); err != nil { + return nil, err + } + } + return nodes, nil +} + +func (_q *EventSubscriptionQuery) loadOwner(ctx context.Context, query *ApplicationQuery, nodes []*EventSubscription, init func(*EventSubscription), assign func(*EventSubscription, *Application)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*EventSubscription) + for i := range nodes { + if nodes[i].application_subscribed_events == nil { + continue + } + fk := *nodes[i].application_subscribed_events + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(application.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "application_subscribed_events" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (_q *EventSubscriptionQuery) loadTarget(ctx context.Context, query *EventExposureQuery, nodes []*EventSubscription, init func(*EventSubscription), assign func(*EventSubscription, *EventExposure)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*EventSubscription) + for i := range nodes { + if nodes[i].event_subscription_target == nil { + continue + } + fk := *nodes[i].event_subscription_target + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(eventexposure.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "event_subscription_target" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (_q *EventSubscriptionQuery) loadApproval(ctx context.Context, query *ApprovalQuery, nodes []*EventSubscription, init func(*EventSubscription), assign func(*EventSubscription, *Approval)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*EventSubscription) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + } + query.withFKs = true + query.Where(predicate.Approval(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(eventsubscription.ApprovalColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.event_subscription_approval + if fk == nil { + return fmt.Errorf(`foreign-key "event_subscription_approval" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "event_subscription_approval" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} +func (_q *EventSubscriptionQuery) loadApprovalRequests(ctx context.Context, query *ApprovalRequestQuery, nodes []*EventSubscription, init func(*EventSubscription), assign func(*EventSubscription, *ApprovalRequest)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*EventSubscription) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.ApprovalRequest(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(eventsubscription.ApprovalRequestsColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.event_subscription_approval_requests + if fk == nil { + return fmt.Errorf(`foreign-key "event_subscription_approval_requests" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "event_subscription_approval_requests" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} + +func (_q *EventSubscriptionQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique + } + return sqlgraph.CountNodes(ctx, _q.driver, _spec) +} + +func (_q *EventSubscriptionQuery) querySpec() *sqlgraph.QuerySpec { + _spec := sqlgraph.NewQuerySpec(eventsubscription.Table, eventsubscription.Columns, sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt)) + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { + _spec.Unique = *unique + } else if _q.path != nil { + _spec.Unique = true + } + if fields := _q.ctx.Fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, eventsubscription.FieldID) + for i := range fields { + if fields[i] != eventsubscription.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) + } + } + } + if ps := _q.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if limit := _q.ctx.Limit; limit != nil { + _spec.Limit = *limit + } + if offset := _q.ctx.Offset; offset != nil { + _spec.Offset = *offset + } + if ps := _q.order; len(ps) > 0 { + _spec.Order = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + return _spec +} + +func (_q *EventSubscriptionQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) + t1 := builder.Table(eventsubscription.Table) + columns := _q.ctx.Fields + if len(columns) == 0 { + columns = eventsubscription.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) + if _q.sql != nil { + selector = _q.sql + selector.Select(selector.Columns(columns...)...) + } + if _q.ctx.Unique != nil && *_q.ctx.Unique { + selector.Distinct() + } + for _, p := range _q.predicates { + p(selector) + } + for _, p := range _q.order { + p(selector) + } + if offset := _q.ctx.Offset; offset != nil { + // limit is mandatory for offset clause. We start + // with default value, and override it below if needed. + selector.Offset(*offset).Limit(math.MaxInt32) + } + if limit := _q.ctx.Limit; limit != nil { + selector.Limit(*limit) + } + return selector +} + +// WithNamedApprovalRequests tells the query-builder to eager-load the nodes that are connected to the "approval_requests" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *EventSubscriptionQuery) WithNamedApprovalRequests(name string, opts ...func(*ApprovalRequestQuery)) *EventSubscriptionQuery { + query := (&ApprovalRequestClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedApprovalRequests == nil { + _q.withNamedApprovalRequests = make(map[string]*ApprovalRequestQuery) + } + _q.withNamedApprovalRequests[name] = query + return _q +} + +// EventSubscriptionGroupBy is the group-by builder for EventSubscription entities. +type EventSubscriptionGroupBy struct { + selector + build *EventSubscriptionQuery +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (_g *EventSubscriptionGroupBy) Aggregate(fns ...AggregateFunc) *EventSubscriptionGroupBy { + _g.fns = append(_g.fns, fns...) + return _g +} + +// Scan applies the selector query and scans the result into the given value. +func (_g *EventSubscriptionGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*EventSubscriptionQuery, *EventSubscriptionGroupBy](ctx, _g.build, _g, _g.build.inters, v) +} + +func (_g *EventSubscriptionGroupBy) sqlScan(ctx context.Context, root *EventSubscriptionQuery, v any) error { + selector := root.sqlQuery(ctx).Select() + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { + aggregation = append(aggregation, fn(selector)) + } + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) + } + selector.GroupBy(selector.Columns(*_g.flds...)...) + if err := selector.Err(); err != nil { + return err + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} + +// EventSubscriptionSelect is the builder for selecting fields of EventSubscription entities. +type EventSubscriptionSelect struct { + *EventSubscriptionQuery + selector +} + +// Aggregate adds the given aggregation functions to the selector query. +func (_s *EventSubscriptionSelect) Aggregate(fns ...AggregateFunc) *EventSubscriptionSelect { + _s.fns = append(_s.fns, fns...) + return _s +} + +// Scan applies the selector query and scans the result into the given value. +func (_s *EventSubscriptionSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*EventSubscriptionQuery, *EventSubscriptionSelect](ctx, _s.EventSubscriptionQuery, _s, _s.inters, v) +} + +func (_s *EventSubscriptionSelect) sqlScan(ctx context.Context, root *EventSubscriptionQuery, v any) error { + selector := root.sqlQuery(ctx) + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { + aggregation = append(aggregation, fn(selector)) + } + switch n := len(*_s.selector.flds); { + case n == 0 && len(aggregation) > 0: + selector.Select(aggregation...) + case n != 0 && len(aggregation) > 0: + selector.AppendSelect(aggregation...) + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := _s.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} diff --git a/controlplane-api/ent/eventsubscription_update.go b/controlplane-api/ent/eventsubscription_update.go new file mode 100644 index 000000000..01b998d17 --- /dev/null +++ b/controlplane-api/ent/eventsubscription_update.go @@ -0,0 +1,1117 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "fmt" + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/approval" + "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" +) + +// EventSubscriptionUpdate is the builder for updating EventSubscription entities. +type EventSubscriptionUpdate struct { + config + hooks []Hook + mutation *EventSubscriptionMutation +} + +// Where appends a list predicates to the EventSubscriptionUpdate builder. +func (_u *EventSubscriptionUpdate) Where(ps ...predicate.EventSubscription) *EventSubscriptionUpdate { + _u.mutation.Where(ps...) + return _u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_u *EventSubscriptionUpdate) SetLastModifiedAt(v time.Time) *EventSubscriptionUpdate { + _u.mutation.SetLastModifiedAt(v) + return _u +} + +// SetStatusPhase sets the "status_phase" field. +func (_u *EventSubscriptionUpdate) SetStatusPhase(v eventsubscription.StatusPhase) *EventSubscriptionUpdate { + _u.mutation.SetStatusPhase(v) + return _u +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_u *EventSubscriptionUpdate) SetNillableStatusPhase(v *eventsubscription.StatusPhase) *EventSubscriptionUpdate { + if v != nil { + _u.SetStatusPhase(*v) + } + return _u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (_u *EventSubscriptionUpdate) ClearStatusPhase() *EventSubscriptionUpdate { + _u.mutation.ClearStatusPhase() + return _u +} + +// SetStatusMessage sets the "status_message" field. +func (_u *EventSubscriptionUpdate) SetStatusMessage(v string) *EventSubscriptionUpdate { + _u.mutation.SetStatusMessage(v) + return _u +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_u *EventSubscriptionUpdate) SetNillableStatusMessage(v *string) *EventSubscriptionUpdate { + if v != nil { + _u.SetStatusMessage(*v) + } + return _u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (_u *EventSubscriptionUpdate) ClearStatusMessage() *EventSubscriptionUpdate { + _u.mutation.ClearStatusMessage() + return _u +} + +// SetEnvironment sets the "environment" field. +func (_u *EventSubscriptionUpdate) SetEnvironment(v string) *EventSubscriptionUpdate { + _u.mutation.SetEnvironment(v) + return _u +} + +// SetNillableEnvironment sets the "environment" field if the given value is not nil. +func (_u *EventSubscriptionUpdate) SetNillableEnvironment(v *string) *EventSubscriptionUpdate { + if v != nil { + _u.SetEnvironment(*v) + } + return _u +} + +// ClearEnvironment clears the value of the "environment" field. +func (_u *EventSubscriptionUpdate) ClearEnvironment() *EventSubscriptionUpdate { + _u.mutation.ClearEnvironment() + return _u +} + +// SetNamespace sets the "namespace" field. +func (_u *EventSubscriptionUpdate) SetNamespace(v string) *EventSubscriptionUpdate { + _u.mutation.SetNamespace(v) + return _u +} + +// SetNillableNamespace sets the "namespace" field if the given value is not nil. +func (_u *EventSubscriptionUpdate) SetNillableNamespace(v *string) *EventSubscriptionUpdate { + if v != nil { + _u.SetNamespace(*v) + } + return _u +} + +// SetName sets the "name" field. +func (_u *EventSubscriptionUpdate) SetName(v string) *EventSubscriptionUpdate { + _u.mutation.SetName(v) + return _u +} + +// SetNillableName sets the "name" field if the given value is not nil. +func (_u *EventSubscriptionUpdate) SetNillableName(v *string) *EventSubscriptionUpdate { + if v != nil { + _u.SetName(*v) + } + return _u +} + +// SetEventType sets the "event_type" field. +func (_u *EventSubscriptionUpdate) SetEventType(v string) *EventSubscriptionUpdate { + _u.mutation.SetEventType(v) + return _u +} + +// SetNillableEventType sets the "event_type" field if the given value is not nil. +func (_u *EventSubscriptionUpdate) SetNillableEventType(v *string) *EventSubscriptionUpdate { + if v != nil { + _u.SetEventType(*v) + } + return _u +} + +// SetDeliveryType sets the "delivery_type" field. +func (_u *EventSubscriptionUpdate) SetDeliveryType(v eventsubscription.DeliveryType) *EventSubscriptionUpdate { + _u.mutation.SetDeliveryType(v) + return _u +} + +// SetNillableDeliveryType sets the "delivery_type" field if the given value is not nil. +func (_u *EventSubscriptionUpdate) SetNillableDeliveryType(v *eventsubscription.DeliveryType) *EventSubscriptionUpdate { + if v != nil { + _u.SetDeliveryType(*v) + } + return _u +} + +// SetCallbackURL sets the "callback_url" field. +func (_u *EventSubscriptionUpdate) SetCallbackURL(v string) *EventSubscriptionUpdate { + _u.mutation.SetCallbackURL(v) + return _u +} + +// SetNillableCallbackURL sets the "callback_url" field if the given value is not nil. +func (_u *EventSubscriptionUpdate) SetNillableCallbackURL(v *string) *EventSubscriptionUpdate { + if v != nil { + _u.SetCallbackURL(*v) + } + return _u +} + +// ClearCallbackURL clears the value of the "callback_url" field. +func (_u *EventSubscriptionUpdate) ClearCallbackURL() *EventSubscriptionUpdate { + _u.mutation.ClearCallbackURL() + return _u +} + +// SetOwnerID sets the "owner" edge to the Application entity by ID. +func (_u *EventSubscriptionUpdate) SetOwnerID(id int) *EventSubscriptionUpdate { + _u.mutation.SetOwnerID(id) + return _u +} + +// SetOwner sets the "owner" edge to the Application entity. +func (_u *EventSubscriptionUpdate) SetOwner(v *Application) *EventSubscriptionUpdate { + return _u.SetOwnerID(v.ID) +} + +// SetTargetID sets the "target" edge to the EventExposure entity by ID. +func (_u *EventSubscriptionUpdate) SetTargetID(id int) *EventSubscriptionUpdate { + _u.mutation.SetTargetID(id) + return _u +} + +// SetNillableTargetID sets the "target" edge to the EventExposure entity by ID if the given value is not nil. +func (_u *EventSubscriptionUpdate) SetNillableTargetID(id *int) *EventSubscriptionUpdate { + if id != nil { + _u = _u.SetTargetID(*id) + } + return _u +} + +// SetTarget sets the "target" edge to the EventExposure entity. +func (_u *EventSubscriptionUpdate) SetTarget(v *EventExposure) *EventSubscriptionUpdate { + return _u.SetTargetID(v.ID) +} + +// SetApprovalID sets the "approval" edge to the Approval entity by ID. +func (_u *EventSubscriptionUpdate) SetApprovalID(id int) *EventSubscriptionUpdate { + _u.mutation.SetApprovalID(id) + return _u +} + +// SetNillableApprovalID sets the "approval" edge to the Approval entity by ID if the given value is not nil. +func (_u *EventSubscriptionUpdate) SetNillableApprovalID(id *int) *EventSubscriptionUpdate { + if id != nil { + _u = _u.SetApprovalID(*id) + } + return _u +} + +// SetApproval sets the "approval" edge to the Approval entity. +func (_u *EventSubscriptionUpdate) SetApproval(v *Approval) *EventSubscriptionUpdate { + return _u.SetApprovalID(v.ID) +} + +// AddApprovalRequestIDs adds the "approval_requests" edge to the ApprovalRequest entity by IDs. +func (_u *EventSubscriptionUpdate) AddApprovalRequestIDs(ids ...int) *EventSubscriptionUpdate { + _u.mutation.AddApprovalRequestIDs(ids...) + return _u +} + +// AddApprovalRequests adds the "approval_requests" edges to the ApprovalRequest entity. +func (_u *EventSubscriptionUpdate) AddApprovalRequests(v ...*ApprovalRequest) *EventSubscriptionUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddApprovalRequestIDs(ids...) +} + +// Mutation returns the EventSubscriptionMutation object of the builder. +func (_u *EventSubscriptionUpdate) Mutation() *EventSubscriptionMutation { + return _u.mutation +} + +// ClearOwner clears the "owner" edge to the Application entity. +func (_u *EventSubscriptionUpdate) ClearOwner() *EventSubscriptionUpdate { + _u.mutation.ClearOwner() + return _u +} + +// ClearTarget clears the "target" edge to the EventExposure entity. +func (_u *EventSubscriptionUpdate) ClearTarget() *EventSubscriptionUpdate { + _u.mutation.ClearTarget() + return _u +} + +// ClearApproval clears the "approval" edge to the Approval entity. +func (_u *EventSubscriptionUpdate) ClearApproval() *EventSubscriptionUpdate { + _u.mutation.ClearApproval() + return _u +} + +// ClearApprovalRequests clears all "approval_requests" edges to the ApprovalRequest entity. +func (_u *EventSubscriptionUpdate) ClearApprovalRequests() *EventSubscriptionUpdate { + _u.mutation.ClearApprovalRequests() + return _u +} + +// RemoveApprovalRequestIDs removes the "approval_requests" edge to ApprovalRequest entities by IDs. +func (_u *EventSubscriptionUpdate) RemoveApprovalRequestIDs(ids ...int) *EventSubscriptionUpdate { + _u.mutation.RemoveApprovalRequestIDs(ids...) + return _u +} + +// RemoveApprovalRequests removes "approval_requests" edges to ApprovalRequest entities. +func (_u *EventSubscriptionUpdate) RemoveApprovalRequests(v ...*ApprovalRequest) *EventSubscriptionUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveApprovalRequestIDs(ids...) +} + +// Save executes the query and returns the number of nodes affected by the update operation. +func (_u *EventSubscriptionUpdate) Save(ctx context.Context) (int, error) { + if err := _u.defaults(); err != nil { + return 0, err + } + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (_u *EventSubscriptionUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (_u *EventSubscriptionUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_u *EventSubscriptionUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (_u *EventSubscriptionUpdate) defaults() error { + if _, ok := _u.mutation.LastModifiedAt(); !ok { + if eventsubscription.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized eventsubscription.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := eventsubscription.UpdateDefaultLastModifiedAt() + _u.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_u *EventSubscriptionUpdate) check() error { + if v, ok := _u.mutation.StatusPhase(); ok { + if err := eventsubscription.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.status_phase": %w`, err)} + } + } + if v, ok := _u.mutation.Namespace(); ok { + if err := eventsubscription.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.namespace": %w`, err)} + } + } + if v, ok := _u.mutation.Name(); ok { + if err := eventsubscription.NameValidator(v); err != nil { + return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.name": %w`, err)} + } + } + if v, ok := _u.mutation.EventType(); ok { + if err := eventsubscription.EventTypeValidator(v); err != nil { + return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.event_type": %w`, err)} + } + } + if v, ok := _u.mutation.DeliveryType(); ok { + if err := eventsubscription.DeliveryTypeValidator(v); err != nil { + return &ValidationError{Name: "delivery_type", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.delivery_type": %w`, err)} + } + } + if _u.mutation.OwnerCleared() && len(_u.mutation.OwnerIDs()) > 0 { + return errors.New(`ent: clearing a required unique edge "EventSubscription.owner"`) + } + return nil +} + +func (_u *EventSubscriptionUpdate) sqlSave(ctx context.Context) (_node int, err error) { + if err := _u.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(eventsubscription.Table, eventsubscription.Columns, sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt)) + if ps := _u.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := _u.mutation.LastModifiedAt(); ok { + _spec.SetField(eventsubscription.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := _u.mutation.StatusPhase(); ok { + _spec.SetField(eventsubscription.FieldStatusPhase, field.TypeEnum, value) + } + if _u.mutation.StatusPhaseCleared() { + _spec.ClearField(eventsubscription.FieldStatusPhase, field.TypeEnum) + } + if value, ok := _u.mutation.StatusMessage(); ok { + _spec.SetField(eventsubscription.FieldStatusMessage, field.TypeString, value) + } + if _u.mutation.StatusMessageCleared() { + _spec.ClearField(eventsubscription.FieldStatusMessage, field.TypeString) + } + if value, ok := _u.mutation.Environment(); ok { + _spec.SetField(eventsubscription.FieldEnvironment, field.TypeString, value) + } + if _u.mutation.EnvironmentCleared() { + _spec.ClearField(eventsubscription.FieldEnvironment, field.TypeString) + } + if value, ok := _u.mutation.Namespace(); ok { + _spec.SetField(eventsubscription.FieldNamespace, field.TypeString, value) + } + if value, ok := _u.mutation.Name(); ok { + _spec.SetField(eventsubscription.FieldName, field.TypeString, value) + } + if value, ok := _u.mutation.EventType(); ok { + _spec.SetField(eventsubscription.FieldEventType, field.TypeString, value) + } + if value, ok := _u.mutation.DeliveryType(); ok { + _spec.SetField(eventsubscription.FieldDeliveryType, field.TypeEnum, value) + } + if value, ok := _u.mutation.CallbackURL(); ok { + _spec.SetField(eventsubscription.FieldCallbackURL, field.TypeString, value) + } + if _u.mutation.CallbackURLCleared() { + _spec.ClearField(eventsubscription.FieldCallbackURL, field.TypeString) + } + if _u.mutation.OwnerCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventsubscription.OwnerTable, + Columns: []string{eventsubscription.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(application.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventsubscription.OwnerTable, + Columns: []string{eventsubscription.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(application.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _u.mutation.TargetCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: eventsubscription.TargetTable, + Columns: []string{eventsubscription.TargetColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.TargetIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: eventsubscription.TargetTable, + Columns: []string{eventsubscription.TargetColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _u.mutation.ApprovalCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: eventsubscription.ApprovalTable, + Columns: []string{eventsubscription.ApprovalColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approval.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.ApprovalIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: eventsubscription.ApprovalTable, + Columns: []string{eventsubscription.ApprovalColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approval.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _u.mutation.ApprovalRequestsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventsubscription.ApprovalRequestsTable, + Columns: []string{eventsubscription.ApprovalRequestsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approvalrequest.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedApprovalRequestsIDs(); len(nodes) > 0 && !_u.mutation.ApprovalRequestsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventsubscription.ApprovalRequestsTable, + Columns: []string{eventsubscription.ApprovalRequestsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approvalrequest.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.ApprovalRequestsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventsubscription.ApprovalRequestsTable, + Columns: []string{eventsubscription.ApprovalRequestsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approvalrequest.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{eventsubscription.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return 0, err + } + _u.mutation.done = true + return _node, nil +} + +// EventSubscriptionUpdateOne is the builder for updating a single EventSubscription entity. +type EventSubscriptionUpdateOne struct { + config + fields []string + hooks []Hook + mutation *EventSubscriptionMutation +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_u *EventSubscriptionUpdateOne) SetLastModifiedAt(v time.Time) *EventSubscriptionUpdateOne { + _u.mutation.SetLastModifiedAt(v) + return _u +} + +// SetStatusPhase sets the "status_phase" field. +func (_u *EventSubscriptionUpdateOne) SetStatusPhase(v eventsubscription.StatusPhase) *EventSubscriptionUpdateOne { + _u.mutation.SetStatusPhase(v) + return _u +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_u *EventSubscriptionUpdateOne) SetNillableStatusPhase(v *eventsubscription.StatusPhase) *EventSubscriptionUpdateOne { + if v != nil { + _u.SetStatusPhase(*v) + } + return _u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (_u *EventSubscriptionUpdateOne) ClearStatusPhase() *EventSubscriptionUpdateOne { + _u.mutation.ClearStatusPhase() + return _u +} + +// SetStatusMessage sets the "status_message" field. +func (_u *EventSubscriptionUpdateOne) SetStatusMessage(v string) *EventSubscriptionUpdateOne { + _u.mutation.SetStatusMessage(v) + return _u +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_u *EventSubscriptionUpdateOne) SetNillableStatusMessage(v *string) *EventSubscriptionUpdateOne { + if v != nil { + _u.SetStatusMessage(*v) + } + return _u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (_u *EventSubscriptionUpdateOne) ClearStatusMessage() *EventSubscriptionUpdateOne { + _u.mutation.ClearStatusMessage() + return _u +} + +// SetEnvironment sets the "environment" field. +func (_u *EventSubscriptionUpdateOne) SetEnvironment(v string) *EventSubscriptionUpdateOne { + _u.mutation.SetEnvironment(v) + return _u +} + +// SetNillableEnvironment sets the "environment" field if the given value is not nil. +func (_u *EventSubscriptionUpdateOne) SetNillableEnvironment(v *string) *EventSubscriptionUpdateOne { + if v != nil { + _u.SetEnvironment(*v) + } + return _u +} + +// ClearEnvironment clears the value of the "environment" field. +func (_u *EventSubscriptionUpdateOne) ClearEnvironment() *EventSubscriptionUpdateOne { + _u.mutation.ClearEnvironment() + return _u +} + +// SetNamespace sets the "namespace" field. +func (_u *EventSubscriptionUpdateOne) SetNamespace(v string) *EventSubscriptionUpdateOne { + _u.mutation.SetNamespace(v) + return _u +} + +// SetNillableNamespace sets the "namespace" field if the given value is not nil. +func (_u *EventSubscriptionUpdateOne) SetNillableNamespace(v *string) *EventSubscriptionUpdateOne { + if v != nil { + _u.SetNamespace(*v) + } + return _u +} + +// SetName sets the "name" field. +func (_u *EventSubscriptionUpdateOne) SetName(v string) *EventSubscriptionUpdateOne { + _u.mutation.SetName(v) + return _u +} + +// SetNillableName sets the "name" field if the given value is not nil. +func (_u *EventSubscriptionUpdateOne) SetNillableName(v *string) *EventSubscriptionUpdateOne { + if v != nil { + _u.SetName(*v) + } + return _u +} + +// SetEventType sets the "event_type" field. +func (_u *EventSubscriptionUpdateOne) SetEventType(v string) *EventSubscriptionUpdateOne { + _u.mutation.SetEventType(v) + return _u +} + +// SetNillableEventType sets the "event_type" field if the given value is not nil. +func (_u *EventSubscriptionUpdateOne) SetNillableEventType(v *string) *EventSubscriptionUpdateOne { + if v != nil { + _u.SetEventType(*v) + } + return _u +} + +// SetDeliveryType sets the "delivery_type" field. +func (_u *EventSubscriptionUpdateOne) SetDeliveryType(v eventsubscription.DeliveryType) *EventSubscriptionUpdateOne { + _u.mutation.SetDeliveryType(v) + return _u +} + +// SetNillableDeliveryType sets the "delivery_type" field if the given value is not nil. +func (_u *EventSubscriptionUpdateOne) SetNillableDeliveryType(v *eventsubscription.DeliveryType) *EventSubscriptionUpdateOne { + if v != nil { + _u.SetDeliveryType(*v) + } + return _u +} + +// SetCallbackURL sets the "callback_url" field. +func (_u *EventSubscriptionUpdateOne) SetCallbackURL(v string) *EventSubscriptionUpdateOne { + _u.mutation.SetCallbackURL(v) + return _u +} + +// SetNillableCallbackURL sets the "callback_url" field if the given value is not nil. +func (_u *EventSubscriptionUpdateOne) SetNillableCallbackURL(v *string) *EventSubscriptionUpdateOne { + if v != nil { + _u.SetCallbackURL(*v) + } + return _u +} + +// ClearCallbackURL clears the value of the "callback_url" field. +func (_u *EventSubscriptionUpdateOne) ClearCallbackURL() *EventSubscriptionUpdateOne { + _u.mutation.ClearCallbackURL() + return _u +} + +// SetOwnerID sets the "owner" edge to the Application entity by ID. +func (_u *EventSubscriptionUpdateOne) SetOwnerID(id int) *EventSubscriptionUpdateOne { + _u.mutation.SetOwnerID(id) + return _u +} + +// SetOwner sets the "owner" edge to the Application entity. +func (_u *EventSubscriptionUpdateOne) SetOwner(v *Application) *EventSubscriptionUpdateOne { + return _u.SetOwnerID(v.ID) +} + +// SetTargetID sets the "target" edge to the EventExposure entity by ID. +func (_u *EventSubscriptionUpdateOne) SetTargetID(id int) *EventSubscriptionUpdateOne { + _u.mutation.SetTargetID(id) + return _u +} + +// SetNillableTargetID sets the "target" edge to the EventExposure entity by ID if the given value is not nil. +func (_u *EventSubscriptionUpdateOne) SetNillableTargetID(id *int) *EventSubscriptionUpdateOne { + if id != nil { + _u = _u.SetTargetID(*id) + } + return _u +} + +// SetTarget sets the "target" edge to the EventExposure entity. +func (_u *EventSubscriptionUpdateOne) SetTarget(v *EventExposure) *EventSubscriptionUpdateOne { + return _u.SetTargetID(v.ID) +} + +// SetApprovalID sets the "approval" edge to the Approval entity by ID. +func (_u *EventSubscriptionUpdateOne) SetApprovalID(id int) *EventSubscriptionUpdateOne { + _u.mutation.SetApprovalID(id) + return _u +} + +// SetNillableApprovalID sets the "approval" edge to the Approval entity by ID if the given value is not nil. +func (_u *EventSubscriptionUpdateOne) SetNillableApprovalID(id *int) *EventSubscriptionUpdateOne { + if id != nil { + _u = _u.SetApprovalID(*id) + } + return _u +} + +// SetApproval sets the "approval" edge to the Approval entity. +func (_u *EventSubscriptionUpdateOne) SetApproval(v *Approval) *EventSubscriptionUpdateOne { + return _u.SetApprovalID(v.ID) +} + +// AddApprovalRequestIDs adds the "approval_requests" edge to the ApprovalRequest entity by IDs. +func (_u *EventSubscriptionUpdateOne) AddApprovalRequestIDs(ids ...int) *EventSubscriptionUpdateOne { + _u.mutation.AddApprovalRequestIDs(ids...) + return _u +} + +// AddApprovalRequests adds the "approval_requests" edges to the ApprovalRequest entity. +func (_u *EventSubscriptionUpdateOne) AddApprovalRequests(v ...*ApprovalRequest) *EventSubscriptionUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddApprovalRequestIDs(ids...) +} + +// Mutation returns the EventSubscriptionMutation object of the builder. +func (_u *EventSubscriptionUpdateOne) Mutation() *EventSubscriptionMutation { + return _u.mutation +} + +// ClearOwner clears the "owner" edge to the Application entity. +func (_u *EventSubscriptionUpdateOne) ClearOwner() *EventSubscriptionUpdateOne { + _u.mutation.ClearOwner() + return _u +} + +// ClearTarget clears the "target" edge to the EventExposure entity. +func (_u *EventSubscriptionUpdateOne) ClearTarget() *EventSubscriptionUpdateOne { + _u.mutation.ClearTarget() + return _u +} + +// ClearApproval clears the "approval" edge to the Approval entity. +func (_u *EventSubscriptionUpdateOne) ClearApproval() *EventSubscriptionUpdateOne { + _u.mutation.ClearApproval() + return _u +} + +// ClearApprovalRequests clears all "approval_requests" edges to the ApprovalRequest entity. +func (_u *EventSubscriptionUpdateOne) ClearApprovalRequests() *EventSubscriptionUpdateOne { + _u.mutation.ClearApprovalRequests() + return _u +} + +// RemoveApprovalRequestIDs removes the "approval_requests" edge to ApprovalRequest entities by IDs. +func (_u *EventSubscriptionUpdateOne) RemoveApprovalRequestIDs(ids ...int) *EventSubscriptionUpdateOne { + _u.mutation.RemoveApprovalRequestIDs(ids...) + return _u +} + +// RemoveApprovalRequests removes "approval_requests" edges to ApprovalRequest entities. +func (_u *EventSubscriptionUpdateOne) RemoveApprovalRequests(v ...*ApprovalRequest) *EventSubscriptionUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveApprovalRequestIDs(ids...) +} + +// Where appends a list predicates to the EventSubscriptionUpdate builder. +func (_u *EventSubscriptionUpdateOne) Where(ps ...predicate.EventSubscription) *EventSubscriptionUpdateOne { + _u.mutation.Where(ps...) + return _u +} + +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (_u *EventSubscriptionUpdateOne) Select(field string, fields ...string) *EventSubscriptionUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u +} + +// Save executes the query and returns the updated EventSubscription entity. +func (_u *EventSubscriptionUpdateOne) Save(ctx context.Context) (*EventSubscription, error) { + if err := _u.defaults(); err != nil { + return nil, err + } + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (_u *EventSubscriptionUpdateOne) SaveX(ctx context.Context) *EventSubscription { + node, err := _u.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (_u *EventSubscriptionUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_u *EventSubscriptionUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (_u *EventSubscriptionUpdateOne) defaults() error { + if _, ok := _u.mutation.LastModifiedAt(); !ok { + if eventsubscription.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized eventsubscription.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := eventsubscription.UpdateDefaultLastModifiedAt() + _u.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_u *EventSubscriptionUpdateOne) check() error { + if v, ok := _u.mutation.StatusPhase(); ok { + if err := eventsubscription.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.status_phase": %w`, err)} + } + } + if v, ok := _u.mutation.Namespace(); ok { + if err := eventsubscription.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.namespace": %w`, err)} + } + } + if v, ok := _u.mutation.Name(); ok { + if err := eventsubscription.NameValidator(v); err != nil { + return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.name": %w`, err)} + } + } + if v, ok := _u.mutation.EventType(); ok { + if err := eventsubscription.EventTypeValidator(v); err != nil { + return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.event_type": %w`, err)} + } + } + if v, ok := _u.mutation.DeliveryType(); ok { + if err := eventsubscription.DeliveryTypeValidator(v); err != nil { + return &ValidationError{Name: "delivery_type", err: fmt.Errorf(`ent: validator failed for field "EventSubscription.delivery_type": %w`, err)} + } + } + if _u.mutation.OwnerCleared() && len(_u.mutation.OwnerIDs()) > 0 { + return errors.New(`ent: clearing a required unique edge "EventSubscription.owner"`) + } + return nil +} + +func (_u *EventSubscriptionUpdateOne) sqlSave(ctx context.Context) (_node *EventSubscription, err error) { + if err := _u.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(eventsubscription.Table, eventsubscription.Columns, sqlgraph.NewFieldSpec(eventsubscription.FieldID, field.TypeInt)) + id, ok := _u.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "EventSubscription.id" for update`)} + } + _spec.Node.ID.Value = id + if fields := _u.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, eventsubscription.FieldID) + for _, f := range fields { + if !eventsubscription.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != eventsubscription.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } + if ps := _u.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := _u.mutation.LastModifiedAt(); ok { + _spec.SetField(eventsubscription.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := _u.mutation.StatusPhase(); ok { + _spec.SetField(eventsubscription.FieldStatusPhase, field.TypeEnum, value) + } + if _u.mutation.StatusPhaseCleared() { + _spec.ClearField(eventsubscription.FieldStatusPhase, field.TypeEnum) + } + if value, ok := _u.mutation.StatusMessage(); ok { + _spec.SetField(eventsubscription.FieldStatusMessage, field.TypeString, value) + } + if _u.mutation.StatusMessageCleared() { + _spec.ClearField(eventsubscription.FieldStatusMessage, field.TypeString) + } + if value, ok := _u.mutation.Environment(); ok { + _spec.SetField(eventsubscription.FieldEnvironment, field.TypeString, value) + } + if _u.mutation.EnvironmentCleared() { + _spec.ClearField(eventsubscription.FieldEnvironment, field.TypeString) + } + if value, ok := _u.mutation.Namespace(); ok { + _spec.SetField(eventsubscription.FieldNamespace, field.TypeString, value) + } + if value, ok := _u.mutation.Name(); ok { + _spec.SetField(eventsubscription.FieldName, field.TypeString, value) + } + if value, ok := _u.mutation.EventType(); ok { + _spec.SetField(eventsubscription.FieldEventType, field.TypeString, value) + } + if value, ok := _u.mutation.DeliveryType(); ok { + _spec.SetField(eventsubscription.FieldDeliveryType, field.TypeEnum, value) + } + if value, ok := _u.mutation.CallbackURL(); ok { + _spec.SetField(eventsubscription.FieldCallbackURL, field.TypeString, value) + } + if _u.mutation.CallbackURLCleared() { + _spec.ClearField(eventsubscription.FieldCallbackURL, field.TypeString) + } + if _u.mutation.OwnerCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventsubscription.OwnerTable, + Columns: []string{eventsubscription.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(application.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventsubscription.OwnerTable, + Columns: []string{eventsubscription.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(application.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _u.mutation.TargetCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: eventsubscription.TargetTable, + Columns: []string{eventsubscription.TargetColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.TargetIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: eventsubscription.TargetTable, + Columns: []string{eventsubscription.TargetColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _u.mutation.ApprovalCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: eventsubscription.ApprovalTable, + Columns: []string{eventsubscription.ApprovalColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approval.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.ApprovalIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: eventsubscription.ApprovalTable, + Columns: []string{eventsubscription.ApprovalColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approval.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if _u.mutation.ApprovalRequestsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventsubscription.ApprovalRequestsTable, + Columns: []string{eventsubscription.ApprovalRequestsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approvalrequest.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedApprovalRequestsIDs(); len(nodes) > 0 && !_u.mutation.ApprovalRequestsCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventsubscription.ApprovalRequestsTable, + Columns: []string{eventsubscription.ApprovalRequestsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approvalrequest.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.ApprovalRequestsIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventsubscription.ApprovalRequestsTable, + Columns: []string{eventsubscription.ApprovalRequestsColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(approvalrequest.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + _node = &EventSubscription{config: _u.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues + if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{eventsubscription.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + _u.mutation.done = true + return _node, nil +} diff --git a/controlplane-api/ent/gql_collection.go b/controlplane-api/ent/gql_collection.go index 5e28f8378..801975632 100644 --- a/controlplane-api/ent/gql_collection.go +++ b/controlplane-api/ent/gql_collection.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -19,6 +18,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" @@ -577,6 +578,184 @@ func (_q *ApplicationQuery) collectField(ctx context.Context, oneNode bool, opCt _q.WithNamedSubscribedApis(alias, func(wq *ApiSubscriptionQuery) { *wq = *query }) + + case "exposedEvents": + var ( + alias = field.Alias + path = append(path, alias) + query = (&EventExposureClient{config: _q.config}).Query() + ) + args := newEventExposurePaginateArgs(fieldArgs(ctx, new(EventExposureWhereInput), path...)) + if err := validateFirstLast(args.first, args.last); err != nil { + return fmt.Errorf("validate first and last in path %q: %w", path, err) + } + pager, err := newEventExposurePager(args.opts, args.last != nil) + if err != nil { + return fmt.Errorf("create new pager in path %q: %w", path, err) + } + if query, err = pager.applyFilter(query); err != nil { + return err + } + ignoredEdges := !hasCollectedField(ctx, append(path, edgesField)...) + if hasCollectedField(ctx, append(path, totalCountField)...) || hasCollectedField(ctx, append(path, pageInfoField)...) { + hasPagination := args.after != nil || args.first != nil || args.before != nil || args.last != nil + if hasPagination || ignoredEdges { + query := query.Clone() + _q.loadTotal = append(_q.loadTotal, func(ctx context.Context, nodes []*Application) error { + ids := make([]driver.Value, len(nodes)) + for i := range nodes { + ids[i] = nodes[i].ID + } + var v []struct { + NodeID int `sql:"application_exposed_events"` + Count int `sql:"count"` + } + query.Where(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(application.ExposedEventsColumn), ids...)) + }) + if err := query.GroupBy(application.ExposedEventsColumn).Aggregate(Count()).Scan(ctx, &v); err != nil { + return err + } + m := make(map[int]int, len(v)) + for i := range v { + m[v[i].NodeID] = v[i].Count + } + for i := range nodes { + n := m[nodes[i].ID] + if nodes[i].Edges.totalCount[3] == nil { + nodes[i].Edges.totalCount[3] = make(map[string]int) + } + nodes[i].Edges.totalCount[3][alias] = n + } + return nil + }) + } else { + _q.loadTotal = append(_q.loadTotal, func(_ context.Context, nodes []*Application) error { + for i := range nodes { + n := len(nodes[i].Edges.ExposedEvents) + if nodes[i].Edges.totalCount[3] == nil { + nodes[i].Edges.totalCount[3] = make(map[string]int) + } + nodes[i].Edges.totalCount[3][alias] = n + } + return nil + }) + } + } + if ignoredEdges || (args.first != nil && *args.first == 0) || (args.last != nil && *args.last == 0) { + continue + } + if query, err = pager.applyCursors(query, args.after, args.before); err != nil { + return err + } + path = append(path, edgesField, nodeField) + if field := collectedField(ctx, path...); field != nil { + if err := query.collectField(ctx, false, opCtx, *field, path, mayAddCondition(satisfies, eventexposureImplementors)...); err != nil { + return err + } + } + if limit := paginateLimit(args.first, args.last); limit > 0 { + if oneNode { + pager.applyOrder(query.Limit(limit)) + } else { + modify := entgql.LimitPerRow(application.ExposedEventsColumn, limit, pager.orderExpr(query)) + query.modifiers = append(query.modifiers, modify) + } + } else { + query = pager.applyOrder(query) + } + _q.WithNamedExposedEvents(alias, func(wq *EventExposureQuery) { + *wq = *query + }) + + case "subscribedEvents": + var ( + alias = field.Alias + path = append(path, alias) + query = (&EventSubscriptionClient{config: _q.config}).Query() + ) + args := newEventSubscriptionPaginateArgs(fieldArgs(ctx, new(EventSubscriptionWhereInput), path...)) + if err := validateFirstLast(args.first, args.last); err != nil { + return fmt.Errorf("validate first and last in path %q: %w", path, err) + } + pager, err := newEventSubscriptionPager(args.opts, args.last != nil) + if err != nil { + return fmt.Errorf("create new pager in path %q: %w", path, err) + } + if query, err = pager.applyFilter(query); err != nil { + return err + } + ignoredEdges := !hasCollectedField(ctx, append(path, edgesField)...) + if hasCollectedField(ctx, append(path, totalCountField)...) || hasCollectedField(ctx, append(path, pageInfoField)...) { + hasPagination := args.after != nil || args.first != nil || args.before != nil || args.last != nil + if hasPagination || ignoredEdges { + query := query.Clone() + _q.loadTotal = append(_q.loadTotal, func(ctx context.Context, nodes []*Application) error { + ids := make([]driver.Value, len(nodes)) + for i := range nodes { + ids[i] = nodes[i].ID + } + var v []struct { + NodeID int `sql:"application_subscribed_events"` + Count int `sql:"count"` + } + query.Where(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(application.SubscribedEventsColumn), ids...)) + }) + if err := query.GroupBy(application.SubscribedEventsColumn).Aggregate(Count()).Scan(ctx, &v); err != nil { + return err + } + m := make(map[int]int, len(v)) + for i := range v { + m[v[i].NodeID] = v[i].Count + } + for i := range nodes { + n := m[nodes[i].ID] + if nodes[i].Edges.totalCount[4] == nil { + nodes[i].Edges.totalCount[4] = make(map[string]int) + } + nodes[i].Edges.totalCount[4][alias] = n + } + return nil + }) + } else { + _q.loadTotal = append(_q.loadTotal, func(_ context.Context, nodes []*Application) error { + for i := range nodes { + n := len(nodes[i].Edges.SubscribedEvents) + if nodes[i].Edges.totalCount[4] == nil { + nodes[i].Edges.totalCount[4] = make(map[string]int) + } + nodes[i].Edges.totalCount[4][alias] = n + } + return nil + }) + } + } + if ignoredEdges || (args.first != nil && *args.first == 0) || (args.last != nil && *args.last == 0) { + continue + } + if query, err = pager.applyCursors(query, args.after, args.before); err != nil { + return err + } + path = append(path, edgesField, nodeField) + if field := collectedField(ctx, path...); field != nil { + if err := query.collectField(ctx, false, opCtx, *field, path, mayAddCondition(satisfies, eventsubscriptionImplementors)...); err != nil { + return err + } + } + if limit := paginateLimit(args.first, args.last); limit > 0 { + if oneNode { + pager.applyOrder(query.Limit(limit)) + } else { + modify := entgql.LimitPerRow(application.SubscribedEventsColumn, limit, pager.orderExpr(query)) + query.modifiers = append(query.modifiers, modify) + } + } else { + query = pager.applyOrder(query) + } + _q.WithNamedSubscribedEvents(alias, func(wq *EventSubscriptionQuery) { + *wq = *query + }) case "createdAt": if _, ok := fieldSeen[application.FieldCreatedAt]; !ok { selectedFields = append(selectedFields, application.FieldCreatedAt) @@ -622,10 +801,30 @@ func (_q *ApplicationQuery) collectField(ctx context.Context, oneNode bool, opCt selectedFields = append(selectedFields, application.FieldClientSecret) fieldSeen[application.FieldClientSecret] = struct{}{} } - case "issuerURL": - if _, ok := fieldSeen[application.FieldIssuerURL]; !ok { - selectedFields = append(selectedFields, application.FieldIssuerURL) - fieldSeen[application.FieldIssuerURL] = struct{}{} + case "rotatedClientSecret": + if _, ok := fieldSeen[application.FieldRotatedClientSecret]; !ok { + selectedFields = append(selectedFields, application.FieldRotatedClientSecret) + fieldSeen[application.FieldRotatedClientSecret] = struct{}{} + } + case "rotatedExpiresAt": + if _, ok := fieldSeen[application.FieldRotatedExpiresAt]; !ok { + selectedFields = append(selectedFields, application.FieldRotatedExpiresAt) + fieldSeen[application.FieldRotatedExpiresAt] = struct{}{} + } + case "currentExpiresAt": + if _, ok := fieldSeen[application.FieldCurrentExpiresAt]; !ok { + selectedFields = append(selectedFields, application.FieldCurrentExpiresAt) + fieldSeen[application.FieldCurrentExpiresAt] = struct{}{} + } + case "secretRotationPhase": + if _, ok := fieldSeen[application.FieldSecretRotationPhase]; !ok { + selectedFields = append(selectedFields, application.FieldSecretRotationPhase) + fieldSeen[application.FieldSecretRotationPhase] = struct{}{} + } + case "secretRotationMessage": + if _, ok := fieldSeen[application.FieldSecretRotationMessage]; !ok { + selectedFields = append(selectedFields, application.FieldSecretRotationMessage) + fieldSeen[application.FieldSecretRotationMessage] = struct{}{} } case "id": case "__typename": @@ -1026,6 +1225,320 @@ func newApprovalRequestPaginateArgs(rv map[string]any) *approvalrequestPaginateA return args } +// CollectFields tells the query-builder to eagerly load connected nodes by resolver context. +func (_q *EventExposureQuery) CollectFields(ctx context.Context, satisfies ...string) (*EventExposureQuery, error) { + fc := graphql.GetFieldContext(ctx) + if fc == nil { + return _q, nil + } + if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { + return nil, err + } + return _q, nil +} + +func (_q *EventExposureQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { + path = append([]string(nil), path...) + var ( + unknownSeen bool + fieldSeen = make(map[string]struct{}, len(eventexposure.Columns)) + selectedFields = []string{eventexposure.FieldID} + ) + for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { + switch field.Name { + + case "owner": + var ( + alias = field.Alias + path = append(path, alias) + query = (&ApplicationClient{config: _q.config}).Query() + ) + if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, applicationImplementors)...); err != nil { + return err + } + _q.withOwner = query + case "createdAt": + if _, ok := fieldSeen[eventexposure.FieldCreatedAt]; !ok { + selectedFields = append(selectedFields, eventexposure.FieldCreatedAt) + fieldSeen[eventexposure.FieldCreatedAt] = struct{}{} + } + case "lastModifiedAt": + if _, ok := fieldSeen[eventexposure.FieldLastModifiedAt]; !ok { + selectedFields = append(selectedFields, eventexposure.FieldLastModifiedAt) + fieldSeen[eventexposure.FieldLastModifiedAt] = struct{}{} + } + case "statusPhase": + if _, ok := fieldSeen[eventexposure.FieldStatusPhase]; !ok { + selectedFields = append(selectedFields, eventexposure.FieldStatusPhase) + fieldSeen[eventexposure.FieldStatusPhase] = struct{}{} + } + case "statusMessage": + if _, ok := fieldSeen[eventexposure.FieldStatusMessage]; !ok { + selectedFields = append(selectedFields, eventexposure.FieldStatusMessage) + fieldSeen[eventexposure.FieldStatusMessage] = struct{}{} + } + case "environment": + if _, ok := fieldSeen[eventexposure.FieldEnvironment]; !ok { + selectedFields = append(selectedFields, eventexposure.FieldEnvironment) + fieldSeen[eventexposure.FieldEnvironment] = struct{}{} + } + case "namespace": + if _, ok := fieldSeen[eventexposure.FieldNamespace]; !ok { + selectedFields = append(selectedFields, eventexposure.FieldNamespace) + fieldSeen[eventexposure.FieldNamespace] = struct{}{} + } + case "eventType": + if _, ok := fieldSeen[eventexposure.FieldEventType]; !ok { + selectedFields = append(selectedFields, eventexposure.FieldEventType) + fieldSeen[eventexposure.FieldEventType] = struct{}{} + } + case "visibility": + if _, ok := fieldSeen[eventexposure.FieldVisibility]; !ok { + selectedFields = append(selectedFields, eventexposure.FieldVisibility) + fieldSeen[eventexposure.FieldVisibility] = struct{}{} + } + case "active": + if _, ok := fieldSeen[eventexposure.FieldActive]; !ok { + selectedFields = append(selectedFields, eventexposure.FieldActive) + fieldSeen[eventexposure.FieldActive] = struct{}{} + } + case "approvalConfig": + if _, ok := fieldSeen[eventexposure.FieldApprovalConfig]; !ok { + selectedFields = append(selectedFields, eventexposure.FieldApprovalConfig) + fieldSeen[eventexposure.FieldApprovalConfig] = struct{}{} + } + case "id": + case "__typename": + default: + unknownSeen = true + } + } + if !unknownSeen { + _q.Select(selectedFields...) + } + return nil +} + +type eventexposurePaginateArgs struct { + first, last *int + after, before *Cursor + opts []EventExposurePaginateOption +} + +func newEventExposurePaginateArgs(rv map[string]any) *eventexposurePaginateArgs { + args := &eventexposurePaginateArgs{} + if rv == nil { + return args + } + if v := rv[firstField]; v != nil { + args.first = v.(*int) + } + if v := rv[lastField]; v != nil { + args.last = v.(*int) + } + if v := rv[afterField]; v != nil { + args.after = v.(*Cursor) + } + if v := rv[beforeField]; v != nil { + args.before = v.(*Cursor) + } + if v, ok := rv[orderByField]; ok { + switch v := v.(type) { + case map[string]any: + var ( + err1, err2 error + order = &EventExposureOrder{Field: &EventExposureOrderField{}, Direction: entgql.OrderDirectionAsc} + ) + if d, ok := v[directionField]; ok { + err1 = order.Direction.UnmarshalGQL(d) + } + if f, ok := v[fieldField]; ok { + err2 = order.Field.UnmarshalGQL(f) + } + if err1 == nil && err2 == nil { + args.opts = append(args.opts, WithEventExposureOrder(order)) + } + case *EventExposureOrder: + if v != nil { + args.opts = append(args.opts, WithEventExposureOrder(v)) + } + } + } + if v, ok := rv[whereField].(*EventExposureWhereInput); ok { + args.opts = append(args.opts, WithEventExposureFilter(v.Filter)) + } + return args +} + +// CollectFields tells the query-builder to eagerly load connected nodes by resolver context. +func (_q *EventSubscriptionQuery) CollectFields(ctx context.Context, satisfies ...string) (*EventSubscriptionQuery, error) { + fc := graphql.GetFieldContext(ctx) + if fc == nil { + return _q, nil + } + if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { + return nil, err + } + return _q, nil +} + +func (_q *EventSubscriptionQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { + path = append([]string(nil), path...) + var ( + unknownSeen bool + fieldSeen = make(map[string]struct{}, len(eventsubscription.Columns)) + selectedFields = []string{eventsubscription.FieldID} + ) + for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { + switch field.Name { + + case "owner": + var ( + alias = field.Alias + path = append(path, alias) + query = (&ApplicationClient{config: _q.config}).Query() + ) + if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, applicationImplementors)...); err != nil { + return err + } + _q.withOwner = query + + case "approval": + var ( + alias = field.Alias + path = append(path, alias) + query = (&ApprovalClient{config: _q.config}).Query() + ) + if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, approvalImplementors)...); err != nil { + return err + } + _q.withApproval = query + + case "approvalRequests": + var ( + alias = field.Alias + path = append(path, alias) + query = (&ApprovalRequestClient{config: _q.config}).Query() + ) + if err := query.collectField(ctx, false, opCtx, field, path, mayAddCondition(satisfies, approvalrequestImplementors)...); err != nil { + return err + } + _q.WithNamedApprovalRequests(alias, func(wq *ApprovalRequestQuery) { + *wq = *query + }) + case "createdAt": + if _, ok := fieldSeen[eventsubscription.FieldCreatedAt]; !ok { + selectedFields = append(selectedFields, eventsubscription.FieldCreatedAt) + fieldSeen[eventsubscription.FieldCreatedAt] = struct{}{} + } + case "lastModifiedAt": + if _, ok := fieldSeen[eventsubscription.FieldLastModifiedAt]; !ok { + selectedFields = append(selectedFields, eventsubscription.FieldLastModifiedAt) + fieldSeen[eventsubscription.FieldLastModifiedAt] = struct{}{} + } + case "statusPhase": + if _, ok := fieldSeen[eventsubscription.FieldStatusPhase]; !ok { + selectedFields = append(selectedFields, eventsubscription.FieldStatusPhase) + fieldSeen[eventsubscription.FieldStatusPhase] = struct{}{} + } + case "statusMessage": + if _, ok := fieldSeen[eventsubscription.FieldStatusMessage]; !ok { + selectedFields = append(selectedFields, eventsubscription.FieldStatusMessage) + fieldSeen[eventsubscription.FieldStatusMessage] = struct{}{} + } + case "environment": + if _, ok := fieldSeen[eventsubscription.FieldEnvironment]; !ok { + selectedFields = append(selectedFields, eventsubscription.FieldEnvironment) + fieldSeen[eventsubscription.FieldEnvironment] = struct{}{} + } + case "namespace": + if _, ok := fieldSeen[eventsubscription.FieldNamespace]; !ok { + selectedFields = append(selectedFields, eventsubscription.FieldNamespace) + fieldSeen[eventsubscription.FieldNamespace] = struct{}{} + } + case "name": + if _, ok := fieldSeen[eventsubscription.FieldName]; !ok { + selectedFields = append(selectedFields, eventsubscription.FieldName) + fieldSeen[eventsubscription.FieldName] = struct{}{} + } + case "eventType": + if _, ok := fieldSeen[eventsubscription.FieldEventType]; !ok { + selectedFields = append(selectedFields, eventsubscription.FieldEventType) + fieldSeen[eventsubscription.FieldEventType] = struct{}{} + } + case "deliveryType": + if _, ok := fieldSeen[eventsubscription.FieldDeliveryType]; !ok { + selectedFields = append(selectedFields, eventsubscription.FieldDeliveryType) + fieldSeen[eventsubscription.FieldDeliveryType] = struct{}{} + } + case "callbackURL": + if _, ok := fieldSeen[eventsubscription.FieldCallbackURL]; !ok { + selectedFields = append(selectedFields, eventsubscription.FieldCallbackURL) + fieldSeen[eventsubscription.FieldCallbackURL] = struct{}{} + } + case "id": + case "__typename": + default: + unknownSeen = true + } + } + if !unknownSeen { + _q.Select(selectedFields...) + } + return nil +} + +type eventsubscriptionPaginateArgs struct { + first, last *int + after, before *Cursor + opts []EventSubscriptionPaginateOption +} + +func newEventSubscriptionPaginateArgs(rv map[string]any) *eventsubscriptionPaginateArgs { + args := &eventsubscriptionPaginateArgs{} + if rv == nil { + return args + } + if v := rv[firstField]; v != nil { + args.first = v.(*int) + } + if v := rv[lastField]; v != nil { + args.last = v.(*int) + } + if v := rv[afterField]; v != nil { + args.after = v.(*Cursor) + } + if v := rv[beforeField]; v != nil { + args.before = v.(*Cursor) + } + if v, ok := rv[orderByField]; ok { + switch v := v.(type) { + case map[string]any: + var ( + err1, err2 error + order = &EventSubscriptionOrder{Field: &EventSubscriptionOrderField{}, Direction: entgql.OrderDirectionAsc} + ) + if d, ok := v[directionField]; ok { + err1 = order.Direction.UnmarshalGQL(d) + } + if f, ok := v[fieldField]; ok { + err2 = order.Field.UnmarshalGQL(f) + } + if err1 == nil && err2 == nil { + args.opts = append(args.opts, WithEventSubscriptionOrder(order)) + } + case *EventSubscriptionOrder: + if v != nil { + args.opts = append(args.opts, WithEventSubscriptionOrder(v)) + } + } + } + if v, ok := rv[whereField].(*EventSubscriptionWhereInput); ok { + args.opts = append(args.opts, WithEventSubscriptionFilter(v.Filter)) + } + return args +} + // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *GroupQuery) CollectFields(ctx context.Context, satisfies ...string) (*GroupQuery, error) { fc := graphql.GetFieldContext(ctx) @@ -1393,10 +1906,10 @@ func (_q *TeamQuery) collectField(ctx context.Context, oneNode bool, opCtx *grap selectedFields = append(selectedFields, team.FieldCategory) fieldSeen[team.FieldCategory] = struct{}{} } - case "roverTokenRef": - if _, ok := fieldSeen[team.FieldRoverTokenRef]; !ok { - selectedFields = append(selectedFields, team.FieldRoverTokenRef) - fieldSeen[team.FieldRoverTokenRef] = struct{}{} + case "teamToken": + if _, ok := fieldSeen[team.FieldTeamToken]; !ok { + selectedFields = append(selectedFields, team.FieldTeamToken) + fieldSeen[team.FieldTeamToken] = struct{}{} } case "id": case "__typename": @@ -1516,6 +2029,11 @@ func (_q *ZoneQuery) collectField(ctx context.Context, oneNode bool, opCtx *grap selectedFields = append(selectedFields, zone.FieldGatewayURL) fieldSeen[zone.FieldGatewayURL] = struct{}{} } + case "issuerURL": + if _, ok := fieldSeen[zone.FieldIssuerURL]; !ok { + selectedFields = append(selectedFields, zone.FieldIssuerURL) + fieldSeen[zone.FieldIssuerURL] = struct{}{} + } case "visibility": if _, ok := fieldSeen[zone.FieldVisibility]; !ok { selectedFields = append(selectedFields, zone.FieldVisibility) diff --git a/controlplane-api/ent/gql_edge.go b/controlplane-api/ent/gql_edge.go index c53daba58..8be9df261 100644 --- a/controlplane-api/ent/gql_edge.go +++ b/controlplane-api/ent/gql_edge.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -110,6 +109,84 @@ func (_m *Application) SubscribedApis( return _m.QuerySubscribedApis().Paginate(ctx, after, first, before, last, opts...) } +func (_m *Application) ExposedEvents( + ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, orderBy *EventExposureOrder, where *EventExposureWhereInput, +) (*EventExposureConnection, error) { + opts := []EventExposurePaginateOption{ + WithEventExposureOrder(orderBy), + WithEventExposureFilter(where.Filter), + } + alias := graphql.GetFieldContext(ctx).Field.Alias + totalCount, hasTotalCount := _m.Edges.totalCount[3][alias] + if nodes, err := _m.NamedExposedEvents(alias); err == nil || hasTotalCount { + pager, err := newEventExposurePager(opts, last != nil) + if err != nil { + return nil, err + } + conn := &EventExposureConnection{Edges: []*EventExposureEdge{}, TotalCount: totalCount} + conn.build(nodes, pager, after, first, before, last) + return conn, nil + } + return _m.QueryExposedEvents().Paginate(ctx, after, first, before, last, opts...) +} + +func (_m *Application) SubscribedEvents( + ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, orderBy *EventSubscriptionOrder, where *EventSubscriptionWhereInput, +) (*EventSubscriptionConnection, error) { + opts := []EventSubscriptionPaginateOption{ + WithEventSubscriptionOrder(orderBy), + WithEventSubscriptionFilter(where.Filter), + } + alias := graphql.GetFieldContext(ctx).Field.Alias + totalCount, hasTotalCount := _m.Edges.totalCount[4][alias] + if nodes, err := _m.NamedSubscribedEvents(alias); err == nil || hasTotalCount { + pager, err := newEventSubscriptionPager(opts, last != nil) + if err != nil { + return nil, err + } + conn := &EventSubscriptionConnection{Edges: []*EventSubscriptionEdge{}, TotalCount: totalCount} + conn.build(nodes, pager, after, first, before, last) + return conn, nil + } + return _m.QuerySubscribedEvents().Paginate(ctx, after, first, before, last, opts...) +} + +func (_m *EventExposure) Owner(ctx context.Context) (*Application, error) { + result, err := _m.Edges.OwnerOrErr() + if IsNotLoaded(err) { + result, err = _m.QueryOwner().Only(ctx) + } + return result, err +} + +func (_m *EventSubscription) Owner(ctx context.Context) (*Application, error) { + result, err := _m.Edges.OwnerOrErr() + if IsNotLoaded(err) { + result, err = _m.QueryOwner().Only(ctx) + } + return result, err +} + +func (_m *EventSubscription) Approval(ctx context.Context) (*Approval, error) { + result, err := _m.Edges.ApprovalOrErr() + if IsNotLoaded(err) { + result, err = _m.QueryApproval().Only(ctx) + } + return result, MaskNotFound(err) +} + +func (_m *EventSubscription) ApprovalRequests(ctx context.Context) (result []*ApprovalRequest, err error) { + if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { + result, err = _m.NamedApprovalRequests(graphql.GetFieldContext(ctx).Field.Alias) + } else { + result, err = _m.Edges.ApprovalRequestsOrErr() + } + if IsNotLoaded(err) { + result, err = _m.QueryApprovalRequests().All(ctx) + } + return result, err +} + func (_m *Group) Teams(ctx context.Context) (result []*Team, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = _m.NamedTeams(graphql.GetFieldContext(ctx).Field.Alias) diff --git a/controlplane-api/ent/gql_node.go b/controlplane-api/ent/gql_node.go index f70adbd7d..3a3b5ebb4 100644 --- a/controlplane-api/ent/gql_node.go +++ b/controlplane-api/ent/gql_node.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -23,6 +22,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" @@ -60,6 +61,16 @@ var approvalrequestImplementors = []string{"ApprovalRequest", "Node"} // IsNode implements the Node interface check for GQLGen. func (*ApprovalRequest) IsNode() {} +var eventexposureImplementors = []string{"EventExposure", "Node"} + +// IsNode implements the Node interface check for GQLGen. +func (*EventExposure) IsNode() {} + +var eventsubscriptionImplementors = []string{"EventSubscription", "Node"} + +// IsNode implements the Node interface check for GQLGen. +func (*EventSubscription) IsNode() {} + var groupImplementors = []string{"Group", "Node"} // IsNode implements the Node interface check for GQLGen. @@ -183,6 +194,24 @@ func (c *Client) noder(ctx context.Context, table string, id int) (Noder, error) } } return query.Only(ctx) + case eventexposure.Table: + query := c.EventExposure.Query(). + Where(eventexposure.ID(id)) + if fc := graphql.GetFieldContext(ctx); fc != nil { + if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, eventexposureImplementors...); err != nil { + return nil, err + } + } + return query.Only(ctx) + case eventsubscription.Table: + query := c.EventSubscription.Query(). + Where(eventsubscription.ID(id)) + if fc := graphql.GetFieldContext(ctx); fc != nil { + if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, eventsubscriptionImplementors...); err != nil { + return nil, err + } + } + return query.Only(ctx) case group.Table: query := c.Group.Query(). Where(group.ID(id)) @@ -372,6 +401,38 @@ func (c *Client) noders(ctx context.Context, table string, ids []int) ([]Noder, *noder = node } } + case eventexposure.Table: + query := c.EventExposure.Query(). + Where(eventexposure.IDIn(ids...)) + query, err := query.CollectFields(ctx, eventexposureImplementors...) + if err != nil { + return nil, err + } + nodes, err := query.All(ctx) + if err != nil { + return nil, err + } + for _, node := range nodes { + for _, noder := range idmap[node.ID] { + *noder = node + } + } + case eventsubscription.Table: + query := c.EventSubscription.Query(). + Where(eventsubscription.IDIn(ids...)) + query, err := query.CollectFields(ctx, eventsubscriptionImplementors...) + if err != nil { + return nil, err + } + nodes, err := query.All(ctx) + if err != nil { + return nil, err + } + for _, node := range nodes { + for _, noder := range idmap[node.ID] { + *noder = node + } + } case group.Table: query := c.Group.Query(). Where(group.IDIn(ids...)) diff --git a/controlplane-api/ent/gql_pagination.go b/controlplane-api/ent/gql_pagination.go index 299cf42cd..e7f64a23c 100644 --- a/controlplane-api/ent/gql_pagination.go +++ b/controlplane-api/ent/gql_pagination.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -23,6 +22,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" @@ -1806,6 +1807,634 @@ func (_m *ApprovalRequest) ToEdge(order *ApprovalRequestOrder) *ApprovalRequestE } } +// EventExposureEdge is the edge representation of EventExposure. +type EventExposureEdge struct { + Node *EventExposure `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EventExposureConnection is the connection containing edges to EventExposure. +type EventExposureConnection struct { + Edges []*EventExposureEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} + +func (c *EventExposureConnection) build(nodes []*EventExposure, pager *eventexposurePager, after *Cursor, first *int, before *Cursor, last *int) { + c.PageInfo.HasNextPage = before != nil + c.PageInfo.HasPreviousPage = after != nil + if first != nil && *first+1 == len(nodes) { + c.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && *last+1 == len(nodes) { + c.PageInfo.HasPreviousPage = true + nodes = nodes[:len(nodes)-1] + } + var nodeAt func(int) *EventExposure + if last != nil { + n := len(nodes) - 1 + nodeAt = func(i int) *EventExposure { + return nodes[n-i] + } + } else { + nodeAt = func(i int) *EventExposure { + return nodes[i] + } + } + c.Edges = make([]*EventExposureEdge, len(nodes)) + for i := range nodes { + node := nodeAt(i) + c.Edges[i] = &EventExposureEdge{ + Node: node, + Cursor: pager.toCursor(node), + } + } + if l := len(c.Edges); l > 0 { + c.PageInfo.StartCursor = &c.Edges[0].Cursor + c.PageInfo.EndCursor = &c.Edges[l-1].Cursor + } + if c.TotalCount == 0 { + c.TotalCount = len(nodes) + } +} + +// EventExposurePaginateOption enables pagination customization. +type EventExposurePaginateOption func(*eventexposurePager) error + +// WithEventExposureOrder configures pagination ordering. +func WithEventExposureOrder(order *EventExposureOrder) EventExposurePaginateOption { + if order == nil { + order = DefaultEventExposureOrder + } + o := *order + return func(pager *eventexposurePager) error { + if err := o.Direction.Validate(); err != nil { + return err + } + if o.Field == nil { + o.Field = DefaultEventExposureOrder.Field + } + pager.order = &o + return nil + } +} + +// WithEventExposureFilter configures pagination filter. +func WithEventExposureFilter(filter func(*EventExposureQuery) (*EventExposureQuery, error)) EventExposurePaginateOption { + return func(pager *eventexposurePager) error { + if filter == nil { + return errors.New("EventExposureQuery filter cannot be nil") + } + pager.filter = filter + return nil + } +} + +type eventexposurePager struct { + reverse bool + order *EventExposureOrder + filter func(*EventExposureQuery) (*EventExposureQuery, error) +} + +func newEventExposurePager(opts []EventExposurePaginateOption, reverse bool) (*eventexposurePager, error) { + pager := &eventexposurePager{reverse: reverse} + for _, opt := range opts { + if err := opt(pager); err != nil { + return nil, err + } + } + if pager.order == nil { + pager.order = DefaultEventExposureOrder + } + return pager, nil +} + +func (p *eventexposurePager) applyFilter(query *EventExposureQuery) (*EventExposureQuery, error) { + if p.filter != nil { + return p.filter(query) + } + return query, nil +} + +func (p *eventexposurePager) toCursor(_m *EventExposure) Cursor { + return p.order.Field.toCursor(_m) +} + +func (p *eventexposurePager) applyCursors(query *EventExposureQuery, after, before *Cursor) (*EventExposureQuery, error) { + direction := p.order.Direction + if p.reverse { + direction = direction.Reverse() + } + for _, predicate := range entgql.CursorsPredicate(after, before, DefaultEventExposureOrder.Field.column, p.order.Field.column, direction) { + query = query.Where(predicate) + } + return query, nil +} + +func (p *eventexposurePager) applyOrder(query *EventExposureQuery) *EventExposureQuery { + direction := p.order.Direction + if p.reverse { + direction = direction.Reverse() + } + query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) + if p.order.Field != DefaultEventExposureOrder.Field { + query = query.Order(DefaultEventExposureOrder.Field.toTerm(direction.OrderTermOption())) + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(p.order.Field.column) + } + return query +} + +func (p *eventexposurePager) orderExpr(query *EventExposureQuery) sql.Querier { + direction := p.order.Direction + if p.reverse { + direction = direction.Reverse() + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(p.order.Field.column) + } + return sql.ExprFunc(func(b *sql.Builder) { + b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) + if p.order.Field != DefaultEventExposureOrder.Field { + b.Comma().Ident(DefaultEventExposureOrder.Field.column).Pad().WriteString(string(direction)) + } + }) +} + +// Paginate executes the query and returns a relay based cursor connection to EventExposure. +func (_m *EventExposureQuery) Paginate( + ctx context.Context, after *Cursor, first *int, + before *Cursor, last *int, opts ...EventExposurePaginateOption, +) (*EventExposureConnection, error) { + if err := validateFirstLast(first, last); err != nil { + return nil, err + } + pager, err := newEventExposurePager(opts, last != nil) + if err != nil { + return nil, err + } + if _m, err = pager.applyFilter(_m); err != nil { + return nil, err + } + conn := &EventExposureConnection{Edges: []*EventExposureEdge{}} + ignoredEdges := !hasCollectedField(ctx, edgesField) + if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { + hasPagination := after != nil || first != nil || before != nil || last != nil + if hasPagination || ignoredEdges { + c := _m.Clone() + c.ctx.Fields = nil + if conn.TotalCount, err = c.Count(ctx); err != nil { + return nil, err + } + conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 + conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 + } + } + if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { + return conn, nil + } + if _m, err = pager.applyCursors(_m, after, before); err != nil { + return nil, err + } + limit := paginateLimit(first, last) + if limit != 0 { + _m.Limit(limit) + } + if field := collectedField(ctx, edgesField, nodeField); field != nil { + if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { + return nil, err + } + } + _m = pager.applyOrder(_m) + nodes, err := _m.All(ctx) + if err != nil { + return nil, err + } + conn.build(nodes, pager, after, first, before, last) + return conn, nil +} + +var ( + // EventExposureOrderFieldCreatedAt orders EventExposure by created_at. + EventExposureOrderFieldCreatedAt = &EventExposureOrderField{ + Value: func(_m *EventExposure) (ent.Value, error) { + return _m.CreatedAt, nil + }, + column: eventexposure.FieldCreatedAt, + toTerm: eventexposure.ByCreatedAt, + toCursor: func(_m *EventExposure) Cursor { + return Cursor{ + ID: _m.ID, + Value: _m.CreatedAt, + } + }, + } + // EventExposureOrderFieldLastModifiedAt orders EventExposure by last_modified_at. + EventExposureOrderFieldLastModifiedAt = &EventExposureOrderField{ + Value: func(_m *EventExposure) (ent.Value, error) { + return _m.LastModifiedAt, nil + }, + column: eventexposure.FieldLastModifiedAt, + toTerm: eventexposure.ByLastModifiedAt, + toCursor: func(_m *EventExposure) Cursor { + return Cursor{ + ID: _m.ID, + Value: _m.LastModifiedAt, + } + }, + } +) + +// String implement fmt.Stringer interface. +func (f EventExposureOrderField) String() string { + var str string + switch f.column { + case EventExposureOrderFieldCreatedAt.column: + str = "CREATED_AT" + case EventExposureOrderFieldLastModifiedAt.column: + str = "LAST_MODIFIED_AT" + } + return str +} + +// MarshalGQL implements graphql.Marshaler interface. +func (f EventExposureOrderField) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(f.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (f *EventExposureOrderField) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("EventExposureOrderField %T must be a string", v) + } + switch str { + case "CREATED_AT": + *f = *EventExposureOrderFieldCreatedAt + case "LAST_MODIFIED_AT": + *f = *EventExposureOrderFieldLastModifiedAt + default: + return fmt.Errorf("%s is not a valid EventExposureOrderField", str) + } + return nil +} + +// EventExposureOrderField defines the ordering field of EventExposure. +type EventExposureOrderField struct { + // Value extracts the ordering value from the given EventExposure. + Value func(*EventExposure) (ent.Value, error) + column string // field or computed. + toTerm func(...sql.OrderTermOption) eventexposure.OrderOption + toCursor func(*EventExposure) Cursor +} + +// EventExposureOrder defines the ordering of EventExposure. +type EventExposureOrder struct { + Direction OrderDirection `json:"direction"` + Field *EventExposureOrderField `json:"field"` +} + +// DefaultEventExposureOrder is the default ordering of EventExposure. +var DefaultEventExposureOrder = &EventExposureOrder{ + Direction: entgql.OrderDirectionAsc, + Field: &EventExposureOrderField{ + Value: func(_m *EventExposure) (ent.Value, error) { + return _m.ID, nil + }, + column: eventexposure.FieldID, + toTerm: eventexposure.ByID, + toCursor: func(_m *EventExposure) Cursor { + return Cursor{ID: _m.ID} + }, + }, +} + +// ToEdge converts EventExposure into EventExposureEdge. +func (_m *EventExposure) ToEdge(order *EventExposureOrder) *EventExposureEdge { + if order == nil { + order = DefaultEventExposureOrder + } + return &EventExposureEdge{ + Node: _m, + Cursor: order.Field.toCursor(_m), + } +} + +// EventSubscriptionEdge is the edge representation of EventSubscription. +type EventSubscriptionEdge struct { + Node *EventSubscription `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EventSubscriptionConnection is the connection containing edges to EventSubscription. +type EventSubscriptionConnection struct { + Edges []*EventSubscriptionEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} + +func (c *EventSubscriptionConnection) build(nodes []*EventSubscription, pager *eventsubscriptionPager, after *Cursor, first *int, before *Cursor, last *int) { + c.PageInfo.HasNextPage = before != nil + c.PageInfo.HasPreviousPage = after != nil + if first != nil && *first+1 == len(nodes) { + c.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && *last+1 == len(nodes) { + c.PageInfo.HasPreviousPage = true + nodes = nodes[:len(nodes)-1] + } + var nodeAt func(int) *EventSubscription + if last != nil { + n := len(nodes) - 1 + nodeAt = func(i int) *EventSubscription { + return nodes[n-i] + } + } else { + nodeAt = func(i int) *EventSubscription { + return nodes[i] + } + } + c.Edges = make([]*EventSubscriptionEdge, len(nodes)) + for i := range nodes { + node := nodeAt(i) + c.Edges[i] = &EventSubscriptionEdge{ + Node: node, + Cursor: pager.toCursor(node), + } + } + if l := len(c.Edges); l > 0 { + c.PageInfo.StartCursor = &c.Edges[0].Cursor + c.PageInfo.EndCursor = &c.Edges[l-1].Cursor + } + if c.TotalCount == 0 { + c.TotalCount = len(nodes) + } +} + +// EventSubscriptionPaginateOption enables pagination customization. +type EventSubscriptionPaginateOption func(*eventsubscriptionPager) error + +// WithEventSubscriptionOrder configures pagination ordering. +func WithEventSubscriptionOrder(order *EventSubscriptionOrder) EventSubscriptionPaginateOption { + if order == nil { + order = DefaultEventSubscriptionOrder + } + o := *order + return func(pager *eventsubscriptionPager) error { + if err := o.Direction.Validate(); err != nil { + return err + } + if o.Field == nil { + o.Field = DefaultEventSubscriptionOrder.Field + } + pager.order = &o + return nil + } +} + +// WithEventSubscriptionFilter configures pagination filter. +func WithEventSubscriptionFilter(filter func(*EventSubscriptionQuery) (*EventSubscriptionQuery, error)) EventSubscriptionPaginateOption { + return func(pager *eventsubscriptionPager) error { + if filter == nil { + return errors.New("EventSubscriptionQuery filter cannot be nil") + } + pager.filter = filter + return nil + } +} + +type eventsubscriptionPager struct { + reverse bool + order *EventSubscriptionOrder + filter func(*EventSubscriptionQuery) (*EventSubscriptionQuery, error) +} + +func newEventSubscriptionPager(opts []EventSubscriptionPaginateOption, reverse bool) (*eventsubscriptionPager, error) { + pager := &eventsubscriptionPager{reverse: reverse} + for _, opt := range opts { + if err := opt(pager); err != nil { + return nil, err + } + } + if pager.order == nil { + pager.order = DefaultEventSubscriptionOrder + } + return pager, nil +} + +func (p *eventsubscriptionPager) applyFilter(query *EventSubscriptionQuery) (*EventSubscriptionQuery, error) { + if p.filter != nil { + return p.filter(query) + } + return query, nil +} + +func (p *eventsubscriptionPager) toCursor(_m *EventSubscription) Cursor { + return p.order.Field.toCursor(_m) +} + +func (p *eventsubscriptionPager) applyCursors(query *EventSubscriptionQuery, after, before *Cursor) (*EventSubscriptionQuery, error) { + direction := p.order.Direction + if p.reverse { + direction = direction.Reverse() + } + for _, predicate := range entgql.CursorsPredicate(after, before, DefaultEventSubscriptionOrder.Field.column, p.order.Field.column, direction) { + query = query.Where(predicate) + } + return query, nil +} + +func (p *eventsubscriptionPager) applyOrder(query *EventSubscriptionQuery) *EventSubscriptionQuery { + direction := p.order.Direction + if p.reverse { + direction = direction.Reverse() + } + query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) + if p.order.Field != DefaultEventSubscriptionOrder.Field { + query = query.Order(DefaultEventSubscriptionOrder.Field.toTerm(direction.OrderTermOption())) + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(p.order.Field.column) + } + return query +} + +func (p *eventsubscriptionPager) orderExpr(query *EventSubscriptionQuery) sql.Querier { + direction := p.order.Direction + if p.reverse { + direction = direction.Reverse() + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(p.order.Field.column) + } + return sql.ExprFunc(func(b *sql.Builder) { + b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) + if p.order.Field != DefaultEventSubscriptionOrder.Field { + b.Comma().Ident(DefaultEventSubscriptionOrder.Field.column).Pad().WriteString(string(direction)) + } + }) +} + +// Paginate executes the query and returns a relay based cursor connection to EventSubscription. +func (_m *EventSubscriptionQuery) Paginate( + ctx context.Context, after *Cursor, first *int, + before *Cursor, last *int, opts ...EventSubscriptionPaginateOption, +) (*EventSubscriptionConnection, error) { + if err := validateFirstLast(first, last); err != nil { + return nil, err + } + pager, err := newEventSubscriptionPager(opts, last != nil) + if err != nil { + return nil, err + } + if _m, err = pager.applyFilter(_m); err != nil { + return nil, err + } + conn := &EventSubscriptionConnection{Edges: []*EventSubscriptionEdge{}} + ignoredEdges := !hasCollectedField(ctx, edgesField) + if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { + hasPagination := after != nil || first != nil || before != nil || last != nil + if hasPagination || ignoredEdges { + c := _m.Clone() + c.ctx.Fields = nil + if conn.TotalCount, err = c.Count(ctx); err != nil { + return nil, err + } + conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 + conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 + } + } + if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { + return conn, nil + } + if _m, err = pager.applyCursors(_m, after, before); err != nil { + return nil, err + } + limit := paginateLimit(first, last) + if limit != 0 { + _m.Limit(limit) + } + if field := collectedField(ctx, edgesField, nodeField); field != nil { + if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { + return nil, err + } + } + _m = pager.applyOrder(_m) + nodes, err := _m.All(ctx) + if err != nil { + return nil, err + } + conn.build(nodes, pager, after, first, before, last) + return conn, nil +} + +var ( + // EventSubscriptionOrderFieldCreatedAt orders EventSubscription by created_at. + EventSubscriptionOrderFieldCreatedAt = &EventSubscriptionOrderField{ + Value: func(_m *EventSubscription) (ent.Value, error) { + return _m.CreatedAt, nil + }, + column: eventsubscription.FieldCreatedAt, + toTerm: eventsubscription.ByCreatedAt, + toCursor: func(_m *EventSubscription) Cursor { + return Cursor{ + ID: _m.ID, + Value: _m.CreatedAt, + } + }, + } + // EventSubscriptionOrderFieldLastModifiedAt orders EventSubscription by last_modified_at. + EventSubscriptionOrderFieldLastModifiedAt = &EventSubscriptionOrderField{ + Value: func(_m *EventSubscription) (ent.Value, error) { + return _m.LastModifiedAt, nil + }, + column: eventsubscription.FieldLastModifiedAt, + toTerm: eventsubscription.ByLastModifiedAt, + toCursor: func(_m *EventSubscription) Cursor { + return Cursor{ + ID: _m.ID, + Value: _m.LastModifiedAt, + } + }, + } +) + +// String implement fmt.Stringer interface. +func (f EventSubscriptionOrderField) String() string { + var str string + switch f.column { + case EventSubscriptionOrderFieldCreatedAt.column: + str = "CREATED_AT" + case EventSubscriptionOrderFieldLastModifiedAt.column: + str = "LAST_MODIFIED_AT" + } + return str +} + +// MarshalGQL implements graphql.Marshaler interface. +func (f EventSubscriptionOrderField) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(f.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (f *EventSubscriptionOrderField) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("EventSubscriptionOrderField %T must be a string", v) + } + switch str { + case "CREATED_AT": + *f = *EventSubscriptionOrderFieldCreatedAt + case "LAST_MODIFIED_AT": + *f = *EventSubscriptionOrderFieldLastModifiedAt + default: + return fmt.Errorf("%s is not a valid EventSubscriptionOrderField", str) + } + return nil +} + +// EventSubscriptionOrderField defines the ordering field of EventSubscription. +type EventSubscriptionOrderField struct { + // Value extracts the ordering value from the given EventSubscription. + Value func(*EventSubscription) (ent.Value, error) + column string // field or computed. + toTerm func(...sql.OrderTermOption) eventsubscription.OrderOption + toCursor func(*EventSubscription) Cursor +} + +// EventSubscriptionOrder defines the ordering of EventSubscription. +type EventSubscriptionOrder struct { + Direction OrderDirection `json:"direction"` + Field *EventSubscriptionOrderField `json:"field"` +} + +// DefaultEventSubscriptionOrder is the default ordering of EventSubscription. +var DefaultEventSubscriptionOrder = &EventSubscriptionOrder{ + Direction: entgql.OrderDirectionAsc, + Field: &EventSubscriptionOrderField{ + Value: func(_m *EventSubscription) (ent.Value, error) { + return _m.ID, nil + }, + column: eventsubscription.FieldID, + toTerm: eventsubscription.ByID, + toCursor: func(_m *EventSubscription) Cursor { + return Cursor{ID: _m.ID} + }, + }, +} + +// ToEdge converts EventSubscription into EventSubscriptionEdge. +func (_m *EventSubscription) ToEdge(order *EventSubscriptionOrder) *EventSubscriptionEdge { + if order == nil { + order = DefaultEventSubscriptionOrder + } + return &EventSubscriptionEdge{ + Node: _m, + Cursor: order.Field.toCursor(_m), + } +} + // GroupEdge is the edge representation of Group. type GroupEdge struct { Node *Group `json:"node"` diff --git a/controlplane-api/ent/gql_transaction.go b/controlplane-api/ent/gql_transaction.go index 5db8ddb91..c9c116204 100644 --- a/controlplane-api/ent/gql_transaction.go +++ b/controlplane-api/ent/gql_transaction.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/gql_where_input.go b/controlplane-api/ent/gql_where_input.go index 04d7c78ee..462490c6e 100644 --- a/controlplane-api/ent/gql_where_input.go +++ b/controlplane-api/ent/gql_where_input.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -16,6 +15,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/predicate" @@ -1373,39 +1374,52 @@ type ApplicationWhereInput struct { ClientIDEqualFold *string `json:"clientIDEqualFold,omitempty"` ClientIDContainsFold *string `json:"clientIDContainsFold,omitempty"` - // "client_secret" field predicates. - ClientSecret *string `json:"clientSecret,omitempty"` - ClientSecretNEQ *string `json:"clientSecretNEQ,omitempty"` - ClientSecretIn []string `json:"clientSecretIn,omitempty"` - ClientSecretNotIn []string `json:"clientSecretNotIn,omitempty"` - ClientSecretGT *string `json:"clientSecretGT,omitempty"` - ClientSecretGTE *string `json:"clientSecretGTE,omitempty"` - ClientSecretLT *string `json:"clientSecretLT,omitempty"` - ClientSecretLTE *string `json:"clientSecretLTE,omitempty"` - ClientSecretContains *string `json:"clientSecretContains,omitempty"` - ClientSecretHasPrefix *string `json:"clientSecretHasPrefix,omitempty"` - ClientSecretHasSuffix *string `json:"clientSecretHasSuffix,omitempty"` - ClientSecretIsNil bool `json:"clientSecretIsNil,omitempty"` - ClientSecretNotNil bool `json:"clientSecretNotNil,omitempty"` - ClientSecretEqualFold *string `json:"clientSecretEqualFold,omitempty"` - ClientSecretContainsFold *string `json:"clientSecretContainsFold,omitempty"` - - // "issuer_url" field predicates. - IssuerURL *string `json:"issuerURL,omitempty"` - IssuerURLNEQ *string `json:"issuerURLNEQ,omitempty"` - IssuerURLIn []string `json:"issuerURLIn,omitempty"` - IssuerURLNotIn []string `json:"issuerURLNotIn,omitempty"` - IssuerURLGT *string `json:"issuerURLGT,omitempty"` - IssuerURLGTE *string `json:"issuerURLGTE,omitempty"` - IssuerURLLT *string `json:"issuerURLLT,omitempty"` - IssuerURLLTE *string `json:"issuerURLLTE,omitempty"` - IssuerURLContains *string `json:"issuerURLContains,omitempty"` - IssuerURLHasPrefix *string `json:"issuerURLHasPrefix,omitempty"` - IssuerURLHasSuffix *string `json:"issuerURLHasSuffix,omitempty"` - IssuerURLIsNil bool `json:"issuerURLIsNil,omitempty"` - IssuerURLNotNil bool `json:"issuerURLNotNil,omitempty"` - IssuerURLEqualFold *string `json:"issuerURLEqualFold,omitempty"` - IssuerURLContainsFold *string `json:"issuerURLContainsFold,omitempty"` + // "rotated_expires_at" field predicates. + RotatedExpiresAt *time.Time `json:"rotatedExpiresAt,omitempty"` + RotatedExpiresAtNEQ *time.Time `json:"rotatedExpiresAtNEQ,omitempty"` + RotatedExpiresAtIn []time.Time `json:"rotatedExpiresAtIn,omitempty"` + RotatedExpiresAtNotIn []time.Time `json:"rotatedExpiresAtNotIn,omitempty"` + RotatedExpiresAtGT *time.Time `json:"rotatedExpiresAtGT,omitempty"` + RotatedExpiresAtGTE *time.Time `json:"rotatedExpiresAtGTE,omitempty"` + RotatedExpiresAtLT *time.Time `json:"rotatedExpiresAtLT,omitempty"` + RotatedExpiresAtLTE *time.Time `json:"rotatedExpiresAtLTE,omitempty"` + RotatedExpiresAtIsNil bool `json:"rotatedExpiresAtIsNil,omitempty"` + RotatedExpiresAtNotNil bool `json:"rotatedExpiresAtNotNil,omitempty"` + + // "current_expires_at" field predicates. + CurrentExpiresAt *time.Time `json:"currentExpiresAt,omitempty"` + CurrentExpiresAtNEQ *time.Time `json:"currentExpiresAtNEQ,omitempty"` + CurrentExpiresAtIn []time.Time `json:"currentExpiresAtIn,omitempty"` + CurrentExpiresAtNotIn []time.Time `json:"currentExpiresAtNotIn,omitempty"` + CurrentExpiresAtGT *time.Time `json:"currentExpiresAtGT,omitempty"` + CurrentExpiresAtGTE *time.Time `json:"currentExpiresAtGTE,omitempty"` + CurrentExpiresAtLT *time.Time `json:"currentExpiresAtLT,omitempty"` + CurrentExpiresAtLTE *time.Time `json:"currentExpiresAtLTE,omitempty"` + CurrentExpiresAtIsNil bool `json:"currentExpiresAtIsNil,omitempty"` + CurrentExpiresAtNotNil bool `json:"currentExpiresAtNotNil,omitempty"` + + // "secret_rotation_phase" field predicates. + SecretRotationPhase *application.SecretRotationPhase `json:"secretRotationPhase,omitempty"` + SecretRotationPhaseNEQ *application.SecretRotationPhase `json:"secretRotationPhaseNEQ,omitempty"` + SecretRotationPhaseIn []application.SecretRotationPhase `json:"secretRotationPhaseIn,omitempty"` + SecretRotationPhaseNotIn []application.SecretRotationPhase `json:"secretRotationPhaseNotIn,omitempty"` + + // "secret_rotation_message" field predicates. + SecretRotationMessage *string `json:"secretRotationMessage,omitempty"` + SecretRotationMessageNEQ *string `json:"secretRotationMessageNEQ,omitempty"` + SecretRotationMessageIn []string `json:"secretRotationMessageIn,omitempty"` + SecretRotationMessageNotIn []string `json:"secretRotationMessageNotIn,omitempty"` + SecretRotationMessageGT *string `json:"secretRotationMessageGT,omitempty"` + SecretRotationMessageGTE *string `json:"secretRotationMessageGTE,omitempty"` + SecretRotationMessageLT *string `json:"secretRotationMessageLT,omitempty"` + SecretRotationMessageLTE *string `json:"secretRotationMessageLTE,omitempty"` + SecretRotationMessageContains *string `json:"secretRotationMessageContains,omitempty"` + SecretRotationMessageHasPrefix *string `json:"secretRotationMessageHasPrefix,omitempty"` + SecretRotationMessageHasSuffix *string `json:"secretRotationMessageHasSuffix,omitempty"` + SecretRotationMessageIsNil bool `json:"secretRotationMessageIsNil,omitempty"` + SecretRotationMessageNotNil bool `json:"secretRotationMessageNotNil,omitempty"` + SecretRotationMessageEqualFold *string `json:"secretRotationMessageEqualFold,omitempty"` + SecretRotationMessageContainsFold *string `json:"secretRotationMessageContainsFold,omitempty"` // "zone" edge predicates. HasZone *bool `json:"hasZone,omitempty"` @@ -1422,6 +1436,14 @@ type ApplicationWhereInput struct { // "subscribed_apis" edge predicates. HasSubscribedApis *bool `json:"hasSubscribedApis,omitempty"` HasSubscribedApisWith []*ApiSubscriptionWhereInput `json:"hasSubscribedApisWith,omitempty"` + + // "exposed_events" edge predicates. + HasExposedEvents *bool `json:"hasExposedEvents,omitempty"` + HasExposedEventsWith []*EventExposureWhereInput `json:"hasExposedEventsWith,omitempty"` + + // "subscribed_events" edge predicates. + HasSubscribedEvents *bool `json:"hasSubscribedEvents,omitempty"` + HasSubscribedEventsWith []*EventSubscriptionWhereInput `json:"hasSubscribedEventsWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. @@ -1798,95 +1820,122 @@ func (i *ApplicationWhereInput) P() (predicate.Application, error) { if i.ClientIDContainsFold != nil { predicates = append(predicates, application.ClientIDContainsFold(*i.ClientIDContainsFold)) } - if i.ClientSecret != nil { - predicates = append(predicates, application.ClientSecretEQ(*i.ClientSecret)) + if i.RotatedExpiresAt != nil { + predicates = append(predicates, application.RotatedExpiresAtEQ(*i.RotatedExpiresAt)) } - if i.ClientSecretNEQ != nil { - predicates = append(predicates, application.ClientSecretNEQ(*i.ClientSecretNEQ)) + if i.RotatedExpiresAtNEQ != nil { + predicates = append(predicates, application.RotatedExpiresAtNEQ(*i.RotatedExpiresAtNEQ)) } - if len(i.ClientSecretIn) > 0 { - predicates = append(predicates, application.ClientSecretIn(i.ClientSecretIn...)) + if len(i.RotatedExpiresAtIn) > 0 { + predicates = append(predicates, application.RotatedExpiresAtIn(i.RotatedExpiresAtIn...)) } - if len(i.ClientSecretNotIn) > 0 { - predicates = append(predicates, application.ClientSecretNotIn(i.ClientSecretNotIn...)) + if len(i.RotatedExpiresAtNotIn) > 0 { + predicates = append(predicates, application.RotatedExpiresAtNotIn(i.RotatedExpiresAtNotIn...)) } - if i.ClientSecretGT != nil { - predicates = append(predicates, application.ClientSecretGT(*i.ClientSecretGT)) + if i.RotatedExpiresAtGT != nil { + predicates = append(predicates, application.RotatedExpiresAtGT(*i.RotatedExpiresAtGT)) } - if i.ClientSecretGTE != nil { - predicates = append(predicates, application.ClientSecretGTE(*i.ClientSecretGTE)) + if i.RotatedExpiresAtGTE != nil { + predicates = append(predicates, application.RotatedExpiresAtGTE(*i.RotatedExpiresAtGTE)) } - if i.ClientSecretLT != nil { - predicates = append(predicates, application.ClientSecretLT(*i.ClientSecretLT)) + if i.RotatedExpiresAtLT != nil { + predicates = append(predicates, application.RotatedExpiresAtLT(*i.RotatedExpiresAtLT)) } - if i.ClientSecretLTE != nil { - predicates = append(predicates, application.ClientSecretLTE(*i.ClientSecretLTE)) + if i.RotatedExpiresAtLTE != nil { + predicates = append(predicates, application.RotatedExpiresAtLTE(*i.RotatedExpiresAtLTE)) } - if i.ClientSecretContains != nil { - predicates = append(predicates, application.ClientSecretContains(*i.ClientSecretContains)) + if i.RotatedExpiresAtIsNil { + predicates = append(predicates, application.RotatedExpiresAtIsNil()) } - if i.ClientSecretHasPrefix != nil { - predicates = append(predicates, application.ClientSecretHasPrefix(*i.ClientSecretHasPrefix)) + if i.RotatedExpiresAtNotNil { + predicates = append(predicates, application.RotatedExpiresAtNotNil()) } - if i.ClientSecretHasSuffix != nil { - predicates = append(predicates, application.ClientSecretHasSuffix(*i.ClientSecretHasSuffix)) + if i.CurrentExpiresAt != nil { + predicates = append(predicates, application.CurrentExpiresAtEQ(*i.CurrentExpiresAt)) } - if i.ClientSecretIsNil { - predicates = append(predicates, application.ClientSecretIsNil()) + if i.CurrentExpiresAtNEQ != nil { + predicates = append(predicates, application.CurrentExpiresAtNEQ(*i.CurrentExpiresAtNEQ)) } - if i.ClientSecretNotNil { - predicates = append(predicates, application.ClientSecretNotNil()) + if len(i.CurrentExpiresAtIn) > 0 { + predicates = append(predicates, application.CurrentExpiresAtIn(i.CurrentExpiresAtIn...)) } - if i.ClientSecretEqualFold != nil { - predicates = append(predicates, application.ClientSecretEqualFold(*i.ClientSecretEqualFold)) + if len(i.CurrentExpiresAtNotIn) > 0 { + predicates = append(predicates, application.CurrentExpiresAtNotIn(i.CurrentExpiresAtNotIn...)) } - if i.ClientSecretContainsFold != nil { - predicates = append(predicates, application.ClientSecretContainsFold(*i.ClientSecretContainsFold)) + if i.CurrentExpiresAtGT != nil { + predicates = append(predicates, application.CurrentExpiresAtGT(*i.CurrentExpiresAtGT)) } - if i.IssuerURL != nil { - predicates = append(predicates, application.IssuerURLEQ(*i.IssuerURL)) + if i.CurrentExpiresAtGTE != nil { + predicates = append(predicates, application.CurrentExpiresAtGTE(*i.CurrentExpiresAtGTE)) } - if i.IssuerURLNEQ != nil { - predicates = append(predicates, application.IssuerURLNEQ(*i.IssuerURLNEQ)) + if i.CurrentExpiresAtLT != nil { + predicates = append(predicates, application.CurrentExpiresAtLT(*i.CurrentExpiresAtLT)) } - if len(i.IssuerURLIn) > 0 { - predicates = append(predicates, application.IssuerURLIn(i.IssuerURLIn...)) + if i.CurrentExpiresAtLTE != nil { + predicates = append(predicates, application.CurrentExpiresAtLTE(*i.CurrentExpiresAtLTE)) } - if len(i.IssuerURLNotIn) > 0 { - predicates = append(predicates, application.IssuerURLNotIn(i.IssuerURLNotIn...)) + if i.CurrentExpiresAtIsNil { + predicates = append(predicates, application.CurrentExpiresAtIsNil()) } - if i.IssuerURLGT != nil { - predicates = append(predicates, application.IssuerURLGT(*i.IssuerURLGT)) + if i.CurrentExpiresAtNotNil { + predicates = append(predicates, application.CurrentExpiresAtNotNil()) } - if i.IssuerURLGTE != nil { - predicates = append(predicates, application.IssuerURLGTE(*i.IssuerURLGTE)) + if i.SecretRotationPhase != nil { + predicates = append(predicates, application.SecretRotationPhaseEQ(*i.SecretRotationPhase)) } - if i.IssuerURLLT != nil { - predicates = append(predicates, application.IssuerURLLT(*i.IssuerURLLT)) + if i.SecretRotationPhaseNEQ != nil { + predicates = append(predicates, application.SecretRotationPhaseNEQ(*i.SecretRotationPhaseNEQ)) } - if i.IssuerURLLTE != nil { - predicates = append(predicates, application.IssuerURLLTE(*i.IssuerURLLTE)) + if len(i.SecretRotationPhaseIn) > 0 { + predicates = append(predicates, application.SecretRotationPhaseIn(i.SecretRotationPhaseIn...)) } - if i.IssuerURLContains != nil { - predicates = append(predicates, application.IssuerURLContains(*i.IssuerURLContains)) + if len(i.SecretRotationPhaseNotIn) > 0 { + predicates = append(predicates, application.SecretRotationPhaseNotIn(i.SecretRotationPhaseNotIn...)) } - if i.IssuerURLHasPrefix != nil { - predicates = append(predicates, application.IssuerURLHasPrefix(*i.IssuerURLHasPrefix)) + if i.SecretRotationMessage != nil { + predicates = append(predicates, application.SecretRotationMessageEQ(*i.SecretRotationMessage)) } - if i.IssuerURLHasSuffix != nil { - predicates = append(predicates, application.IssuerURLHasSuffix(*i.IssuerURLHasSuffix)) + if i.SecretRotationMessageNEQ != nil { + predicates = append(predicates, application.SecretRotationMessageNEQ(*i.SecretRotationMessageNEQ)) } - if i.IssuerURLIsNil { - predicates = append(predicates, application.IssuerURLIsNil()) + if len(i.SecretRotationMessageIn) > 0 { + predicates = append(predicates, application.SecretRotationMessageIn(i.SecretRotationMessageIn...)) } - if i.IssuerURLNotNil { - predicates = append(predicates, application.IssuerURLNotNil()) + if len(i.SecretRotationMessageNotIn) > 0 { + predicates = append(predicates, application.SecretRotationMessageNotIn(i.SecretRotationMessageNotIn...)) } - if i.IssuerURLEqualFold != nil { - predicates = append(predicates, application.IssuerURLEqualFold(*i.IssuerURLEqualFold)) + if i.SecretRotationMessageGT != nil { + predicates = append(predicates, application.SecretRotationMessageGT(*i.SecretRotationMessageGT)) } - if i.IssuerURLContainsFold != nil { - predicates = append(predicates, application.IssuerURLContainsFold(*i.IssuerURLContainsFold)) + if i.SecretRotationMessageGTE != nil { + predicates = append(predicates, application.SecretRotationMessageGTE(*i.SecretRotationMessageGTE)) + } + if i.SecretRotationMessageLT != nil { + predicates = append(predicates, application.SecretRotationMessageLT(*i.SecretRotationMessageLT)) + } + if i.SecretRotationMessageLTE != nil { + predicates = append(predicates, application.SecretRotationMessageLTE(*i.SecretRotationMessageLTE)) + } + if i.SecretRotationMessageContains != nil { + predicates = append(predicates, application.SecretRotationMessageContains(*i.SecretRotationMessageContains)) + } + if i.SecretRotationMessageHasPrefix != nil { + predicates = append(predicates, application.SecretRotationMessageHasPrefix(*i.SecretRotationMessageHasPrefix)) + } + if i.SecretRotationMessageHasSuffix != nil { + predicates = append(predicates, application.SecretRotationMessageHasSuffix(*i.SecretRotationMessageHasSuffix)) + } + if i.SecretRotationMessageIsNil { + predicates = append(predicates, application.SecretRotationMessageIsNil()) + } + if i.SecretRotationMessageNotNil { + predicates = append(predicates, application.SecretRotationMessageNotNil()) + } + if i.SecretRotationMessageEqualFold != nil { + predicates = append(predicates, application.SecretRotationMessageEqualFold(*i.SecretRotationMessageEqualFold)) + } + if i.SecretRotationMessageContainsFold != nil { + predicates = append(predicates, application.SecretRotationMessageContainsFold(*i.SecretRotationMessageContainsFold)) } if i.HasZone != nil { @@ -1961,6 +2010,42 @@ func (i *ApplicationWhereInput) P() (predicate.Application, error) { } predicates = append(predicates, application.HasSubscribedApisWith(with...)) } + if i.HasExposedEvents != nil { + p := application.HasExposedEvents() + if !*i.HasExposedEvents { + p = application.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasExposedEventsWith) > 0 { + with := make([]predicate.EventExposure, 0, len(i.HasExposedEventsWith)) + for _, w := range i.HasExposedEventsWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasExposedEventsWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, application.HasExposedEventsWith(with...)) + } + if i.HasSubscribedEvents != nil { + p := application.HasSubscribedEvents() + if !*i.HasSubscribedEvents { + p = application.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasSubscribedEventsWith) > 0 { + with := make([]predicate.EventSubscription, 0, len(i.HasSubscribedEventsWith)) + for _, w := range i.HasSubscribedEventsWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasSubscribedEventsWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, application.HasSubscribedEventsWith(with...)) + } switch len(predicates) { case 0: return nil, ErrEmptyApplicationWhereInput @@ -2125,6 +2210,10 @@ type ApprovalWhereInput struct { // "api_subscription" edge predicates. HasAPISubscription *bool `json:"hasAPISubscription,omitempty"` HasAPISubscriptionWith []*ApiSubscriptionWhereInput `json:"hasAPISubscriptionWith,omitempty"` + + // "event_subscription" edge predicates. + HasEventSubscription *bool `json:"hasEventSubscription,omitempty"` + HasEventSubscriptionWith []*EventSubscriptionWhereInput `json:"hasEventSubscriptionWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. @@ -2577,6 +2666,24 @@ func (i *ApprovalWhereInput) P() (predicate.Approval, error) { } predicates = append(predicates, approval.HasAPISubscriptionWith(with...)) } + if i.HasEventSubscription != nil { + p := approval.HasEventSubscription() + if !*i.HasEventSubscription { + p = approval.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasEventSubscriptionWith) > 0 { + with := make([]predicate.EventSubscription, 0, len(i.HasEventSubscriptionWith)) + for _, w := range i.HasEventSubscriptionWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasEventSubscriptionWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, approval.HasEventSubscriptionWith(with...)) + } switch len(predicates) { case 0: return nil, ErrEmptyApprovalWhereInput @@ -2741,6 +2848,10 @@ type ApprovalRequestWhereInput struct { // "api_subscription" edge predicates. HasAPISubscription *bool `json:"hasAPISubscription,omitempty"` HasAPISubscriptionWith []*ApiSubscriptionWhereInput `json:"hasAPISubscriptionWith,omitempty"` + + // "event_subscription" edge predicates. + HasEventSubscription *bool `json:"hasEventSubscription,omitempty"` + HasEventSubscriptionWith []*EventSubscriptionWhereInput `json:"hasEventSubscriptionWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. @@ -3193,6 +3304,24 @@ func (i *ApprovalRequestWhereInput) P() (predicate.ApprovalRequest, error) { } predicates = append(predicates, approvalrequest.HasAPISubscriptionWith(with...)) } + if i.HasEventSubscription != nil { + p := approvalrequest.HasEventSubscription() + if !*i.HasEventSubscription { + p = approvalrequest.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasEventSubscriptionWith) > 0 { + with := make([]predicate.EventSubscription, 0, len(i.HasEventSubscriptionWith)) + for _, w := range i.HasEventSubscriptionWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasEventSubscriptionWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, approvalrequest.HasEventSubscriptionWith(with...)) + } switch len(predicates) { case 0: return nil, ErrEmptyApprovalRequestWhereInput @@ -3203,12 +3332,12 @@ func (i *ApprovalRequestWhereInput) P() (predicate.ApprovalRequest, error) { } } -// GroupWhereInput represents a where input for filtering Group queries. -type GroupWhereInput struct { - Predicates []predicate.Group `json:"-"` - Not *GroupWhereInput `json:"not,omitempty"` - Or []*GroupWhereInput `json:"or,omitempty"` - And []*GroupWhereInput `json:"and,omitempty"` +// EventExposureWhereInput represents a where input for filtering EventExposure queries. +type EventExposureWhereInput struct { + Predicates []predicate.EventExposure `json:"-"` + Not *EventExposureWhereInput `json:"not,omitempty"` + Or []*EventExposureWhereInput `json:"or,omitempty"` + And []*EventExposureWhereInput `json:"and,omitempty"` // "id" field predicates. ID *int `json:"id,omitempty"` @@ -3220,6 +3349,51 @@ type GroupWhereInput struct { IDLT *int `json:"idLT,omitempty"` IDLTE *int `json:"idLTE,omitempty"` + // "created_at" field predicates. + CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"` + CreatedAtIn []time.Time `json:"createdAtIn,omitempty"` + CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"` + CreatedAtGT *time.Time `json:"createdAtGT,omitempty"` + CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"` + CreatedAtLT *time.Time `json:"createdAtLT,omitempty"` + CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"` + + // "last_modified_at" field predicates. + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAtNEQ *time.Time `json:"lastModifiedAtNEQ,omitempty"` + LastModifiedAtIn []time.Time `json:"lastModifiedAtIn,omitempty"` + LastModifiedAtNotIn []time.Time `json:"lastModifiedAtNotIn,omitempty"` + LastModifiedAtGT *time.Time `json:"lastModifiedAtGT,omitempty"` + LastModifiedAtGTE *time.Time `json:"lastModifiedAtGTE,omitempty"` + LastModifiedAtLT *time.Time `json:"lastModifiedAtLT,omitempty"` + LastModifiedAtLTE *time.Time `json:"lastModifiedAtLTE,omitempty"` + + // "status_phase" field predicates. + StatusPhase *eventexposure.StatusPhase `json:"statusPhase,omitempty"` + StatusPhaseNEQ *eventexposure.StatusPhase `json:"statusPhaseNEQ,omitempty"` + StatusPhaseIn []eventexposure.StatusPhase `json:"statusPhaseIn,omitempty"` + StatusPhaseNotIn []eventexposure.StatusPhase `json:"statusPhaseNotIn,omitempty"` + StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` + StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` + + // "status_message" field predicates. + StatusMessage *string `json:"statusMessage,omitempty"` + StatusMessageNEQ *string `json:"statusMessageNEQ,omitempty"` + StatusMessageIn []string `json:"statusMessageIn,omitempty"` + StatusMessageNotIn []string `json:"statusMessageNotIn,omitempty"` + StatusMessageGT *string `json:"statusMessageGT,omitempty"` + StatusMessageGTE *string `json:"statusMessageGTE,omitempty"` + StatusMessageLT *string `json:"statusMessageLT,omitempty"` + StatusMessageLTE *string `json:"statusMessageLTE,omitempty"` + StatusMessageContains *string `json:"statusMessageContains,omitempty"` + StatusMessageHasPrefix *string `json:"statusMessageHasPrefix,omitempty"` + StatusMessageHasSuffix *string `json:"statusMessageHasSuffix,omitempty"` + StatusMessageIsNil bool `json:"statusMessageIsNil,omitempty"` + StatusMessageNotNil bool `json:"statusMessageNotNil,omitempty"` + StatusMessageEqualFold *string `json:"statusMessageEqualFold,omitempty"` + StatusMessageContainsFold *string `json:"statusMessageContainsFold,omitempty"` + // "environment" field predicates. Environment *string `json:"environment,omitempty"` EnvironmentNEQ *string `json:"environmentNEQ,omitempty"` @@ -3252,69 +3426,55 @@ type GroupWhereInput struct { NamespaceEqualFold *string `json:"namespaceEqualFold,omitempty"` NamespaceContainsFold *string `json:"namespaceContainsFold,omitempty"` - // "name" field predicates. - Name *string `json:"name,omitempty"` - NameNEQ *string `json:"nameNEQ,omitempty"` - NameIn []string `json:"nameIn,omitempty"` - NameNotIn []string `json:"nameNotIn,omitempty"` - NameGT *string `json:"nameGT,omitempty"` - NameGTE *string `json:"nameGTE,omitempty"` - NameLT *string `json:"nameLT,omitempty"` - NameLTE *string `json:"nameLTE,omitempty"` - NameContains *string `json:"nameContains,omitempty"` - NameHasPrefix *string `json:"nameHasPrefix,omitempty"` - NameHasSuffix *string `json:"nameHasSuffix,omitempty"` - NameEqualFold *string `json:"nameEqualFold,omitempty"` - NameContainsFold *string `json:"nameContainsFold,omitempty"` + // "event_type" field predicates. + EventType *string `json:"eventType,omitempty"` + EventTypeNEQ *string `json:"eventTypeNEQ,omitempty"` + EventTypeIn []string `json:"eventTypeIn,omitempty"` + EventTypeNotIn []string `json:"eventTypeNotIn,omitempty"` + EventTypeGT *string `json:"eventTypeGT,omitempty"` + EventTypeGTE *string `json:"eventTypeGTE,omitempty"` + EventTypeLT *string `json:"eventTypeLT,omitempty"` + EventTypeLTE *string `json:"eventTypeLTE,omitempty"` + EventTypeContains *string `json:"eventTypeContains,omitempty"` + EventTypeHasPrefix *string `json:"eventTypeHasPrefix,omitempty"` + EventTypeHasSuffix *string `json:"eventTypeHasSuffix,omitempty"` + EventTypeEqualFold *string `json:"eventTypeEqualFold,omitempty"` + EventTypeContainsFold *string `json:"eventTypeContainsFold,omitempty"` - // "display_name" field predicates. - DisplayName *string `json:"displayName,omitempty"` - DisplayNameNEQ *string `json:"displayNameNEQ,omitempty"` - DisplayNameIn []string `json:"displayNameIn,omitempty"` - DisplayNameNotIn []string `json:"displayNameNotIn,omitempty"` - DisplayNameGT *string `json:"displayNameGT,omitempty"` - DisplayNameGTE *string `json:"displayNameGTE,omitempty"` - DisplayNameLT *string `json:"displayNameLT,omitempty"` - DisplayNameLTE *string `json:"displayNameLTE,omitempty"` - DisplayNameContains *string `json:"displayNameContains,omitempty"` - DisplayNameHasPrefix *string `json:"displayNameHasPrefix,omitempty"` - DisplayNameHasSuffix *string `json:"displayNameHasSuffix,omitempty"` - DisplayNameEqualFold *string `json:"displayNameEqualFold,omitempty"` - DisplayNameContainsFold *string `json:"displayNameContainsFold,omitempty"` + // "visibility" field predicates. + Visibility *eventexposure.Visibility `json:"visibility,omitempty"` + VisibilityNEQ *eventexposure.Visibility `json:"visibilityNEQ,omitempty"` + VisibilityIn []eventexposure.Visibility `json:"visibilityIn,omitempty"` + VisibilityNotIn []eventexposure.Visibility `json:"visibilityNotIn,omitempty"` - // "description" field predicates. - Description *string `json:"description,omitempty"` - DescriptionNEQ *string `json:"descriptionNEQ,omitempty"` - DescriptionIn []string `json:"descriptionIn,omitempty"` - DescriptionNotIn []string `json:"descriptionNotIn,omitempty"` - DescriptionGT *string `json:"descriptionGT,omitempty"` - DescriptionGTE *string `json:"descriptionGTE,omitempty"` - DescriptionLT *string `json:"descriptionLT,omitempty"` - DescriptionLTE *string `json:"descriptionLTE,omitempty"` - DescriptionContains *string `json:"descriptionContains,omitempty"` - DescriptionHasPrefix *string `json:"descriptionHasPrefix,omitempty"` - DescriptionHasSuffix *string `json:"descriptionHasSuffix,omitempty"` - DescriptionEqualFold *string `json:"descriptionEqualFold,omitempty"` - DescriptionContainsFold *string `json:"descriptionContainsFold,omitempty"` + // "active" field predicates. + Active *bool `json:"active,omitempty"` + ActiveNEQ *bool `json:"activeNEQ,omitempty"` + ActiveIsNil bool `json:"activeIsNil,omitempty"` + ActiveNotNil bool `json:"activeNotNil,omitempty"` - // "teams" edge predicates. - HasTeams *bool `json:"hasTeams,omitempty"` - HasTeamsWith []*TeamWhereInput `json:"hasTeamsWith,omitempty"` + // "owner" edge predicates. + HasOwner *bool `json:"hasOwner,omitempty"` + HasOwnerWith []*ApplicationWhereInput `json:"hasOwnerWith,omitempty"` + + // "subscriptions" edge predicates. + HasSubscriptions *bool `json:"hasSubscriptions,omitempty"` + HasSubscriptionsWith []*EventSubscriptionWhereInput `json:"hasSubscriptionsWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. -func (i *GroupWhereInput) AddPredicates(predicates ...predicate.Group) { +func (i *EventExposureWhereInput) AddPredicates(predicates ...predicate.EventExposure) { i.Predicates = append(i.Predicates, predicates...) } -// Filter applies the GroupWhereInput filter on the GroupQuery builder. -func (i *GroupWhereInput) Filter(q *GroupQuery) (*GroupQuery, error) { +// Filter applies the EventExposureWhereInput filter on the EventExposureQuery builder. +func (i *EventExposureWhereInput) Filter(q *EventExposureQuery) (*EventExposureQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { - if err == ErrEmptyGroupWhereInput { + if err == ErrEmptyEventExposureWhereInput { return q, nil } return nil, err @@ -3322,19 +3482,19 @@ func (i *GroupWhereInput) Filter(q *GroupQuery) (*GroupQuery, error) { return q.Where(p), nil } -// ErrEmptyGroupWhereInput is returned in case the GroupWhereInput is empty. -var ErrEmptyGroupWhereInput = errors.New("ent: empty predicate GroupWhereInput") +// ErrEmptyEventExposureWhereInput is returned in case the EventExposureWhereInput is empty. +var ErrEmptyEventExposureWhereInput = errors.New("ent: empty predicate EventExposureWhereInput") -// P returns a predicate for filtering groups. +// P returns a predicate for filtering eventexposures. // An error is returned if the input is empty or invalid. -func (i *GroupWhereInput) P() (predicate.Group, error) { - var predicates []predicate.Group +func (i *EventExposureWhereInput) P() (predicate.EventExposure, error) { + var predicates []predicate.EventExposure if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } - predicates = append(predicates, group.Not(p)) + predicates = append(predicates, eventexposure.Not(p)) } switch n := len(i.Or); { case n == 1: @@ -3344,7 +3504,7 @@ func (i *GroupWhereInput) P() (predicate.Group, error) { } predicates = append(predicates, p) case n > 1: - or := make([]predicate.Group, 0, n) + or := make([]predicate.EventExposure, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { @@ -3352,7 +3512,7 @@ func (i *GroupWhereInput) P() (predicate.Group, error) { } or = append(or, p) } - predicates = append(predicates, group.Or(or...)) + predicates = append(predicates, eventexposure.Or(or...)) } switch n := len(i.And); { case n == 1: @@ -3362,7 +3522,7 @@ func (i *GroupWhereInput) P() (predicate.Group, error) { } predicates = append(predicates, p) case n > 1: - and := make([]predicate.Group, 0, n) + and := make([]predicate.EventExposure, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { @@ -3370,80 +3530,1251 @@ func (i *GroupWhereInput) P() (predicate.Group, error) { } and = append(and, p) } - predicates = append(predicates, group.And(and...)) + predicates = append(predicates, eventexposure.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { - predicates = append(predicates, group.IDEQ(*i.ID)) + predicates = append(predicates, eventexposure.IDEQ(*i.ID)) } if i.IDNEQ != nil { - predicates = append(predicates, group.IDNEQ(*i.IDNEQ)) + predicates = append(predicates, eventexposure.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { - predicates = append(predicates, group.IDIn(i.IDIn...)) + predicates = append(predicates, eventexposure.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { - predicates = append(predicates, group.IDNotIn(i.IDNotIn...)) + predicates = append(predicates, eventexposure.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { - predicates = append(predicates, group.IDGT(*i.IDGT)) + predicates = append(predicates, eventexposure.IDGT(*i.IDGT)) } if i.IDGTE != nil { - predicates = append(predicates, group.IDGTE(*i.IDGTE)) + predicates = append(predicates, eventexposure.IDGTE(*i.IDGTE)) } if i.IDLT != nil { - predicates = append(predicates, group.IDLT(*i.IDLT)) + predicates = append(predicates, eventexposure.IDLT(*i.IDLT)) } if i.IDLTE != nil { - predicates = append(predicates, group.IDLTE(*i.IDLTE)) + predicates = append(predicates, eventexposure.IDLTE(*i.IDLTE)) } - if i.Environment != nil { - predicates = append(predicates, group.EnvironmentEQ(*i.Environment)) + if i.CreatedAt != nil { + predicates = append(predicates, eventexposure.CreatedAtEQ(*i.CreatedAt)) } - if i.EnvironmentNEQ != nil { - predicates = append(predicates, group.EnvironmentNEQ(*i.EnvironmentNEQ)) + if i.CreatedAtNEQ != nil { + predicates = append(predicates, eventexposure.CreatedAtNEQ(*i.CreatedAtNEQ)) } - if len(i.EnvironmentIn) > 0 { - predicates = append(predicates, group.EnvironmentIn(i.EnvironmentIn...)) + if len(i.CreatedAtIn) > 0 { + predicates = append(predicates, eventexposure.CreatedAtIn(i.CreatedAtIn...)) } - if len(i.EnvironmentNotIn) > 0 { - predicates = append(predicates, group.EnvironmentNotIn(i.EnvironmentNotIn...)) + if len(i.CreatedAtNotIn) > 0 { + predicates = append(predicates, eventexposure.CreatedAtNotIn(i.CreatedAtNotIn...)) } - if i.EnvironmentGT != nil { - predicates = append(predicates, group.EnvironmentGT(*i.EnvironmentGT)) + if i.CreatedAtGT != nil { + predicates = append(predicates, eventexposure.CreatedAtGT(*i.CreatedAtGT)) } - if i.EnvironmentGTE != nil { - predicates = append(predicates, group.EnvironmentGTE(*i.EnvironmentGTE)) + if i.CreatedAtGTE != nil { + predicates = append(predicates, eventexposure.CreatedAtGTE(*i.CreatedAtGTE)) } - if i.EnvironmentLT != nil { - predicates = append(predicates, group.EnvironmentLT(*i.EnvironmentLT)) + if i.CreatedAtLT != nil { + predicates = append(predicates, eventexposure.CreatedAtLT(*i.CreatedAtLT)) } - if i.EnvironmentLTE != nil { - predicates = append(predicates, group.EnvironmentLTE(*i.EnvironmentLTE)) + if i.CreatedAtLTE != nil { + predicates = append(predicates, eventexposure.CreatedAtLTE(*i.CreatedAtLTE)) } - if i.EnvironmentContains != nil { - predicates = append(predicates, group.EnvironmentContains(*i.EnvironmentContains)) + if i.LastModifiedAt != nil { + predicates = append(predicates, eventexposure.LastModifiedAtEQ(*i.LastModifiedAt)) } - if i.EnvironmentHasPrefix != nil { - predicates = append(predicates, group.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + if i.LastModifiedAtNEQ != nil { + predicates = append(predicates, eventexposure.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) } - if i.EnvironmentHasSuffix != nil { - predicates = append(predicates, group.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + if len(i.LastModifiedAtIn) > 0 { + predicates = append(predicates, eventexposure.LastModifiedAtIn(i.LastModifiedAtIn...)) } - if i.EnvironmentIsNil { - predicates = append(predicates, group.EnvironmentIsNil()) + if len(i.LastModifiedAtNotIn) > 0 { + predicates = append(predicates, eventexposure.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) } - if i.EnvironmentNotNil { - predicates = append(predicates, group.EnvironmentNotNil()) + if i.LastModifiedAtGT != nil { + predicates = append(predicates, eventexposure.LastModifiedAtGT(*i.LastModifiedAtGT)) } - if i.EnvironmentEqualFold != nil { - predicates = append(predicates, group.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + if i.LastModifiedAtGTE != nil { + predicates = append(predicates, eventexposure.LastModifiedAtGTE(*i.LastModifiedAtGTE)) } - if i.EnvironmentContainsFold != nil { - predicates = append(predicates, group.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + if i.LastModifiedAtLT != nil { + predicates = append(predicates, eventexposure.LastModifiedAtLT(*i.LastModifiedAtLT)) } - if i.Namespace != nil { - predicates = append(predicates, group.NamespaceEQ(*i.Namespace)) + if i.LastModifiedAtLTE != nil { + predicates = append(predicates, eventexposure.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + } + if i.StatusPhase != nil { + predicates = append(predicates, eventexposure.StatusPhaseEQ(*i.StatusPhase)) + } + if i.StatusPhaseNEQ != nil { + predicates = append(predicates, eventexposure.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + } + if len(i.StatusPhaseIn) > 0 { + predicates = append(predicates, eventexposure.StatusPhaseIn(i.StatusPhaseIn...)) + } + if len(i.StatusPhaseNotIn) > 0 { + predicates = append(predicates, eventexposure.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + } + if i.StatusPhaseIsNil { + predicates = append(predicates, eventexposure.StatusPhaseIsNil()) + } + if i.StatusPhaseNotNil { + predicates = append(predicates, eventexposure.StatusPhaseNotNil()) + } + if i.StatusMessage != nil { + predicates = append(predicates, eventexposure.StatusMessageEQ(*i.StatusMessage)) + } + if i.StatusMessageNEQ != nil { + predicates = append(predicates, eventexposure.StatusMessageNEQ(*i.StatusMessageNEQ)) + } + if len(i.StatusMessageIn) > 0 { + predicates = append(predicates, eventexposure.StatusMessageIn(i.StatusMessageIn...)) + } + if len(i.StatusMessageNotIn) > 0 { + predicates = append(predicates, eventexposure.StatusMessageNotIn(i.StatusMessageNotIn...)) + } + if i.StatusMessageGT != nil { + predicates = append(predicates, eventexposure.StatusMessageGT(*i.StatusMessageGT)) + } + if i.StatusMessageGTE != nil { + predicates = append(predicates, eventexposure.StatusMessageGTE(*i.StatusMessageGTE)) + } + if i.StatusMessageLT != nil { + predicates = append(predicates, eventexposure.StatusMessageLT(*i.StatusMessageLT)) + } + if i.StatusMessageLTE != nil { + predicates = append(predicates, eventexposure.StatusMessageLTE(*i.StatusMessageLTE)) + } + if i.StatusMessageContains != nil { + predicates = append(predicates, eventexposure.StatusMessageContains(*i.StatusMessageContains)) + } + if i.StatusMessageHasPrefix != nil { + predicates = append(predicates, eventexposure.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) + } + if i.StatusMessageHasSuffix != nil { + predicates = append(predicates, eventexposure.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) + } + if i.StatusMessageIsNil { + predicates = append(predicates, eventexposure.StatusMessageIsNil()) + } + if i.StatusMessageNotNil { + predicates = append(predicates, eventexposure.StatusMessageNotNil()) + } + if i.StatusMessageEqualFold != nil { + predicates = append(predicates, eventexposure.StatusMessageEqualFold(*i.StatusMessageEqualFold)) + } + if i.StatusMessageContainsFold != nil { + predicates = append(predicates, eventexposure.StatusMessageContainsFold(*i.StatusMessageContainsFold)) + } + if i.Environment != nil { + predicates = append(predicates, eventexposure.EnvironmentEQ(*i.Environment)) + } + if i.EnvironmentNEQ != nil { + predicates = append(predicates, eventexposure.EnvironmentNEQ(*i.EnvironmentNEQ)) + } + if len(i.EnvironmentIn) > 0 { + predicates = append(predicates, eventexposure.EnvironmentIn(i.EnvironmentIn...)) + } + if len(i.EnvironmentNotIn) > 0 { + predicates = append(predicates, eventexposure.EnvironmentNotIn(i.EnvironmentNotIn...)) + } + if i.EnvironmentGT != nil { + predicates = append(predicates, eventexposure.EnvironmentGT(*i.EnvironmentGT)) + } + if i.EnvironmentGTE != nil { + predicates = append(predicates, eventexposure.EnvironmentGTE(*i.EnvironmentGTE)) + } + if i.EnvironmentLT != nil { + predicates = append(predicates, eventexposure.EnvironmentLT(*i.EnvironmentLT)) + } + if i.EnvironmentLTE != nil { + predicates = append(predicates, eventexposure.EnvironmentLTE(*i.EnvironmentLTE)) + } + if i.EnvironmentContains != nil { + predicates = append(predicates, eventexposure.EnvironmentContains(*i.EnvironmentContains)) + } + if i.EnvironmentHasPrefix != nil { + predicates = append(predicates, eventexposure.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + } + if i.EnvironmentHasSuffix != nil { + predicates = append(predicates, eventexposure.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + } + if i.EnvironmentIsNil { + predicates = append(predicates, eventexposure.EnvironmentIsNil()) + } + if i.EnvironmentNotNil { + predicates = append(predicates, eventexposure.EnvironmentNotNil()) + } + if i.EnvironmentEqualFold != nil { + predicates = append(predicates, eventexposure.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + } + if i.EnvironmentContainsFold != nil { + predicates = append(predicates, eventexposure.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + } + if i.Namespace != nil { + predicates = append(predicates, eventexposure.NamespaceEQ(*i.Namespace)) + } + if i.NamespaceNEQ != nil { + predicates = append(predicates, eventexposure.NamespaceNEQ(*i.NamespaceNEQ)) + } + if len(i.NamespaceIn) > 0 { + predicates = append(predicates, eventexposure.NamespaceIn(i.NamespaceIn...)) + } + if len(i.NamespaceNotIn) > 0 { + predicates = append(predicates, eventexposure.NamespaceNotIn(i.NamespaceNotIn...)) + } + if i.NamespaceGT != nil { + predicates = append(predicates, eventexposure.NamespaceGT(*i.NamespaceGT)) + } + if i.NamespaceGTE != nil { + predicates = append(predicates, eventexposure.NamespaceGTE(*i.NamespaceGTE)) + } + if i.NamespaceLT != nil { + predicates = append(predicates, eventexposure.NamespaceLT(*i.NamespaceLT)) + } + if i.NamespaceLTE != nil { + predicates = append(predicates, eventexposure.NamespaceLTE(*i.NamespaceLTE)) + } + if i.NamespaceContains != nil { + predicates = append(predicates, eventexposure.NamespaceContains(*i.NamespaceContains)) + } + if i.NamespaceHasPrefix != nil { + predicates = append(predicates, eventexposure.NamespaceHasPrefix(*i.NamespaceHasPrefix)) + } + if i.NamespaceHasSuffix != nil { + predicates = append(predicates, eventexposure.NamespaceHasSuffix(*i.NamespaceHasSuffix)) + } + if i.NamespaceEqualFold != nil { + predicates = append(predicates, eventexposure.NamespaceEqualFold(*i.NamespaceEqualFold)) + } + if i.NamespaceContainsFold != nil { + predicates = append(predicates, eventexposure.NamespaceContainsFold(*i.NamespaceContainsFold)) + } + if i.EventType != nil { + predicates = append(predicates, eventexposure.EventTypeEQ(*i.EventType)) + } + if i.EventTypeNEQ != nil { + predicates = append(predicates, eventexposure.EventTypeNEQ(*i.EventTypeNEQ)) + } + if len(i.EventTypeIn) > 0 { + predicates = append(predicates, eventexposure.EventTypeIn(i.EventTypeIn...)) + } + if len(i.EventTypeNotIn) > 0 { + predicates = append(predicates, eventexposure.EventTypeNotIn(i.EventTypeNotIn...)) + } + if i.EventTypeGT != nil { + predicates = append(predicates, eventexposure.EventTypeGT(*i.EventTypeGT)) + } + if i.EventTypeGTE != nil { + predicates = append(predicates, eventexposure.EventTypeGTE(*i.EventTypeGTE)) + } + if i.EventTypeLT != nil { + predicates = append(predicates, eventexposure.EventTypeLT(*i.EventTypeLT)) + } + if i.EventTypeLTE != nil { + predicates = append(predicates, eventexposure.EventTypeLTE(*i.EventTypeLTE)) + } + if i.EventTypeContains != nil { + predicates = append(predicates, eventexposure.EventTypeContains(*i.EventTypeContains)) + } + if i.EventTypeHasPrefix != nil { + predicates = append(predicates, eventexposure.EventTypeHasPrefix(*i.EventTypeHasPrefix)) + } + if i.EventTypeHasSuffix != nil { + predicates = append(predicates, eventexposure.EventTypeHasSuffix(*i.EventTypeHasSuffix)) + } + if i.EventTypeEqualFold != nil { + predicates = append(predicates, eventexposure.EventTypeEqualFold(*i.EventTypeEqualFold)) + } + if i.EventTypeContainsFold != nil { + predicates = append(predicates, eventexposure.EventTypeContainsFold(*i.EventTypeContainsFold)) + } + if i.Visibility != nil { + predicates = append(predicates, eventexposure.VisibilityEQ(*i.Visibility)) + } + if i.VisibilityNEQ != nil { + predicates = append(predicates, eventexposure.VisibilityNEQ(*i.VisibilityNEQ)) + } + if len(i.VisibilityIn) > 0 { + predicates = append(predicates, eventexposure.VisibilityIn(i.VisibilityIn...)) + } + if len(i.VisibilityNotIn) > 0 { + predicates = append(predicates, eventexposure.VisibilityNotIn(i.VisibilityNotIn...)) + } + if i.Active != nil { + predicates = append(predicates, eventexposure.ActiveEQ(*i.Active)) + } + if i.ActiveNEQ != nil { + predicates = append(predicates, eventexposure.ActiveNEQ(*i.ActiveNEQ)) + } + if i.ActiveIsNil { + predicates = append(predicates, eventexposure.ActiveIsNil()) + } + if i.ActiveNotNil { + predicates = append(predicates, eventexposure.ActiveNotNil()) + } + + if i.HasOwner != nil { + p := eventexposure.HasOwner() + if !*i.HasOwner { + p = eventexposure.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasOwnerWith) > 0 { + with := make([]predicate.Application, 0, len(i.HasOwnerWith)) + for _, w := range i.HasOwnerWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasOwnerWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, eventexposure.HasOwnerWith(with...)) + } + if i.HasSubscriptions != nil { + p := eventexposure.HasSubscriptions() + if !*i.HasSubscriptions { + p = eventexposure.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasSubscriptionsWith) > 0 { + with := make([]predicate.EventSubscription, 0, len(i.HasSubscriptionsWith)) + for _, w := range i.HasSubscriptionsWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasSubscriptionsWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, eventexposure.HasSubscriptionsWith(with...)) + } + switch len(predicates) { + case 0: + return nil, ErrEmptyEventExposureWhereInput + case 1: + return predicates[0], nil + default: + return eventexposure.And(predicates...), nil + } +} + +// EventSubscriptionWhereInput represents a where input for filtering EventSubscription queries. +type EventSubscriptionWhereInput struct { + Predicates []predicate.EventSubscription `json:"-"` + Not *EventSubscriptionWhereInput `json:"not,omitempty"` + Or []*EventSubscriptionWhereInput `json:"or,omitempty"` + And []*EventSubscriptionWhereInput `json:"and,omitempty"` + + // "id" field predicates. + ID *int `json:"id,omitempty"` + IDNEQ *int `json:"idNEQ,omitempty"` + IDIn []int `json:"idIn,omitempty"` + IDNotIn []int `json:"idNotIn,omitempty"` + IDGT *int `json:"idGT,omitempty"` + IDGTE *int `json:"idGTE,omitempty"` + IDLT *int `json:"idLT,omitempty"` + IDLTE *int `json:"idLTE,omitempty"` + + // "created_at" field predicates. + CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"` + CreatedAtIn []time.Time `json:"createdAtIn,omitempty"` + CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"` + CreatedAtGT *time.Time `json:"createdAtGT,omitempty"` + CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"` + CreatedAtLT *time.Time `json:"createdAtLT,omitempty"` + CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"` + + // "last_modified_at" field predicates. + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAtNEQ *time.Time `json:"lastModifiedAtNEQ,omitempty"` + LastModifiedAtIn []time.Time `json:"lastModifiedAtIn,omitempty"` + LastModifiedAtNotIn []time.Time `json:"lastModifiedAtNotIn,omitempty"` + LastModifiedAtGT *time.Time `json:"lastModifiedAtGT,omitempty"` + LastModifiedAtGTE *time.Time `json:"lastModifiedAtGTE,omitempty"` + LastModifiedAtLT *time.Time `json:"lastModifiedAtLT,omitempty"` + LastModifiedAtLTE *time.Time `json:"lastModifiedAtLTE,omitempty"` + + // "status_phase" field predicates. + StatusPhase *eventsubscription.StatusPhase `json:"statusPhase,omitempty"` + StatusPhaseNEQ *eventsubscription.StatusPhase `json:"statusPhaseNEQ,omitempty"` + StatusPhaseIn []eventsubscription.StatusPhase `json:"statusPhaseIn,omitempty"` + StatusPhaseNotIn []eventsubscription.StatusPhase `json:"statusPhaseNotIn,omitempty"` + StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` + StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` + + // "status_message" field predicates. + StatusMessage *string `json:"statusMessage,omitempty"` + StatusMessageNEQ *string `json:"statusMessageNEQ,omitempty"` + StatusMessageIn []string `json:"statusMessageIn,omitempty"` + StatusMessageNotIn []string `json:"statusMessageNotIn,omitempty"` + StatusMessageGT *string `json:"statusMessageGT,omitempty"` + StatusMessageGTE *string `json:"statusMessageGTE,omitempty"` + StatusMessageLT *string `json:"statusMessageLT,omitempty"` + StatusMessageLTE *string `json:"statusMessageLTE,omitempty"` + StatusMessageContains *string `json:"statusMessageContains,omitempty"` + StatusMessageHasPrefix *string `json:"statusMessageHasPrefix,omitempty"` + StatusMessageHasSuffix *string `json:"statusMessageHasSuffix,omitempty"` + StatusMessageIsNil bool `json:"statusMessageIsNil,omitempty"` + StatusMessageNotNil bool `json:"statusMessageNotNil,omitempty"` + StatusMessageEqualFold *string `json:"statusMessageEqualFold,omitempty"` + StatusMessageContainsFold *string `json:"statusMessageContainsFold,omitempty"` + + // "environment" field predicates. + Environment *string `json:"environment,omitempty"` + EnvironmentNEQ *string `json:"environmentNEQ,omitempty"` + EnvironmentIn []string `json:"environmentIn,omitempty"` + EnvironmentNotIn []string `json:"environmentNotIn,omitempty"` + EnvironmentGT *string `json:"environmentGT,omitempty"` + EnvironmentGTE *string `json:"environmentGTE,omitempty"` + EnvironmentLT *string `json:"environmentLT,omitempty"` + EnvironmentLTE *string `json:"environmentLTE,omitempty"` + EnvironmentContains *string `json:"environmentContains,omitempty"` + EnvironmentHasPrefix *string `json:"environmentHasPrefix,omitempty"` + EnvironmentHasSuffix *string `json:"environmentHasSuffix,omitempty"` + EnvironmentIsNil bool `json:"environmentIsNil,omitempty"` + EnvironmentNotNil bool `json:"environmentNotNil,omitempty"` + EnvironmentEqualFold *string `json:"environmentEqualFold,omitempty"` + EnvironmentContainsFold *string `json:"environmentContainsFold,omitempty"` + + // "namespace" field predicates. + Namespace *string `json:"namespace,omitempty"` + NamespaceNEQ *string `json:"namespaceNEQ,omitempty"` + NamespaceIn []string `json:"namespaceIn,omitempty"` + NamespaceNotIn []string `json:"namespaceNotIn,omitempty"` + NamespaceGT *string `json:"namespaceGT,omitempty"` + NamespaceGTE *string `json:"namespaceGTE,omitempty"` + NamespaceLT *string `json:"namespaceLT,omitempty"` + NamespaceLTE *string `json:"namespaceLTE,omitempty"` + NamespaceContains *string `json:"namespaceContains,omitempty"` + NamespaceHasPrefix *string `json:"namespaceHasPrefix,omitempty"` + NamespaceHasSuffix *string `json:"namespaceHasSuffix,omitempty"` + NamespaceEqualFold *string `json:"namespaceEqualFold,omitempty"` + NamespaceContainsFold *string `json:"namespaceContainsFold,omitempty"` + + // "name" field predicates. + Name *string `json:"name,omitempty"` + NameNEQ *string `json:"nameNEQ,omitempty"` + NameIn []string `json:"nameIn,omitempty"` + NameNotIn []string `json:"nameNotIn,omitempty"` + NameGT *string `json:"nameGT,omitempty"` + NameGTE *string `json:"nameGTE,omitempty"` + NameLT *string `json:"nameLT,omitempty"` + NameLTE *string `json:"nameLTE,omitempty"` + NameContains *string `json:"nameContains,omitempty"` + NameHasPrefix *string `json:"nameHasPrefix,omitempty"` + NameHasSuffix *string `json:"nameHasSuffix,omitempty"` + NameEqualFold *string `json:"nameEqualFold,omitempty"` + NameContainsFold *string `json:"nameContainsFold,omitempty"` + + // "event_type" field predicates. + EventType *string `json:"eventType,omitempty"` + EventTypeNEQ *string `json:"eventTypeNEQ,omitempty"` + EventTypeIn []string `json:"eventTypeIn,omitempty"` + EventTypeNotIn []string `json:"eventTypeNotIn,omitempty"` + EventTypeGT *string `json:"eventTypeGT,omitempty"` + EventTypeGTE *string `json:"eventTypeGTE,omitempty"` + EventTypeLT *string `json:"eventTypeLT,omitempty"` + EventTypeLTE *string `json:"eventTypeLTE,omitempty"` + EventTypeContains *string `json:"eventTypeContains,omitempty"` + EventTypeHasPrefix *string `json:"eventTypeHasPrefix,omitempty"` + EventTypeHasSuffix *string `json:"eventTypeHasSuffix,omitempty"` + EventTypeEqualFold *string `json:"eventTypeEqualFold,omitempty"` + EventTypeContainsFold *string `json:"eventTypeContainsFold,omitempty"` + + // "delivery_type" field predicates. + DeliveryType *eventsubscription.DeliveryType `json:"deliveryType,omitempty"` + DeliveryTypeNEQ *eventsubscription.DeliveryType `json:"deliveryTypeNEQ,omitempty"` + DeliveryTypeIn []eventsubscription.DeliveryType `json:"deliveryTypeIn,omitempty"` + DeliveryTypeNotIn []eventsubscription.DeliveryType `json:"deliveryTypeNotIn,omitempty"` + + // "callback_url" field predicates. + CallbackURL *string `json:"callbackURL,omitempty"` + CallbackURLNEQ *string `json:"callbackURLNEQ,omitempty"` + CallbackURLIn []string `json:"callbackURLIn,omitempty"` + CallbackURLNotIn []string `json:"callbackURLNotIn,omitempty"` + CallbackURLGT *string `json:"callbackURLGT,omitempty"` + CallbackURLGTE *string `json:"callbackURLGTE,omitempty"` + CallbackURLLT *string `json:"callbackURLLT,omitempty"` + CallbackURLLTE *string `json:"callbackURLLTE,omitempty"` + CallbackURLContains *string `json:"callbackURLContains,omitempty"` + CallbackURLHasPrefix *string `json:"callbackURLHasPrefix,omitempty"` + CallbackURLHasSuffix *string `json:"callbackURLHasSuffix,omitempty"` + CallbackURLIsNil bool `json:"callbackURLIsNil,omitempty"` + CallbackURLNotNil bool `json:"callbackURLNotNil,omitempty"` + CallbackURLEqualFold *string `json:"callbackURLEqualFold,omitempty"` + CallbackURLContainsFold *string `json:"callbackURLContainsFold,omitempty"` + + // "owner" edge predicates. + HasOwner *bool `json:"hasOwner,omitempty"` + HasOwnerWith []*ApplicationWhereInput `json:"hasOwnerWith,omitempty"` + + // "target" edge predicates. + HasTarget *bool `json:"hasTarget,omitempty"` + HasTargetWith []*EventExposureWhereInput `json:"hasTargetWith,omitempty"` + + // "approval" edge predicates. + HasApproval *bool `json:"hasApproval,omitempty"` + HasApprovalWith []*ApprovalWhereInput `json:"hasApprovalWith,omitempty"` + + // "approval_requests" edge predicates. + HasApprovalRequests *bool `json:"hasApprovalRequests,omitempty"` + HasApprovalRequestsWith []*ApprovalRequestWhereInput `json:"hasApprovalRequestsWith,omitempty"` +} + +// AddPredicates adds custom predicates to the where input to be used during the filtering phase. +func (i *EventSubscriptionWhereInput) AddPredicates(predicates ...predicate.EventSubscription) { + i.Predicates = append(i.Predicates, predicates...) +} + +// Filter applies the EventSubscriptionWhereInput filter on the EventSubscriptionQuery builder. +func (i *EventSubscriptionWhereInput) Filter(q *EventSubscriptionQuery) (*EventSubscriptionQuery, error) { + if i == nil { + return q, nil + } + p, err := i.P() + if err != nil { + if err == ErrEmptyEventSubscriptionWhereInput { + return q, nil + } + return nil, err + } + return q.Where(p), nil +} + +// ErrEmptyEventSubscriptionWhereInput is returned in case the EventSubscriptionWhereInput is empty. +var ErrEmptyEventSubscriptionWhereInput = errors.New("ent: empty predicate EventSubscriptionWhereInput") + +// P returns a predicate for filtering eventsubscriptions. +// An error is returned if the input is empty or invalid. +func (i *EventSubscriptionWhereInput) P() (predicate.EventSubscription, error) { + var predicates []predicate.EventSubscription + if i.Not != nil { + p, err := i.Not.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'not'", err) + } + predicates = append(predicates, eventsubscription.Not(p)) + } + switch n := len(i.Or); { + case n == 1: + p, err := i.Or[0].P() + if err != nil { + return nil, fmt.Errorf("%w: field 'or'", err) + } + predicates = append(predicates, p) + case n > 1: + or := make([]predicate.EventSubscription, 0, n) + for _, w := range i.Or { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'or'", err) + } + or = append(or, p) + } + predicates = append(predicates, eventsubscription.Or(or...)) + } + switch n := len(i.And); { + case n == 1: + p, err := i.And[0].P() + if err != nil { + return nil, fmt.Errorf("%w: field 'and'", err) + } + predicates = append(predicates, p) + case n > 1: + and := make([]predicate.EventSubscription, 0, n) + for _, w := range i.And { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'and'", err) + } + and = append(and, p) + } + predicates = append(predicates, eventsubscription.And(and...)) + } + predicates = append(predicates, i.Predicates...) + if i.ID != nil { + predicates = append(predicates, eventsubscription.IDEQ(*i.ID)) + } + if i.IDNEQ != nil { + predicates = append(predicates, eventsubscription.IDNEQ(*i.IDNEQ)) + } + if len(i.IDIn) > 0 { + predicates = append(predicates, eventsubscription.IDIn(i.IDIn...)) + } + if len(i.IDNotIn) > 0 { + predicates = append(predicates, eventsubscription.IDNotIn(i.IDNotIn...)) + } + if i.IDGT != nil { + predicates = append(predicates, eventsubscription.IDGT(*i.IDGT)) + } + if i.IDGTE != nil { + predicates = append(predicates, eventsubscription.IDGTE(*i.IDGTE)) + } + if i.IDLT != nil { + predicates = append(predicates, eventsubscription.IDLT(*i.IDLT)) + } + if i.IDLTE != nil { + predicates = append(predicates, eventsubscription.IDLTE(*i.IDLTE)) + } + if i.CreatedAt != nil { + predicates = append(predicates, eventsubscription.CreatedAtEQ(*i.CreatedAt)) + } + if i.CreatedAtNEQ != nil { + predicates = append(predicates, eventsubscription.CreatedAtNEQ(*i.CreatedAtNEQ)) + } + if len(i.CreatedAtIn) > 0 { + predicates = append(predicates, eventsubscription.CreatedAtIn(i.CreatedAtIn...)) + } + if len(i.CreatedAtNotIn) > 0 { + predicates = append(predicates, eventsubscription.CreatedAtNotIn(i.CreatedAtNotIn...)) + } + if i.CreatedAtGT != nil { + predicates = append(predicates, eventsubscription.CreatedAtGT(*i.CreatedAtGT)) + } + if i.CreatedAtGTE != nil { + predicates = append(predicates, eventsubscription.CreatedAtGTE(*i.CreatedAtGTE)) + } + if i.CreatedAtLT != nil { + predicates = append(predicates, eventsubscription.CreatedAtLT(*i.CreatedAtLT)) + } + if i.CreatedAtLTE != nil { + predicates = append(predicates, eventsubscription.CreatedAtLTE(*i.CreatedAtLTE)) + } + if i.LastModifiedAt != nil { + predicates = append(predicates, eventsubscription.LastModifiedAtEQ(*i.LastModifiedAt)) + } + if i.LastModifiedAtNEQ != nil { + predicates = append(predicates, eventsubscription.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + } + if len(i.LastModifiedAtIn) > 0 { + predicates = append(predicates, eventsubscription.LastModifiedAtIn(i.LastModifiedAtIn...)) + } + if len(i.LastModifiedAtNotIn) > 0 { + predicates = append(predicates, eventsubscription.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + } + if i.LastModifiedAtGT != nil { + predicates = append(predicates, eventsubscription.LastModifiedAtGT(*i.LastModifiedAtGT)) + } + if i.LastModifiedAtGTE != nil { + predicates = append(predicates, eventsubscription.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + } + if i.LastModifiedAtLT != nil { + predicates = append(predicates, eventsubscription.LastModifiedAtLT(*i.LastModifiedAtLT)) + } + if i.LastModifiedAtLTE != nil { + predicates = append(predicates, eventsubscription.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + } + if i.StatusPhase != nil { + predicates = append(predicates, eventsubscription.StatusPhaseEQ(*i.StatusPhase)) + } + if i.StatusPhaseNEQ != nil { + predicates = append(predicates, eventsubscription.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + } + if len(i.StatusPhaseIn) > 0 { + predicates = append(predicates, eventsubscription.StatusPhaseIn(i.StatusPhaseIn...)) + } + if len(i.StatusPhaseNotIn) > 0 { + predicates = append(predicates, eventsubscription.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + } + if i.StatusPhaseIsNil { + predicates = append(predicates, eventsubscription.StatusPhaseIsNil()) + } + if i.StatusPhaseNotNil { + predicates = append(predicates, eventsubscription.StatusPhaseNotNil()) + } + if i.StatusMessage != nil { + predicates = append(predicates, eventsubscription.StatusMessageEQ(*i.StatusMessage)) + } + if i.StatusMessageNEQ != nil { + predicates = append(predicates, eventsubscription.StatusMessageNEQ(*i.StatusMessageNEQ)) + } + if len(i.StatusMessageIn) > 0 { + predicates = append(predicates, eventsubscription.StatusMessageIn(i.StatusMessageIn...)) + } + if len(i.StatusMessageNotIn) > 0 { + predicates = append(predicates, eventsubscription.StatusMessageNotIn(i.StatusMessageNotIn...)) + } + if i.StatusMessageGT != nil { + predicates = append(predicates, eventsubscription.StatusMessageGT(*i.StatusMessageGT)) + } + if i.StatusMessageGTE != nil { + predicates = append(predicates, eventsubscription.StatusMessageGTE(*i.StatusMessageGTE)) + } + if i.StatusMessageLT != nil { + predicates = append(predicates, eventsubscription.StatusMessageLT(*i.StatusMessageLT)) + } + if i.StatusMessageLTE != nil { + predicates = append(predicates, eventsubscription.StatusMessageLTE(*i.StatusMessageLTE)) + } + if i.StatusMessageContains != nil { + predicates = append(predicates, eventsubscription.StatusMessageContains(*i.StatusMessageContains)) + } + if i.StatusMessageHasPrefix != nil { + predicates = append(predicates, eventsubscription.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) + } + if i.StatusMessageHasSuffix != nil { + predicates = append(predicates, eventsubscription.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) + } + if i.StatusMessageIsNil { + predicates = append(predicates, eventsubscription.StatusMessageIsNil()) + } + if i.StatusMessageNotNil { + predicates = append(predicates, eventsubscription.StatusMessageNotNil()) + } + if i.StatusMessageEqualFold != nil { + predicates = append(predicates, eventsubscription.StatusMessageEqualFold(*i.StatusMessageEqualFold)) + } + if i.StatusMessageContainsFold != nil { + predicates = append(predicates, eventsubscription.StatusMessageContainsFold(*i.StatusMessageContainsFold)) + } + if i.Environment != nil { + predicates = append(predicates, eventsubscription.EnvironmentEQ(*i.Environment)) + } + if i.EnvironmentNEQ != nil { + predicates = append(predicates, eventsubscription.EnvironmentNEQ(*i.EnvironmentNEQ)) + } + if len(i.EnvironmentIn) > 0 { + predicates = append(predicates, eventsubscription.EnvironmentIn(i.EnvironmentIn...)) + } + if len(i.EnvironmentNotIn) > 0 { + predicates = append(predicates, eventsubscription.EnvironmentNotIn(i.EnvironmentNotIn...)) + } + if i.EnvironmentGT != nil { + predicates = append(predicates, eventsubscription.EnvironmentGT(*i.EnvironmentGT)) + } + if i.EnvironmentGTE != nil { + predicates = append(predicates, eventsubscription.EnvironmentGTE(*i.EnvironmentGTE)) + } + if i.EnvironmentLT != nil { + predicates = append(predicates, eventsubscription.EnvironmentLT(*i.EnvironmentLT)) + } + if i.EnvironmentLTE != nil { + predicates = append(predicates, eventsubscription.EnvironmentLTE(*i.EnvironmentLTE)) + } + if i.EnvironmentContains != nil { + predicates = append(predicates, eventsubscription.EnvironmentContains(*i.EnvironmentContains)) + } + if i.EnvironmentHasPrefix != nil { + predicates = append(predicates, eventsubscription.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + } + if i.EnvironmentHasSuffix != nil { + predicates = append(predicates, eventsubscription.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + } + if i.EnvironmentIsNil { + predicates = append(predicates, eventsubscription.EnvironmentIsNil()) + } + if i.EnvironmentNotNil { + predicates = append(predicates, eventsubscription.EnvironmentNotNil()) + } + if i.EnvironmentEqualFold != nil { + predicates = append(predicates, eventsubscription.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + } + if i.EnvironmentContainsFold != nil { + predicates = append(predicates, eventsubscription.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + } + if i.Namespace != nil { + predicates = append(predicates, eventsubscription.NamespaceEQ(*i.Namespace)) + } + if i.NamespaceNEQ != nil { + predicates = append(predicates, eventsubscription.NamespaceNEQ(*i.NamespaceNEQ)) + } + if len(i.NamespaceIn) > 0 { + predicates = append(predicates, eventsubscription.NamespaceIn(i.NamespaceIn...)) + } + if len(i.NamespaceNotIn) > 0 { + predicates = append(predicates, eventsubscription.NamespaceNotIn(i.NamespaceNotIn...)) + } + if i.NamespaceGT != nil { + predicates = append(predicates, eventsubscription.NamespaceGT(*i.NamespaceGT)) + } + if i.NamespaceGTE != nil { + predicates = append(predicates, eventsubscription.NamespaceGTE(*i.NamespaceGTE)) + } + if i.NamespaceLT != nil { + predicates = append(predicates, eventsubscription.NamespaceLT(*i.NamespaceLT)) + } + if i.NamespaceLTE != nil { + predicates = append(predicates, eventsubscription.NamespaceLTE(*i.NamespaceLTE)) + } + if i.NamespaceContains != nil { + predicates = append(predicates, eventsubscription.NamespaceContains(*i.NamespaceContains)) + } + if i.NamespaceHasPrefix != nil { + predicates = append(predicates, eventsubscription.NamespaceHasPrefix(*i.NamespaceHasPrefix)) + } + if i.NamespaceHasSuffix != nil { + predicates = append(predicates, eventsubscription.NamespaceHasSuffix(*i.NamespaceHasSuffix)) + } + if i.NamespaceEqualFold != nil { + predicates = append(predicates, eventsubscription.NamespaceEqualFold(*i.NamespaceEqualFold)) + } + if i.NamespaceContainsFold != nil { + predicates = append(predicates, eventsubscription.NamespaceContainsFold(*i.NamespaceContainsFold)) + } + if i.Name != nil { + predicates = append(predicates, eventsubscription.NameEQ(*i.Name)) + } + if i.NameNEQ != nil { + predicates = append(predicates, eventsubscription.NameNEQ(*i.NameNEQ)) + } + if len(i.NameIn) > 0 { + predicates = append(predicates, eventsubscription.NameIn(i.NameIn...)) + } + if len(i.NameNotIn) > 0 { + predicates = append(predicates, eventsubscription.NameNotIn(i.NameNotIn...)) + } + if i.NameGT != nil { + predicates = append(predicates, eventsubscription.NameGT(*i.NameGT)) + } + if i.NameGTE != nil { + predicates = append(predicates, eventsubscription.NameGTE(*i.NameGTE)) + } + if i.NameLT != nil { + predicates = append(predicates, eventsubscription.NameLT(*i.NameLT)) + } + if i.NameLTE != nil { + predicates = append(predicates, eventsubscription.NameLTE(*i.NameLTE)) + } + if i.NameContains != nil { + predicates = append(predicates, eventsubscription.NameContains(*i.NameContains)) + } + if i.NameHasPrefix != nil { + predicates = append(predicates, eventsubscription.NameHasPrefix(*i.NameHasPrefix)) + } + if i.NameHasSuffix != nil { + predicates = append(predicates, eventsubscription.NameHasSuffix(*i.NameHasSuffix)) + } + if i.NameEqualFold != nil { + predicates = append(predicates, eventsubscription.NameEqualFold(*i.NameEqualFold)) + } + if i.NameContainsFold != nil { + predicates = append(predicates, eventsubscription.NameContainsFold(*i.NameContainsFold)) + } + if i.EventType != nil { + predicates = append(predicates, eventsubscription.EventTypeEQ(*i.EventType)) + } + if i.EventTypeNEQ != nil { + predicates = append(predicates, eventsubscription.EventTypeNEQ(*i.EventTypeNEQ)) + } + if len(i.EventTypeIn) > 0 { + predicates = append(predicates, eventsubscription.EventTypeIn(i.EventTypeIn...)) + } + if len(i.EventTypeNotIn) > 0 { + predicates = append(predicates, eventsubscription.EventTypeNotIn(i.EventTypeNotIn...)) + } + if i.EventTypeGT != nil { + predicates = append(predicates, eventsubscription.EventTypeGT(*i.EventTypeGT)) + } + if i.EventTypeGTE != nil { + predicates = append(predicates, eventsubscription.EventTypeGTE(*i.EventTypeGTE)) + } + if i.EventTypeLT != nil { + predicates = append(predicates, eventsubscription.EventTypeLT(*i.EventTypeLT)) + } + if i.EventTypeLTE != nil { + predicates = append(predicates, eventsubscription.EventTypeLTE(*i.EventTypeLTE)) + } + if i.EventTypeContains != nil { + predicates = append(predicates, eventsubscription.EventTypeContains(*i.EventTypeContains)) + } + if i.EventTypeHasPrefix != nil { + predicates = append(predicates, eventsubscription.EventTypeHasPrefix(*i.EventTypeHasPrefix)) + } + if i.EventTypeHasSuffix != nil { + predicates = append(predicates, eventsubscription.EventTypeHasSuffix(*i.EventTypeHasSuffix)) + } + if i.EventTypeEqualFold != nil { + predicates = append(predicates, eventsubscription.EventTypeEqualFold(*i.EventTypeEqualFold)) + } + if i.EventTypeContainsFold != nil { + predicates = append(predicates, eventsubscription.EventTypeContainsFold(*i.EventTypeContainsFold)) + } + if i.DeliveryType != nil { + predicates = append(predicates, eventsubscription.DeliveryTypeEQ(*i.DeliveryType)) + } + if i.DeliveryTypeNEQ != nil { + predicates = append(predicates, eventsubscription.DeliveryTypeNEQ(*i.DeliveryTypeNEQ)) + } + if len(i.DeliveryTypeIn) > 0 { + predicates = append(predicates, eventsubscription.DeliveryTypeIn(i.DeliveryTypeIn...)) + } + if len(i.DeliveryTypeNotIn) > 0 { + predicates = append(predicates, eventsubscription.DeliveryTypeNotIn(i.DeliveryTypeNotIn...)) + } + if i.CallbackURL != nil { + predicates = append(predicates, eventsubscription.CallbackURLEQ(*i.CallbackURL)) + } + if i.CallbackURLNEQ != nil { + predicates = append(predicates, eventsubscription.CallbackURLNEQ(*i.CallbackURLNEQ)) + } + if len(i.CallbackURLIn) > 0 { + predicates = append(predicates, eventsubscription.CallbackURLIn(i.CallbackURLIn...)) + } + if len(i.CallbackURLNotIn) > 0 { + predicates = append(predicates, eventsubscription.CallbackURLNotIn(i.CallbackURLNotIn...)) + } + if i.CallbackURLGT != nil { + predicates = append(predicates, eventsubscription.CallbackURLGT(*i.CallbackURLGT)) + } + if i.CallbackURLGTE != nil { + predicates = append(predicates, eventsubscription.CallbackURLGTE(*i.CallbackURLGTE)) + } + if i.CallbackURLLT != nil { + predicates = append(predicates, eventsubscription.CallbackURLLT(*i.CallbackURLLT)) + } + if i.CallbackURLLTE != nil { + predicates = append(predicates, eventsubscription.CallbackURLLTE(*i.CallbackURLLTE)) + } + if i.CallbackURLContains != nil { + predicates = append(predicates, eventsubscription.CallbackURLContains(*i.CallbackURLContains)) + } + if i.CallbackURLHasPrefix != nil { + predicates = append(predicates, eventsubscription.CallbackURLHasPrefix(*i.CallbackURLHasPrefix)) + } + if i.CallbackURLHasSuffix != nil { + predicates = append(predicates, eventsubscription.CallbackURLHasSuffix(*i.CallbackURLHasSuffix)) + } + if i.CallbackURLIsNil { + predicates = append(predicates, eventsubscription.CallbackURLIsNil()) + } + if i.CallbackURLNotNil { + predicates = append(predicates, eventsubscription.CallbackURLNotNil()) + } + if i.CallbackURLEqualFold != nil { + predicates = append(predicates, eventsubscription.CallbackURLEqualFold(*i.CallbackURLEqualFold)) + } + if i.CallbackURLContainsFold != nil { + predicates = append(predicates, eventsubscription.CallbackURLContainsFold(*i.CallbackURLContainsFold)) + } + + if i.HasOwner != nil { + p := eventsubscription.HasOwner() + if !*i.HasOwner { + p = eventsubscription.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasOwnerWith) > 0 { + with := make([]predicate.Application, 0, len(i.HasOwnerWith)) + for _, w := range i.HasOwnerWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasOwnerWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, eventsubscription.HasOwnerWith(with...)) + } + if i.HasTarget != nil { + p := eventsubscription.HasTarget() + if !*i.HasTarget { + p = eventsubscription.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasTargetWith) > 0 { + with := make([]predicate.EventExposure, 0, len(i.HasTargetWith)) + for _, w := range i.HasTargetWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasTargetWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, eventsubscription.HasTargetWith(with...)) + } + if i.HasApproval != nil { + p := eventsubscription.HasApproval() + if !*i.HasApproval { + p = eventsubscription.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasApprovalWith) > 0 { + with := make([]predicate.Approval, 0, len(i.HasApprovalWith)) + for _, w := range i.HasApprovalWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasApprovalWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, eventsubscription.HasApprovalWith(with...)) + } + if i.HasApprovalRequests != nil { + p := eventsubscription.HasApprovalRequests() + if !*i.HasApprovalRequests { + p = eventsubscription.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasApprovalRequestsWith) > 0 { + with := make([]predicate.ApprovalRequest, 0, len(i.HasApprovalRequestsWith)) + for _, w := range i.HasApprovalRequestsWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasApprovalRequestsWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, eventsubscription.HasApprovalRequestsWith(with...)) + } + switch len(predicates) { + case 0: + return nil, ErrEmptyEventSubscriptionWhereInput + case 1: + return predicates[0], nil + default: + return eventsubscription.And(predicates...), nil + } +} + +// GroupWhereInput represents a where input for filtering Group queries. +type GroupWhereInput struct { + Predicates []predicate.Group `json:"-"` + Not *GroupWhereInput `json:"not,omitempty"` + Or []*GroupWhereInput `json:"or,omitempty"` + And []*GroupWhereInput `json:"and,omitempty"` + + // "id" field predicates. + ID *int `json:"id,omitempty"` + IDNEQ *int `json:"idNEQ,omitempty"` + IDIn []int `json:"idIn,omitempty"` + IDNotIn []int `json:"idNotIn,omitempty"` + IDGT *int `json:"idGT,omitempty"` + IDGTE *int `json:"idGTE,omitempty"` + IDLT *int `json:"idLT,omitempty"` + IDLTE *int `json:"idLTE,omitempty"` + + // "environment" field predicates. + Environment *string `json:"environment,omitempty"` + EnvironmentNEQ *string `json:"environmentNEQ,omitempty"` + EnvironmentIn []string `json:"environmentIn,omitempty"` + EnvironmentNotIn []string `json:"environmentNotIn,omitempty"` + EnvironmentGT *string `json:"environmentGT,omitempty"` + EnvironmentGTE *string `json:"environmentGTE,omitempty"` + EnvironmentLT *string `json:"environmentLT,omitempty"` + EnvironmentLTE *string `json:"environmentLTE,omitempty"` + EnvironmentContains *string `json:"environmentContains,omitempty"` + EnvironmentHasPrefix *string `json:"environmentHasPrefix,omitempty"` + EnvironmentHasSuffix *string `json:"environmentHasSuffix,omitempty"` + EnvironmentIsNil bool `json:"environmentIsNil,omitempty"` + EnvironmentNotNil bool `json:"environmentNotNil,omitempty"` + EnvironmentEqualFold *string `json:"environmentEqualFold,omitempty"` + EnvironmentContainsFold *string `json:"environmentContainsFold,omitempty"` + + // "namespace" field predicates. + Namespace *string `json:"namespace,omitempty"` + NamespaceNEQ *string `json:"namespaceNEQ,omitempty"` + NamespaceIn []string `json:"namespaceIn,omitempty"` + NamespaceNotIn []string `json:"namespaceNotIn,omitempty"` + NamespaceGT *string `json:"namespaceGT,omitempty"` + NamespaceGTE *string `json:"namespaceGTE,omitempty"` + NamespaceLT *string `json:"namespaceLT,omitempty"` + NamespaceLTE *string `json:"namespaceLTE,omitempty"` + NamespaceContains *string `json:"namespaceContains,omitempty"` + NamespaceHasPrefix *string `json:"namespaceHasPrefix,omitempty"` + NamespaceHasSuffix *string `json:"namespaceHasSuffix,omitempty"` + NamespaceEqualFold *string `json:"namespaceEqualFold,omitempty"` + NamespaceContainsFold *string `json:"namespaceContainsFold,omitempty"` + + // "name" field predicates. + Name *string `json:"name,omitempty"` + NameNEQ *string `json:"nameNEQ,omitempty"` + NameIn []string `json:"nameIn,omitempty"` + NameNotIn []string `json:"nameNotIn,omitempty"` + NameGT *string `json:"nameGT,omitempty"` + NameGTE *string `json:"nameGTE,omitempty"` + NameLT *string `json:"nameLT,omitempty"` + NameLTE *string `json:"nameLTE,omitempty"` + NameContains *string `json:"nameContains,omitempty"` + NameHasPrefix *string `json:"nameHasPrefix,omitempty"` + NameHasSuffix *string `json:"nameHasSuffix,omitempty"` + NameEqualFold *string `json:"nameEqualFold,omitempty"` + NameContainsFold *string `json:"nameContainsFold,omitempty"` + + // "display_name" field predicates. + DisplayName *string `json:"displayName,omitempty"` + DisplayNameNEQ *string `json:"displayNameNEQ,omitempty"` + DisplayNameIn []string `json:"displayNameIn,omitempty"` + DisplayNameNotIn []string `json:"displayNameNotIn,omitempty"` + DisplayNameGT *string `json:"displayNameGT,omitempty"` + DisplayNameGTE *string `json:"displayNameGTE,omitempty"` + DisplayNameLT *string `json:"displayNameLT,omitempty"` + DisplayNameLTE *string `json:"displayNameLTE,omitempty"` + DisplayNameContains *string `json:"displayNameContains,omitempty"` + DisplayNameHasPrefix *string `json:"displayNameHasPrefix,omitempty"` + DisplayNameHasSuffix *string `json:"displayNameHasSuffix,omitempty"` + DisplayNameEqualFold *string `json:"displayNameEqualFold,omitempty"` + DisplayNameContainsFold *string `json:"displayNameContainsFold,omitempty"` + + // "description" field predicates. + Description *string `json:"description,omitempty"` + DescriptionNEQ *string `json:"descriptionNEQ,omitempty"` + DescriptionIn []string `json:"descriptionIn,omitempty"` + DescriptionNotIn []string `json:"descriptionNotIn,omitempty"` + DescriptionGT *string `json:"descriptionGT,omitempty"` + DescriptionGTE *string `json:"descriptionGTE,omitempty"` + DescriptionLT *string `json:"descriptionLT,omitempty"` + DescriptionLTE *string `json:"descriptionLTE,omitempty"` + DescriptionContains *string `json:"descriptionContains,omitempty"` + DescriptionHasPrefix *string `json:"descriptionHasPrefix,omitempty"` + DescriptionHasSuffix *string `json:"descriptionHasSuffix,omitempty"` + DescriptionEqualFold *string `json:"descriptionEqualFold,omitempty"` + DescriptionContainsFold *string `json:"descriptionContainsFold,omitempty"` + + // "teams" edge predicates. + HasTeams *bool `json:"hasTeams,omitempty"` + HasTeamsWith []*TeamWhereInput `json:"hasTeamsWith,omitempty"` +} + +// AddPredicates adds custom predicates to the where input to be used during the filtering phase. +func (i *GroupWhereInput) AddPredicates(predicates ...predicate.Group) { + i.Predicates = append(i.Predicates, predicates...) +} + +// Filter applies the GroupWhereInput filter on the GroupQuery builder. +func (i *GroupWhereInput) Filter(q *GroupQuery) (*GroupQuery, error) { + if i == nil { + return q, nil + } + p, err := i.P() + if err != nil { + if err == ErrEmptyGroupWhereInput { + return q, nil + } + return nil, err + } + return q.Where(p), nil +} + +// ErrEmptyGroupWhereInput is returned in case the GroupWhereInput is empty. +var ErrEmptyGroupWhereInput = errors.New("ent: empty predicate GroupWhereInput") + +// P returns a predicate for filtering groups. +// An error is returned if the input is empty or invalid. +func (i *GroupWhereInput) P() (predicate.Group, error) { + var predicates []predicate.Group + if i.Not != nil { + p, err := i.Not.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'not'", err) + } + predicates = append(predicates, group.Not(p)) + } + switch n := len(i.Or); { + case n == 1: + p, err := i.Or[0].P() + if err != nil { + return nil, fmt.Errorf("%w: field 'or'", err) + } + predicates = append(predicates, p) + case n > 1: + or := make([]predicate.Group, 0, n) + for _, w := range i.Or { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'or'", err) + } + or = append(or, p) + } + predicates = append(predicates, group.Or(or...)) + } + switch n := len(i.And); { + case n == 1: + p, err := i.And[0].P() + if err != nil { + return nil, fmt.Errorf("%w: field 'and'", err) + } + predicates = append(predicates, p) + case n > 1: + and := make([]predicate.Group, 0, n) + for _, w := range i.And { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'and'", err) + } + and = append(and, p) + } + predicates = append(predicates, group.And(and...)) + } + predicates = append(predicates, i.Predicates...) + if i.ID != nil { + predicates = append(predicates, group.IDEQ(*i.ID)) + } + if i.IDNEQ != nil { + predicates = append(predicates, group.IDNEQ(*i.IDNEQ)) + } + if len(i.IDIn) > 0 { + predicates = append(predicates, group.IDIn(i.IDIn...)) + } + if len(i.IDNotIn) > 0 { + predicates = append(predicates, group.IDNotIn(i.IDNotIn...)) + } + if i.IDGT != nil { + predicates = append(predicates, group.IDGT(*i.IDGT)) + } + if i.IDGTE != nil { + predicates = append(predicates, group.IDGTE(*i.IDGTE)) + } + if i.IDLT != nil { + predicates = append(predicates, group.IDLT(*i.IDLT)) + } + if i.IDLTE != nil { + predicates = append(predicates, group.IDLTE(*i.IDLTE)) + } + if i.Environment != nil { + predicates = append(predicates, group.EnvironmentEQ(*i.Environment)) + } + if i.EnvironmentNEQ != nil { + predicates = append(predicates, group.EnvironmentNEQ(*i.EnvironmentNEQ)) + } + if len(i.EnvironmentIn) > 0 { + predicates = append(predicates, group.EnvironmentIn(i.EnvironmentIn...)) + } + if len(i.EnvironmentNotIn) > 0 { + predicates = append(predicates, group.EnvironmentNotIn(i.EnvironmentNotIn...)) + } + if i.EnvironmentGT != nil { + predicates = append(predicates, group.EnvironmentGT(*i.EnvironmentGT)) + } + if i.EnvironmentGTE != nil { + predicates = append(predicates, group.EnvironmentGTE(*i.EnvironmentGTE)) + } + if i.EnvironmentLT != nil { + predicates = append(predicates, group.EnvironmentLT(*i.EnvironmentLT)) + } + if i.EnvironmentLTE != nil { + predicates = append(predicates, group.EnvironmentLTE(*i.EnvironmentLTE)) + } + if i.EnvironmentContains != nil { + predicates = append(predicates, group.EnvironmentContains(*i.EnvironmentContains)) + } + if i.EnvironmentHasPrefix != nil { + predicates = append(predicates, group.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + } + if i.EnvironmentHasSuffix != nil { + predicates = append(predicates, group.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + } + if i.EnvironmentIsNil { + predicates = append(predicates, group.EnvironmentIsNil()) + } + if i.EnvironmentNotNil { + predicates = append(predicates, group.EnvironmentNotNil()) + } + if i.EnvironmentEqualFold != nil { + predicates = append(predicates, group.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + } + if i.EnvironmentContainsFold != nil { + predicates = append(predicates, group.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + } + if i.Namespace != nil { + predicates = append(predicates, group.NamespaceEQ(*i.Namespace)) } if i.NamespaceNEQ != nil { predicates = append(predicates, group.NamespaceNEQ(*i.NamespaceNEQ)) @@ -4073,22 +5404,22 @@ type TeamWhereInput struct { CategoryIn []team.Category `json:"categoryIn,omitempty"` CategoryNotIn []team.Category `json:"categoryNotIn,omitempty"` - // "rover_token_ref" field predicates. - RoverTokenRef *string `json:"roverTokenRef,omitempty"` - RoverTokenRefNEQ *string `json:"roverTokenRefNEQ,omitempty"` - RoverTokenRefIn []string `json:"roverTokenRefIn,omitempty"` - RoverTokenRefNotIn []string `json:"roverTokenRefNotIn,omitempty"` - RoverTokenRefGT *string `json:"roverTokenRefGT,omitempty"` - RoverTokenRefGTE *string `json:"roverTokenRefGTE,omitempty"` - RoverTokenRefLT *string `json:"roverTokenRefLT,omitempty"` - RoverTokenRefLTE *string `json:"roverTokenRefLTE,omitempty"` - RoverTokenRefContains *string `json:"roverTokenRefContains,omitempty"` - RoverTokenRefHasPrefix *string `json:"roverTokenRefHasPrefix,omitempty"` - RoverTokenRefHasSuffix *string `json:"roverTokenRefHasSuffix,omitempty"` - RoverTokenRefIsNil bool `json:"roverTokenRefIsNil,omitempty"` - RoverTokenRefNotNil bool `json:"roverTokenRefNotNil,omitempty"` - RoverTokenRefEqualFold *string `json:"roverTokenRefEqualFold,omitempty"` - RoverTokenRefContainsFold *string `json:"roverTokenRefContainsFold,omitempty"` + // "team_token" field predicates. + TeamToken *string `json:"teamToken,omitempty"` + TeamTokenNEQ *string `json:"teamTokenNEQ,omitempty"` + TeamTokenIn []string `json:"teamTokenIn,omitempty"` + TeamTokenNotIn []string `json:"teamTokenNotIn,omitempty"` + TeamTokenGT *string `json:"teamTokenGT,omitempty"` + TeamTokenGTE *string `json:"teamTokenGTE,omitempty"` + TeamTokenLT *string `json:"teamTokenLT,omitempty"` + TeamTokenLTE *string `json:"teamTokenLTE,omitempty"` + TeamTokenContains *string `json:"teamTokenContains,omitempty"` + TeamTokenHasPrefix *string `json:"teamTokenHasPrefix,omitempty"` + TeamTokenHasSuffix *string `json:"teamTokenHasSuffix,omitempty"` + TeamTokenIsNil bool `json:"teamTokenIsNil,omitempty"` + TeamTokenNotNil bool `json:"teamTokenNotNil,omitempty"` + TeamTokenEqualFold *string `json:"teamTokenEqualFold,omitempty"` + TeamTokenContainsFold *string `json:"teamTokenContainsFold,omitempty"` // "group" edge predicates. HasGroup *bool `json:"hasGroup,omitempty"` @@ -4483,50 +5814,50 @@ func (i *TeamWhereInput) P() (predicate.Team, error) { if len(i.CategoryNotIn) > 0 { predicates = append(predicates, team.CategoryNotIn(i.CategoryNotIn...)) } - if i.RoverTokenRef != nil { - predicates = append(predicates, team.RoverTokenRefEQ(*i.RoverTokenRef)) + if i.TeamToken != nil { + predicates = append(predicates, team.TeamTokenEQ(*i.TeamToken)) } - if i.RoverTokenRefNEQ != nil { - predicates = append(predicates, team.RoverTokenRefNEQ(*i.RoverTokenRefNEQ)) + if i.TeamTokenNEQ != nil { + predicates = append(predicates, team.TeamTokenNEQ(*i.TeamTokenNEQ)) } - if len(i.RoverTokenRefIn) > 0 { - predicates = append(predicates, team.RoverTokenRefIn(i.RoverTokenRefIn...)) + if len(i.TeamTokenIn) > 0 { + predicates = append(predicates, team.TeamTokenIn(i.TeamTokenIn...)) } - if len(i.RoverTokenRefNotIn) > 0 { - predicates = append(predicates, team.RoverTokenRefNotIn(i.RoverTokenRefNotIn...)) + if len(i.TeamTokenNotIn) > 0 { + predicates = append(predicates, team.TeamTokenNotIn(i.TeamTokenNotIn...)) } - if i.RoverTokenRefGT != nil { - predicates = append(predicates, team.RoverTokenRefGT(*i.RoverTokenRefGT)) + if i.TeamTokenGT != nil { + predicates = append(predicates, team.TeamTokenGT(*i.TeamTokenGT)) } - if i.RoverTokenRefGTE != nil { - predicates = append(predicates, team.RoverTokenRefGTE(*i.RoverTokenRefGTE)) + if i.TeamTokenGTE != nil { + predicates = append(predicates, team.TeamTokenGTE(*i.TeamTokenGTE)) } - if i.RoverTokenRefLT != nil { - predicates = append(predicates, team.RoverTokenRefLT(*i.RoverTokenRefLT)) + if i.TeamTokenLT != nil { + predicates = append(predicates, team.TeamTokenLT(*i.TeamTokenLT)) } - if i.RoverTokenRefLTE != nil { - predicates = append(predicates, team.RoverTokenRefLTE(*i.RoverTokenRefLTE)) + if i.TeamTokenLTE != nil { + predicates = append(predicates, team.TeamTokenLTE(*i.TeamTokenLTE)) } - if i.RoverTokenRefContains != nil { - predicates = append(predicates, team.RoverTokenRefContains(*i.RoverTokenRefContains)) + if i.TeamTokenContains != nil { + predicates = append(predicates, team.TeamTokenContains(*i.TeamTokenContains)) } - if i.RoverTokenRefHasPrefix != nil { - predicates = append(predicates, team.RoverTokenRefHasPrefix(*i.RoverTokenRefHasPrefix)) + if i.TeamTokenHasPrefix != nil { + predicates = append(predicates, team.TeamTokenHasPrefix(*i.TeamTokenHasPrefix)) } - if i.RoverTokenRefHasSuffix != nil { - predicates = append(predicates, team.RoverTokenRefHasSuffix(*i.RoverTokenRefHasSuffix)) + if i.TeamTokenHasSuffix != nil { + predicates = append(predicates, team.TeamTokenHasSuffix(*i.TeamTokenHasSuffix)) } - if i.RoverTokenRefIsNil { - predicates = append(predicates, team.RoverTokenRefIsNil()) + if i.TeamTokenIsNil { + predicates = append(predicates, team.TeamTokenIsNil()) } - if i.RoverTokenRefNotNil { - predicates = append(predicates, team.RoverTokenRefNotNil()) + if i.TeamTokenNotNil { + predicates = append(predicates, team.TeamTokenNotNil()) } - if i.RoverTokenRefEqualFold != nil { - predicates = append(predicates, team.RoverTokenRefEqualFold(*i.RoverTokenRefEqualFold)) + if i.TeamTokenEqualFold != nil { + predicates = append(predicates, team.TeamTokenEqualFold(*i.TeamTokenEqualFold)) } - if i.RoverTokenRefContainsFold != nil { - predicates = append(predicates, team.RoverTokenRefContainsFold(*i.RoverTokenRefContainsFold)) + if i.TeamTokenContainsFold != nil { + predicates = append(predicates, team.TeamTokenContainsFold(*i.TeamTokenContainsFold)) } if i.HasGroup != nil { @@ -4659,6 +5990,23 @@ type ZoneWhereInput struct { GatewayURLEqualFold *string `json:"gatewayURLEqualFold,omitempty"` GatewayURLContainsFold *string `json:"gatewayURLContainsFold,omitempty"` + // "issuer_url" field predicates. + IssuerURL *string `json:"issuerURL,omitempty"` + IssuerURLNEQ *string `json:"issuerURLNEQ,omitempty"` + IssuerURLIn []string `json:"issuerURLIn,omitempty"` + IssuerURLNotIn []string `json:"issuerURLNotIn,omitempty"` + IssuerURLGT *string `json:"issuerURLGT,omitempty"` + IssuerURLGTE *string `json:"issuerURLGTE,omitempty"` + IssuerURLLT *string `json:"issuerURLLT,omitempty"` + IssuerURLLTE *string `json:"issuerURLLTE,omitempty"` + IssuerURLContains *string `json:"issuerURLContains,omitempty"` + IssuerURLHasPrefix *string `json:"issuerURLHasPrefix,omitempty"` + IssuerURLHasSuffix *string `json:"issuerURLHasSuffix,omitempty"` + IssuerURLIsNil bool `json:"issuerURLIsNil,omitempty"` + IssuerURLNotNil bool `json:"issuerURLNotNil,omitempty"` + IssuerURLEqualFold *string `json:"issuerURLEqualFold,omitempty"` + IssuerURLContainsFold *string `json:"issuerURLContainsFold,omitempty"` + // "visibility" field predicates. Visibility *zone.Visibility `json:"visibility,omitempty"` VisibilityNEQ *zone.Visibility `json:"visibilityNEQ,omitempty"` @@ -4894,6 +6242,51 @@ func (i *ZoneWhereInput) P() (predicate.Zone, error) { if i.GatewayURLContainsFold != nil { predicates = append(predicates, zone.GatewayURLContainsFold(*i.GatewayURLContainsFold)) } + if i.IssuerURL != nil { + predicates = append(predicates, zone.IssuerURLEQ(*i.IssuerURL)) + } + if i.IssuerURLNEQ != nil { + predicates = append(predicates, zone.IssuerURLNEQ(*i.IssuerURLNEQ)) + } + if len(i.IssuerURLIn) > 0 { + predicates = append(predicates, zone.IssuerURLIn(i.IssuerURLIn...)) + } + if len(i.IssuerURLNotIn) > 0 { + predicates = append(predicates, zone.IssuerURLNotIn(i.IssuerURLNotIn...)) + } + if i.IssuerURLGT != nil { + predicates = append(predicates, zone.IssuerURLGT(*i.IssuerURLGT)) + } + if i.IssuerURLGTE != nil { + predicates = append(predicates, zone.IssuerURLGTE(*i.IssuerURLGTE)) + } + if i.IssuerURLLT != nil { + predicates = append(predicates, zone.IssuerURLLT(*i.IssuerURLLT)) + } + if i.IssuerURLLTE != nil { + predicates = append(predicates, zone.IssuerURLLTE(*i.IssuerURLLTE)) + } + if i.IssuerURLContains != nil { + predicates = append(predicates, zone.IssuerURLContains(*i.IssuerURLContains)) + } + if i.IssuerURLHasPrefix != nil { + predicates = append(predicates, zone.IssuerURLHasPrefix(*i.IssuerURLHasPrefix)) + } + if i.IssuerURLHasSuffix != nil { + predicates = append(predicates, zone.IssuerURLHasSuffix(*i.IssuerURLHasSuffix)) + } + if i.IssuerURLIsNil { + predicates = append(predicates, zone.IssuerURLIsNil()) + } + if i.IssuerURLNotNil { + predicates = append(predicates, zone.IssuerURLNotNil()) + } + if i.IssuerURLEqualFold != nil { + predicates = append(predicates, zone.IssuerURLEqualFold(*i.IssuerURLEqualFold)) + } + if i.IssuerURLContainsFold != nil { + predicates = append(predicates, zone.IssuerURLContainsFold(*i.IssuerURLContainsFold)) + } if i.Visibility != nil { predicates = append(predicates, zone.VisibilityEQ(*i.Visibility)) } diff --git a/controlplane-api/ent/group.go b/controlplane-api/ent/group.go index 619229ace..16b88db1f 100644 --- a/controlplane-api/ent/group.go +++ b/controlplane-api/ent/group.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/group/group.go b/controlplane-api/ent/group/group.go index 4cf6db693..7226a5b67 100644 --- a/controlplane-api/ent/group/group.go +++ b/controlplane-api/ent/group/group.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package group diff --git a/controlplane-api/ent/group/where.go b/controlplane-api/ent/group/where.go index 57fa4d557..f2f70b98a 100644 --- a/controlplane-api/ent/group/where.go +++ b/controlplane-api/ent/group/where.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package group diff --git a/controlplane-api/ent/group_create.go b/controlplane-api/ent/group_create.go index e34b13a7d..016690ef8 100644 --- a/controlplane-api/ent/group_create.go +++ b/controlplane-api/ent/group_create.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/group_delete.go b/controlplane-api/ent/group_delete.go index e35d530ac..0401e4880 100644 --- a/controlplane-api/ent/group_delete.go +++ b/controlplane-api/ent/group_delete.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/group_query.go b/controlplane-api/ent/group_query.go index 41c025393..89afc523a 100644 --- a/controlplane-api/ent/group_query.go +++ b/controlplane-api/ent/group_query.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/group_update.go b/controlplane-api/ent/group_update.go index 57e0113d1..b55687523 100644 --- a/controlplane-api/ent/group_update.go +++ b/controlplane-api/ent/group_update.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/hook/hook.go b/controlplane-api/ent/hook/hook.go index 5846784fd..885b28a60 100644 --- a/controlplane-api/ent/hook/hook.go +++ b/controlplane-api/ent/hook/hook.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package hook @@ -73,6 +72,30 @@ func (f ApprovalRequestFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Va return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ApprovalRequestMutation", m) } +// The EventExposureFunc type is an adapter to allow the use of ordinary +// function as EventExposure mutator. +type EventExposureFunc func(context.Context, *ent.EventExposureMutation) (ent.Value, error) + +// Mutate calls f(ctx, m). +func (f EventExposureFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if mv, ok := m.(*ent.EventExposureMutation); ok { + return f(ctx, mv) + } + return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EventExposureMutation", m) +} + +// The EventSubscriptionFunc type is an adapter to allow the use of ordinary +// function as EventSubscription mutator. +type EventSubscriptionFunc func(context.Context, *ent.EventSubscriptionMutation) (ent.Value, error) + +// Mutate calls f(ctx, m). +func (f EventSubscriptionFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if mv, ok := m.(*ent.EventSubscriptionMutation); ok { + return f(ctx, mv) + } + return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EventSubscriptionMutation", m) +} + // The GroupFunc type is an adapter to allow the use of ordinary // function as Group mutator. type GroupFunc func(context.Context, *ent.GroupMutation) (ent.Value, error) diff --git a/controlplane-api/ent/member.go b/controlplane-api/ent/member.go index eea0dc376..f2eeb273e 100644 --- a/controlplane-api/ent/member.go +++ b/controlplane-api/ent/member.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/member/member.go b/controlplane-api/ent/member/member.go index 37eecfd73..ed2d8d0ec 100644 --- a/controlplane-api/ent/member/member.go +++ b/controlplane-api/ent/member/member.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package member diff --git a/controlplane-api/ent/member/where.go b/controlplane-api/ent/member/where.go index 73d3fd308..451e51aee 100644 --- a/controlplane-api/ent/member/where.go +++ b/controlplane-api/ent/member/where.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package member diff --git a/controlplane-api/ent/member_create.go b/controlplane-api/ent/member_create.go index 2befaeec3..33368044c 100644 --- a/controlplane-api/ent/member_create.go +++ b/controlplane-api/ent/member_create.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/member_delete.go b/controlplane-api/ent/member_delete.go index 352a86a47..36c20b410 100644 --- a/controlplane-api/ent/member_delete.go +++ b/controlplane-api/ent/member_delete.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/member_query.go b/controlplane-api/ent/member_query.go index b99e71796..436b345c4 100644 --- a/controlplane-api/ent/member_query.go +++ b/controlplane-api/ent/member_query.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/member_update.go b/controlplane-api/ent/member_update.go index 01c2fd202..ca7a21fbb 100644 --- a/controlplane-api/ent/member_update.go +++ b/controlplane-api/ent/member_update.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/migrate/migrate.go b/controlplane-api/ent/migrate/migrate.go index 8f08095fc..0c832c4fa 100644 --- a/controlplane-api/ent/migrate/migrate.go +++ b/controlplane-api/ent/migrate/migrate.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package migrate diff --git a/controlplane-api/ent/migrate/schema.go b/controlplane-api/ent/migrate/schema.go index ae61a5f35..745bdd896 100644 --- a/controlplane-api/ent/migrate/schema.go +++ b/controlplane-api/ent/migrate/schema.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package migrate @@ -111,7 +110,11 @@ var ( {Name: "name", Type: field.TypeString, Size: 2147483647}, {Name: "client_id", Type: field.TypeString, Nullable: true, Size: 2147483647}, {Name: "client_secret", Type: field.TypeString, Nullable: true, Size: 2147483647}, - {Name: "issuer_url", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "rotated_client_secret", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "rotated_expires_at", Type: field.TypeTime, Nullable: true}, + {Name: "current_expires_at", Type: field.TypeTime, Nullable: true}, + {Name: "secret_rotation_phase", Type: field.TypeEnum, Enums: []string{"DONE", "ROTATING", "GRACE_PERIOD_ACTIVE", "GRACE_PERIOD_EXPIRING", "FAILED"}, Default: "DONE"}, + {Name: "secret_rotation_message", Type: field.TypeString, Nullable: true, Size: 2147483647}, {Name: "team_applications", Type: field.TypeInt}, {Name: "zone_applications", Type: field.TypeInt}, } @@ -123,13 +126,13 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "applications_teams_applications", - Columns: []*schema.Column{ApplicationsColumns[11]}, + Columns: []*schema.Column{ApplicationsColumns[15]}, RefColumns: []*schema.Column{TeamsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "applications_zones_applications", - Columns: []*schema.Column{ApplicationsColumns[12]}, + Columns: []*schema.Column{ApplicationsColumns[16]}, RefColumns: []*schema.Column{ZonesColumns[0]}, OnDelete: schema.NoAction, }, @@ -138,7 +141,7 @@ var ( { Name: "application_name_team_applications", Unique: true, - Columns: []*schema.Column{ApplicationsColumns[7], ApplicationsColumns[11]}, + Columns: []*schema.Column{ApplicationsColumns[7], ApplicationsColumns[15]}, }, }, } @@ -161,6 +164,7 @@ var ( {Name: "name", Type: field.TypeString, Size: 2147483647}, {Name: "state", Type: field.TypeEnum, Enums: []string{"PENDING", "SEMIGRANTED", "GRANTED", "REJECTED", "SUSPENDED", "EXPIRED"}, Default: "PENDING"}, {Name: "api_subscription_approval", Type: field.TypeInt, Unique: true, Nullable: true}, + {Name: "event_subscription_approval", Type: field.TypeInt, Unique: true, Nullable: true}, } // ApprovalsTable holds the schema information for the "approvals" table. ApprovalsTable = &schema.Table{ @@ -174,6 +178,12 @@ var ( RefColumns: []*schema.Column{APISubscriptionsColumns[0]}, OnDelete: schema.SetNull, }, + { + Symbol: "approvals_event_subscriptions_approval", + Columns: []*schema.Column{ApprovalsColumns[17]}, + RefColumns: []*schema.Column{EventSubscriptionsColumns[0]}, + OnDelete: schema.SetNull, + }, }, Indexes: []*schema.Index{ { @@ -202,6 +212,7 @@ var ( {Name: "name", Type: field.TypeString, Size: 2147483647}, {Name: "state", Type: field.TypeEnum, Enums: []string{"PENDING", "SEMIGRANTED", "GRANTED", "REJECTED"}, Default: "PENDING"}, {Name: "api_subscription_approval_requests", Type: field.TypeInt, Nullable: true}, + {Name: "event_subscription_approval_requests", Type: field.TypeInt, Nullable: true}, } // ApprovalRequestsTable holds the schema information for the "approval_requests" table. ApprovalRequestsTable = &schema.Table{ @@ -213,7 +224,13 @@ var ( Symbol: "approval_requests_api_subscriptions_approval_requests", Columns: []*schema.Column{ApprovalRequestsColumns[16]}, RefColumns: []*schema.Column{APISubscriptionsColumns[0]}, - OnDelete: schema.SetNull, + OnDelete: schema.Cascade, + }, + { + Symbol: "approval_requests_event_subscriptions_approval_requests", + Columns: []*schema.Column{ApprovalRequestsColumns[17]}, + RefColumns: []*schema.Column{EventSubscriptionsColumns[0]}, + OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ @@ -224,6 +241,90 @@ var ( }, }, } + // EventExposuresColumns holds the columns for the "event_exposures" table. + EventExposuresColumns = []*schema.Column{ + {Name: "id", Type: field.TypeInt, Increment: true}, + {Name: "created_at", Type: field.TypeTime}, + {Name: "last_modified_at", Type: field.TypeTime}, + {Name: "status_phase", Type: field.TypeEnum, Nullable: true, Enums: []string{"READY", "PENDING", "ERROR", "UNKNOWN"}}, + {Name: "status_message", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "environment", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "namespace", Type: field.TypeString, Size: 2147483647}, + {Name: "event_type", Type: field.TypeString, Size: 2147483647}, + {Name: "visibility", Type: field.TypeEnum, Enums: []string{"WORLD", "ZONE", "ENTERPRISE"}, Default: "ENTERPRISE"}, + {Name: "active", Type: field.TypeBool, Nullable: true, Default: false}, + {Name: "approval_config", Type: field.TypeJSON}, + {Name: "application_exposed_events", Type: field.TypeInt}, + } + // EventExposuresTable holds the schema information for the "event_exposures" table. + EventExposuresTable = &schema.Table{ + Name: "event_exposures", + Columns: EventExposuresColumns, + PrimaryKey: []*schema.Column{EventExposuresColumns[0]}, + ForeignKeys: []*schema.ForeignKey{ + { + Symbol: "event_exposures_applications_exposed_events", + Columns: []*schema.Column{EventExposuresColumns[11]}, + RefColumns: []*schema.Column{ApplicationsColumns[0]}, + OnDelete: schema.NoAction, + }, + }, + Indexes: []*schema.Index{ + { + Name: "eventexposure_event_type_application_exposed_events", + Unique: true, + Columns: []*schema.Column{EventExposuresColumns[7], EventExposuresColumns[11]}, + }, + }, + } + // EventSubscriptionsColumns holds the columns for the "event_subscriptions" table. + EventSubscriptionsColumns = []*schema.Column{ + {Name: "id", Type: field.TypeInt, Increment: true}, + {Name: "created_at", Type: field.TypeTime}, + {Name: "last_modified_at", Type: field.TypeTime}, + {Name: "status_phase", Type: field.TypeEnum, Nullable: true, Enums: []string{"READY", "PENDING", "ERROR", "UNKNOWN"}}, + {Name: "status_message", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "environment", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "namespace", Type: field.TypeString, Size: 2147483647}, + {Name: "name", Type: field.TypeString, Size: 2147483647}, + {Name: "event_type", Type: field.TypeString, Size: 2147483647}, + {Name: "delivery_type", Type: field.TypeEnum, Enums: []string{"CALLBACK", "SERVER_SENT_EVENT"}, Default: "CALLBACK"}, + {Name: "callback_url", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "application_subscribed_events", Type: field.TypeInt}, + {Name: "event_subscription_target", Type: field.TypeInt, Nullable: true}, + } + // EventSubscriptionsTable holds the schema information for the "event_subscriptions" table. + EventSubscriptionsTable = &schema.Table{ + Name: "event_subscriptions", + Columns: EventSubscriptionsColumns, + PrimaryKey: []*schema.Column{EventSubscriptionsColumns[0]}, + ForeignKeys: []*schema.ForeignKey{ + { + Symbol: "event_subscriptions_applications_subscribed_events", + Columns: []*schema.Column{EventSubscriptionsColumns[11]}, + RefColumns: []*schema.Column{ApplicationsColumns[0]}, + OnDelete: schema.NoAction, + }, + { + Symbol: "event_subscriptions_event_exposures_target", + Columns: []*schema.Column{EventSubscriptionsColumns[12]}, + RefColumns: []*schema.Column{EventExposuresColumns[0]}, + OnDelete: schema.SetNull, + }, + }, + Indexes: []*schema.Index{ + { + Name: "eventsubscription_namespace_name", + Unique: true, + Columns: []*schema.Column{EventSubscriptionsColumns[6], EventSubscriptionsColumns[7]}, + }, + { + Name: "eventsubscription_event_type_application_subscribed_events", + Unique: true, + Columns: []*schema.Column{EventSubscriptionsColumns[8], EventSubscriptionsColumns[11]}, + }, + }, + } // GroupsColumns holds the columns for the "groups" table. GroupsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, @@ -285,7 +386,7 @@ var ( {Name: "name", Type: field.TypeString, Unique: true, Size: 2147483647}, {Name: "email", Type: field.TypeString, Size: 2147483647}, {Name: "category", Type: field.TypeEnum, Enums: []string{"CUSTOMER", "INFRASTRUCTURE"}, Default: "CUSTOMER"}, - {Name: "rover_token_ref", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "team_token", Type: field.TypeString, Nullable: true, Size: 2147483647}, {Name: "group_teams", Type: field.TypeInt, Nullable: true}, } // TeamsTable holds the schema information for the "teams" table. @@ -308,6 +409,7 @@ var ( {Name: "environment", Type: field.TypeString, Nullable: true, Size: 2147483647}, {Name: "name", Type: field.TypeString, Unique: true, Size: 2147483647}, {Name: "gateway_url", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "issuer_url", Type: field.TypeString, Nullable: true, Size: 2147483647}, {Name: "visibility", Type: field.TypeEnum, Enums: []string{"WORLD", "ENTERPRISE"}, Default: "ENTERPRISE"}, {Name: "api_subscription_failover_zones", Type: field.TypeInt, Nullable: true}, } @@ -319,7 +421,7 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "zones_api_subscriptions_failover_zones", - Columns: []*schema.Column{ZonesColumns[5]}, + Columns: []*schema.Column{ZonesColumns[6]}, RefColumns: []*schema.Column{APISubscriptionsColumns[0]}, OnDelete: schema.SetNull, }, @@ -332,6 +434,8 @@ var ( ApplicationsTable, ApprovalsTable, ApprovalRequestsTable, + EventExposuresTable, + EventSubscriptionsTable, GroupsTable, MembersTable, TeamsTable, @@ -346,7 +450,12 @@ func init() { ApplicationsTable.ForeignKeys[0].RefTable = TeamsTable ApplicationsTable.ForeignKeys[1].RefTable = ZonesTable ApprovalsTable.ForeignKeys[0].RefTable = APISubscriptionsTable + ApprovalsTable.ForeignKeys[1].RefTable = EventSubscriptionsTable ApprovalRequestsTable.ForeignKeys[0].RefTable = APISubscriptionsTable + ApprovalRequestsTable.ForeignKeys[1].RefTable = EventSubscriptionsTable + EventExposuresTable.ForeignKeys[0].RefTable = ApplicationsTable + EventSubscriptionsTable.ForeignKeys[0].RefTable = ApplicationsTable + EventSubscriptionsTable.ForeignKeys[1].RefTable = EventExposuresTable MembersTable.ForeignKeys[0].RefTable = TeamsTable TeamsTable.ForeignKeys[0].RefTable = GroupsTable ZonesTable.ForeignKeys[0].RefTable = APISubscriptionsTable diff --git a/controlplane-api/ent/mutation.go b/controlplane-api/ent/mutation.go index 15922e19c..c6ae324a6 100644 --- a/controlplane-api/ent/mutation.go +++ b/controlplane-api/ent/mutation.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -20,6 +19,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/predicate" @@ -37,15 +38,17 @@ const ( OpUpdateOne = ent.OpUpdateOne // Node types. - TypeApiExposure = "ApiExposure" - TypeApiSubscription = "ApiSubscription" - TypeApplication = "Application" - TypeApproval = "Approval" - TypeApprovalRequest = "ApprovalRequest" - TypeGroup = "Group" - TypeMember = "Member" - TypeTeam = "Team" - TypeZone = "Zone" + TypeApiExposure = "ApiExposure" + TypeApiSubscription = "ApiSubscription" + TypeApplication = "Application" + TypeApproval = "Approval" + TypeApprovalRequest = "ApprovalRequest" + TypeEventExposure = "EventExposure" + TypeEventSubscription = "EventSubscription" + TypeGroup = "Group" + TypeMember = "Member" + TypeTeam = "Team" + TypeZone = "Zone" ) // ApiExposureMutation represents an operation that mutates the ApiExposure nodes in the graph. @@ -2548,33 +2551,43 @@ func (m *ApiSubscriptionMutation) ResetEdge(name string) error { // ApplicationMutation represents an operation that mutates the Application nodes in the graph. type ApplicationMutation struct { config - op Op - typ string - id *int - created_at *time.Time - last_modified_at *time.Time - status_phase *application.StatusPhase - status_message *string - environment *string - namespace *string - name *string - client_id *string - client_secret *string - issuer_url *string - clearedFields map[string]struct{} - zone *int - clearedzone bool - owner_team *int - clearedowner_team bool - exposed_apis map[int]struct{} - removedexposed_apis map[int]struct{} - clearedexposed_apis bool - subscribed_apis map[int]struct{} - removedsubscribed_apis map[int]struct{} - clearedsubscribed_apis bool - done bool - oldValue func(context.Context) (*Application, error) - predicates []predicate.Application + op Op + typ string + id *int + created_at *time.Time + last_modified_at *time.Time + status_phase *application.StatusPhase + status_message *string + environment *string + namespace *string + name *string + client_id *string + client_secret *string + rotated_client_secret *string + rotated_expires_at *time.Time + current_expires_at *time.Time + secret_rotation_phase *application.SecretRotationPhase + secret_rotation_message *string + clearedFields map[string]struct{} + zone *int + clearedzone bool + owner_team *int + clearedowner_team bool + exposed_apis map[int]struct{} + removedexposed_apis map[int]struct{} + clearedexposed_apis bool + subscribed_apis map[int]struct{} + removedsubscribed_apis map[int]struct{} + clearedsubscribed_apis bool + exposed_events map[int]struct{} + removedexposed_events map[int]struct{} + clearedexposed_events bool + subscribed_events map[int]struct{} + removedsubscribed_events map[int]struct{} + clearedsubscribed_events bool + done bool + oldValue func(context.Context) (*Application, error) + predicates []predicate.Application } var _ ent.Mutation = (*ApplicationMutation)(nil) @@ -3064,53 +3077,236 @@ func (m *ApplicationMutation) ResetClientSecret() { delete(m.clearedFields, application.FieldClientSecret) } -// SetIssuerURL sets the "issuer_url" field. -func (m *ApplicationMutation) SetIssuerURL(s string) { - m.issuer_url = &s +// SetRotatedClientSecret sets the "rotated_client_secret" field. +func (m *ApplicationMutation) SetRotatedClientSecret(s string) { + m.rotated_client_secret = &s } -// IssuerURL returns the value of the "issuer_url" field in the mutation. -func (m *ApplicationMutation) IssuerURL() (r string, exists bool) { - v := m.issuer_url +// RotatedClientSecret returns the value of the "rotated_client_secret" field in the mutation. +func (m *ApplicationMutation) RotatedClientSecret() (r string, exists bool) { + v := m.rotated_client_secret if v == nil { return } return *v, true } -// OldIssuerURL returns the old "issuer_url" field's value of the Application entity. +// OldRotatedClientSecret returns the old "rotated_client_secret" field's value of the Application entity. // If the Application object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *ApplicationMutation) OldIssuerURL(ctx context.Context) (v *string, err error) { +func (m *ApplicationMutation) OldRotatedClientSecret(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldIssuerURL is only allowed on UpdateOne operations") + return v, errors.New("OldRotatedClientSecret is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldIssuerURL requires an ID field in the mutation") + return v, errors.New("OldRotatedClientSecret requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldIssuerURL: %w", err) + return v, fmt.Errorf("querying old value for OldRotatedClientSecret: %w", err) } - return oldValue.IssuerURL, nil + return oldValue.RotatedClientSecret, nil } -// ClearIssuerURL clears the value of the "issuer_url" field. -func (m *ApplicationMutation) ClearIssuerURL() { - m.issuer_url = nil - m.clearedFields[application.FieldIssuerURL] = struct{}{} +// ClearRotatedClientSecret clears the value of the "rotated_client_secret" field. +func (m *ApplicationMutation) ClearRotatedClientSecret() { + m.rotated_client_secret = nil + m.clearedFields[application.FieldRotatedClientSecret] = struct{}{} } -// IssuerURLCleared returns if the "issuer_url" field was cleared in this mutation. -func (m *ApplicationMutation) IssuerURLCleared() bool { - _, ok := m.clearedFields[application.FieldIssuerURL] +// RotatedClientSecretCleared returns if the "rotated_client_secret" field was cleared in this mutation. +func (m *ApplicationMutation) RotatedClientSecretCleared() bool { + _, ok := m.clearedFields[application.FieldRotatedClientSecret] return ok } -// ResetIssuerURL resets all changes to the "issuer_url" field. -func (m *ApplicationMutation) ResetIssuerURL() { - m.issuer_url = nil - delete(m.clearedFields, application.FieldIssuerURL) +// ResetRotatedClientSecret resets all changes to the "rotated_client_secret" field. +func (m *ApplicationMutation) ResetRotatedClientSecret() { + m.rotated_client_secret = nil + delete(m.clearedFields, application.FieldRotatedClientSecret) +} + +// SetRotatedExpiresAt sets the "rotated_expires_at" field. +func (m *ApplicationMutation) SetRotatedExpiresAt(t time.Time) { + m.rotated_expires_at = &t +} + +// RotatedExpiresAt returns the value of the "rotated_expires_at" field in the mutation. +func (m *ApplicationMutation) RotatedExpiresAt() (r time.Time, exists bool) { + v := m.rotated_expires_at + if v == nil { + return + } + return *v, true +} + +// OldRotatedExpiresAt returns the old "rotated_expires_at" field's value of the Application entity. +// If the Application object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *ApplicationMutation) OldRotatedExpiresAt(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldRotatedExpiresAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldRotatedExpiresAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldRotatedExpiresAt: %w", err) + } + return oldValue.RotatedExpiresAt, nil +} + +// ClearRotatedExpiresAt clears the value of the "rotated_expires_at" field. +func (m *ApplicationMutation) ClearRotatedExpiresAt() { + m.rotated_expires_at = nil + m.clearedFields[application.FieldRotatedExpiresAt] = struct{}{} +} + +// RotatedExpiresAtCleared returns if the "rotated_expires_at" field was cleared in this mutation. +func (m *ApplicationMutation) RotatedExpiresAtCleared() bool { + _, ok := m.clearedFields[application.FieldRotatedExpiresAt] + return ok +} + +// ResetRotatedExpiresAt resets all changes to the "rotated_expires_at" field. +func (m *ApplicationMutation) ResetRotatedExpiresAt() { + m.rotated_expires_at = nil + delete(m.clearedFields, application.FieldRotatedExpiresAt) +} + +// SetCurrentExpiresAt sets the "current_expires_at" field. +func (m *ApplicationMutation) SetCurrentExpiresAt(t time.Time) { + m.current_expires_at = &t +} + +// CurrentExpiresAt returns the value of the "current_expires_at" field in the mutation. +func (m *ApplicationMutation) CurrentExpiresAt() (r time.Time, exists bool) { + v := m.current_expires_at + if v == nil { + return + } + return *v, true +} + +// OldCurrentExpiresAt returns the old "current_expires_at" field's value of the Application entity. +// If the Application object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *ApplicationMutation) OldCurrentExpiresAt(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCurrentExpiresAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCurrentExpiresAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCurrentExpiresAt: %w", err) + } + return oldValue.CurrentExpiresAt, nil +} + +// ClearCurrentExpiresAt clears the value of the "current_expires_at" field. +func (m *ApplicationMutation) ClearCurrentExpiresAt() { + m.current_expires_at = nil + m.clearedFields[application.FieldCurrentExpiresAt] = struct{}{} +} + +// CurrentExpiresAtCleared returns if the "current_expires_at" field was cleared in this mutation. +func (m *ApplicationMutation) CurrentExpiresAtCleared() bool { + _, ok := m.clearedFields[application.FieldCurrentExpiresAt] + return ok +} + +// ResetCurrentExpiresAt resets all changes to the "current_expires_at" field. +func (m *ApplicationMutation) ResetCurrentExpiresAt() { + m.current_expires_at = nil + delete(m.clearedFields, application.FieldCurrentExpiresAt) +} + +// SetSecretRotationPhase sets the "secret_rotation_phase" field. +func (m *ApplicationMutation) SetSecretRotationPhase(arp application.SecretRotationPhase) { + m.secret_rotation_phase = &arp +} + +// SecretRotationPhase returns the value of the "secret_rotation_phase" field in the mutation. +func (m *ApplicationMutation) SecretRotationPhase() (r application.SecretRotationPhase, exists bool) { + v := m.secret_rotation_phase + if v == nil { + return + } + return *v, true +} + +// OldSecretRotationPhase returns the old "secret_rotation_phase" field's value of the Application entity. +// If the Application object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *ApplicationMutation) OldSecretRotationPhase(ctx context.Context) (v application.SecretRotationPhase, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldSecretRotationPhase is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldSecretRotationPhase requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldSecretRotationPhase: %w", err) + } + return oldValue.SecretRotationPhase, nil +} + +// ResetSecretRotationPhase resets all changes to the "secret_rotation_phase" field. +func (m *ApplicationMutation) ResetSecretRotationPhase() { + m.secret_rotation_phase = nil +} + +// SetSecretRotationMessage sets the "secret_rotation_message" field. +func (m *ApplicationMutation) SetSecretRotationMessage(s string) { + m.secret_rotation_message = &s +} + +// SecretRotationMessage returns the value of the "secret_rotation_message" field in the mutation. +func (m *ApplicationMutation) SecretRotationMessage() (r string, exists bool) { + v := m.secret_rotation_message + if v == nil { + return + } + return *v, true +} + +// OldSecretRotationMessage returns the old "secret_rotation_message" field's value of the Application entity. +// If the Application object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *ApplicationMutation) OldSecretRotationMessage(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldSecretRotationMessage is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldSecretRotationMessage requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldSecretRotationMessage: %w", err) + } + return oldValue.SecretRotationMessage, nil +} + +// ClearSecretRotationMessage clears the value of the "secret_rotation_message" field. +func (m *ApplicationMutation) ClearSecretRotationMessage() { + m.secret_rotation_message = nil + m.clearedFields[application.FieldSecretRotationMessage] = struct{}{} +} + +// SecretRotationMessageCleared returns if the "secret_rotation_message" field was cleared in this mutation. +func (m *ApplicationMutation) SecretRotationMessageCleared() bool { + _, ok := m.clearedFields[application.FieldSecretRotationMessage] + return ok +} + +// ResetSecretRotationMessage resets all changes to the "secret_rotation_message" field. +func (m *ApplicationMutation) ResetSecretRotationMessage() { + m.secret_rotation_message = nil + delete(m.clearedFields, application.FieldSecretRotationMessage) } // SetZoneID sets the "zone" edge to the Zone entity by id. @@ -3299,6 +3495,114 @@ func (m *ApplicationMutation) ResetSubscribedApis() { m.removedsubscribed_apis = nil } +// AddExposedEventIDs adds the "exposed_events" edge to the EventExposure entity by ids. +func (m *ApplicationMutation) AddExposedEventIDs(ids ...int) { + if m.exposed_events == nil { + m.exposed_events = make(map[int]struct{}) + } + for i := range ids { + m.exposed_events[ids[i]] = struct{}{} + } +} + +// ClearExposedEvents clears the "exposed_events" edge to the EventExposure entity. +func (m *ApplicationMutation) ClearExposedEvents() { + m.clearedexposed_events = true +} + +// ExposedEventsCleared reports if the "exposed_events" edge to the EventExposure entity was cleared. +func (m *ApplicationMutation) ExposedEventsCleared() bool { + return m.clearedexposed_events +} + +// RemoveExposedEventIDs removes the "exposed_events" edge to the EventExposure entity by IDs. +func (m *ApplicationMutation) RemoveExposedEventIDs(ids ...int) { + if m.removedexposed_events == nil { + m.removedexposed_events = make(map[int]struct{}) + } + for i := range ids { + delete(m.exposed_events, ids[i]) + m.removedexposed_events[ids[i]] = struct{}{} + } +} + +// RemovedExposedEvents returns the removed IDs of the "exposed_events" edge to the EventExposure entity. +func (m *ApplicationMutation) RemovedExposedEventsIDs() (ids []int) { + for id := range m.removedexposed_events { + ids = append(ids, id) + } + return +} + +// ExposedEventsIDs returns the "exposed_events" edge IDs in the mutation. +func (m *ApplicationMutation) ExposedEventsIDs() (ids []int) { + for id := range m.exposed_events { + ids = append(ids, id) + } + return +} + +// ResetExposedEvents resets all changes to the "exposed_events" edge. +func (m *ApplicationMutation) ResetExposedEvents() { + m.exposed_events = nil + m.clearedexposed_events = false + m.removedexposed_events = nil +} + +// AddSubscribedEventIDs adds the "subscribed_events" edge to the EventSubscription entity by ids. +func (m *ApplicationMutation) AddSubscribedEventIDs(ids ...int) { + if m.subscribed_events == nil { + m.subscribed_events = make(map[int]struct{}) + } + for i := range ids { + m.subscribed_events[ids[i]] = struct{}{} + } +} + +// ClearSubscribedEvents clears the "subscribed_events" edge to the EventSubscription entity. +func (m *ApplicationMutation) ClearSubscribedEvents() { + m.clearedsubscribed_events = true +} + +// SubscribedEventsCleared reports if the "subscribed_events" edge to the EventSubscription entity was cleared. +func (m *ApplicationMutation) SubscribedEventsCleared() bool { + return m.clearedsubscribed_events +} + +// RemoveSubscribedEventIDs removes the "subscribed_events" edge to the EventSubscription entity by IDs. +func (m *ApplicationMutation) RemoveSubscribedEventIDs(ids ...int) { + if m.removedsubscribed_events == nil { + m.removedsubscribed_events = make(map[int]struct{}) + } + for i := range ids { + delete(m.subscribed_events, ids[i]) + m.removedsubscribed_events[ids[i]] = struct{}{} + } +} + +// RemovedSubscribedEvents returns the removed IDs of the "subscribed_events" edge to the EventSubscription entity. +func (m *ApplicationMutation) RemovedSubscribedEventsIDs() (ids []int) { + for id := range m.removedsubscribed_events { + ids = append(ids, id) + } + return +} + +// SubscribedEventsIDs returns the "subscribed_events" edge IDs in the mutation. +func (m *ApplicationMutation) SubscribedEventsIDs() (ids []int) { + for id := range m.subscribed_events { + ids = append(ids, id) + } + return +} + +// ResetSubscribedEvents resets all changes to the "subscribed_events" edge. +func (m *ApplicationMutation) ResetSubscribedEvents() { + m.subscribed_events = nil + m.clearedsubscribed_events = false + m.removedsubscribed_events = nil +} + // Where appends a list predicates to the ApplicationMutation builder. func (m *ApplicationMutation) Where(ps ...predicate.Application) { m.predicates = append(m.predicates, ps...) @@ -3333,7 +3637,7 @@ func (m *ApplicationMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *ApplicationMutation) Fields() []string { - fields := make([]string, 0, 10) + fields := make([]string, 0, 14) if m.created_at != nil { fields = append(fields, application.FieldCreatedAt) } @@ -3361,8 +3665,20 @@ func (m *ApplicationMutation) Fields() []string { if m.client_secret != nil { fields = append(fields, application.FieldClientSecret) } - if m.issuer_url != nil { - fields = append(fields, application.FieldIssuerURL) + if m.rotated_client_secret != nil { + fields = append(fields, application.FieldRotatedClientSecret) + } + if m.rotated_expires_at != nil { + fields = append(fields, application.FieldRotatedExpiresAt) + } + if m.current_expires_at != nil { + fields = append(fields, application.FieldCurrentExpiresAt) + } + if m.secret_rotation_phase != nil { + fields = append(fields, application.FieldSecretRotationPhase) + } + if m.secret_rotation_message != nil { + fields = append(fields, application.FieldSecretRotationMessage) } return fields } @@ -3390,8 +3706,16 @@ func (m *ApplicationMutation) Field(name string) (ent.Value, bool) { return m.ClientID() case application.FieldClientSecret: return m.ClientSecret() - case application.FieldIssuerURL: - return m.IssuerURL() + case application.FieldRotatedClientSecret: + return m.RotatedClientSecret() + case application.FieldRotatedExpiresAt: + return m.RotatedExpiresAt() + case application.FieldCurrentExpiresAt: + return m.CurrentExpiresAt() + case application.FieldSecretRotationPhase: + return m.SecretRotationPhase() + case application.FieldSecretRotationMessage: + return m.SecretRotationMessage() } return nil, false } @@ -3419,8 +3743,16 @@ func (m *ApplicationMutation) OldField(ctx context.Context, name string) (ent.Va return m.OldClientID(ctx) case application.FieldClientSecret: return m.OldClientSecret(ctx) - case application.FieldIssuerURL: - return m.OldIssuerURL(ctx) + case application.FieldRotatedClientSecret: + return m.OldRotatedClientSecret(ctx) + case application.FieldRotatedExpiresAt: + return m.OldRotatedExpiresAt(ctx) + case application.FieldCurrentExpiresAt: + return m.OldCurrentExpiresAt(ctx) + case application.FieldSecretRotationPhase: + return m.OldSecretRotationPhase(ctx) + case application.FieldSecretRotationMessage: + return m.OldSecretRotationMessage(ctx) } return nil, fmt.Errorf("unknown Application field %s", name) } @@ -3493,12 +3825,40 @@ func (m *ApplicationMutation) SetField(name string, value ent.Value) error { } m.SetClientSecret(v) return nil - case application.FieldIssuerURL: + case application.FieldRotatedClientSecret: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetIssuerURL(v) + m.SetRotatedClientSecret(v) + return nil + case application.FieldRotatedExpiresAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetRotatedExpiresAt(v) + return nil + case application.FieldCurrentExpiresAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCurrentExpiresAt(v) + return nil + case application.FieldSecretRotationPhase: + v, ok := value.(application.SecretRotationPhase) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSecretRotationPhase(v) + return nil + case application.FieldSecretRotationMessage: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSecretRotationMessage(v) return nil } return fmt.Errorf("unknown Application field %s", name) @@ -3545,8 +3905,17 @@ func (m *ApplicationMutation) ClearedFields() []string { if m.FieldCleared(application.FieldClientSecret) { fields = append(fields, application.FieldClientSecret) } - if m.FieldCleared(application.FieldIssuerURL) { - fields = append(fields, application.FieldIssuerURL) + if m.FieldCleared(application.FieldRotatedClientSecret) { + fields = append(fields, application.FieldRotatedClientSecret) + } + if m.FieldCleared(application.FieldRotatedExpiresAt) { + fields = append(fields, application.FieldRotatedExpiresAt) + } + if m.FieldCleared(application.FieldCurrentExpiresAt) { + fields = append(fields, application.FieldCurrentExpiresAt) + } + if m.FieldCleared(application.FieldSecretRotationMessage) { + fields = append(fields, application.FieldSecretRotationMessage) } return fields } @@ -3577,8 +3946,17 @@ func (m *ApplicationMutation) ClearField(name string) error { case application.FieldClientSecret: m.ClearClientSecret() return nil - case application.FieldIssuerURL: - m.ClearIssuerURL() + case application.FieldRotatedClientSecret: + m.ClearRotatedClientSecret() + return nil + case application.FieldRotatedExpiresAt: + m.ClearRotatedExpiresAt() + return nil + case application.FieldCurrentExpiresAt: + m.ClearCurrentExpiresAt() + return nil + case application.FieldSecretRotationMessage: + m.ClearSecretRotationMessage() return nil } return fmt.Errorf("unknown Application nullable field %s", name) @@ -3615,8 +3993,20 @@ func (m *ApplicationMutation) ResetField(name string) error { case application.FieldClientSecret: m.ResetClientSecret() return nil - case application.FieldIssuerURL: - m.ResetIssuerURL() + case application.FieldRotatedClientSecret: + m.ResetRotatedClientSecret() + return nil + case application.FieldRotatedExpiresAt: + m.ResetRotatedExpiresAt() + return nil + case application.FieldCurrentExpiresAt: + m.ResetCurrentExpiresAt() + return nil + case application.FieldSecretRotationPhase: + m.ResetSecretRotationPhase() + return nil + case application.FieldSecretRotationMessage: + m.ResetSecretRotationMessage() return nil } return fmt.Errorf("unknown Application field %s", name) @@ -3624,7 +4014,7 @@ func (m *ApplicationMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this mutation. func (m *ApplicationMutation) AddedEdges() []string { - edges := make([]string, 0, 4) + edges := make([]string, 0, 6) if m.zone != nil { edges = append(edges, application.EdgeZone) } @@ -3637,6 +4027,12 @@ func (m *ApplicationMutation) AddedEdges() []string { if m.subscribed_apis != nil { edges = append(edges, application.EdgeSubscribedApis) } + if m.exposed_events != nil { + edges = append(edges, application.EdgeExposedEvents) + } + if m.subscribed_events != nil { + edges = append(edges, application.EdgeSubscribedEvents) + } return edges } @@ -3664,19 +4060,37 @@ func (m *ApplicationMutation) AddedIDs(name string) []ent.Value { ids = append(ids, id) } return ids + case application.EdgeExposedEvents: + ids := make([]ent.Value, 0, len(m.exposed_events)) + for id := range m.exposed_events { + ids = append(ids, id) + } + return ids + case application.EdgeSubscribedEvents: + ids := make([]ent.Value, 0, len(m.subscribed_events)) + for id := range m.subscribed_events { + ids = append(ids, id) + } + return ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *ApplicationMutation) RemovedEdges() []string { - edges := make([]string, 0, 4) + edges := make([]string, 0, 6) if m.removedexposed_apis != nil { edges = append(edges, application.EdgeExposedApis) } if m.removedsubscribed_apis != nil { edges = append(edges, application.EdgeSubscribedApis) } + if m.removedexposed_events != nil { + edges = append(edges, application.EdgeExposedEvents) + } + if m.removedsubscribed_events != nil { + edges = append(edges, application.EdgeSubscribedEvents) + } return edges } @@ -3696,13 +4110,25 @@ func (m *ApplicationMutation) RemovedIDs(name string) []ent.Value { ids = append(ids, id) } return ids + case application.EdgeExposedEvents: + ids := make([]ent.Value, 0, len(m.removedexposed_events)) + for id := range m.removedexposed_events { + ids = append(ids, id) + } + return ids + case application.EdgeSubscribedEvents: + ids := make([]ent.Value, 0, len(m.removedsubscribed_events)) + for id := range m.removedsubscribed_events { + ids = append(ids, id) + } + return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *ApplicationMutation) ClearedEdges() []string { - edges := make([]string, 0, 4) + edges := make([]string, 0, 6) if m.clearedzone { edges = append(edges, application.EdgeZone) } @@ -3715,6 +4141,12 @@ func (m *ApplicationMutation) ClearedEdges() []string { if m.clearedsubscribed_apis { edges = append(edges, application.EdgeSubscribedApis) } + if m.clearedexposed_events { + edges = append(edges, application.EdgeExposedEvents) + } + if m.clearedsubscribed_events { + edges = append(edges, application.EdgeSubscribedEvents) + } return edges } @@ -3730,6 +4162,10 @@ func (m *ApplicationMutation) EdgeCleared(name string) bool { return m.clearedexposed_apis case application.EdgeSubscribedApis: return m.clearedsubscribed_apis + case application.EdgeExposedEvents: + return m.clearedexposed_events + case application.EdgeSubscribedEvents: + return m.clearedsubscribed_events } return false } @@ -3764,6 +4200,12 @@ func (m *ApplicationMutation) ResetEdge(name string) error { case application.EdgeSubscribedApis: m.ResetSubscribedApis() return nil + case application.EdgeExposedEvents: + m.ResetExposedEvents() + return nil + case application.EdgeSubscribedEvents: + m.ResetSubscribedEvents() + return nil } return fmt.Errorf("unknown Application edge %s", name) } @@ -3794,6 +4236,8 @@ type ApprovalMutation struct { clearedFields map[string]struct{} api_subscription *int clearedapi_subscription bool + event_subscription *int + clearedevent_subscription bool done bool oldValue func(context.Context) (*Approval, error) predicates []predicate.Approval @@ -4559,29 +5003,68 @@ func (m *ApprovalMutation) ResetAPISubscription() { m.clearedapi_subscription = false } -// Where appends a list predicates to the ApprovalMutation builder. -func (m *ApprovalMutation) Where(ps ...predicate.Approval) { - m.predicates = append(m.predicates, ps...) +// SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by id. +func (m *ApprovalMutation) SetEventSubscriptionID(id int) { + m.event_subscription = &id } -// WhereP appends storage-level predicates to the ApprovalMutation builder. Using this method, -// users can use type-assertion to append predicates that do not depend on any generated package. -func (m *ApprovalMutation) WhereP(ps ...func(*sql.Selector)) { - p := make([]predicate.Approval, len(ps)) - for i := range ps { - p[i] = ps[i] - } - m.Where(p...) +// ClearEventSubscription clears the "event_subscription" edge to the EventSubscription entity. +func (m *ApprovalMutation) ClearEventSubscription() { + m.clearedevent_subscription = true } -// Op returns the operation name. -func (m *ApprovalMutation) Op() Op { - return m.op +// EventSubscriptionCleared reports if the "event_subscription" edge to the EventSubscription entity was cleared. +func (m *ApprovalMutation) EventSubscriptionCleared() bool { + return m.clearedevent_subscription } -// SetOp allows setting the mutation operation. -func (m *ApprovalMutation) SetOp(op Op) { - m.op = op +// EventSubscriptionID returns the "event_subscription" edge ID in the mutation. +func (m *ApprovalMutation) EventSubscriptionID() (id int, exists bool) { + if m.event_subscription != nil { + return *m.event_subscription, true + } + return +} + +// EventSubscriptionIDs returns the "event_subscription" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// EventSubscriptionID instead. It exists only for internal usage by the builders. +func (m *ApprovalMutation) EventSubscriptionIDs() (ids []int) { + if id := m.event_subscription; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetEventSubscription resets all changes to the "event_subscription" edge. +func (m *ApprovalMutation) ResetEventSubscription() { + m.event_subscription = nil + m.clearedevent_subscription = false +} + +// Where appends a list predicates to the ApprovalMutation builder. +func (m *ApprovalMutation) Where(ps ...predicate.Approval) { + m.predicates = append(m.predicates, ps...) +} + +// WhereP appends storage-level predicates to the ApprovalMutation builder. Using this method, +// users can use type-assertion to append predicates that do not depend on any generated package. +func (m *ApprovalMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.Approval, len(ps)) + for i := range ps { + p[i] = ps[i] + } + m.Where(p...) +} + +// Op returns the operation name. +func (m *ApprovalMutation) Op() Op { + return m.op +} + +// SetOp allows setting the mutation operation. +func (m *ApprovalMutation) SetOp(op Op) { + m.op = op } // Type returns the node type of this mutation (Approval). @@ -4957,10 +5440,13 @@ func (m *ApprovalMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this mutation. func (m *ApprovalMutation) AddedEdges() []string { - edges := make([]string, 0, 1) + edges := make([]string, 0, 2) if m.api_subscription != nil { edges = append(edges, approval.EdgeAPISubscription) } + if m.event_subscription != nil { + edges = append(edges, approval.EdgeEventSubscription) + } return edges } @@ -4972,13 +5458,17 @@ func (m *ApprovalMutation) AddedIDs(name string) []ent.Value { if id := m.api_subscription; id != nil { return []ent.Value{*id} } + case approval.EdgeEventSubscription: + if id := m.event_subscription; id != nil { + return []ent.Value{*id} + } } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *ApprovalMutation) RemovedEdges() []string { - edges := make([]string, 0, 1) + edges := make([]string, 0, 2) return edges } @@ -4990,10 +5480,13 @@ func (m *ApprovalMutation) RemovedIDs(name string) []ent.Value { // ClearedEdges returns all edge names that were cleared in this mutation. func (m *ApprovalMutation) ClearedEdges() []string { - edges := make([]string, 0, 1) + edges := make([]string, 0, 2) if m.clearedapi_subscription { edges = append(edges, approval.EdgeAPISubscription) } + if m.clearedevent_subscription { + edges = append(edges, approval.EdgeEventSubscription) + } return edges } @@ -5003,6 +5496,8 @@ func (m *ApprovalMutation) EdgeCleared(name string) bool { switch name { case approval.EdgeAPISubscription: return m.clearedapi_subscription + case approval.EdgeEventSubscription: + return m.clearedevent_subscription } return false } @@ -5014,6 +5509,9 @@ func (m *ApprovalMutation) ClearEdge(name string) error { case approval.EdgeAPISubscription: m.ClearAPISubscription() return nil + case approval.EdgeEventSubscription: + m.ClearEventSubscription() + return nil } return fmt.Errorf("unknown Approval unique edge %s", name) } @@ -5025,6 +5523,9 @@ func (m *ApprovalMutation) ResetEdge(name string) error { case approval.EdgeAPISubscription: m.ResetAPISubscription() return nil + case approval.EdgeEventSubscription: + m.ResetEventSubscription() + return nil } return fmt.Errorf("unknown Approval edge %s", name) } @@ -5055,6 +5556,8 @@ type ApprovalRequestMutation struct { clearedFields map[string]struct{} api_subscription *int clearedapi_subscription bool + event_subscription *int + clearedevent_subscription bool done bool oldValue func(context.Context) (*ApprovalRequest, error) predicates []predicate.ApprovalRequest @@ -5820,6 +6323,45 @@ func (m *ApprovalRequestMutation) ResetAPISubscription() { m.clearedapi_subscription = false } +// SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by id. +func (m *ApprovalRequestMutation) SetEventSubscriptionID(id int) { + m.event_subscription = &id +} + +// ClearEventSubscription clears the "event_subscription" edge to the EventSubscription entity. +func (m *ApprovalRequestMutation) ClearEventSubscription() { + m.clearedevent_subscription = true +} + +// EventSubscriptionCleared reports if the "event_subscription" edge to the EventSubscription entity was cleared. +func (m *ApprovalRequestMutation) EventSubscriptionCleared() bool { + return m.clearedevent_subscription +} + +// EventSubscriptionID returns the "event_subscription" edge ID in the mutation. +func (m *ApprovalRequestMutation) EventSubscriptionID() (id int, exists bool) { + if m.event_subscription != nil { + return *m.event_subscription, true + } + return +} + +// EventSubscriptionIDs returns the "event_subscription" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// EventSubscriptionID instead. It exists only for internal usage by the builders. +func (m *ApprovalRequestMutation) EventSubscriptionIDs() (ids []int) { + if id := m.event_subscription; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetEventSubscription resets all changes to the "event_subscription" edge. +func (m *ApprovalRequestMutation) ResetEventSubscription() { + m.event_subscription = nil + m.clearedevent_subscription = false +} + // Where appends a list predicates to the ApprovalRequestMutation builder. func (m *ApprovalRequestMutation) Where(ps ...predicate.ApprovalRequest) { m.predicates = append(m.predicates, ps...) @@ -5975,319 +6517,2541 @@ func (m *ApprovalRequestMutation) OldField(ctx context.Context, name string) (en return m.OldAvailableTransitions(ctx) case approvalrequest.FieldName: return m.OldName(ctx) - case approvalrequest.FieldState: - return m.OldState(ctx) + case approvalrequest.FieldState: + return m.OldState(ctx) + } + return nil, fmt.Errorf("unknown ApprovalRequest field %s", name) +} + +// SetField sets the value of a field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *ApprovalRequestMutation) SetField(name string, value ent.Value) error { + switch name { + case approvalrequest.FieldCreatedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedAt(v) + return nil + case approvalrequest.FieldLastModifiedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetLastModifiedAt(v) + return nil + case approvalrequest.FieldStatusPhase: + v, ok := value.(approvalrequest.StatusPhase) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatusPhase(v) + return nil + case approvalrequest.FieldStatusMessage: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatusMessage(v) + return nil + case approvalrequest.FieldEnvironment: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetEnvironment(v) + return nil + case approvalrequest.FieldNamespace: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetNamespace(v) + return nil + case approvalrequest.FieldAction: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetAction(v) + return nil + case approvalrequest.FieldStrategy: + v, ok := value.(approvalrequest.Strategy) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStrategy(v) + return nil + case approvalrequest.FieldRequester: + v, ok := value.(model.RequesterInfo) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetRequester(v) + return nil + case approvalrequest.FieldDecider: + v, ok := value.(model.DeciderInfo) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetDecider(v) + return nil + case approvalrequest.FieldDeciderTeamName: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetDeciderTeamName(v) + return nil + case approvalrequest.FieldDecisions: + v, ok := value.([]model.Decision) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetDecisions(v) + return nil + case approvalrequest.FieldAvailableTransitions: + v, ok := value.([]model.AvailableTransition) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetAvailableTransitions(v) + return nil + case approvalrequest.FieldName: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetName(v) + return nil + case approvalrequest.FieldState: + v, ok := value.(approvalrequest.State) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetState(v) + return nil + } + return fmt.Errorf("unknown ApprovalRequest field %s", name) +} + +// AddedFields returns all numeric fields that were incremented/decremented during +// this mutation. +func (m *ApprovalRequestMutation) AddedFields() []string { + return nil +} + +// AddedField returns the numeric value that was incremented/decremented on a field +// with the given name. The second boolean return value indicates that this field +// was not set, or was not defined in the schema. +func (m *ApprovalRequestMutation) AddedField(name string) (ent.Value, bool) { + return nil, false +} + +// AddField adds the value to the field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *ApprovalRequestMutation) AddField(name string, value ent.Value) error { + switch name { + } + return fmt.Errorf("unknown ApprovalRequest numeric field %s", name) +} + +// ClearedFields returns all nullable fields that were cleared during this +// mutation. +func (m *ApprovalRequestMutation) ClearedFields() []string { + var fields []string + if m.FieldCleared(approvalrequest.FieldStatusPhase) { + fields = append(fields, approvalrequest.FieldStatusPhase) + } + if m.FieldCleared(approvalrequest.FieldStatusMessage) { + fields = append(fields, approvalrequest.FieldStatusMessage) + } + if m.FieldCleared(approvalrequest.FieldEnvironment) { + fields = append(fields, approvalrequest.FieldEnvironment) + } + if m.FieldCleared(approvalrequest.FieldAvailableTransitions) { + fields = append(fields, approvalrequest.FieldAvailableTransitions) + } + return fields +} + +// FieldCleared returns a boolean indicating if a field with the given name was +// cleared in this mutation. +func (m *ApprovalRequestMutation) FieldCleared(name string) bool { + _, ok := m.clearedFields[name] + return ok +} + +// ClearField clears the value of the field with the given name. It returns an +// error if the field is not defined in the schema. +func (m *ApprovalRequestMutation) ClearField(name string) error { + switch name { + case approvalrequest.FieldStatusPhase: + m.ClearStatusPhase() + return nil + case approvalrequest.FieldStatusMessage: + m.ClearStatusMessage() + return nil + case approvalrequest.FieldEnvironment: + m.ClearEnvironment() + return nil + case approvalrequest.FieldAvailableTransitions: + m.ClearAvailableTransitions() + return nil + } + return fmt.Errorf("unknown ApprovalRequest nullable field %s", name) +} + +// ResetField resets all changes in the mutation for the field with the given name. +// It returns an error if the field is not defined in the schema. +func (m *ApprovalRequestMutation) ResetField(name string) error { + switch name { + case approvalrequest.FieldCreatedAt: + m.ResetCreatedAt() + return nil + case approvalrequest.FieldLastModifiedAt: + m.ResetLastModifiedAt() + return nil + case approvalrequest.FieldStatusPhase: + m.ResetStatusPhase() + return nil + case approvalrequest.FieldStatusMessage: + m.ResetStatusMessage() + return nil + case approvalrequest.FieldEnvironment: + m.ResetEnvironment() + return nil + case approvalrequest.FieldNamespace: + m.ResetNamespace() + return nil + case approvalrequest.FieldAction: + m.ResetAction() + return nil + case approvalrequest.FieldStrategy: + m.ResetStrategy() + return nil + case approvalrequest.FieldRequester: + m.ResetRequester() + return nil + case approvalrequest.FieldDecider: + m.ResetDecider() + return nil + case approvalrequest.FieldDeciderTeamName: + m.ResetDeciderTeamName() + return nil + case approvalrequest.FieldDecisions: + m.ResetDecisions() + return nil + case approvalrequest.FieldAvailableTransitions: + m.ResetAvailableTransitions() + return nil + case approvalrequest.FieldName: + m.ResetName() + return nil + case approvalrequest.FieldState: + m.ResetState() + return nil + } + return fmt.Errorf("unknown ApprovalRequest field %s", name) +} + +// AddedEdges returns all edge names that were set/added in this mutation. +func (m *ApprovalRequestMutation) AddedEdges() []string { + edges := make([]string, 0, 2) + if m.api_subscription != nil { + edges = append(edges, approvalrequest.EdgeAPISubscription) + } + if m.event_subscription != nil { + edges = append(edges, approvalrequest.EdgeEventSubscription) + } + return edges +} + +// AddedIDs returns all IDs (to other nodes) that were added for the given edge +// name in this mutation. +func (m *ApprovalRequestMutation) AddedIDs(name string) []ent.Value { + switch name { + case approvalrequest.EdgeAPISubscription: + if id := m.api_subscription; id != nil { + return []ent.Value{*id} + } + case approvalrequest.EdgeEventSubscription: + if id := m.event_subscription; id != nil { + return []ent.Value{*id} + } + } + return nil +} + +// RemovedEdges returns all edge names that were removed in this mutation. +func (m *ApprovalRequestMutation) RemovedEdges() []string { + edges := make([]string, 0, 2) + return edges +} + +// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with +// the given name in this mutation. +func (m *ApprovalRequestMutation) RemovedIDs(name string) []ent.Value { + return nil +} + +// ClearedEdges returns all edge names that were cleared in this mutation. +func (m *ApprovalRequestMutation) ClearedEdges() []string { + edges := make([]string, 0, 2) + if m.clearedapi_subscription { + edges = append(edges, approvalrequest.EdgeAPISubscription) + } + if m.clearedevent_subscription { + edges = append(edges, approvalrequest.EdgeEventSubscription) + } + return edges +} + +// EdgeCleared returns a boolean which indicates if the edge with the given name +// was cleared in this mutation. +func (m *ApprovalRequestMutation) EdgeCleared(name string) bool { + switch name { + case approvalrequest.EdgeAPISubscription: + return m.clearedapi_subscription + case approvalrequest.EdgeEventSubscription: + return m.clearedevent_subscription + } + return false +} + +// ClearEdge clears the value of the edge with the given name. It returns an error +// if that edge is not defined in the schema. +func (m *ApprovalRequestMutation) ClearEdge(name string) error { + switch name { + case approvalrequest.EdgeAPISubscription: + m.ClearAPISubscription() + return nil + case approvalrequest.EdgeEventSubscription: + m.ClearEventSubscription() + return nil + } + return fmt.Errorf("unknown ApprovalRequest unique edge %s", name) +} + +// ResetEdge resets all changes to the edge with the given name in this mutation. +// It returns an error if the edge is not defined in the schema. +func (m *ApprovalRequestMutation) ResetEdge(name string) error { + switch name { + case approvalrequest.EdgeAPISubscription: + m.ResetAPISubscription() + return nil + case approvalrequest.EdgeEventSubscription: + m.ResetEventSubscription() + return nil + } + return fmt.Errorf("unknown ApprovalRequest edge %s", name) +} + +// EventExposureMutation represents an operation that mutates the EventExposure nodes in the graph. +type EventExposureMutation struct { + config + op Op + typ string + id *int + created_at *time.Time + last_modified_at *time.Time + status_phase *eventexposure.StatusPhase + status_message *string + environment *string + namespace *string + event_type *string + visibility *eventexposure.Visibility + active *bool + approval_config *model.ApprovalConfig + clearedFields map[string]struct{} + owner *int + clearedowner bool + subscriptions map[int]struct{} + removedsubscriptions map[int]struct{} + clearedsubscriptions bool + done bool + oldValue func(context.Context) (*EventExposure, error) + predicates []predicate.EventExposure +} + +var _ ent.Mutation = (*EventExposureMutation)(nil) + +// eventexposureOption allows management of the mutation configuration using functional options. +type eventexposureOption func(*EventExposureMutation) + +// newEventExposureMutation creates new mutation for the EventExposure entity. +func newEventExposureMutation(c config, op Op, opts ...eventexposureOption) *EventExposureMutation { + m := &EventExposureMutation{ + config: c, + op: op, + typ: TypeEventExposure, + clearedFields: make(map[string]struct{}), + } + for _, opt := range opts { + opt(m) + } + return m +} + +// withEventExposureID sets the ID field of the mutation. +func withEventExposureID(id int) eventexposureOption { + return func(m *EventExposureMutation) { + var ( + err error + once sync.Once + value *EventExposure + ) + m.oldValue = func(ctx context.Context) (*EventExposure, error) { + once.Do(func() { + if m.done { + err = errors.New("querying old values post mutation is not allowed") + } else { + value, err = m.Client().EventExposure.Get(ctx, id) + } + }) + return value, err + } + m.id = &id + } +} + +// withEventExposure sets the old EventExposure of the mutation. +func withEventExposure(node *EventExposure) eventexposureOption { + return func(m *EventExposureMutation) { + m.oldValue = func(context.Context) (*EventExposure, error) { + return node, nil + } + m.id = &node.ID + } +} + +// Client returns a new `ent.Client` from the mutation. If the mutation was +// executed in a transaction (ent.Tx), a transactional client is returned. +func (m EventExposureMutation) Client() *Client { + client := &Client{config: m.config} + client.init() + return client +} + +// Tx returns an `ent.Tx` for mutations that were executed in transactions; +// it returns an error otherwise. +func (m EventExposureMutation) Tx() (*Tx, error) { + if _, ok := m.driver.(*txDriver); !ok { + return nil, errors.New("ent: mutation is not running in a transaction") + } + tx := &Tx{config: m.config} + tx.init() + return tx, nil +} + +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. +func (m *EventExposureMutation) ID() (id int, exists bool) { + if m.id == nil { + return + } + return *m.id, true +} + +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *EventExposureMutation) IDs(ctx context.Context) ([]int, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []int{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().EventExposure.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + +// SetCreatedAt sets the "created_at" field. +func (m *EventExposureMutation) SetCreatedAt(t time.Time) { + m.created_at = &t +} + +// CreatedAt returns the value of the "created_at" field in the mutation. +func (m *EventExposureMutation) CreatedAt() (r time.Time, exists bool) { + v := m.created_at + if v == nil { + return + } + return *v, true +} + +// OldCreatedAt returns the old "created_at" field's value of the EventExposure entity. +// If the EventExposure object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventExposureMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCreatedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err) + } + return oldValue.CreatedAt, nil +} + +// ResetCreatedAt resets all changes to the "created_at" field. +func (m *EventExposureMutation) ResetCreatedAt() { + m.created_at = nil +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (m *EventExposureMutation) SetLastModifiedAt(t time.Time) { + m.last_modified_at = &t +} + +// LastModifiedAt returns the value of the "last_modified_at" field in the mutation. +func (m *EventExposureMutation) LastModifiedAt() (r time.Time, exists bool) { + v := m.last_modified_at + if v == nil { + return + } + return *v, true +} + +// OldLastModifiedAt returns the old "last_modified_at" field's value of the EventExposure entity. +// If the EventExposure object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventExposureMutation) OldLastModifiedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldLastModifiedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldLastModifiedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldLastModifiedAt: %w", err) + } + return oldValue.LastModifiedAt, nil +} + +// ResetLastModifiedAt resets all changes to the "last_modified_at" field. +func (m *EventExposureMutation) ResetLastModifiedAt() { + m.last_modified_at = nil +} + +// SetStatusPhase sets the "status_phase" field. +func (m *EventExposureMutation) SetStatusPhase(ep eventexposure.StatusPhase) { + m.status_phase = &ep +} + +// StatusPhase returns the value of the "status_phase" field in the mutation. +func (m *EventExposureMutation) StatusPhase() (r eventexposure.StatusPhase, exists bool) { + v := m.status_phase + if v == nil { + return + } + return *v, true +} + +// OldStatusPhase returns the old "status_phase" field's value of the EventExposure entity. +// If the EventExposure object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventExposureMutation) OldStatusPhase(ctx context.Context) (v *eventexposure.StatusPhase, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldStatusPhase is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldStatusPhase requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldStatusPhase: %w", err) + } + return oldValue.StatusPhase, nil +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (m *EventExposureMutation) ClearStatusPhase() { + m.status_phase = nil + m.clearedFields[eventexposure.FieldStatusPhase] = struct{}{} +} + +// StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. +func (m *EventExposureMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[eventexposure.FieldStatusPhase] + return ok +} + +// ResetStatusPhase resets all changes to the "status_phase" field. +func (m *EventExposureMutation) ResetStatusPhase() { + m.status_phase = nil + delete(m.clearedFields, eventexposure.FieldStatusPhase) +} + +// SetStatusMessage sets the "status_message" field. +func (m *EventExposureMutation) SetStatusMessage(s string) { + m.status_message = &s +} + +// StatusMessage returns the value of the "status_message" field in the mutation. +func (m *EventExposureMutation) StatusMessage() (r string, exists bool) { + v := m.status_message + if v == nil { + return + } + return *v, true +} + +// OldStatusMessage returns the old "status_message" field's value of the EventExposure entity. +// If the EventExposure object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventExposureMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldStatusMessage is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldStatusMessage requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldStatusMessage: %w", err) + } + return oldValue.StatusMessage, nil +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (m *EventExposureMutation) ClearStatusMessage() { + m.status_message = nil + m.clearedFields[eventexposure.FieldStatusMessage] = struct{}{} +} + +// StatusMessageCleared returns if the "status_message" field was cleared in this mutation. +func (m *EventExposureMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[eventexposure.FieldStatusMessage] + return ok +} + +// ResetStatusMessage resets all changes to the "status_message" field. +func (m *EventExposureMutation) ResetStatusMessage() { + m.status_message = nil + delete(m.clearedFields, eventexposure.FieldStatusMessage) +} + +// SetEnvironment sets the "environment" field. +func (m *EventExposureMutation) SetEnvironment(s string) { + m.environment = &s +} + +// Environment returns the value of the "environment" field in the mutation. +func (m *EventExposureMutation) Environment() (r string, exists bool) { + v := m.environment + if v == nil { + return + } + return *v, true +} + +// OldEnvironment returns the old "environment" field's value of the EventExposure entity. +// If the EventExposure object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventExposureMutation) OldEnvironment(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldEnvironment is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldEnvironment requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldEnvironment: %w", err) + } + return oldValue.Environment, nil +} + +// ClearEnvironment clears the value of the "environment" field. +func (m *EventExposureMutation) ClearEnvironment() { + m.environment = nil + m.clearedFields[eventexposure.FieldEnvironment] = struct{}{} +} + +// EnvironmentCleared returns if the "environment" field was cleared in this mutation. +func (m *EventExposureMutation) EnvironmentCleared() bool { + _, ok := m.clearedFields[eventexposure.FieldEnvironment] + return ok +} + +// ResetEnvironment resets all changes to the "environment" field. +func (m *EventExposureMutation) ResetEnvironment() { + m.environment = nil + delete(m.clearedFields, eventexposure.FieldEnvironment) +} + +// SetNamespace sets the "namespace" field. +func (m *EventExposureMutation) SetNamespace(s string) { + m.namespace = &s +} + +// Namespace returns the value of the "namespace" field in the mutation. +func (m *EventExposureMutation) Namespace() (r string, exists bool) { + v := m.namespace + if v == nil { + return + } + return *v, true +} + +// OldNamespace returns the old "namespace" field's value of the EventExposure entity. +// If the EventExposure object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventExposureMutation) OldNamespace(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldNamespace is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldNamespace requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldNamespace: %w", err) + } + return oldValue.Namespace, nil +} + +// ResetNamespace resets all changes to the "namespace" field. +func (m *EventExposureMutation) ResetNamespace() { + m.namespace = nil +} + +// SetEventType sets the "event_type" field. +func (m *EventExposureMutation) SetEventType(s string) { + m.event_type = &s +} + +// EventType returns the value of the "event_type" field in the mutation. +func (m *EventExposureMutation) EventType() (r string, exists bool) { + v := m.event_type + if v == nil { + return + } + return *v, true +} + +// OldEventType returns the old "event_type" field's value of the EventExposure entity. +// If the EventExposure object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventExposureMutation) OldEventType(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldEventType is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldEventType requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldEventType: %w", err) + } + return oldValue.EventType, nil +} + +// ResetEventType resets all changes to the "event_type" field. +func (m *EventExposureMutation) ResetEventType() { + m.event_type = nil +} + +// SetVisibility sets the "visibility" field. +func (m *EventExposureMutation) SetVisibility(e eventexposure.Visibility) { + m.visibility = &e +} + +// Visibility returns the value of the "visibility" field in the mutation. +func (m *EventExposureMutation) Visibility() (r eventexposure.Visibility, exists bool) { + v := m.visibility + if v == nil { + return + } + return *v, true +} + +// OldVisibility returns the old "visibility" field's value of the EventExposure entity. +// If the EventExposure object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventExposureMutation) OldVisibility(ctx context.Context) (v eventexposure.Visibility, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldVisibility is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldVisibility requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldVisibility: %w", err) + } + return oldValue.Visibility, nil +} + +// ResetVisibility resets all changes to the "visibility" field. +func (m *EventExposureMutation) ResetVisibility() { + m.visibility = nil +} + +// SetActive sets the "active" field. +func (m *EventExposureMutation) SetActive(b bool) { + m.active = &b +} + +// Active returns the value of the "active" field in the mutation. +func (m *EventExposureMutation) Active() (r bool, exists bool) { + v := m.active + if v == nil { + return + } + return *v, true +} + +// OldActive returns the old "active" field's value of the EventExposure entity. +// If the EventExposure object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventExposureMutation) OldActive(ctx context.Context) (v *bool, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldActive is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldActive requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldActive: %w", err) + } + return oldValue.Active, nil +} + +// ClearActive clears the value of the "active" field. +func (m *EventExposureMutation) ClearActive() { + m.active = nil + m.clearedFields[eventexposure.FieldActive] = struct{}{} +} + +// ActiveCleared returns if the "active" field was cleared in this mutation. +func (m *EventExposureMutation) ActiveCleared() bool { + _, ok := m.clearedFields[eventexposure.FieldActive] + return ok +} + +// ResetActive resets all changes to the "active" field. +func (m *EventExposureMutation) ResetActive() { + m.active = nil + delete(m.clearedFields, eventexposure.FieldActive) +} + +// SetApprovalConfig sets the "approval_config" field. +func (m *EventExposureMutation) SetApprovalConfig(mc model.ApprovalConfig) { + m.approval_config = &mc +} + +// ApprovalConfig returns the value of the "approval_config" field in the mutation. +func (m *EventExposureMutation) ApprovalConfig() (r model.ApprovalConfig, exists bool) { + v := m.approval_config + if v == nil { + return + } + return *v, true +} + +// OldApprovalConfig returns the old "approval_config" field's value of the EventExposure entity. +// If the EventExposure object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventExposureMutation) OldApprovalConfig(ctx context.Context) (v model.ApprovalConfig, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldApprovalConfig is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldApprovalConfig requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldApprovalConfig: %w", err) + } + return oldValue.ApprovalConfig, nil +} + +// ResetApprovalConfig resets all changes to the "approval_config" field. +func (m *EventExposureMutation) ResetApprovalConfig() { + m.approval_config = nil +} + +// SetOwnerID sets the "owner" edge to the Application entity by id. +func (m *EventExposureMutation) SetOwnerID(id int) { + m.owner = &id +} + +// ClearOwner clears the "owner" edge to the Application entity. +func (m *EventExposureMutation) ClearOwner() { + m.clearedowner = true +} + +// OwnerCleared reports if the "owner" edge to the Application entity was cleared. +func (m *EventExposureMutation) OwnerCleared() bool { + return m.clearedowner +} + +// OwnerID returns the "owner" edge ID in the mutation. +func (m *EventExposureMutation) OwnerID() (id int, exists bool) { + if m.owner != nil { + return *m.owner, true + } + return +} + +// OwnerIDs returns the "owner" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// OwnerID instead. It exists only for internal usage by the builders. +func (m *EventExposureMutation) OwnerIDs() (ids []int) { + if id := m.owner; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetOwner resets all changes to the "owner" edge. +func (m *EventExposureMutation) ResetOwner() { + m.owner = nil + m.clearedowner = false +} + +// AddSubscriptionIDs adds the "subscriptions" edge to the EventSubscription entity by ids. +func (m *EventExposureMutation) AddSubscriptionIDs(ids ...int) { + if m.subscriptions == nil { + m.subscriptions = make(map[int]struct{}) + } + for i := range ids { + m.subscriptions[ids[i]] = struct{}{} + } +} + +// ClearSubscriptions clears the "subscriptions" edge to the EventSubscription entity. +func (m *EventExposureMutation) ClearSubscriptions() { + m.clearedsubscriptions = true +} + +// SubscriptionsCleared reports if the "subscriptions" edge to the EventSubscription entity was cleared. +func (m *EventExposureMutation) SubscriptionsCleared() bool { + return m.clearedsubscriptions +} + +// RemoveSubscriptionIDs removes the "subscriptions" edge to the EventSubscription entity by IDs. +func (m *EventExposureMutation) RemoveSubscriptionIDs(ids ...int) { + if m.removedsubscriptions == nil { + m.removedsubscriptions = make(map[int]struct{}) + } + for i := range ids { + delete(m.subscriptions, ids[i]) + m.removedsubscriptions[ids[i]] = struct{}{} + } +} + +// RemovedSubscriptions returns the removed IDs of the "subscriptions" edge to the EventSubscription entity. +func (m *EventExposureMutation) RemovedSubscriptionsIDs() (ids []int) { + for id := range m.removedsubscriptions { + ids = append(ids, id) + } + return +} + +// SubscriptionsIDs returns the "subscriptions" edge IDs in the mutation. +func (m *EventExposureMutation) SubscriptionsIDs() (ids []int) { + for id := range m.subscriptions { + ids = append(ids, id) + } + return +} + +// ResetSubscriptions resets all changes to the "subscriptions" edge. +func (m *EventExposureMutation) ResetSubscriptions() { + m.subscriptions = nil + m.clearedsubscriptions = false + m.removedsubscriptions = nil +} + +// Where appends a list predicates to the EventExposureMutation builder. +func (m *EventExposureMutation) Where(ps ...predicate.EventExposure) { + m.predicates = append(m.predicates, ps...) +} + +// WhereP appends storage-level predicates to the EventExposureMutation builder. Using this method, +// users can use type-assertion to append predicates that do not depend on any generated package. +func (m *EventExposureMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.EventExposure, len(ps)) + for i := range ps { + p[i] = ps[i] + } + m.Where(p...) +} + +// Op returns the operation name. +func (m *EventExposureMutation) Op() Op { + return m.op +} + +// SetOp allows setting the mutation operation. +func (m *EventExposureMutation) SetOp(op Op) { + m.op = op +} + +// Type returns the node type of this mutation (EventExposure). +func (m *EventExposureMutation) Type() string { + return m.typ +} + +// Fields returns all fields that were changed during this mutation. Note that in +// order to get all numeric fields that were incremented/decremented, call +// AddedFields(). +func (m *EventExposureMutation) Fields() []string { + fields := make([]string, 0, 10) + if m.created_at != nil { + fields = append(fields, eventexposure.FieldCreatedAt) + } + if m.last_modified_at != nil { + fields = append(fields, eventexposure.FieldLastModifiedAt) + } + if m.status_phase != nil { + fields = append(fields, eventexposure.FieldStatusPhase) + } + if m.status_message != nil { + fields = append(fields, eventexposure.FieldStatusMessage) + } + if m.environment != nil { + fields = append(fields, eventexposure.FieldEnvironment) + } + if m.namespace != nil { + fields = append(fields, eventexposure.FieldNamespace) + } + if m.event_type != nil { + fields = append(fields, eventexposure.FieldEventType) + } + if m.visibility != nil { + fields = append(fields, eventexposure.FieldVisibility) + } + if m.active != nil { + fields = append(fields, eventexposure.FieldActive) + } + if m.approval_config != nil { + fields = append(fields, eventexposure.FieldApprovalConfig) + } + return fields +} + +// Field returns the value of a field with the given name. The second boolean +// return value indicates that this field was not set, or was not defined in the +// schema. +func (m *EventExposureMutation) Field(name string) (ent.Value, bool) { + switch name { + case eventexposure.FieldCreatedAt: + return m.CreatedAt() + case eventexposure.FieldLastModifiedAt: + return m.LastModifiedAt() + case eventexposure.FieldStatusPhase: + return m.StatusPhase() + case eventexposure.FieldStatusMessage: + return m.StatusMessage() + case eventexposure.FieldEnvironment: + return m.Environment() + case eventexposure.FieldNamespace: + return m.Namespace() + case eventexposure.FieldEventType: + return m.EventType() + case eventexposure.FieldVisibility: + return m.Visibility() + case eventexposure.FieldActive: + return m.Active() + case eventexposure.FieldApprovalConfig: + return m.ApprovalConfig() + } + return nil, false +} + +// OldField returns the old value of the field from the database. An error is +// returned if the mutation operation is not UpdateOne, or the query to the +// database failed. +func (m *EventExposureMutation) OldField(ctx context.Context, name string) (ent.Value, error) { + switch name { + case eventexposure.FieldCreatedAt: + return m.OldCreatedAt(ctx) + case eventexposure.FieldLastModifiedAt: + return m.OldLastModifiedAt(ctx) + case eventexposure.FieldStatusPhase: + return m.OldStatusPhase(ctx) + case eventexposure.FieldStatusMessage: + return m.OldStatusMessage(ctx) + case eventexposure.FieldEnvironment: + return m.OldEnvironment(ctx) + case eventexposure.FieldNamespace: + return m.OldNamespace(ctx) + case eventexposure.FieldEventType: + return m.OldEventType(ctx) + case eventexposure.FieldVisibility: + return m.OldVisibility(ctx) + case eventexposure.FieldActive: + return m.OldActive(ctx) + case eventexposure.FieldApprovalConfig: + return m.OldApprovalConfig(ctx) + } + return nil, fmt.Errorf("unknown EventExposure field %s", name) +} + +// SetField sets the value of a field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *EventExposureMutation) SetField(name string, value ent.Value) error { + switch name { + case eventexposure.FieldCreatedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedAt(v) + return nil + case eventexposure.FieldLastModifiedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetLastModifiedAt(v) + return nil + case eventexposure.FieldStatusPhase: + v, ok := value.(eventexposure.StatusPhase) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatusPhase(v) + return nil + case eventexposure.FieldStatusMessage: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatusMessage(v) + return nil + case eventexposure.FieldEnvironment: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetEnvironment(v) + return nil + case eventexposure.FieldNamespace: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetNamespace(v) + return nil + case eventexposure.FieldEventType: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetEventType(v) + return nil + case eventexposure.FieldVisibility: + v, ok := value.(eventexposure.Visibility) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetVisibility(v) + return nil + case eventexposure.FieldActive: + v, ok := value.(bool) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetActive(v) + return nil + case eventexposure.FieldApprovalConfig: + v, ok := value.(model.ApprovalConfig) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetApprovalConfig(v) + return nil + } + return fmt.Errorf("unknown EventExposure field %s", name) +} + +// AddedFields returns all numeric fields that were incremented/decremented during +// this mutation. +func (m *EventExposureMutation) AddedFields() []string { + return nil +} + +// AddedField returns the numeric value that was incremented/decremented on a field +// with the given name. The second boolean return value indicates that this field +// was not set, or was not defined in the schema. +func (m *EventExposureMutation) AddedField(name string) (ent.Value, bool) { + return nil, false +} + +// AddField adds the value to the field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *EventExposureMutation) AddField(name string, value ent.Value) error { + switch name { + } + return fmt.Errorf("unknown EventExposure numeric field %s", name) +} + +// ClearedFields returns all nullable fields that were cleared during this +// mutation. +func (m *EventExposureMutation) ClearedFields() []string { + var fields []string + if m.FieldCleared(eventexposure.FieldStatusPhase) { + fields = append(fields, eventexposure.FieldStatusPhase) + } + if m.FieldCleared(eventexposure.FieldStatusMessage) { + fields = append(fields, eventexposure.FieldStatusMessage) + } + if m.FieldCleared(eventexposure.FieldEnvironment) { + fields = append(fields, eventexposure.FieldEnvironment) + } + if m.FieldCleared(eventexposure.FieldActive) { + fields = append(fields, eventexposure.FieldActive) + } + return fields +} + +// FieldCleared returns a boolean indicating if a field with the given name was +// cleared in this mutation. +func (m *EventExposureMutation) FieldCleared(name string) bool { + _, ok := m.clearedFields[name] + return ok +} + +// ClearField clears the value of the field with the given name. It returns an +// error if the field is not defined in the schema. +func (m *EventExposureMutation) ClearField(name string) error { + switch name { + case eventexposure.FieldStatusPhase: + m.ClearStatusPhase() + return nil + case eventexposure.FieldStatusMessage: + m.ClearStatusMessage() + return nil + case eventexposure.FieldEnvironment: + m.ClearEnvironment() + return nil + case eventexposure.FieldActive: + m.ClearActive() + return nil + } + return fmt.Errorf("unknown EventExposure nullable field %s", name) +} + +// ResetField resets all changes in the mutation for the field with the given name. +// It returns an error if the field is not defined in the schema. +func (m *EventExposureMutation) ResetField(name string) error { + switch name { + case eventexposure.FieldCreatedAt: + m.ResetCreatedAt() + return nil + case eventexposure.FieldLastModifiedAt: + m.ResetLastModifiedAt() + return nil + case eventexposure.FieldStatusPhase: + m.ResetStatusPhase() + return nil + case eventexposure.FieldStatusMessage: + m.ResetStatusMessage() + return nil + case eventexposure.FieldEnvironment: + m.ResetEnvironment() + return nil + case eventexposure.FieldNamespace: + m.ResetNamespace() + return nil + case eventexposure.FieldEventType: + m.ResetEventType() + return nil + case eventexposure.FieldVisibility: + m.ResetVisibility() + return nil + case eventexposure.FieldActive: + m.ResetActive() + return nil + case eventexposure.FieldApprovalConfig: + m.ResetApprovalConfig() + return nil + } + return fmt.Errorf("unknown EventExposure field %s", name) +} + +// AddedEdges returns all edge names that were set/added in this mutation. +func (m *EventExposureMutation) AddedEdges() []string { + edges := make([]string, 0, 2) + if m.owner != nil { + edges = append(edges, eventexposure.EdgeOwner) + } + if m.subscriptions != nil { + edges = append(edges, eventexposure.EdgeSubscriptions) + } + return edges +} + +// AddedIDs returns all IDs (to other nodes) that were added for the given edge +// name in this mutation. +func (m *EventExposureMutation) AddedIDs(name string) []ent.Value { + switch name { + case eventexposure.EdgeOwner: + if id := m.owner; id != nil { + return []ent.Value{*id} + } + case eventexposure.EdgeSubscriptions: + ids := make([]ent.Value, 0, len(m.subscriptions)) + for id := range m.subscriptions { + ids = append(ids, id) + } + return ids + } + return nil +} + +// RemovedEdges returns all edge names that were removed in this mutation. +func (m *EventExposureMutation) RemovedEdges() []string { + edges := make([]string, 0, 2) + if m.removedsubscriptions != nil { + edges = append(edges, eventexposure.EdgeSubscriptions) + } + return edges +} + +// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with +// the given name in this mutation. +func (m *EventExposureMutation) RemovedIDs(name string) []ent.Value { + switch name { + case eventexposure.EdgeSubscriptions: + ids := make([]ent.Value, 0, len(m.removedsubscriptions)) + for id := range m.removedsubscriptions { + ids = append(ids, id) + } + return ids + } + return nil +} + +// ClearedEdges returns all edge names that were cleared in this mutation. +func (m *EventExposureMutation) ClearedEdges() []string { + edges := make([]string, 0, 2) + if m.clearedowner { + edges = append(edges, eventexposure.EdgeOwner) + } + if m.clearedsubscriptions { + edges = append(edges, eventexposure.EdgeSubscriptions) + } + return edges +} + +// EdgeCleared returns a boolean which indicates if the edge with the given name +// was cleared in this mutation. +func (m *EventExposureMutation) EdgeCleared(name string) bool { + switch name { + case eventexposure.EdgeOwner: + return m.clearedowner + case eventexposure.EdgeSubscriptions: + return m.clearedsubscriptions + } + return false +} + +// ClearEdge clears the value of the edge with the given name. It returns an error +// if that edge is not defined in the schema. +func (m *EventExposureMutation) ClearEdge(name string) error { + switch name { + case eventexposure.EdgeOwner: + m.ClearOwner() + return nil + } + return fmt.Errorf("unknown EventExposure unique edge %s", name) +} + +// ResetEdge resets all changes to the edge with the given name in this mutation. +// It returns an error if the edge is not defined in the schema. +func (m *EventExposureMutation) ResetEdge(name string) error { + switch name { + case eventexposure.EdgeOwner: + m.ResetOwner() + return nil + case eventexposure.EdgeSubscriptions: + m.ResetSubscriptions() + return nil + } + return fmt.Errorf("unknown EventExposure edge %s", name) +} + +// EventSubscriptionMutation represents an operation that mutates the EventSubscription nodes in the graph. +type EventSubscriptionMutation struct { + config + op Op + typ string + id *int + created_at *time.Time + last_modified_at *time.Time + status_phase *eventsubscription.StatusPhase + status_message *string + environment *string + namespace *string + name *string + event_type *string + delivery_type *eventsubscription.DeliveryType + callback_url *string + clearedFields map[string]struct{} + owner *int + clearedowner bool + target *int + clearedtarget bool + approval *int + clearedapproval bool + approval_requests map[int]struct{} + removedapproval_requests map[int]struct{} + clearedapproval_requests bool + done bool + oldValue func(context.Context) (*EventSubscription, error) + predicates []predicate.EventSubscription +} + +var _ ent.Mutation = (*EventSubscriptionMutation)(nil) + +// eventsubscriptionOption allows management of the mutation configuration using functional options. +type eventsubscriptionOption func(*EventSubscriptionMutation) + +// newEventSubscriptionMutation creates new mutation for the EventSubscription entity. +func newEventSubscriptionMutation(c config, op Op, opts ...eventsubscriptionOption) *EventSubscriptionMutation { + m := &EventSubscriptionMutation{ + config: c, + op: op, + typ: TypeEventSubscription, + clearedFields: make(map[string]struct{}), + } + for _, opt := range opts { + opt(m) + } + return m +} + +// withEventSubscriptionID sets the ID field of the mutation. +func withEventSubscriptionID(id int) eventsubscriptionOption { + return func(m *EventSubscriptionMutation) { + var ( + err error + once sync.Once + value *EventSubscription + ) + m.oldValue = func(ctx context.Context) (*EventSubscription, error) { + once.Do(func() { + if m.done { + err = errors.New("querying old values post mutation is not allowed") + } else { + value, err = m.Client().EventSubscription.Get(ctx, id) + } + }) + return value, err + } + m.id = &id + } +} + +// withEventSubscription sets the old EventSubscription of the mutation. +func withEventSubscription(node *EventSubscription) eventsubscriptionOption { + return func(m *EventSubscriptionMutation) { + m.oldValue = func(context.Context) (*EventSubscription, error) { + return node, nil + } + m.id = &node.ID + } +} + +// Client returns a new `ent.Client` from the mutation. If the mutation was +// executed in a transaction (ent.Tx), a transactional client is returned. +func (m EventSubscriptionMutation) Client() *Client { + client := &Client{config: m.config} + client.init() + return client +} + +// Tx returns an `ent.Tx` for mutations that were executed in transactions; +// it returns an error otherwise. +func (m EventSubscriptionMutation) Tx() (*Tx, error) { + if _, ok := m.driver.(*txDriver); !ok { + return nil, errors.New("ent: mutation is not running in a transaction") + } + tx := &Tx{config: m.config} + tx.init() + return tx, nil +} + +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. +func (m *EventSubscriptionMutation) ID() (id int, exists bool) { + if m.id == nil { + return + } + return *m.id, true +} + +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *EventSubscriptionMutation) IDs(ctx context.Context) ([]int, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []int{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().EventSubscription.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + +// SetCreatedAt sets the "created_at" field. +func (m *EventSubscriptionMutation) SetCreatedAt(t time.Time) { + m.created_at = &t +} + +// CreatedAt returns the value of the "created_at" field in the mutation. +func (m *EventSubscriptionMutation) CreatedAt() (r time.Time, exists bool) { + v := m.created_at + if v == nil { + return + } + return *v, true +} + +// OldCreatedAt returns the old "created_at" field's value of the EventSubscription entity. +// If the EventSubscription object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventSubscriptionMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCreatedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err) + } + return oldValue.CreatedAt, nil +} + +// ResetCreatedAt resets all changes to the "created_at" field. +func (m *EventSubscriptionMutation) ResetCreatedAt() { + m.created_at = nil +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (m *EventSubscriptionMutation) SetLastModifiedAt(t time.Time) { + m.last_modified_at = &t +} + +// LastModifiedAt returns the value of the "last_modified_at" field in the mutation. +func (m *EventSubscriptionMutation) LastModifiedAt() (r time.Time, exists bool) { + v := m.last_modified_at + if v == nil { + return + } + return *v, true +} + +// OldLastModifiedAt returns the old "last_modified_at" field's value of the EventSubscription entity. +// If the EventSubscription object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventSubscriptionMutation) OldLastModifiedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldLastModifiedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldLastModifiedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldLastModifiedAt: %w", err) + } + return oldValue.LastModifiedAt, nil +} + +// ResetLastModifiedAt resets all changes to the "last_modified_at" field. +func (m *EventSubscriptionMutation) ResetLastModifiedAt() { + m.last_modified_at = nil +} + +// SetStatusPhase sets the "status_phase" field. +func (m *EventSubscriptionMutation) SetStatusPhase(ep eventsubscription.StatusPhase) { + m.status_phase = &ep +} + +// StatusPhase returns the value of the "status_phase" field in the mutation. +func (m *EventSubscriptionMutation) StatusPhase() (r eventsubscription.StatusPhase, exists bool) { + v := m.status_phase + if v == nil { + return + } + return *v, true +} + +// OldStatusPhase returns the old "status_phase" field's value of the EventSubscription entity. +// If the EventSubscription object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventSubscriptionMutation) OldStatusPhase(ctx context.Context) (v *eventsubscription.StatusPhase, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldStatusPhase is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldStatusPhase requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldStatusPhase: %w", err) + } + return oldValue.StatusPhase, nil +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (m *EventSubscriptionMutation) ClearStatusPhase() { + m.status_phase = nil + m.clearedFields[eventsubscription.FieldStatusPhase] = struct{}{} +} + +// StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. +func (m *EventSubscriptionMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[eventsubscription.FieldStatusPhase] + return ok +} + +// ResetStatusPhase resets all changes to the "status_phase" field. +func (m *EventSubscriptionMutation) ResetStatusPhase() { + m.status_phase = nil + delete(m.clearedFields, eventsubscription.FieldStatusPhase) +} + +// SetStatusMessage sets the "status_message" field. +func (m *EventSubscriptionMutation) SetStatusMessage(s string) { + m.status_message = &s +} + +// StatusMessage returns the value of the "status_message" field in the mutation. +func (m *EventSubscriptionMutation) StatusMessage() (r string, exists bool) { + v := m.status_message + if v == nil { + return + } + return *v, true +} + +// OldStatusMessage returns the old "status_message" field's value of the EventSubscription entity. +// If the EventSubscription object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventSubscriptionMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldStatusMessage is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldStatusMessage requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldStatusMessage: %w", err) + } + return oldValue.StatusMessage, nil +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (m *EventSubscriptionMutation) ClearStatusMessage() { + m.status_message = nil + m.clearedFields[eventsubscription.FieldStatusMessage] = struct{}{} +} + +// StatusMessageCleared returns if the "status_message" field was cleared in this mutation. +func (m *EventSubscriptionMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[eventsubscription.FieldStatusMessage] + return ok +} + +// ResetStatusMessage resets all changes to the "status_message" field. +func (m *EventSubscriptionMutation) ResetStatusMessage() { + m.status_message = nil + delete(m.clearedFields, eventsubscription.FieldStatusMessage) +} + +// SetEnvironment sets the "environment" field. +func (m *EventSubscriptionMutation) SetEnvironment(s string) { + m.environment = &s +} + +// Environment returns the value of the "environment" field in the mutation. +func (m *EventSubscriptionMutation) Environment() (r string, exists bool) { + v := m.environment + if v == nil { + return + } + return *v, true +} + +// OldEnvironment returns the old "environment" field's value of the EventSubscription entity. +// If the EventSubscription object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventSubscriptionMutation) OldEnvironment(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldEnvironment is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldEnvironment requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldEnvironment: %w", err) + } + return oldValue.Environment, nil +} + +// ClearEnvironment clears the value of the "environment" field. +func (m *EventSubscriptionMutation) ClearEnvironment() { + m.environment = nil + m.clearedFields[eventsubscription.FieldEnvironment] = struct{}{} +} + +// EnvironmentCleared returns if the "environment" field was cleared in this mutation. +func (m *EventSubscriptionMutation) EnvironmentCleared() bool { + _, ok := m.clearedFields[eventsubscription.FieldEnvironment] + return ok +} + +// ResetEnvironment resets all changes to the "environment" field. +func (m *EventSubscriptionMutation) ResetEnvironment() { + m.environment = nil + delete(m.clearedFields, eventsubscription.FieldEnvironment) +} + +// SetNamespace sets the "namespace" field. +func (m *EventSubscriptionMutation) SetNamespace(s string) { + m.namespace = &s +} + +// Namespace returns the value of the "namespace" field in the mutation. +func (m *EventSubscriptionMutation) Namespace() (r string, exists bool) { + v := m.namespace + if v == nil { + return + } + return *v, true +} + +// OldNamespace returns the old "namespace" field's value of the EventSubscription entity. +// If the EventSubscription object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventSubscriptionMutation) OldNamespace(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldNamespace is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldNamespace requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldNamespace: %w", err) + } + return oldValue.Namespace, nil +} + +// ResetNamespace resets all changes to the "namespace" field. +func (m *EventSubscriptionMutation) ResetNamespace() { + m.namespace = nil +} + +// SetName sets the "name" field. +func (m *EventSubscriptionMutation) SetName(s string) { + m.name = &s +} + +// Name returns the value of the "name" field in the mutation. +func (m *EventSubscriptionMutation) Name() (r string, exists bool) { + v := m.name + if v == nil { + return + } + return *v, true +} + +// OldName returns the old "name" field's value of the EventSubscription entity. +// If the EventSubscription object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventSubscriptionMutation) OldName(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldName is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldName requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldName: %w", err) + } + return oldValue.Name, nil +} + +// ResetName resets all changes to the "name" field. +func (m *EventSubscriptionMutation) ResetName() { + m.name = nil +} + +// SetEventType sets the "event_type" field. +func (m *EventSubscriptionMutation) SetEventType(s string) { + m.event_type = &s +} + +// EventType returns the value of the "event_type" field in the mutation. +func (m *EventSubscriptionMutation) EventType() (r string, exists bool) { + v := m.event_type + if v == nil { + return + } + return *v, true +} + +// OldEventType returns the old "event_type" field's value of the EventSubscription entity. +// If the EventSubscription object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventSubscriptionMutation) OldEventType(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldEventType is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldEventType requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldEventType: %w", err) + } + return oldValue.EventType, nil +} + +// ResetEventType resets all changes to the "event_type" field. +func (m *EventSubscriptionMutation) ResetEventType() { + m.event_type = nil +} + +// SetDeliveryType sets the "delivery_type" field. +func (m *EventSubscriptionMutation) SetDeliveryType(et eventsubscription.DeliveryType) { + m.delivery_type = &et +} + +// DeliveryType returns the value of the "delivery_type" field in the mutation. +func (m *EventSubscriptionMutation) DeliveryType() (r eventsubscription.DeliveryType, exists bool) { + v := m.delivery_type + if v == nil { + return + } + return *v, true +} + +// OldDeliveryType returns the old "delivery_type" field's value of the EventSubscription entity. +// If the EventSubscription object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventSubscriptionMutation) OldDeliveryType(ctx context.Context) (v eventsubscription.DeliveryType, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldDeliveryType is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldDeliveryType requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldDeliveryType: %w", err) + } + return oldValue.DeliveryType, nil +} + +// ResetDeliveryType resets all changes to the "delivery_type" field. +func (m *EventSubscriptionMutation) ResetDeliveryType() { + m.delivery_type = nil +} + +// SetCallbackURL sets the "callback_url" field. +func (m *EventSubscriptionMutation) SetCallbackURL(s string) { + m.callback_url = &s +} + +// CallbackURL returns the value of the "callback_url" field in the mutation. +func (m *EventSubscriptionMutation) CallbackURL() (r string, exists bool) { + v := m.callback_url + if v == nil { + return + } + return *v, true +} + +// OldCallbackURL returns the old "callback_url" field's value of the EventSubscription entity. +// If the EventSubscription object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventSubscriptionMutation) OldCallbackURL(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCallbackURL is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCallbackURL requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCallbackURL: %w", err) + } + return oldValue.CallbackURL, nil +} + +// ClearCallbackURL clears the value of the "callback_url" field. +func (m *EventSubscriptionMutation) ClearCallbackURL() { + m.callback_url = nil + m.clearedFields[eventsubscription.FieldCallbackURL] = struct{}{} +} + +// CallbackURLCleared returns if the "callback_url" field was cleared in this mutation. +func (m *EventSubscriptionMutation) CallbackURLCleared() bool { + _, ok := m.clearedFields[eventsubscription.FieldCallbackURL] + return ok +} + +// ResetCallbackURL resets all changes to the "callback_url" field. +func (m *EventSubscriptionMutation) ResetCallbackURL() { + m.callback_url = nil + delete(m.clearedFields, eventsubscription.FieldCallbackURL) +} + +// SetOwnerID sets the "owner" edge to the Application entity by id. +func (m *EventSubscriptionMutation) SetOwnerID(id int) { + m.owner = &id +} + +// ClearOwner clears the "owner" edge to the Application entity. +func (m *EventSubscriptionMutation) ClearOwner() { + m.clearedowner = true +} + +// OwnerCleared reports if the "owner" edge to the Application entity was cleared. +func (m *EventSubscriptionMutation) OwnerCleared() bool { + return m.clearedowner +} + +// OwnerID returns the "owner" edge ID in the mutation. +func (m *EventSubscriptionMutation) OwnerID() (id int, exists bool) { + if m.owner != nil { + return *m.owner, true + } + return +} + +// OwnerIDs returns the "owner" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// OwnerID instead. It exists only for internal usage by the builders. +func (m *EventSubscriptionMutation) OwnerIDs() (ids []int) { + if id := m.owner; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetOwner resets all changes to the "owner" edge. +func (m *EventSubscriptionMutation) ResetOwner() { + m.owner = nil + m.clearedowner = false +} + +// SetTargetID sets the "target" edge to the EventExposure entity by id. +func (m *EventSubscriptionMutation) SetTargetID(id int) { + m.target = &id +} + +// ClearTarget clears the "target" edge to the EventExposure entity. +func (m *EventSubscriptionMutation) ClearTarget() { + m.clearedtarget = true +} + +// TargetCleared reports if the "target" edge to the EventExposure entity was cleared. +func (m *EventSubscriptionMutation) TargetCleared() bool { + return m.clearedtarget +} + +// TargetID returns the "target" edge ID in the mutation. +func (m *EventSubscriptionMutation) TargetID() (id int, exists bool) { + if m.target != nil { + return *m.target, true + } + return +} + +// TargetIDs returns the "target" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// TargetID instead. It exists only for internal usage by the builders. +func (m *EventSubscriptionMutation) TargetIDs() (ids []int) { + if id := m.target; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetTarget resets all changes to the "target" edge. +func (m *EventSubscriptionMutation) ResetTarget() { + m.target = nil + m.clearedtarget = false +} + +// SetApprovalID sets the "approval" edge to the Approval entity by id. +func (m *EventSubscriptionMutation) SetApprovalID(id int) { + m.approval = &id +} + +// ClearApproval clears the "approval" edge to the Approval entity. +func (m *EventSubscriptionMutation) ClearApproval() { + m.clearedapproval = true +} + +// ApprovalCleared reports if the "approval" edge to the Approval entity was cleared. +func (m *EventSubscriptionMutation) ApprovalCleared() bool { + return m.clearedapproval +} + +// ApprovalID returns the "approval" edge ID in the mutation. +func (m *EventSubscriptionMutation) ApprovalID() (id int, exists bool) { + if m.approval != nil { + return *m.approval, true + } + return +} + +// ApprovalIDs returns the "approval" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// ApprovalID instead. It exists only for internal usage by the builders. +func (m *EventSubscriptionMutation) ApprovalIDs() (ids []int) { + if id := m.approval; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetApproval resets all changes to the "approval" edge. +func (m *EventSubscriptionMutation) ResetApproval() { + m.approval = nil + m.clearedapproval = false +} + +// AddApprovalRequestIDs adds the "approval_requests" edge to the ApprovalRequest entity by ids. +func (m *EventSubscriptionMutation) AddApprovalRequestIDs(ids ...int) { + if m.approval_requests == nil { + m.approval_requests = make(map[int]struct{}) + } + for i := range ids { + m.approval_requests[ids[i]] = struct{}{} + } +} + +// ClearApprovalRequests clears the "approval_requests" edge to the ApprovalRequest entity. +func (m *EventSubscriptionMutation) ClearApprovalRequests() { + m.clearedapproval_requests = true +} + +// ApprovalRequestsCleared reports if the "approval_requests" edge to the ApprovalRequest entity was cleared. +func (m *EventSubscriptionMutation) ApprovalRequestsCleared() bool { + return m.clearedapproval_requests +} + +// RemoveApprovalRequestIDs removes the "approval_requests" edge to the ApprovalRequest entity by IDs. +func (m *EventSubscriptionMutation) RemoveApprovalRequestIDs(ids ...int) { + if m.removedapproval_requests == nil { + m.removedapproval_requests = make(map[int]struct{}) + } + for i := range ids { + delete(m.approval_requests, ids[i]) + m.removedapproval_requests[ids[i]] = struct{}{} + } +} + +// RemovedApprovalRequests returns the removed IDs of the "approval_requests" edge to the ApprovalRequest entity. +func (m *EventSubscriptionMutation) RemovedApprovalRequestsIDs() (ids []int) { + for id := range m.removedapproval_requests { + ids = append(ids, id) + } + return +} + +// ApprovalRequestsIDs returns the "approval_requests" edge IDs in the mutation. +func (m *EventSubscriptionMutation) ApprovalRequestsIDs() (ids []int) { + for id := range m.approval_requests { + ids = append(ids, id) + } + return +} + +// ResetApprovalRequests resets all changes to the "approval_requests" edge. +func (m *EventSubscriptionMutation) ResetApprovalRequests() { + m.approval_requests = nil + m.clearedapproval_requests = false + m.removedapproval_requests = nil +} + +// Where appends a list predicates to the EventSubscriptionMutation builder. +func (m *EventSubscriptionMutation) Where(ps ...predicate.EventSubscription) { + m.predicates = append(m.predicates, ps...) +} + +// WhereP appends storage-level predicates to the EventSubscriptionMutation builder. Using this method, +// users can use type-assertion to append predicates that do not depend on any generated package. +func (m *EventSubscriptionMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.EventSubscription, len(ps)) + for i := range ps { + p[i] = ps[i] + } + m.Where(p...) +} + +// Op returns the operation name. +func (m *EventSubscriptionMutation) Op() Op { + return m.op +} + +// SetOp allows setting the mutation operation. +func (m *EventSubscriptionMutation) SetOp(op Op) { + m.op = op +} + +// Type returns the node type of this mutation (EventSubscription). +func (m *EventSubscriptionMutation) Type() string { + return m.typ +} + +// Fields returns all fields that were changed during this mutation. Note that in +// order to get all numeric fields that were incremented/decremented, call +// AddedFields(). +func (m *EventSubscriptionMutation) Fields() []string { + fields := make([]string, 0, 10) + if m.created_at != nil { + fields = append(fields, eventsubscription.FieldCreatedAt) + } + if m.last_modified_at != nil { + fields = append(fields, eventsubscription.FieldLastModifiedAt) + } + if m.status_phase != nil { + fields = append(fields, eventsubscription.FieldStatusPhase) + } + if m.status_message != nil { + fields = append(fields, eventsubscription.FieldStatusMessage) + } + if m.environment != nil { + fields = append(fields, eventsubscription.FieldEnvironment) + } + if m.namespace != nil { + fields = append(fields, eventsubscription.FieldNamespace) + } + if m.name != nil { + fields = append(fields, eventsubscription.FieldName) + } + if m.event_type != nil { + fields = append(fields, eventsubscription.FieldEventType) + } + if m.delivery_type != nil { + fields = append(fields, eventsubscription.FieldDeliveryType) + } + if m.callback_url != nil { + fields = append(fields, eventsubscription.FieldCallbackURL) + } + return fields +} + +// Field returns the value of a field with the given name. The second boolean +// return value indicates that this field was not set, or was not defined in the +// schema. +func (m *EventSubscriptionMutation) Field(name string) (ent.Value, bool) { + switch name { + case eventsubscription.FieldCreatedAt: + return m.CreatedAt() + case eventsubscription.FieldLastModifiedAt: + return m.LastModifiedAt() + case eventsubscription.FieldStatusPhase: + return m.StatusPhase() + case eventsubscription.FieldStatusMessage: + return m.StatusMessage() + case eventsubscription.FieldEnvironment: + return m.Environment() + case eventsubscription.FieldNamespace: + return m.Namespace() + case eventsubscription.FieldName: + return m.Name() + case eventsubscription.FieldEventType: + return m.EventType() + case eventsubscription.FieldDeliveryType: + return m.DeliveryType() + case eventsubscription.FieldCallbackURL: + return m.CallbackURL() + } + return nil, false +} + +// OldField returns the old value of the field from the database. An error is +// returned if the mutation operation is not UpdateOne, or the query to the +// database failed. +func (m *EventSubscriptionMutation) OldField(ctx context.Context, name string) (ent.Value, error) { + switch name { + case eventsubscription.FieldCreatedAt: + return m.OldCreatedAt(ctx) + case eventsubscription.FieldLastModifiedAt: + return m.OldLastModifiedAt(ctx) + case eventsubscription.FieldStatusPhase: + return m.OldStatusPhase(ctx) + case eventsubscription.FieldStatusMessage: + return m.OldStatusMessage(ctx) + case eventsubscription.FieldEnvironment: + return m.OldEnvironment(ctx) + case eventsubscription.FieldNamespace: + return m.OldNamespace(ctx) + case eventsubscription.FieldName: + return m.OldName(ctx) + case eventsubscription.FieldEventType: + return m.OldEventType(ctx) + case eventsubscription.FieldDeliveryType: + return m.OldDeliveryType(ctx) + case eventsubscription.FieldCallbackURL: + return m.OldCallbackURL(ctx) } - return nil, fmt.Errorf("unknown ApprovalRequest field %s", name) + return nil, fmt.Errorf("unknown EventSubscription field %s", name) } // SetField sets the value of a field with the given name. It returns an error if // the field is not defined in the schema, or if the type mismatched the field // type. -func (m *ApprovalRequestMutation) SetField(name string, value ent.Value) error { +func (m *EventSubscriptionMutation) SetField(name string, value ent.Value) error { switch name { - case approvalrequest.FieldCreatedAt: + case eventsubscription.FieldCreatedAt: v, ok := value.(time.Time) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetCreatedAt(v) return nil - case approvalrequest.FieldLastModifiedAt: + case eventsubscription.FieldLastModifiedAt: v, ok := value.(time.Time) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetLastModifiedAt(v) return nil - case approvalrequest.FieldStatusPhase: - v, ok := value.(approvalrequest.StatusPhase) + case eventsubscription.FieldStatusPhase: + v, ok := value.(eventsubscription.StatusPhase) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetStatusPhase(v) return nil - case approvalrequest.FieldStatusMessage: + case eventsubscription.FieldStatusMessage: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetStatusMessage(v) return nil - case approvalrequest.FieldEnvironment: + case eventsubscription.FieldEnvironment: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetEnvironment(v) return nil - case approvalrequest.FieldNamespace: + case eventsubscription.FieldNamespace: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetNamespace(v) return nil - case approvalrequest.FieldAction: + case eventsubscription.FieldName: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetAction(v) - return nil - case approvalrequest.FieldStrategy: - v, ok := value.(approvalrequest.Strategy) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetStrategy(v) - return nil - case approvalrequest.FieldRequester: - v, ok := value.(model.RequesterInfo) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetRequester(v) - return nil - case approvalrequest.FieldDecider: - v, ok := value.(model.DeciderInfo) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetDecider(v) + m.SetName(v) return nil - case approvalrequest.FieldDeciderTeamName: + case eventsubscription.FieldEventType: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetDeciderTeamName(v) - return nil - case approvalrequest.FieldDecisions: - v, ok := value.([]model.Decision) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetDecisions(v) + m.SetEventType(v) return nil - case approvalrequest.FieldAvailableTransitions: - v, ok := value.([]model.AvailableTransition) + case eventsubscription.FieldDeliveryType: + v, ok := value.(eventsubscription.DeliveryType) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetAvailableTransitions(v) + m.SetDeliveryType(v) return nil - case approvalrequest.FieldName: + case eventsubscription.FieldCallbackURL: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetName(v) - return nil - case approvalrequest.FieldState: - v, ok := value.(approvalrequest.State) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetState(v) + m.SetCallbackURL(v) return nil } - return fmt.Errorf("unknown ApprovalRequest field %s", name) + return fmt.Errorf("unknown EventSubscription field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. -func (m *ApprovalRequestMutation) AddedFields() []string { +func (m *EventSubscriptionMutation) AddedFields() []string { return nil } // AddedField returns the numeric value that was incremented/decremented on a field // with the given name. The second boolean return value indicates that this field // was not set, or was not defined in the schema. -func (m *ApprovalRequestMutation) AddedField(name string) (ent.Value, bool) { +func (m *EventSubscriptionMutation) AddedField(name string) (ent.Value, bool) { return nil, false } // AddField adds the value to the field with the given name. It returns an error if // the field is not defined in the schema, or if the type mismatched the field // type. -func (m *ApprovalRequestMutation) AddField(name string, value ent.Value) error { +func (m *EventSubscriptionMutation) AddField(name string, value ent.Value) error { switch name { } - return fmt.Errorf("unknown ApprovalRequest numeric field %s", name) + return fmt.Errorf("unknown EventSubscription numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. -func (m *ApprovalRequestMutation) ClearedFields() []string { +func (m *EventSubscriptionMutation) ClearedFields() []string { var fields []string - if m.FieldCleared(approvalrequest.FieldStatusPhase) { - fields = append(fields, approvalrequest.FieldStatusPhase) + if m.FieldCleared(eventsubscription.FieldStatusPhase) { + fields = append(fields, eventsubscription.FieldStatusPhase) } - if m.FieldCleared(approvalrequest.FieldStatusMessage) { - fields = append(fields, approvalrequest.FieldStatusMessage) + if m.FieldCleared(eventsubscription.FieldStatusMessage) { + fields = append(fields, eventsubscription.FieldStatusMessage) } - if m.FieldCleared(approvalrequest.FieldEnvironment) { - fields = append(fields, approvalrequest.FieldEnvironment) + if m.FieldCleared(eventsubscription.FieldEnvironment) { + fields = append(fields, eventsubscription.FieldEnvironment) } - if m.FieldCleared(approvalrequest.FieldAvailableTransitions) { - fields = append(fields, approvalrequest.FieldAvailableTransitions) + if m.FieldCleared(eventsubscription.FieldCallbackURL) { + fields = append(fields, eventsubscription.FieldCallbackURL) } return fields } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. -func (m *ApprovalRequestMutation) FieldCleared(name string) bool { +func (m *EventSubscriptionMutation) FieldCleared(name string) bool { _, ok := m.clearedFields[name] return ok } // ClearField clears the value of the field with the given name. It returns an // error if the field is not defined in the schema. -func (m *ApprovalRequestMutation) ClearField(name string) error { +func (m *EventSubscriptionMutation) ClearField(name string) error { switch name { - case approvalrequest.FieldStatusPhase: + case eventsubscription.FieldStatusPhase: m.ClearStatusPhase() return nil - case approvalrequest.FieldStatusMessage: + case eventsubscription.FieldStatusMessage: m.ClearStatusMessage() return nil - case approvalrequest.FieldEnvironment: + case eventsubscription.FieldEnvironment: m.ClearEnvironment() return nil - case approvalrequest.FieldAvailableTransitions: - m.ClearAvailableTransitions() + case eventsubscription.FieldCallbackURL: + m.ClearCallbackURL() return nil } - return fmt.Errorf("unknown ApprovalRequest nullable field %s", name) + return fmt.Errorf("unknown EventSubscription nullable field %s", name) } // ResetField resets all changes in the mutation for the field with the given name. // It returns an error if the field is not defined in the schema. -func (m *ApprovalRequestMutation) ResetField(name string) error { +func (m *EventSubscriptionMutation) ResetField(name string) error { switch name { - case approvalrequest.FieldCreatedAt: + case eventsubscription.FieldCreatedAt: m.ResetCreatedAt() return nil - case approvalrequest.FieldLastModifiedAt: + case eventsubscription.FieldLastModifiedAt: m.ResetLastModifiedAt() return nil - case approvalrequest.FieldStatusPhase: + case eventsubscription.FieldStatusPhase: m.ResetStatusPhase() return nil - case approvalrequest.FieldStatusMessage: + case eventsubscription.FieldStatusMessage: m.ResetStatusMessage() return nil - case approvalrequest.FieldEnvironment: + case eventsubscription.FieldEnvironment: m.ResetEnvironment() return nil - case approvalrequest.FieldNamespace: + case eventsubscription.FieldNamespace: m.ResetNamespace() return nil - case approvalrequest.FieldAction: - m.ResetAction() - return nil - case approvalrequest.FieldStrategy: - m.ResetStrategy() - return nil - case approvalrequest.FieldRequester: - m.ResetRequester() - return nil - case approvalrequest.FieldDecider: - m.ResetDecider() - return nil - case approvalrequest.FieldDeciderTeamName: - m.ResetDeciderTeamName() - return nil - case approvalrequest.FieldDecisions: - m.ResetDecisions() + case eventsubscription.FieldName: + m.ResetName() return nil - case approvalrequest.FieldAvailableTransitions: - m.ResetAvailableTransitions() + case eventsubscription.FieldEventType: + m.ResetEventType() return nil - case approvalrequest.FieldName: - m.ResetName() + case eventsubscription.FieldDeliveryType: + m.ResetDeliveryType() return nil - case approvalrequest.FieldState: - m.ResetState() + case eventsubscription.FieldCallbackURL: + m.ResetCallbackURL() return nil } - return fmt.Errorf("unknown ApprovalRequest field %s", name) + return fmt.Errorf("unknown EventSubscription field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. -func (m *ApprovalRequestMutation) AddedEdges() []string { - edges := make([]string, 0, 1) - if m.api_subscription != nil { - edges = append(edges, approvalrequest.EdgeAPISubscription) +func (m *EventSubscriptionMutation) AddedEdges() []string { + edges := make([]string, 0, 4) + if m.owner != nil { + edges = append(edges, eventsubscription.EdgeOwner) + } + if m.target != nil { + edges = append(edges, eventsubscription.EdgeTarget) + } + if m.approval != nil { + edges = append(edges, eventsubscription.EdgeApproval) + } + if m.approval_requests != nil { + edges = append(edges, eventsubscription.EdgeApprovalRequests) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. -func (m *ApprovalRequestMutation) AddedIDs(name string) []ent.Value { +func (m *EventSubscriptionMutation) AddedIDs(name string) []ent.Value { switch name { - case approvalrequest.EdgeAPISubscription: - if id := m.api_subscription; id != nil { + case eventsubscription.EdgeOwner: + if id := m.owner; id != nil { + return []ent.Value{*id} + } + case eventsubscription.EdgeTarget: + if id := m.target; id != nil { + return []ent.Value{*id} + } + case eventsubscription.EdgeApproval: + if id := m.approval; id != nil { return []ent.Value{*id} } + case eventsubscription.EdgeApprovalRequests: + ids := make([]ent.Value, 0, len(m.approval_requests)) + for id := range m.approval_requests { + ids = append(ids, id) + } + return ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. -func (m *ApprovalRequestMutation) RemovedEdges() []string { - edges := make([]string, 0, 1) +func (m *EventSubscriptionMutation) RemovedEdges() []string { + edges := make([]string, 0, 4) + if m.removedapproval_requests != nil { + edges = append(edges, eventsubscription.EdgeApprovalRequests) + } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. -func (m *ApprovalRequestMutation) RemovedIDs(name string) []ent.Value { +func (m *EventSubscriptionMutation) RemovedIDs(name string) []ent.Value { + switch name { + case eventsubscription.EdgeApprovalRequests: + ids := make([]ent.Value, 0, len(m.removedapproval_requests)) + for id := range m.removedapproval_requests { + ids = append(ids, id) + } + return ids + } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. -func (m *ApprovalRequestMutation) ClearedEdges() []string { - edges := make([]string, 0, 1) - if m.clearedapi_subscription { - edges = append(edges, approvalrequest.EdgeAPISubscription) +func (m *EventSubscriptionMutation) ClearedEdges() []string { + edges := make([]string, 0, 4) + if m.clearedowner { + edges = append(edges, eventsubscription.EdgeOwner) + } + if m.clearedtarget { + edges = append(edges, eventsubscription.EdgeTarget) + } + if m.clearedapproval { + edges = append(edges, eventsubscription.EdgeApproval) + } + if m.clearedapproval_requests { + edges = append(edges, eventsubscription.EdgeApprovalRequests) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. -func (m *ApprovalRequestMutation) EdgeCleared(name string) bool { +func (m *EventSubscriptionMutation) EdgeCleared(name string) bool { switch name { - case approvalrequest.EdgeAPISubscription: - return m.clearedapi_subscription + case eventsubscription.EdgeOwner: + return m.clearedowner + case eventsubscription.EdgeTarget: + return m.clearedtarget + case eventsubscription.EdgeApproval: + return m.clearedapproval + case eventsubscription.EdgeApprovalRequests: + return m.clearedapproval_requests } return false } // ClearEdge clears the value of the edge with the given name. It returns an error // if that edge is not defined in the schema. -func (m *ApprovalRequestMutation) ClearEdge(name string) error { +func (m *EventSubscriptionMutation) ClearEdge(name string) error { switch name { - case approvalrequest.EdgeAPISubscription: - m.ClearAPISubscription() + case eventsubscription.EdgeOwner: + m.ClearOwner() + return nil + case eventsubscription.EdgeTarget: + m.ClearTarget() + return nil + case eventsubscription.EdgeApproval: + m.ClearApproval() return nil } - return fmt.Errorf("unknown ApprovalRequest unique edge %s", name) + return fmt.Errorf("unknown EventSubscription unique edge %s", name) } // ResetEdge resets all changes to the edge with the given name in this mutation. // It returns an error if the edge is not defined in the schema. -func (m *ApprovalRequestMutation) ResetEdge(name string) error { +func (m *EventSubscriptionMutation) ResetEdge(name string) error { switch name { - case approvalrequest.EdgeAPISubscription: - m.ResetAPISubscription() + case eventsubscription.EdgeOwner: + m.ResetOwner() + return nil + case eventsubscription.EdgeTarget: + m.ResetTarget() + return nil + case eventsubscription.EdgeApproval: + m.ResetApproval() + return nil + case eventsubscription.EdgeApprovalRequests: + m.ResetApprovalRequests() return nil } - return fmt.Errorf("unknown ApprovalRequest edge %s", name) + return fmt.Errorf("unknown EventSubscription edge %s", name) } // GroupMutation represents an operation that mutates the Group nodes in the graph. @@ -7485,7 +10249,7 @@ type TeamMutation struct { name *string email *string category *team.Category - rover_token_ref *string + team_token *string clearedFields map[string]struct{} group *int clearedgroup bool @@ -7961,53 +10725,53 @@ func (m *TeamMutation) ResetCategory() { m.category = nil } -// SetRoverTokenRef sets the "rover_token_ref" field. -func (m *TeamMutation) SetRoverTokenRef(s string) { - m.rover_token_ref = &s +// SetTeamToken sets the "team_token" field. +func (m *TeamMutation) SetTeamToken(s string) { + m.team_token = &s } -// RoverTokenRef returns the value of the "rover_token_ref" field in the mutation. -func (m *TeamMutation) RoverTokenRef() (r string, exists bool) { - v := m.rover_token_ref +// TeamToken returns the value of the "team_token" field in the mutation. +func (m *TeamMutation) TeamToken() (r string, exists bool) { + v := m.team_token if v == nil { return } return *v, true } -// OldRoverTokenRef returns the old "rover_token_ref" field's value of the Team entity. +// OldTeamToken returns the old "team_token" field's value of the Team entity. // If the Team object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *TeamMutation) OldRoverTokenRef(ctx context.Context) (v *string, err error) { +func (m *TeamMutation) OldTeamToken(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldRoverTokenRef is only allowed on UpdateOne operations") + return v, errors.New("OldTeamToken is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldRoverTokenRef requires an ID field in the mutation") + return v, errors.New("OldTeamToken requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldRoverTokenRef: %w", err) + return v, fmt.Errorf("querying old value for OldTeamToken: %w", err) } - return oldValue.RoverTokenRef, nil + return oldValue.TeamToken, nil } -// ClearRoverTokenRef clears the value of the "rover_token_ref" field. -func (m *TeamMutation) ClearRoverTokenRef() { - m.rover_token_ref = nil - m.clearedFields[team.FieldRoverTokenRef] = struct{}{} +// ClearTeamToken clears the value of the "team_token" field. +func (m *TeamMutation) ClearTeamToken() { + m.team_token = nil + m.clearedFields[team.FieldTeamToken] = struct{}{} } -// RoverTokenRefCleared returns if the "rover_token_ref" field was cleared in this mutation. -func (m *TeamMutation) RoverTokenRefCleared() bool { - _, ok := m.clearedFields[team.FieldRoverTokenRef] +// TeamTokenCleared returns if the "team_token" field was cleared in this mutation. +func (m *TeamMutation) TeamTokenCleared() bool { + _, ok := m.clearedFields[team.FieldTeamToken] return ok } -// ResetRoverTokenRef resets all changes to the "rover_token_ref" field. -func (m *TeamMutation) ResetRoverTokenRef() { - m.rover_token_ref = nil - delete(m.clearedFields, team.FieldRoverTokenRef) +// ResetTeamToken resets all changes to the "team_token" field. +func (m *TeamMutation) ResetTeamToken() { + m.team_token = nil + delete(m.clearedFields, team.FieldTeamToken) } // SetGroupID sets the "group" edge to the Group entity by id. @@ -8219,8 +10983,8 @@ func (m *TeamMutation) Fields() []string { if m.category != nil { fields = append(fields, team.FieldCategory) } - if m.rover_token_ref != nil { - fields = append(fields, team.FieldRoverTokenRef) + if m.team_token != nil { + fields = append(fields, team.FieldTeamToken) } return fields } @@ -8248,8 +11012,8 @@ func (m *TeamMutation) Field(name string) (ent.Value, bool) { return m.Email() case team.FieldCategory: return m.Category() - case team.FieldRoverTokenRef: - return m.RoverTokenRef() + case team.FieldTeamToken: + return m.TeamToken() } return nil, false } @@ -8277,8 +11041,8 @@ func (m *TeamMutation) OldField(ctx context.Context, name string) (ent.Value, er return m.OldEmail(ctx) case team.FieldCategory: return m.OldCategory(ctx) - case team.FieldRoverTokenRef: - return m.OldRoverTokenRef(ctx) + case team.FieldTeamToken: + return m.OldTeamToken(ctx) } return nil, fmt.Errorf("unknown Team field %s", name) } @@ -8351,12 +11115,12 @@ func (m *TeamMutation) SetField(name string, value ent.Value) error { } m.SetCategory(v) return nil - case team.FieldRoverTokenRef: + case team.FieldTeamToken: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetRoverTokenRef(v) + m.SetTeamToken(v) return nil } return fmt.Errorf("unknown Team field %s", name) @@ -8397,8 +11161,8 @@ func (m *TeamMutation) ClearedFields() []string { if m.FieldCleared(team.FieldEnvironment) { fields = append(fields, team.FieldEnvironment) } - if m.FieldCleared(team.FieldRoverTokenRef) { - fields = append(fields, team.FieldRoverTokenRef) + if m.FieldCleared(team.FieldTeamToken) { + fields = append(fields, team.FieldTeamToken) } return fields } @@ -8423,8 +11187,8 @@ func (m *TeamMutation) ClearField(name string) error { case team.FieldEnvironment: m.ClearEnvironment() return nil - case team.FieldRoverTokenRef: - m.ClearRoverTokenRef() + case team.FieldTeamToken: + m.ClearTeamToken() return nil } return fmt.Errorf("unknown Team nullable field %s", name) @@ -8461,8 +11225,8 @@ func (m *TeamMutation) ResetField(name string) error { case team.FieldCategory: m.ResetCategory() return nil - case team.FieldRoverTokenRef: - m.ResetRoverTokenRef() + case team.FieldTeamToken: + m.ResetTeamToken() return nil } return fmt.Errorf("unknown Team field %s", name) @@ -8605,6 +11369,7 @@ type ZoneMutation struct { environment *string name *string gateway_url *string + issuer_url *string visibility *zone.Visibility clearedFields map[string]struct{} applications map[int]struct{} @@ -8847,6 +11612,55 @@ func (m *ZoneMutation) ResetGatewayURL() { delete(m.clearedFields, zone.FieldGatewayURL) } +// SetIssuerURL sets the "issuer_url" field. +func (m *ZoneMutation) SetIssuerURL(s string) { + m.issuer_url = &s +} + +// IssuerURL returns the value of the "issuer_url" field in the mutation. +func (m *ZoneMutation) IssuerURL() (r string, exists bool) { + v := m.issuer_url + if v == nil { + return + } + return *v, true +} + +// OldIssuerURL returns the old "issuer_url" field's value of the Zone entity. +// If the Zone object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *ZoneMutation) OldIssuerURL(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldIssuerURL is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldIssuerURL requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldIssuerURL: %w", err) + } + return oldValue.IssuerURL, nil +} + +// ClearIssuerURL clears the value of the "issuer_url" field. +func (m *ZoneMutation) ClearIssuerURL() { + m.issuer_url = nil + m.clearedFields[zone.FieldIssuerURL] = struct{}{} +} + +// IssuerURLCleared returns if the "issuer_url" field was cleared in this mutation. +func (m *ZoneMutation) IssuerURLCleared() bool { + _, ok := m.clearedFields[zone.FieldIssuerURL] + return ok +} + +// ResetIssuerURL resets all changes to the "issuer_url" field. +func (m *ZoneMutation) ResetIssuerURL() { + m.issuer_url = nil + delete(m.clearedFields, zone.FieldIssuerURL) +} + // SetVisibility sets the "visibility" field. func (m *ZoneMutation) SetVisibility(z zone.Visibility) { m.visibility = &z @@ -8971,7 +11785,7 @@ func (m *ZoneMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *ZoneMutation) Fields() []string { - fields := make([]string, 0, 4) + fields := make([]string, 0, 5) if m.environment != nil { fields = append(fields, zone.FieldEnvironment) } @@ -8981,6 +11795,9 @@ func (m *ZoneMutation) Fields() []string { if m.gateway_url != nil { fields = append(fields, zone.FieldGatewayURL) } + if m.issuer_url != nil { + fields = append(fields, zone.FieldIssuerURL) + } if m.visibility != nil { fields = append(fields, zone.FieldVisibility) } @@ -8998,6 +11815,8 @@ func (m *ZoneMutation) Field(name string) (ent.Value, bool) { return m.Name() case zone.FieldGatewayURL: return m.GatewayURL() + case zone.FieldIssuerURL: + return m.IssuerURL() case zone.FieldVisibility: return m.Visibility() } @@ -9015,6 +11834,8 @@ func (m *ZoneMutation) OldField(ctx context.Context, name string) (ent.Value, er return m.OldName(ctx) case zone.FieldGatewayURL: return m.OldGatewayURL(ctx) + case zone.FieldIssuerURL: + return m.OldIssuerURL(ctx) case zone.FieldVisibility: return m.OldVisibility(ctx) } @@ -9047,6 +11868,13 @@ func (m *ZoneMutation) SetField(name string, value ent.Value) error { } m.SetGatewayURL(v) return nil + case zone.FieldIssuerURL: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetIssuerURL(v) + return nil case zone.FieldVisibility: v, ok := value.(zone.Visibility) if !ok { @@ -9090,6 +11918,9 @@ func (m *ZoneMutation) ClearedFields() []string { if m.FieldCleared(zone.FieldGatewayURL) { fields = append(fields, zone.FieldGatewayURL) } + if m.FieldCleared(zone.FieldIssuerURL) { + fields = append(fields, zone.FieldIssuerURL) + } return fields } @@ -9110,6 +11941,9 @@ func (m *ZoneMutation) ClearField(name string) error { case zone.FieldGatewayURL: m.ClearGatewayURL() return nil + case zone.FieldIssuerURL: + m.ClearIssuerURL() + return nil } return fmt.Errorf("unknown Zone nullable field %s", name) } @@ -9127,6 +11961,9 @@ func (m *ZoneMutation) ResetField(name string) error { case zone.FieldGatewayURL: m.ResetGatewayURL() return nil + case zone.FieldIssuerURL: + m.ResetIssuerURL() + return nil case zone.FieldVisibility: m.ResetVisibility() return nil diff --git a/controlplane-api/ent/predicate/predicate.go b/controlplane-api/ent/predicate/predicate.go index bad17143e..351f33662 100644 --- a/controlplane-api/ent/predicate/predicate.go +++ b/controlplane-api/ent/predicate/predicate.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package predicate @@ -25,6 +24,12 @@ type Approval func(*sql.Selector) // ApprovalRequest is the predicate function for approvalrequest builders. type ApprovalRequest func(*sql.Selector) +// EventExposure is the predicate function for eventexposure builders. +type EventExposure func(*sql.Selector) + +// EventSubscription is the predicate function for eventsubscription builders. +type EventSubscription func(*sql.Selector) + // Group is the predicate function for group builders. type Group func(*sql.Selector) diff --git a/controlplane-api/ent/privacy/privacy.go b/controlplane-api/ent/privacy/privacy.go index bd65589cb..fb2b00a08 100644 --- a/controlplane-api/ent/privacy/privacy.go +++ b/controlplane-api/ent/privacy/privacy.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package privacy @@ -234,6 +233,54 @@ func (f ApprovalRequestMutationRuleFunc) EvalMutation(ctx context.Context, m ent return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ApprovalRequestMutation", m) } +// The EventExposureQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type EventExposureQueryRuleFunc func(context.Context, *ent.EventExposureQuery) error + +// EvalQuery return f(ctx, q). +func (f EventExposureQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.EventExposureQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.EventExposureQuery", q) +} + +// The EventExposureMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type EventExposureMutationRuleFunc func(context.Context, *ent.EventExposureMutation) error + +// EvalMutation calls f(ctx, m). +func (f EventExposureMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.EventExposureMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.EventExposureMutation", m) +} + +// The EventSubscriptionQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type EventSubscriptionQueryRuleFunc func(context.Context, *ent.EventSubscriptionQuery) error + +// EvalQuery return f(ctx, q). +func (f EventSubscriptionQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.EventSubscriptionQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.EventSubscriptionQuery", q) +} + +// The EventSubscriptionMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type EventSubscriptionMutationRuleFunc func(context.Context, *ent.EventSubscriptionMutation) error + +// EvalMutation calls f(ctx, m). +func (f EventSubscriptionMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.EventSubscriptionMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.EventSubscriptionMutation", m) +} + // The GroupQueryRuleFunc type is an adapter to allow the use of ordinary // functions as a query rule. type GroupQueryRuleFunc func(context.Context, *ent.GroupQuery) error diff --git a/controlplane-api/ent/runtime.go b/controlplane-api/ent/runtime.go index 22e328c54..2c077241d 100644 --- a/controlplane-api/ent/runtime.go +++ b/controlplane-api/ent/runtime.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/runtime/runtime.go b/controlplane-api/ent/runtime/runtime.go index f03f3d21e..94af5da4f 100644 --- a/controlplane-api/ent/runtime/runtime.go +++ b/controlplane-api/ent/runtime/runtime.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package runtime @@ -15,6 +14,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/schema" @@ -164,6 +165,10 @@ func init() { applicationDescClientSecret := applicationFields[2].Descriptor() // application.ClientSecretValidator is a validator for the "client_secret" field. It is called by the builders before save. application.ClientSecretValidator = applicationDescClientSecret.Validators[0].(func(string) error) + // applicationDescRotatedClientSecret is the schema descriptor for rotated_client_secret field. + applicationDescRotatedClientSecret := applicationFields[3].Descriptor() + // application.RotatedClientSecretValidator is a validator for the "rotated_client_secret" field. It is called by the builders before save. + application.RotatedClientSecretValidator = applicationDescRotatedClientSecret.Validators[0].(func(string) error) approvalMixin := schema.Approval{}.Mixin() approval.Policy = privacy.NewPolicies(approvalMixin[0], schema.Approval{}) approval.Hooks[0] = func(next ent.Mutator) ent.Mutator { @@ -260,6 +265,86 @@ func init() { approvalrequestDescName := approvalrequestFields[0].Descriptor() // approvalrequest.NameValidator is a validator for the "name" field. It is called by the builders before save. approvalrequest.NameValidator = approvalrequestDescName.Validators[0].(func(string) error) + eventexposureMixin := schema.EventExposure{}.Mixin() + eventexposure.Policy = privacy.NewPolicies(eventexposureMixin[0], schema.EventExposure{}) + eventexposure.Hooks[0] = func(next ent.Mutator) ent.Mutator { + return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if err := eventexposure.Policy.EvalMutation(ctx, m); err != nil { + return nil, err + } + return next.Mutate(ctx, m) + }) + } + eventexposureMixinFields1 := eventexposureMixin[1].Fields() + _ = eventexposureMixinFields1 + eventexposureMixinFields4 := eventexposureMixin[4].Fields() + _ = eventexposureMixinFields4 + eventexposureFields := schema.EventExposure{}.Fields() + _ = eventexposureFields + // eventexposureDescCreatedAt is the schema descriptor for created_at field. + eventexposureDescCreatedAt := eventexposureMixinFields1[0].Descriptor() + // eventexposure.DefaultCreatedAt holds the default value on creation for the created_at field. + eventexposure.DefaultCreatedAt = eventexposureDescCreatedAt.Default.(func() time.Time) + // eventexposureDescLastModifiedAt is the schema descriptor for last_modified_at field. + eventexposureDescLastModifiedAt := eventexposureMixinFields1[1].Descriptor() + // eventexposure.DefaultLastModifiedAt holds the default value on creation for the last_modified_at field. + eventexposure.DefaultLastModifiedAt = eventexposureDescLastModifiedAt.Default.(func() time.Time) + // eventexposure.UpdateDefaultLastModifiedAt holds the default value on update for the last_modified_at field. + eventexposure.UpdateDefaultLastModifiedAt = eventexposureDescLastModifiedAt.UpdateDefault.(func() time.Time) + // eventexposureDescNamespace is the schema descriptor for namespace field. + eventexposureDescNamespace := eventexposureMixinFields4[0].Descriptor() + // eventexposure.NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. + eventexposure.NamespaceValidator = eventexposureDescNamespace.Validators[0].(func(string) error) + // eventexposureDescEventType is the schema descriptor for event_type field. + eventexposureDescEventType := eventexposureFields[0].Descriptor() + // eventexposure.EventTypeValidator is a validator for the "event_type" field. It is called by the builders before save. + eventexposure.EventTypeValidator = eventexposureDescEventType.Validators[0].(func(string) error) + // eventexposureDescActive is the schema descriptor for active field. + eventexposureDescActive := eventexposureFields[2].Descriptor() + // eventexposure.DefaultActive holds the default value on creation for the active field. + eventexposure.DefaultActive = eventexposureDescActive.Default.(bool) + // eventexposureDescApprovalConfig is the schema descriptor for approval_config field. + eventexposureDescApprovalConfig := eventexposureFields[3].Descriptor() + // eventexposure.DefaultApprovalConfig holds the default value on creation for the approval_config field. + eventexposure.DefaultApprovalConfig = eventexposureDescApprovalConfig.Default.(model.ApprovalConfig) + eventsubscriptionMixin := schema.EventSubscription{}.Mixin() + eventsubscription.Policy = privacy.NewPolicies(eventsubscriptionMixin[0], schema.EventSubscription{}) + eventsubscription.Hooks[0] = func(next ent.Mutator) ent.Mutator { + return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if err := eventsubscription.Policy.EvalMutation(ctx, m); err != nil { + return nil, err + } + return next.Mutate(ctx, m) + }) + } + eventsubscriptionMixinFields1 := eventsubscriptionMixin[1].Fields() + _ = eventsubscriptionMixinFields1 + eventsubscriptionMixinFields4 := eventsubscriptionMixin[4].Fields() + _ = eventsubscriptionMixinFields4 + eventsubscriptionFields := schema.EventSubscription{}.Fields() + _ = eventsubscriptionFields + // eventsubscriptionDescCreatedAt is the schema descriptor for created_at field. + eventsubscriptionDescCreatedAt := eventsubscriptionMixinFields1[0].Descriptor() + // eventsubscription.DefaultCreatedAt holds the default value on creation for the created_at field. + eventsubscription.DefaultCreatedAt = eventsubscriptionDescCreatedAt.Default.(func() time.Time) + // eventsubscriptionDescLastModifiedAt is the schema descriptor for last_modified_at field. + eventsubscriptionDescLastModifiedAt := eventsubscriptionMixinFields1[1].Descriptor() + // eventsubscription.DefaultLastModifiedAt holds the default value on creation for the last_modified_at field. + eventsubscription.DefaultLastModifiedAt = eventsubscriptionDescLastModifiedAt.Default.(func() time.Time) + // eventsubscription.UpdateDefaultLastModifiedAt holds the default value on update for the last_modified_at field. + eventsubscription.UpdateDefaultLastModifiedAt = eventsubscriptionDescLastModifiedAt.UpdateDefault.(func() time.Time) + // eventsubscriptionDescNamespace is the schema descriptor for namespace field. + eventsubscriptionDescNamespace := eventsubscriptionMixinFields4[0].Descriptor() + // eventsubscription.NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. + eventsubscription.NamespaceValidator = eventsubscriptionDescNamespace.Validators[0].(func(string) error) + // eventsubscriptionDescName is the schema descriptor for name field. + eventsubscriptionDescName := eventsubscriptionMixinFields4[1].Descriptor() + // eventsubscription.NameValidator is a validator for the "name" field. It is called by the builders before save. + eventsubscription.NameValidator = eventsubscriptionDescName.Validators[0].(func(string) error) + // eventsubscriptionDescEventType is the schema descriptor for event_type field. + eventsubscriptionDescEventType := eventsubscriptionFields[0].Descriptor() + // eventsubscription.EventTypeValidator is a validator for the "event_type" field. It is called by the builders before save. + eventsubscription.EventTypeValidator = eventsubscriptionDescEventType.Validators[0].(func(string) error) groupMixin := schema.Group{}.Mixin() group.Policy = privacy.NewPolicies(groupMixin[0], schema.Group{}) group.Hooks[0] = func(next ent.Mutator) ent.Mutator { @@ -367,6 +452,6 @@ func init() { } const ( - Version = "v0.14.5" // Version of ent codegen. - Sum = "h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=" // Sum of ent codegen. + Version = "v0.14.6" // Version of ent codegen. + Sum = "h1:/f2696BpwuWAEEG6PVGWflg6+Inrpq4pRWuNlWz/Skk=" // Sum of ent codegen. ) diff --git a/controlplane-api/ent/schema/api_subscription.go b/controlplane-api/ent/schema/api_subscription.go index 9eee6a20c..20ccadb8a 100644 --- a/controlplane-api/ent/schema/api_subscription.go +++ b/controlplane-api/ent/schema/api_subscription.go @@ -7,6 +7,7 @@ package schema import ( "entgo.io/contrib/entgql" "entgo.io/ent" + "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" @@ -60,7 +61,8 @@ func (ApiSubscription) Edges() []ent.Edge { edge.To("failover_zones", Zone.Type), edge.To("approval", Approval.Type). Unique(), - edge.To("approval_requests", ApprovalRequest.Type), + edge.To("approval_requests", ApprovalRequest.Type). + Annotations(entsql.OnDelete(entsql.Cascade)), } } diff --git a/controlplane-api/ent/schema/application.go b/controlplane-api/ent/schema/application.go index ad8b06b64..8710e38ee 100644 --- a/controlplane-api/ent/schema/application.go +++ b/controlplane-api/ent/schema/application.go @@ -42,8 +42,23 @@ func (Application) Fields() []ent.Field { field.Text("client_secret"). Optional(). Nillable(). - NotEmpty(), - field.Text("issuer_url"). + NotEmpty(). + Annotations(entgql.Skip(entgql.SkipWhereInput)), + field.Text("rotated_client_secret"). + Optional(). + Nillable(). + NotEmpty(). + Annotations(entgql.Skip(entgql.SkipWhereInput)), + field.Time("rotated_expires_at"). + Optional(). + Nillable(), + field.Time("current_expires_at"). + Optional(). + Nillable(), + field.Enum("secret_rotation_phase"). + Values("DONE", "ROTATING", "GRACE_PERIOD_ACTIVE", "GRACE_PERIOD_EXPIRING", "FAILED"). + Default("DONE"), + field.Text("secret_rotation_message"). Optional(). Nillable(), } @@ -64,6 +79,10 @@ func (Application) Edges() []ent.Edge { Annotations(entgql.RelayConnection()), edge.To("subscribed_apis", ApiSubscription.Type). Annotations(entgql.RelayConnection()), + edge.To("exposed_events", EventExposure.Type). + Annotations(entgql.RelayConnection()), + edge.To("subscribed_events", EventSubscription.Type). + Annotations(entgql.RelayConnection()), } } diff --git a/controlplane-api/ent/schema/approval.go b/controlplane-api/ent/schema/approval.go index 4f9d6b09f..250940a5b 100644 --- a/controlplane-api/ent/schema/approval.go +++ b/controlplane-api/ent/schema/approval.go @@ -60,6 +60,10 @@ func (Approval) Edges() []ent.Edge { Ref("approval"). Unique(). Annotations(entgql.Skip(entgql.SkipType)), + edge.From("event_subscription", EventSubscription.Type). + Ref("approval"). + Unique(). + Annotations(entgql.Skip(entgql.SkipType)), } } diff --git a/controlplane-api/ent/schema/approval_request.go b/controlplane-api/ent/schema/approval_request.go index 49677a06b..2412aea7d 100644 --- a/controlplane-api/ent/schema/approval_request.go +++ b/controlplane-api/ent/schema/approval_request.go @@ -58,6 +58,10 @@ func (ApprovalRequest) Edges() []ent.Edge { Ref("approval_requests"). Unique(). Annotations(entgql.Skip(entgql.SkipType)), + edge.From("event_subscription", EventSubscription.Type). + Ref("approval_requests"). + Unique(). + Annotations(entgql.Skip(entgql.SkipType)), } } diff --git a/controlplane-api/ent/schema/event_exposure.go b/controlplane-api/ent/schema/event_exposure.go new file mode 100644 index 000000000..02d4f1e76 --- /dev/null +++ b/controlplane-api/ent/schema/event_exposure.go @@ -0,0 +1,78 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package schema + +import ( + "entgo.io/contrib/entgql" + "entgo.io/ent" + "entgo.io/ent/schema" + "entgo.io/ent/schema/edge" + "entgo.io/ent/schema/field" + "entgo.io/ent/schema/index" + + schemamixin "github.com/telekom/controlplane/controlplane-api/ent/schema/mixin" + "github.com/telekom/controlplane/controlplane-api/pkg/model" +) + +// EventExposure holds the schema definition for an exposed event. +type EventExposure struct { + ent.Schema +} + +func (EventExposure) Mixin() []ent.Mixin { + return []ent.Mixin{ + schemamixin.PrivacyMixin{}, + schemamixin.TimestampsMixin{}, + schemamixin.StatusMixin{}, + schemamixin.EnvironmentMixin{}, + schemamixin.NamespaceMixin{}, + } +} + +func (EventExposure) Fields() []ent.Field { + return []ent.Field{ + field.Text("event_type"). + NotEmpty(), + field.Enum("visibility"). + NamedValues( + "World", "WORLD", + "Zone", "ZONE", + "Enterprise", "ENTERPRISE", + ). + Default("ENTERPRISE"), + field.Bool("active"). + Optional(). + Nillable(). + Default(false), + field.JSON("approval_config", model.ApprovalConfig{}). + Default(model.ApprovalConfig{Strategy: "AUTO"}). + Annotations(entgql.Type("ApprovalConfig"), entgql.Skip(entgql.SkipWhereInput)), + } +} + +func (EventExposure) Edges() []ent.Edge { + return []ent.Edge{ + edge.From("owner", Application.Type). + Ref("exposed_events"). + Required(). + Unique(), + edge.From("subscriptions", EventSubscription.Type). + Ref("target"). + Annotations(entgql.Skip(entgql.SkipType)), + } +} + +func (EventExposure) Annotations() []schema.Annotation { + return []schema.Annotation{ + entgql.QueryField(), + entgql.RelayConnection(), + } +} + +func (EventExposure) Indexes() []ent.Index { + return []ent.Index{ + index.Fields("event_type").Edges("owner").Unique(), + } +} diff --git a/controlplane-api/ent/schema/event_subscription.go b/controlplane-api/ent/schema/event_subscription.go new file mode 100644 index 000000000..8f3c7c036 --- /dev/null +++ b/controlplane-api/ent/schema/event_subscription.go @@ -0,0 +1,77 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package schema + +import ( + "entgo.io/contrib/entgql" + "entgo.io/ent" + "entgo.io/ent/dialect/entsql" + "entgo.io/ent/schema" + "entgo.io/ent/schema/edge" + "entgo.io/ent/schema/field" + "entgo.io/ent/schema/index" + + schemamixin "github.com/telekom/controlplane/controlplane-api/ent/schema/mixin" +) + +// EventSubscription holds the schema definition for an event subscription. +type EventSubscription struct { + ent.Schema +} + +func (EventSubscription) Mixin() []ent.Mixin { + return []ent.Mixin{ + schemamixin.PrivacyMixin{}, + schemamixin.TimestampsMixin{}, + schemamixin.StatusMixin{}, + schemamixin.EnvironmentMixin{}, + schemamixin.MetadataMixin{}, + } +} + +func (EventSubscription) Fields() []ent.Field { + return []ent.Field{ + field.Text("event_type"). + NotEmpty(), + field.Enum("delivery_type"). + NamedValues( + "Callback", "CALLBACK", + "ServerSentEvent", "SERVER_SENT_EVENT", + ). + Default("CALLBACK"), + field.Text("callback_url"). + Optional(). + Nillable(), + } +} + +func (EventSubscription) Edges() []ent.Edge { + return []ent.Edge{ + edge.From("owner", Application.Type). + Ref("subscribed_events"). + Required(). + Unique(), + edge.To("target", EventExposure.Type). + Unique(). + Annotations(entgql.Skip(entgql.SkipType)), + edge.To("approval", Approval.Type). + Unique(), + edge.To("approval_requests", ApprovalRequest.Type). + Annotations(entsql.OnDelete(entsql.Cascade)), + } +} + +func (EventSubscription) Annotations() []schema.Annotation { + return []schema.Annotation{ + entgql.QueryField(), + entgql.RelayConnection(), + } +} + +func (EventSubscription) Indexes() []ent.Index { + return []ent.Index{ + index.Fields("event_type").Edges("owner").Unique(), + } +} diff --git a/controlplane-api/ent/schema/team.go b/controlplane-api/ent/schema/team.go index 160a83dba..7a9802f96 100644 --- a/controlplane-api/ent/schema/team.go +++ b/controlplane-api/ent/schema/team.go @@ -43,7 +43,7 @@ func (Team) Fields() []ent.Field { "Infrastructure", "INFRASTRUCTURE", ). Default("CUSTOMER"), - field.Text("rover_token_ref"). + field.Text("team_token"). Optional(). Nillable(), } diff --git a/controlplane-api/ent/schema/zone.go b/controlplane-api/ent/schema/zone.go index f2e11634e..51959befa 100644 --- a/controlplane-api/ent/schema/zone.go +++ b/controlplane-api/ent/schema/zone.go @@ -34,6 +34,9 @@ func (Zone) Fields() []ent.Field { field.Text("gateway_url"). Optional(). Nillable(), + field.Text("issuer_url"). + Optional(). + Nillable(), field.Enum("visibility"). NamedValues( "World", "WORLD", diff --git a/controlplane-api/ent/team.go b/controlplane-api/ent/team.go index 4d119bb78..dfae8ac09 100644 --- a/controlplane-api/ent/team.go +++ b/controlplane-api/ent/team.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -40,8 +39,8 @@ type Team struct { Email string `json:"email,omitempty"` // Category holds the value of the "category" field. Category team.Category `json:"category,omitempty"` - // RoverTokenRef holds the value of the "rover_token_ref" field. - RoverTokenRef *string `json:"rover_token_ref,omitempty"` + // TeamToken holds the value of the "team_token" field. + TeamToken *string `json:"team_token,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the TeamQuery when eager-loading is set. Edges TeamEdges `json:"edges"` @@ -103,7 +102,7 @@ func (*Team) scanValues(columns []string) ([]any, error) { switch columns[i] { case team.FieldID: values[i] = new(sql.NullInt64) - case team.FieldStatusPhase, team.FieldStatusMessage, team.FieldEnvironment, team.FieldNamespace, team.FieldName, team.FieldEmail, team.FieldCategory, team.FieldRoverTokenRef: + case team.FieldStatusPhase, team.FieldStatusMessage, team.FieldEnvironment, team.FieldNamespace, team.FieldName, team.FieldEmail, team.FieldCategory, team.FieldTeamToken: values[i] = new(sql.NullString) case team.FieldCreatedAt, team.FieldLastModifiedAt: values[i] = new(sql.NullTime) @@ -187,12 +186,12 @@ func (_m *Team) assignValues(columns []string, values []any) error { } else if value.Valid { _m.Category = team.Category(value.String) } - case team.FieldRoverTokenRef: + case team.FieldTeamToken: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field rover_token_ref", values[i]) + return fmt.Errorf("unexpected type %T for field team_token", values[i]) } else if value.Valid { - _m.RoverTokenRef = new(string) - *_m.RoverTokenRef = value.String + _m.TeamToken = new(string) + *_m.TeamToken = value.String } case team.ForeignKeys[0]: if value, ok := values[i].(*sql.NullInt64); !ok { @@ -285,8 +284,8 @@ func (_m *Team) String() string { builder.WriteString("category=") builder.WriteString(fmt.Sprintf("%v", _m.Category)) builder.WriteString(", ") - if v := _m.RoverTokenRef; v != nil { - builder.WriteString("rover_token_ref=") + if v := _m.TeamToken; v != nil { + builder.WriteString("team_token=") builder.WriteString(*v) } builder.WriteByte(')') diff --git a/controlplane-api/ent/team/team.go b/controlplane-api/ent/team/team.go index 07d5a5dbc..1bc8b9c3e 100644 --- a/controlplane-api/ent/team/team.go +++ b/controlplane-api/ent/team/team.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package team @@ -40,8 +39,8 @@ const ( FieldEmail = "email" // FieldCategory holds the string denoting the category field in the database. FieldCategory = "category" - // FieldRoverTokenRef holds the string denoting the rover_token_ref field in the database. - FieldRoverTokenRef = "rover_token_ref" + // FieldTeamToken holds the string denoting the team_token field in the database. + FieldTeamToken = "team_token" // EdgeGroup holds the string denoting the group edge name in mutations. EdgeGroup = "group" // EdgeMembers holds the string denoting the members edge name in mutations. @@ -85,7 +84,7 @@ var Columns = []string{ FieldName, FieldEmail, FieldCategory, - FieldRoverTokenRef, + FieldTeamToken, } // ForeignKeys holds the SQL foreign-keys that are owned by the "teams" @@ -235,9 +234,9 @@ func ByCategory(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCategory, opts...).ToFunc() } -// ByRoverTokenRef orders the results by the rover_token_ref field. -func ByRoverTokenRef(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldRoverTokenRef, opts...).ToFunc() +// ByTeamToken orders the results by the team_token field. +func ByTeamToken(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTeamToken, opts...).ToFunc() } // ByGroupField orders the results by group field. diff --git a/controlplane-api/ent/team/where.go b/controlplane-api/ent/team/where.go index 12a1337a8..b58e5bd59 100644 --- a/controlplane-api/ent/team/where.go +++ b/controlplane-api/ent/team/where.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package team @@ -94,9 +93,9 @@ func Email(v string) predicate.Team { return predicate.Team(sql.FieldEQ(FieldEmail, v)) } -// RoverTokenRef applies equality check predicate on the "rover_token_ref" field. It's identical to RoverTokenRefEQ. -func RoverTokenRef(v string) predicate.Team { - return predicate.Team(sql.FieldEQ(FieldRoverTokenRef, v)) +// TeamToken applies equality check predicate on the "team_token" field. It's identical to TeamTokenEQ. +func TeamToken(v string) predicate.Team { + return predicate.Team(sql.FieldEQ(FieldTeamToken, v)) } // CreatedAtEQ applies the EQ predicate on the "created_at" field. @@ -574,79 +573,79 @@ func CategoryNotIn(vs ...Category) predicate.Team { return predicate.Team(sql.FieldNotIn(FieldCategory, vs...)) } -// RoverTokenRefEQ applies the EQ predicate on the "rover_token_ref" field. -func RoverTokenRefEQ(v string) predicate.Team { - return predicate.Team(sql.FieldEQ(FieldRoverTokenRef, v)) +// TeamTokenEQ applies the EQ predicate on the "team_token" field. +func TeamTokenEQ(v string) predicate.Team { + return predicate.Team(sql.FieldEQ(FieldTeamToken, v)) } -// RoverTokenRefNEQ applies the NEQ predicate on the "rover_token_ref" field. -func RoverTokenRefNEQ(v string) predicate.Team { - return predicate.Team(sql.FieldNEQ(FieldRoverTokenRef, v)) +// TeamTokenNEQ applies the NEQ predicate on the "team_token" field. +func TeamTokenNEQ(v string) predicate.Team { + return predicate.Team(sql.FieldNEQ(FieldTeamToken, v)) } -// RoverTokenRefIn applies the In predicate on the "rover_token_ref" field. -func RoverTokenRefIn(vs ...string) predicate.Team { - return predicate.Team(sql.FieldIn(FieldRoverTokenRef, vs...)) +// TeamTokenIn applies the In predicate on the "team_token" field. +func TeamTokenIn(vs ...string) predicate.Team { + return predicate.Team(sql.FieldIn(FieldTeamToken, vs...)) } -// RoverTokenRefNotIn applies the NotIn predicate on the "rover_token_ref" field. -func RoverTokenRefNotIn(vs ...string) predicate.Team { - return predicate.Team(sql.FieldNotIn(FieldRoverTokenRef, vs...)) +// TeamTokenNotIn applies the NotIn predicate on the "team_token" field. +func TeamTokenNotIn(vs ...string) predicate.Team { + return predicate.Team(sql.FieldNotIn(FieldTeamToken, vs...)) } -// RoverTokenRefGT applies the GT predicate on the "rover_token_ref" field. -func RoverTokenRefGT(v string) predicate.Team { - return predicate.Team(sql.FieldGT(FieldRoverTokenRef, v)) +// TeamTokenGT applies the GT predicate on the "team_token" field. +func TeamTokenGT(v string) predicate.Team { + return predicate.Team(sql.FieldGT(FieldTeamToken, v)) } -// RoverTokenRefGTE applies the GTE predicate on the "rover_token_ref" field. -func RoverTokenRefGTE(v string) predicate.Team { - return predicate.Team(sql.FieldGTE(FieldRoverTokenRef, v)) +// TeamTokenGTE applies the GTE predicate on the "team_token" field. +func TeamTokenGTE(v string) predicate.Team { + return predicate.Team(sql.FieldGTE(FieldTeamToken, v)) } -// RoverTokenRefLT applies the LT predicate on the "rover_token_ref" field. -func RoverTokenRefLT(v string) predicate.Team { - return predicate.Team(sql.FieldLT(FieldRoverTokenRef, v)) +// TeamTokenLT applies the LT predicate on the "team_token" field. +func TeamTokenLT(v string) predicate.Team { + return predicate.Team(sql.FieldLT(FieldTeamToken, v)) } -// RoverTokenRefLTE applies the LTE predicate on the "rover_token_ref" field. -func RoverTokenRefLTE(v string) predicate.Team { - return predicate.Team(sql.FieldLTE(FieldRoverTokenRef, v)) +// TeamTokenLTE applies the LTE predicate on the "team_token" field. +func TeamTokenLTE(v string) predicate.Team { + return predicate.Team(sql.FieldLTE(FieldTeamToken, v)) } -// RoverTokenRefContains applies the Contains predicate on the "rover_token_ref" field. -func RoverTokenRefContains(v string) predicate.Team { - return predicate.Team(sql.FieldContains(FieldRoverTokenRef, v)) +// TeamTokenContains applies the Contains predicate on the "team_token" field. +func TeamTokenContains(v string) predicate.Team { + return predicate.Team(sql.FieldContains(FieldTeamToken, v)) } -// RoverTokenRefHasPrefix applies the HasPrefix predicate on the "rover_token_ref" field. -func RoverTokenRefHasPrefix(v string) predicate.Team { - return predicate.Team(sql.FieldHasPrefix(FieldRoverTokenRef, v)) +// TeamTokenHasPrefix applies the HasPrefix predicate on the "team_token" field. +func TeamTokenHasPrefix(v string) predicate.Team { + return predicate.Team(sql.FieldHasPrefix(FieldTeamToken, v)) } -// RoverTokenRefHasSuffix applies the HasSuffix predicate on the "rover_token_ref" field. -func RoverTokenRefHasSuffix(v string) predicate.Team { - return predicate.Team(sql.FieldHasSuffix(FieldRoverTokenRef, v)) +// TeamTokenHasSuffix applies the HasSuffix predicate on the "team_token" field. +func TeamTokenHasSuffix(v string) predicate.Team { + return predicate.Team(sql.FieldHasSuffix(FieldTeamToken, v)) } -// RoverTokenRefIsNil applies the IsNil predicate on the "rover_token_ref" field. -func RoverTokenRefIsNil() predicate.Team { - return predicate.Team(sql.FieldIsNull(FieldRoverTokenRef)) +// TeamTokenIsNil applies the IsNil predicate on the "team_token" field. +func TeamTokenIsNil() predicate.Team { + return predicate.Team(sql.FieldIsNull(FieldTeamToken)) } -// RoverTokenRefNotNil applies the NotNil predicate on the "rover_token_ref" field. -func RoverTokenRefNotNil() predicate.Team { - return predicate.Team(sql.FieldNotNull(FieldRoverTokenRef)) +// TeamTokenNotNil applies the NotNil predicate on the "team_token" field. +func TeamTokenNotNil() predicate.Team { + return predicate.Team(sql.FieldNotNull(FieldTeamToken)) } -// RoverTokenRefEqualFold applies the EqualFold predicate on the "rover_token_ref" field. -func RoverTokenRefEqualFold(v string) predicate.Team { - return predicate.Team(sql.FieldEqualFold(FieldRoverTokenRef, v)) +// TeamTokenEqualFold applies the EqualFold predicate on the "team_token" field. +func TeamTokenEqualFold(v string) predicate.Team { + return predicate.Team(sql.FieldEqualFold(FieldTeamToken, v)) } -// RoverTokenRefContainsFold applies the ContainsFold predicate on the "rover_token_ref" field. -func RoverTokenRefContainsFold(v string) predicate.Team { - return predicate.Team(sql.FieldContainsFold(FieldRoverTokenRef, v)) +// TeamTokenContainsFold applies the ContainsFold predicate on the "team_token" field. +func TeamTokenContainsFold(v string) predicate.Team { + return predicate.Team(sql.FieldContainsFold(FieldTeamToken, v)) } // HasGroup applies the HasEdge predicate on the "group" edge. diff --git a/controlplane-api/ent/team_create.go b/controlplane-api/ent/team_create.go index 8f3bc39c2..e5ef3c5a3 100644 --- a/controlplane-api/ent/team_create.go +++ b/controlplane-api/ent/team_create.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -131,16 +130,16 @@ func (_c *TeamCreate) SetNillableCategory(v *team.Category) *TeamCreate { return _c } -// SetRoverTokenRef sets the "rover_token_ref" field. -func (_c *TeamCreate) SetRoverTokenRef(v string) *TeamCreate { - _c.mutation.SetRoverTokenRef(v) +// SetTeamToken sets the "team_token" field. +func (_c *TeamCreate) SetTeamToken(v string) *TeamCreate { + _c.mutation.SetTeamToken(v) return _c } -// SetNillableRoverTokenRef sets the "rover_token_ref" field if the given value is not nil. -func (_c *TeamCreate) SetNillableRoverTokenRef(v *string) *TeamCreate { +// SetNillableTeamToken sets the "team_token" field if the given value is not nil. +func (_c *TeamCreate) SetNillableTeamToken(v *string) *TeamCreate { if v != nil { - _c.SetRoverTokenRef(*v) + _c.SetTeamToken(*v) } return _c } @@ -360,9 +359,9 @@ func (_c *TeamCreate) createSpec() (*Team, *sqlgraph.CreateSpec) { _spec.SetField(team.FieldCategory, field.TypeEnum, value) _node.Category = value } - if value, ok := _c.mutation.RoverTokenRef(); ok { - _spec.SetField(team.FieldRoverTokenRef, field.TypeString, value) - _node.RoverTokenRef = &value + if value, ok := _c.mutation.TeamToken(); ok { + _spec.SetField(team.FieldTeamToken, field.TypeString, value) + _node.TeamToken = &value } if nodes := _c.mutation.GroupIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -579,21 +578,21 @@ func (u *TeamUpsert) UpdateCategory() *TeamUpsert { return u } -// SetRoverTokenRef sets the "rover_token_ref" field. -func (u *TeamUpsert) SetRoverTokenRef(v string) *TeamUpsert { - u.Set(team.FieldRoverTokenRef, v) +// SetTeamToken sets the "team_token" field. +func (u *TeamUpsert) SetTeamToken(v string) *TeamUpsert { + u.Set(team.FieldTeamToken, v) return u } -// UpdateRoverTokenRef sets the "rover_token_ref" field to the value that was provided on create. -func (u *TeamUpsert) UpdateRoverTokenRef() *TeamUpsert { - u.SetExcluded(team.FieldRoverTokenRef) +// UpdateTeamToken sets the "team_token" field to the value that was provided on create. +func (u *TeamUpsert) UpdateTeamToken() *TeamUpsert { + u.SetExcluded(team.FieldTeamToken) return u } -// ClearRoverTokenRef clears the value of the "rover_token_ref" field. -func (u *TeamUpsert) ClearRoverTokenRef() *TeamUpsert { - u.SetNull(team.FieldRoverTokenRef) +// ClearTeamToken clears the value of the "team_token" field. +func (u *TeamUpsert) ClearTeamToken() *TeamUpsert { + u.SetNull(team.FieldTeamToken) return u } @@ -775,24 +774,24 @@ func (u *TeamUpsertOne) UpdateCategory() *TeamUpsertOne { }) } -// SetRoverTokenRef sets the "rover_token_ref" field. -func (u *TeamUpsertOne) SetRoverTokenRef(v string) *TeamUpsertOne { +// SetTeamToken sets the "team_token" field. +func (u *TeamUpsertOne) SetTeamToken(v string) *TeamUpsertOne { return u.Update(func(s *TeamUpsert) { - s.SetRoverTokenRef(v) + s.SetTeamToken(v) }) } -// UpdateRoverTokenRef sets the "rover_token_ref" field to the value that was provided on create. -func (u *TeamUpsertOne) UpdateRoverTokenRef() *TeamUpsertOne { +// UpdateTeamToken sets the "team_token" field to the value that was provided on create. +func (u *TeamUpsertOne) UpdateTeamToken() *TeamUpsertOne { return u.Update(func(s *TeamUpsert) { - s.UpdateRoverTokenRef() + s.UpdateTeamToken() }) } -// ClearRoverTokenRef clears the value of the "rover_token_ref" field. -func (u *TeamUpsertOne) ClearRoverTokenRef() *TeamUpsertOne { +// ClearTeamToken clears the value of the "team_token" field. +func (u *TeamUpsertOne) ClearTeamToken() *TeamUpsertOne { return u.Update(func(s *TeamUpsert) { - s.ClearRoverTokenRef() + s.ClearTeamToken() }) } @@ -1140,24 +1139,24 @@ func (u *TeamUpsertBulk) UpdateCategory() *TeamUpsertBulk { }) } -// SetRoverTokenRef sets the "rover_token_ref" field. -func (u *TeamUpsertBulk) SetRoverTokenRef(v string) *TeamUpsertBulk { +// SetTeamToken sets the "team_token" field. +func (u *TeamUpsertBulk) SetTeamToken(v string) *TeamUpsertBulk { return u.Update(func(s *TeamUpsert) { - s.SetRoverTokenRef(v) + s.SetTeamToken(v) }) } -// UpdateRoverTokenRef sets the "rover_token_ref" field to the value that was provided on create. -func (u *TeamUpsertBulk) UpdateRoverTokenRef() *TeamUpsertBulk { +// UpdateTeamToken sets the "team_token" field to the value that was provided on create. +func (u *TeamUpsertBulk) UpdateTeamToken() *TeamUpsertBulk { return u.Update(func(s *TeamUpsert) { - s.UpdateRoverTokenRef() + s.UpdateTeamToken() }) } -// ClearRoverTokenRef clears the value of the "rover_token_ref" field. -func (u *TeamUpsertBulk) ClearRoverTokenRef() *TeamUpsertBulk { +// ClearTeamToken clears the value of the "team_token" field. +func (u *TeamUpsertBulk) ClearTeamToken() *TeamUpsertBulk { return u.Update(func(s *TeamUpsert) { - s.ClearRoverTokenRef() + s.ClearTeamToken() }) } diff --git a/controlplane-api/ent/team_delete.go b/controlplane-api/ent/team_delete.go index d9ca0cea1..ae6468893 100644 --- a/controlplane-api/ent/team_delete.go +++ b/controlplane-api/ent/team_delete.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/team_query.go b/controlplane-api/ent/team_query.go index 479c33a26..5194fa8e1 100644 --- a/controlplane-api/ent/team_query.go +++ b/controlplane-api/ent/team_query.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/team_update.go b/controlplane-api/ent/team_update.go index 3b137e351..40a9d7e14 100644 --- a/controlplane-api/ent/team_update.go +++ b/controlplane-api/ent/team_update.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -157,23 +156,23 @@ func (_u *TeamUpdate) SetNillableCategory(v *team.Category) *TeamUpdate { return _u } -// SetRoverTokenRef sets the "rover_token_ref" field. -func (_u *TeamUpdate) SetRoverTokenRef(v string) *TeamUpdate { - _u.mutation.SetRoverTokenRef(v) +// SetTeamToken sets the "team_token" field. +func (_u *TeamUpdate) SetTeamToken(v string) *TeamUpdate { + _u.mutation.SetTeamToken(v) return _u } -// SetNillableRoverTokenRef sets the "rover_token_ref" field if the given value is not nil. -func (_u *TeamUpdate) SetNillableRoverTokenRef(v *string) *TeamUpdate { +// SetNillableTeamToken sets the "team_token" field if the given value is not nil. +func (_u *TeamUpdate) SetNillableTeamToken(v *string) *TeamUpdate { if v != nil { - _u.SetRoverTokenRef(*v) + _u.SetTeamToken(*v) } return _u } -// ClearRoverTokenRef clears the value of the "rover_token_ref" field. -func (_u *TeamUpdate) ClearRoverTokenRef() *TeamUpdate { - _u.mutation.ClearRoverTokenRef() +// ClearTeamToken clears the value of the "team_token" field. +func (_u *TeamUpdate) ClearTeamToken() *TeamUpdate { + _u.mutation.ClearTeamToken() return _u } @@ -396,11 +395,11 @@ func (_u *TeamUpdate) sqlSave(ctx context.Context) (_node int, err error) { if value, ok := _u.mutation.Category(); ok { _spec.SetField(team.FieldCategory, field.TypeEnum, value) } - if value, ok := _u.mutation.RoverTokenRef(); ok { - _spec.SetField(team.FieldRoverTokenRef, field.TypeString, value) + if value, ok := _u.mutation.TeamToken(); ok { + _spec.SetField(team.FieldTeamToken, field.TypeString, value) } - if _u.mutation.RoverTokenRefCleared() { - _spec.ClearField(team.FieldRoverTokenRef, field.TypeString) + if _u.mutation.TeamTokenCleared() { + _spec.ClearField(team.FieldTeamToken, field.TypeString) } if _u.mutation.GroupCleared() { edge := &sqlgraph.EdgeSpec{ @@ -663,23 +662,23 @@ func (_u *TeamUpdateOne) SetNillableCategory(v *team.Category) *TeamUpdateOne { return _u } -// SetRoverTokenRef sets the "rover_token_ref" field. -func (_u *TeamUpdateOne) SetRoverTokenRef(v string) *TeamUpdateOne { - _u.mutation.SetRoverTokenRef(v) +// SetTeamToken sets the "team_token" field. +func (_u *TeamUpdateOne) SetTeamToken(v string) *TeamUpdateOne { + _u.mutation.SetTeamToken(v) return _u } -// SetNillableRoverTokenRef sets the "rover_token_ref" field if the given value is not nil. -func (_u *TeamUpdateOne) SetNillableRoverTokenRef(v *string) *TeamUpdateOne { +// SetNillableTeamToken sets the "team_token" field if the given value is not nil. +func (_u *TeamUpdateOne) SetNillableTeamToken(v *string) *TeamUpdateOne { if v != nil { - _u.SetRoverTokenRef(*v) + _u.SetTeamToken(*v) } return _u } -// ClearRoverTokenRef clears the value of the "rover_token_ref" field. -func (_u *TeamUpdateOne) ClearRoverTokenRef() *TeamUpdateOne { - _u.mutation.ClearRoverTokenRef() +// ClearTeamToken clears the value of the "team_token" field. +func (_u *TeamUpdateOne) ClearTeamToken() *TeamUpdateOne { + _u.mutation.ClearTeamToken() return _u } @@ -932,11 +931,11 @@ func (_u *TeamUpdateOne) sqlSave(ctx context.Context) (_node *Team, err error) { if value, ok := _u.mutation.Category(); ok { _spec.SetField(team.FieldCategory, field.TypeEnum, value) } - if value, ok := _u.mutation.RoverTokenRef(); ok { - _spec.SetField(team.FieldRoverTokenRef, field.TypeString, value) + if value, ok := _u.mutation.TeamToken(); ok { + _spec.SetField(team.FieldTeamToken, field.TypeString, value) } - if _u.mutation.RoverTokenRefCleared() { - _spec.ClearField(team.FieldRoverTokenRef, field.TypeString) + if _u.mutation.TeamTokenCleared() { + _spec.ClearField(team.FieldTeamToken, field.TypeString) } if _u.mutation.GroupCleared() { edge := &sqlgraph.EdgeSpec{ diff --git a/controlplane-api/ent/tx.go b/controlplane-api/ent/tx.go index f256b07c3..56a7a68b5 100644 --- a/controlplane-api/ent/tx.go +++ b/controlplane-api/ent/tx.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -26,6 +25,10 @@ type Tx struct { Approval *ApprovalClient // ApprovalRequest is the client for interacting with the ApprovalRequest builders. ApprovalRequest *ApprovalRequestClient + // EventExposure is the client for interacting with the EventExposure builders. + EventExposure *EventExposureClient + // EventSubscription is the client for interacting with the EventSubscription builders. + EventSubscription *EventSubscriptionClient // Group is the client for interacting with the Group builders. Group *GroupClient // Member is the client for interacting with the Member builders. @@ -170,6 +173,8 @@ func (tx *Tx) init() { tx.Application = NewApplicationClient(tx.config) tx.Approval = NewApprovalClient(tx.config) tx.ApprovalRequest = NewApprovalRequestClient(tx.config) + tx.EventExposure = NewEventExposureClient(tx.config) + tx.EventSubscription = NewEventSubscriptionClient(tx.config) tx.Group = NewGroupClient(tx.config) tx.Member = NewMemberClient(tx.config) tx.Team = NewTeamClient(tx.config) diff --git a/controlplane-api/ent/zone.go b/controlplane-api/ent/zone.go index 9c39200b9..e30a151a1 100644 --- a/controlplane-api/ent/zone.go +++ b/controlplane-api/ent/zone.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -26,6 +25,8 @@ type Zone struct { Name string `json:"name,omitempty"` // GatewayURL holds the value of the "gateway_url" field. GatewayURL *string `json:"gateway_url,omitempty"` + // IssuerURL holds the value of the "issuer_url" field. + IssuerURL *string `json:"issuer_url,omitempty"` // Visibility holds the value of the "visibility" field. Visibility zone.Visibility `json:"visibility,omitempty"` // Edges holds the relations/edges for other nodes in the graph. @@ -64,7 +65,7 @@ func (*Zone) scanValues(columns []string) ([]any, error) { switch columns[i] { case zone.FieldID: values[i] = new(sql.NullInt64) - case zone.FieldEnvironment, zone.FieldName, zone.FieldGatewayURL, zone.FieldVisibility: + case zone.FieldEnvironment, zone.FieldName, zone.FieldGatewayURL, zone.FieldIssuerURL, zone.FieldVisibility: values[i] = new(sql.NullString) case zone.ForeignKeys[0]: // api_subscription_failover_zones values[i] = new(sql.NullInt64) @@ -109,6 +110,13 @@ func (_m *Zone) assignValues(columns []string, values []any) error { _m.GatewayURL = new(string) *_m.GatewayURL = value.String } + case zone.FieldIssuerURL: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field issuer_url", values[i]) + } else if value.Valid { + _m.IssuerURL = new(string) + *_m.IssuerURL = value.String + } case zone.FieldVisibility: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field visibility", values[i]) @@ -176,6 +184,11 @@ func (_m *Zone) String() string { builder.WriteString(*v) } builder.WriteString(", ") + if v := _m.IssuerURL; v != nil { + builder.WriteString("issuer_url=") + builder.WriteString(*v) + } + builder.WriteString(", ") builder.WriteString("visibility=") builder.WriteString(fmt.Sprintf("%v", _m.Visibility)) builder.WriteByte(')') diff --git a/controlplane-api/ent/zone/where.go b/controlplane-api/ent/zone/where.go index 82c6ff755..d295f724c 100644 --- a/controlplane-api/ent/zone/where.go +++ b/controlplane-api/ent/zone/where.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package zone @@ -72,6 +71,11 @@ func GatewayURL(v string) predicate.Zone { return predicate.Zone(sql.FieldEQ(FieldGatewayURL, v)) } +// IssuerURL applies equality check predicate on the "issuer_url" field. It's identical to IssuerURLEQ. +func IssuerURL(v string) predicate.Zone { + return predicate.Zone(sql.FieldEQ(FieldIssuerURL, v)) +} + // EnvironmentEQ applies the EQ predicate on the "environment" field. func EnvironmentEQ(v string) predicate.Zone { return predicate.Zone(sql.FieldEQ(FieldEnvironment, v)) @@ -287,6 +291,81 @@ func GatewayURLContainsFold(v string) predicate.Zone { return predicate.Zone(sql.FieldContainsFold(FieldGatewayURL, v)) } +// IssuerURLEQ applies the EQ predicate on the "issuer_url" field. +func IssuerURLEQ(v string) predicate.Zone { + return predicate.Zone(sql.FieldEQ(FieldIssuerURL, v)) +} + +// IssuerURLNEQ applies the NEQ predicate on the "issuer_url" field. +func IssuerURLNEQ(v string) predicate.Zone { + return predicate.Zone(sql.FieldNEQ(FieldIssuerURL, v)) +} + +// IssuerURLIn applies the In predicate on the "issuer_url" field. +func IssuerURLIn(vs ...string) predicate.Zone { + return predicate.Zone(sql.FieldIn(FieldIssuerURL, vs...)) +} + +// IssuerURLNotIn applies the NotIn predicate on the "issuer_url" field. +func IssuerURLNotIn(vs ...string) predicate.Zone { + return predicate.Zone(sql.FieldNotIn(FieldIssuerURL, vs...)) +} + +// IssuerURLGT applies the GT predicate on the "issuer_url" field. +func IssuerURLGT(v string) predicate.Zone { + return predicate.Zone(sql.FieldGT(FieldIssuerURL, v)) +} + +// IssuerURLGTE applies the GTE predicate on the "issuer_url" field. +func IssuerURLGTE(v string) predicate.Zone { + return predicate.Zone(sql.FieldGTE(FieldIssuerURL, v)) +} + +// IssuerURLLT applies the LT predicate on the "issuer_url" field. +func IssuerURLLT(v string) predicate.Zone { + return predicate.Zone(sql.FieldLT(FieldIssuerURL, v)) +} + +// IssuerURLLTE applies the LTE predicate on the "issuer_url" field. +func IssuerURLLTE(v string) predicate.Zone { + return predicate.Zone(sql.FieldLTE(FieldIssuerURL, v)) +} + +// IssuerURLContains applies the Contains predicate on the "issuer_url" field. +func IssuerURLContains(v string) predicate.Zone { + return predicate.Zone(sql.FieldContains(FieldIssuerURL, v)) +} + +// IssuerURLHasPrefix applies the HasPrefix predicate on the "issuer_url" field. +func IssuerURLHasPrefix(v string) predicate.Zone { + return predicate.Zone(sql.FieldHasPrefix(FieldIssuerURL, v)) +} + +// IssuerURLHasSuffix applies the HasSuffix predicate on the "issuer_url" field. +func IssuerURLHasSuffix(v string) predicate.Zone { + return predicate.Zone(sql.FieldHasSuffix(FieldIssuerURL, v)) +} + +// IssuerURLIsNil applies the IsNil predicate on the "issuer_url" field. +func IssuerURLIsNil() predicate.Zone { + return predicate.Zone(sql.FieldIsNull(FieldIssuerURL)) +} + +// IssuerURLNotNil applies the NotNil predicate on the "issuer_url" field. +func IssuerURLNotNil() predicate.Zone { + return predicate.Zone(sql.FieldNotNull(FieldIssuerURL)) +} + +// IssuerURLEqualFold applies the EqualFold predicate on the "issuer_url" field. +func IssuerURLEqualFold(v string) predicate.Zone { + return predicate.Zone(sql.FieldEqualFold(FieldIssuerURL, v)) +} + +// IssuerURLContainsFold applies the ContainsFold predicate on the "issuer_url" field. +func IssuerURLContainsFold(v string) predicate.Zone { + return predicate.Zone(sql.FieldContainsFold(FieldIssuerURL, v)) +} + // VisibilityEQ applies the EQ predicate on the "visibility" field. func VisibilityEQ(v Visibility) predicate.Zone { return predicate.Zone(sql.FieldEQ(FieldVisibility, v)) diff --git a/controlplane-api/ent/zone/zone.go b/controlplane-api/ent/zone/zone.go index d68792bed..cc9ada502 100644 --- a/controlplane-api/ent/zone/zone.go +++ b/controlplane-api/ent/zone/zone.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package zone @@ -27,6 +26,8 @@ const ( FieldName = "name" // FieldGatewayURL holds the string denoting the gateway_url field in the database. FieldGatewayURL = "gateway_url" + // FieldIssuerURL holds the string denoting the issuer_url field in the database. + FieldIssuerURL = "issuer_url" // FieldVisibility holds the string denoting the visibility field in the database. FieldVisibility = "visibility" // EdgeApplications holds the string denoting the applications edge name in mutations. @@ -48,6 +49,7 @@ var Columns = []string{ FieldEnvironment, FieldName, FieldGatewayURL, + FieldIssuerURL, FieldVisibility, } @@ -133,6 +135,11 @@ func ByGatewayURL(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldGatewayURL, opts...).ToFunc() } +// ByIssuerURL orders the results by the issuer_url field. +func ByIssuerURL(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldIssuerURL, opts...).ToFunc() +} + // ByVisibility orders the results by the visibility field. func ByVisibility(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldVisibility, opts...).ToFunc() diff --git a/controlplane-api/ent/zone_create.go b/controlplane-api/ent/zone_create.go index 765a4f76f..ab988b626 100644 --- a/controlplane-api/ent/zone_create.go +++ b/controlplane-api/ent/zone_create.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -60,6 +59,20 @@ func (_c *ZoneCreate) SetNillableGatewayURL(v *string) *ZoneCreate { return _c } +// SetIssuerURL sets the "issuer_url" field. +func (_c *ZoneCreate) SetIssuerURL(v string) *ZoneCreate { + _c.mutation.SetIssuerURL(v) + return _c +} + +// SetNillableIssuerURL sets the "issuer_url" field if the given value is not nil. +func (_c *ZoneCreate) SetNillableIssuerURL(v *string) *ZoneCreate { + if v != nil { + _c.SetIssuerURL(*v) + } + return _c +} + // SetVisibility sets the "visibility" field. func (_c *ZoneCreate) SetVisibility(v zone.Visibility) *ZoneCreate { _c.mutation.SetVisibility(v) @@ -190,6 +203,10 @@ func (_c *ZoneCreate) createSpec() (*Zone, *sqlgraph.CreateSpec) { _spec.SetField(zone.FieldGatewayURL, field.TypeString, value) _node.GatewayURL = &value } + if value, ok := _c.mutation.IssuerURL(); ok { + _spec.SetField(zone.FieldIssuerURL, field.TypeString, value) + _node.IssuerURL = &value + } if value, ok := _c.mutation.Visibility(); ok { _spec.SetField(zone.FieldVisibility, field.TypeEnum, value) _node.Visibility = value @@ -310,6 +327,24 @@ func (u *ZoneUpsert) ClearGatewayURL() *ZoneUpsert { return u } +// SetIssuerURL sets the "issuer_url" field. +func (u *ZoneUpsert) SetIssuerURL(v string) *ZoneUpsert { + u.Set(zone.FieldIssuerURL, v) + return u +} + +// UpdateIssuerURL sets the "issuer_url" field to the value that was provided on create. +func (u *ZoneUpsert) UpdateIssuerURL() *ZoneUpsert { + u.SetExcluded(zone.FieldIssuerURL) + return u +} + +// ClearIssuerURL clears the value of the "issuer_url" field. +func (u *ZoneUpsert) ClearIssuerURL() *ZoneUpsert { + u.SetNull(zone.FieldIssuerURL) + return u +} + // SetVisibility sets the "visibility" field. func (u *ZoneUpsert) SetVisibility(v zone.Visibility) *ZoneUpsert { u.Set(zone.FieldVisibility, v) @@ -418,6 +453,27 @@ func (u *ZoneUpsertOne) ClearGatewayURL() *ZoneUpsertOne { }) } +// SetIssuerURL sets the "issuer_url" field. +func (u *ZoneUpsertOne) SetIssuerURL(v string) *ZoneUpsertOne { + return u.Update(func(s *ZoneUpsert) { + s.SetIssuerURL(v) + }) +} + +// UpdateIssuerURL sets the "issuer_url" field to the value that was provided on create. +func (u *ZoneUpsertOne) UpdateIssuerURL() *ZoneUpsertOne { + return u.Update(func(s *ZoneUpsert) { + s.UpdateIssuerURL() + }) +} + +// ClearIssuerURL clears the value of the "issuer_url" field. +func (u *ZoneUpsertOne) ClearIssuerURL() *ZoneUpsertOne { + return u.Update(func(s *ZoneUpsert) { + s.ClearIssuerURL() + }) +} + // SetVisibility sets the "visibility" field. func (u *ZoneUpsertOne) SetVisibility(v zone.Visibility) *ZoneUpsertOne { return u.Update(func(s *ZoneUpsert) { @@ -692,6 +748,27 @@ func (u *ZoneUpsertBulk) ClearGatewayURL() *ZoneUpsertBulk { }) } +// SetIssuerURL sets the "issuer_url" field. +func (u *ZoneUpsertBulk) SetIssuerURL(v string) *ZoneUpsertBulk { + return u.Update(func(s *ZoneUpsert) { + s.SetIssuerURL(v) + }) +} + +// UpdateIssuerURL sets the "issuer_url" field to the value that was provided on create. +func (u *ZoneUpsertBulk) UpdateIssuerURL() *ZoneUpsertBulk { + return u.Update(func(s *ZoneUpsert) { + s.UpdateIssuerURL() + }) +} + +// ClearIssuerURL clears the value of the "issuer_url" field. +func (u *ZoneUpsertBulk) ClearIssuerURL() *ZoneUpsertBulk { + return u.Update(func(s *ZoneUpsert) { + s.ClearIssuerURL() + }) +} + // SetVisibility sets the "visibility" field. func (u *ZoneUpsertBulk) SetVisibility(v zone.Visibility) *ZoneUpsertBulk { return u.Update(func(s *ZoneUpsert) { diff --git a/controlplane-api/ent/zone_delete.go b/controlplane-api/ent/zone_delete.go index 805abf917..f45fcdfb6 100644 --- a/controlplane-api/ent/zone_delete.go +++ b/controlplane-api/ent/zone_delete.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/zone_query.go b/controlplane-api/ent/zone_query.go index 4a6cbcc75..643aca6ef 100644 --- a/controlplane-api/ent/zone_query.go +++ b/controlplane-api/ent/zone_query.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent diff --git a/controlplane-api/ent/zone_update.go b/controlplane-api/ent/zone_update.go index c936ab123..e1ad9c40d 100644 --- a/controlplane-api/ent/zone_update.go +++ b/controlplane-api/ent/zone_update.go @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by ent, DO NOT EDIT. package ent @@ -86,6 +85,26 @@ func (_u *ZoneUpdate) ClearGatewayURL() *ZoneUpdate { return _u } +// SetIssuerURL sets the "issuer_url" field. +func (_u *ZoneUpdate) SetIssuerURL(v string) *ZoneUpdate { + _u.mutation.SetIssuerURL(v) + return _u +} + +// SetNillableIssuerURL sets the "issuer_url" field if the given value is not nil. +func (_u *ZoneUpdate) SetNillableIssuerURL(v *string) *ZoneUpdate { + if v != nil { + _u.SetIssuerURL(*v) + } + return _u +} + +// ClearIssuerURL clears the value of the "issuer_url" field. +func (_u *ZoneUpdate) ClearIssuerURL() *ZoneUpdate { + _u.mutation.ClearIssuerURL() + return _u +} + // SetVisibility sets the "visibility" field. func (_u *ZoneUpdate) SetVisibility(v zone.Visibility) *ZoneUpdate { _u.mutation.SetVisibility(v) @@ -210,6 +229,12 @@ func (_u *ZoneUpdate) sqlSave(ctx context.Context) (_node int, err error) { if _u.mutation.GatewayURLCleared() { _spec.ClearField(zone.FieldGatewayURL, field.TypeString) } + if value, ok := _u.mutation.IssuerURL(); ok { + _spec.SetField(zone.FieldIssuerURL, field.TypeString, value) + } + if _u.mutation.IssuerURLCleared() { + _spec.ClearField(zone.FieldIssuerURL, field.TypeString) + } if value, ok := _u.mutation.Visibility(); ok { _spec.SetField(zone.FieldVisibility, field.TypeEnum, value) } @@ -332,6 +357,26 @@ func (_u *ZoneUpdateOne) ClearGatewayURL() *ZoneUpdateOne { return _u } +// SetIssuerURL sets the "issuer_url" field. +func (_u *ZoneUpdateOne) SetIssuerURL(v string) *ZoneUpdateOne { + _u.mutation.SetIssuerURL(v) + return _u +} + +// SetNillableIssuerURL sets the "issuer_url" field if the given value is not nil. +func (_u *ZoneUpdateOne) SetNillableIssuerURL(v *string) *ZoneUpdateOne { + if v != nil { + _u.SetIssuerURL(*v) + } + return _u +} + +// ClearIssuerURL clears the value of the "issuer_url" field. +func (_u *ZoneUpdateOne) ClearIssuerURL() *ZoneUpdateOne { + _u.mutation.ClearIssuerURL() + return _u +} + // SetVisibility sets the "visibility" field. func (_u *ZoneUpdateOne) SetVisibility(v zone.Visibility) *ZoneUpdateOne { _u.mutation.SetVisibility(v) @@ -486,6 +531,12 @@ func (_u *ZoneUpdateOne) sqlSave(ctx context.Context) (_node *Zone, err error) { if _u.mutation.GatewayURLCleared() { _spec.ClearField(zone.FieldGatewayURL, field.TypeString) } + if value, ok := _u.mutation.IssuerURL(); ok { + _spec.SetField(zone.FieldIssuerURL, field.TypeString, value) + } + if _u.mutation.IssuerURLCleared() { + _spec.ClearField(zone.FieldIssuerURL, field.TypeString) + } if value, ok := _u.mutation.Visibility(); ok { _spec.SetField(zone.FieldVisibility, field.TypeEnum, value) } diff --git a/controlplane-api/go.mod b/controlplane-api/go.mod index b4bfe6c18..83646f02a 100644 --- a/controlplane-api/go.mod +++ b/controlplane-api/go.mod @@ -18,11 +18,13 @@ require ( github.com/mattn/go-sqlite3 v1.14.44 github.com/onsi/ginkgo/v2 v2.28.3 github.com/onsi/gomega v1.40.0 + github.com/stretchr/testify v1.11.1 github.com/telekom/controlplane/application/api v0.0.0-00010101000000-000000000000 github.com/telekom/controlplane/approval/api v0.0.0-00010101000000-000000000000 github.com/telekom/controlplane/common v0.0.0 github.com/telekom/controlplane/common-server v0.0.0 github.com/telekom/controlplane/organization/api v0.0.0-00010101000000-000000000000 + github.com/telekom/controlplane/secret-manager v0.0.0 github.com/valyala/fasthttp v1.70.0 github.com/vektah/gqlparser/v2 v2.5.33 go.uber.org/zap v1.28.0 @@ -40,6 +42,7 @@ require ( github.com/agext/levenshtein v1.2.3 // indirect github.com/agnivade/levenshtein v1.2.1 // indirect github.com/andybalholm/brotli v1.2.1 // indirect + github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bmatcuk/doublestar v1.3.4 // indirect @@ -87,6 +90,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/oapi-codegen/runtime v1.4.0 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -100,6 +104,7 @@ require ( github.com/spf13/cast v1.10.0 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/spf13/viper v1.21.0 // indirect + github.com/stretchr/objx v0.5.3 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/urfave/cli/v3 v3.8.0 // indirect diff --git a/controlplane-api/go.sum b/controlplane-api/go.sum index 08ff8b45b..fa4ac6bf7 100644 --- a/controlplane-api/go.sum +++ b/controlplane-api/go.sum @@ -14,6 +14,7 @@ github.com/MicahParks/keyfunc/v2 v2.1.0 h1:6ZXKb9Rp6qp1bDbJefnG7cTH8yMN1IC/4nf+G github.com/MicahParks/keyfunc/v2 v2.1.0/go.mod h1:rW42fi+xgLJ2FRRXAfNx9ZA8WpD4OeE/yHVMteCkw9k= github.com/PuerkitoBio/goquery v1.12.0 h1:pAcL4g3WRXekcB9AU/y1mbKez2dbY2AajVhtkO8RIBo= github.com/PuerkitoBio/goquery v1.12.0/go.mod h1:802ej+gV2y7bbIhOIoPY5sT183ZW0YFofScC4q/hIpQ= +github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= @@ -24,12 +25,15 @@ github.com/andybalholm/brotli v1.2.1 h1:R+f5xP285VArJDRgowrfb9DqL18yVK0gKAW/F+eT github.com/andybalholm/brotli v1.2.1/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= +github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= +github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0= github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M= @@ -131,6 +135,7 @@ github.com/joshdk/go-junit v1.0.0 h1:S86cUKIdwBHWwA6xCmFlf3RTLfVXYQfvanM5Uh+K6GE github.com/joshdk/go-junit v1.0.0/go.mod h1:TiiV0PqkaNfFXjEiyjWM3XXrhVyCa1K4Zfga6W52ung= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= @@ -165,6 +170,8 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFd github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/oapi-codegen/runtime v1.4.0 h1:KLOSFOp7UzkbS7Cs1ms6NBEKYr0WmH2wZG0KKbd2er4= +github.com/oapi-codegen/runtime v1.4.0/go.mod h1:5sw5fxCDmnOzKNYmkVNF8d34kyUeejJEY8HNT2WaPec= github.com/onsi/ginkgo/v2 v2.28.3 h1:4JvMdwtFU0imd8fHx25OJXoDMRexnf8v5NHKYSTTji4= github.com/onsi/ginkgo/v2 v2.28.3/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44= github.com/onsi/gomega v1.40.0 h1:Vtol0e1MghCD2ZVIilPDIg44XSL9l2QAn8ZNaljWcJc= @@ -200,6 +207,7 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY= +github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= diff --git a/controlplane-api/gqlgen.yml b/controlplane-api/gqlgen.yml index 9fe5c763f..9501c3489 100644 --- a/controlplane-api/gqlgen.yml +++ b/controlplane-api/gqlgen.yml @@ -27,14 +27,13 @@ autobind: - github.com/telekom/controlplane/controlplane-api/ent/application - github.com/telekom/controlplane/controlplane-api/ent/apiexposure - github.com/telekom/controlplane/controlplane-api/ent/apisubscription + - github.com/telekom/controlplane/controlplane-api/ent/eventexposure + - github.com/telekom/controlplane/controlplane-api/ent/eventsubscription models: ID: model: - github.com/99designs/gqlgen/graphql.IntID - TeamMutationResult: - model: - - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.TeamMutationResult CreateTeamInput: model: - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.CreateTeamInput @@ -44,27 +43,36 @@ models: MemberInput: model: - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.MemberInput - RotateTeamTokenInput: + DecisionInput: model: - - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.RotateTeamTokenInput - RotateApplicationSecretInput: + - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.DecisionInput + MutationError: model: - - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.RotateApplicationSecretInput - RotateApplicationSecretResult: + - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.MutationError + CreateTeamPayload: model: - - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.RotateApplicationSecretResult - DecideApprovalRequestInput: + - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.CreateTeamPayload + UpdateTeamPayload: model: - - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.DecideApprovalRequestInput - DecideApprovalInput: + - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.UpdateTeamPayload + AddTeamMemberPayload: model: - - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.DecideApprovalInput - DecisionInput: + - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.AddTeamMemberPayload + RemoveTeamMemberPayload: model: - - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.DecisionInput - ApprovalMutationResult: + - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.RemoveTeamMemberPayload + RotateTeamTokenPayload: model: - - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.ApprovalMutationResult + - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.RotateTeamTokenPayload + RotateApplicationSecretPayload: + model: + - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.RotateApplicationSecretPayload + DecideApprovalRequestPayload: + model: + - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.DecideApprovalRequestPayload + DecideApprovalPayload: + model: + - github.com/telekom/controlplane/controlplane-api/internal/resolvers/model.DecideApprovalPayload Node: model: - github.com/telekom/controlplane/controlplane-api/ent.Noder @@ -89,9 +97,25 @@ models: AvailableTransition: model: - github.com/telekom/controlplane/controlplane-api/pkg/model.AvailableTransition + Application: + fields: + clientSecret: + resolver: true + rotatedClientSecret: + resolver: true + Team: + fields: + teamToken: + resolver: true ApiExposureInfo: model: - github.com/telekom/controlplane/controlplane-api/pkg/model.ApiExposureInfo ApiSubscriptionInfo: model: - github.com/telekom/controlplane/controlplane-api/pkg/model.ApiSubscriptionInfo + EventSubscriptionInfo: + model: + - github.com/telekom/controlplane/controlplane-api/pkg/model.EventSubscriptionInfo + EventExposureInfo: + model: + - github.com/telekom/controlplane/controlplane-api/pkg/model.EventExposureInfo diff --git a/controlplane-api/internal/graphql/controller.go b/controlplane-api/internal/graphql/controller.go index b3c8bd361..396a50194 100644 --- a/controlplane-api/internal/graphql/controller.go +++ b/controlplane-api/internal/graphql/controller.go @@ -6,14 +6,17 @@ package graphql import ( "net/http" + "strings" "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/playground" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/adaptor" + "github.com/valyala/fasthttp/fasthttpadaptor" + "github.com/telekom/controlplane/common-server/pkg/server" "github.com/telekom/controlplane/common-server/pkg/server/middleware/security" - "github.com/valyala/fasthttp/fasthttpadaptor" + "github.com/telekom/controlplane/controlplane-api/internal/viewer" ) // Controller is a Fiber controller that wraps a gqlgen handler. @@ -55,7 +58,22 @@ func httpHandlerWithUserContext(h http.Handler) fiber.Handler { if err := fasthttpadaptor.ConvertRequest(c.Context(), &req, true); err != nil { return err } - req = *req.WithContext(c.UserContext()) + ctx := c.UserContext() + + // Propagate forwarded user identity headers into context for the Viewer middleware. + if name, email := c.Get("X-Forwarded-User-Name"), c.Get("X-Forwarded-User-Email"); name != "" || email != "" { + fu := viewer.ForwardedUser{Name: name, Email: email} + fu.IsAdmin = strings.EqualFold(c.Get("X-Forwarded-User-Is-Admin"), "true") + if roles := c.Get("X-Forwarded-User-Roles"); roles != "" { + fu.Roles = strings.Split(roles, ",") + } + if groups := c.Get("X-Forwarded-User-Groups"); groups != "" { + fu.Groups = strings.Split(groups, ",") + } + ctx = viewer.NewForwardedUserContext(ctx, fu) + } + + req = *req.WithContext(ctx) rec := &responseRecorder{ctx: c} h.ServeHTTP(rec, &req) return nil diff --git a/controlplane-api/internal/graphql/error_presenter.go b/controlplane-api/internal/graphql/error_presenter.go new file mode 100644 index 000000000..91adad9f2 --- /dev/null +++ b/controlplane-api/internal/graphql/error_presenter.go @@ -0,0 +1,74 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package graphql + +import ( + "context" + "errors" + + "entgo.io/ent/privacy" + "github.com/99designs/gqlgen/graphql" + "github.com/go-logr/logr" + "github.com/vektah/gqlparser/v2/gqlerror" + apierrors "k8s.io/apimachinery/pkg/api/errors" + + "github.com/telekom/controlplane/common-server/pkg/client" + "github.com/telekom/controlplane/controlplane-api/ent" +) + +// ErrorPresenter maps internal errors to stable GraphQL error responses. +func ErrorPresenter(ctx context.Context, err error) *gqlerror.Error { + if err == nil { + return nil + } + + var gqlErr *gqlerror.Error + if errors.As(err, &gqlErr) { + return graphql.DefaultErrorPresenter(ctx, err) + } + + presented := graphql.DefaultErrorPresenter(ctx, err) + if presented == nil { + return nil + } + + switch { + case ent.IsNotFound(err), apierrors.IsNotFound(err): + presented.Message = "resource not found" + setGraphQLErrorCode(presented, "NOT_FOUND") + case errors.Is(err, privacy.Deny), apierrors.IsForbidden(err): + presented.Message = "forbidden" + setGraphQLErrorCode(presented, "FORBIDDEN") + case ent.IsValidationError(err), apierrors.IsInvalid(err): + presented.Message = "validation failed" + setGraphQLErrorCode(presented, "VALIDATION_FAILED") + case apierrors.IsConflict(err), apierrors.IsAlreadyExists(err): + presented.Message = "conflict" + setGraphQLErrorCode(presented, "CONFLICT") + case isHttpError(err): + logr.FromContextOrDiscard(ctx).Error(err, "External service error in GraphQL resolver") + presented.Message = "internal error while processing request" + setGraphQLErrorCode(presented, "INTERNAL") + default: + logr.FromContextOrDiscard(ctx).Error(err, "Unhandled GraphQL resolver error") + presented.Message = "internal error while processing request" + setGraphQLErrorCode(presented, "INTERNAL") + } + + return presented +} + +func setGraphQLErrorCode(err *gqlerror.Error, code string) { + if err.Extensions == nil { + err.Extensions = map[string]any{} + } + err.Extensions["code"] = code +} + +// isHttpError returns true if the error chain contains a *client.HttpError. +func isHttpError(err error) bool { + var httpErr *client.HttpError + return errors.As(err, &httpErr) +} diff --git a/controlplane-api/internal/graphql/error_presenter_test.go b/controlplane-api/internal/graphql/error_presenter_test.go new file mode 100644 index 000000000..f49319821 --- /dev/null +++ b/controlplane-api/internal/graphql/error_presenter_test.go @@ -0,0 +1,116 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package graphql_test + +import ( + "context" + "fmt" + + "entgo.io/ent/privacy" + "github.com/99designs/gqlgen/graphql" + "github.com/vektah/gqlparser/v2/gqlerror" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/telekom/controlplane/common-server/pkg/client" + "github.com/telekom/controlplane/controlplane-api/ent" + cpgraphql "github.com/telekom/controlplane/controlplane-api/internal/graphql" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("ErrorPresenter", func() { + newPathContext := func(field string) context.Context { + return graphql.WithPathContext(context.Background(), graphql.NewPathWithField(field)) + } + + It("maps ent not found errors to NOT_FOUND", func() { + gqlErr := cpgraphql.ErrorPresenter(newPathContext("testField"), &ent.NotFoundError{}) + Expect(gqlErr).To(HaveOccurred()) + Expect(gqlErr.Message).To(Equal("resource not found")) + Expect(gqlErr.Extensions).To(HaveKeyWithValue("code", "NOT_FOUND")) + }) + + It("maps privacy deny errors to FORBIDDEN", func() { + err := fmt.Errorf("policy denied: %w", privacy.Deny) + gqlErr := cpgraphql.ErrorPresenter(newPathContext("testField"), err) + Expect(gqlErr).To(HaveOccurred()) + Expect(gqlErr.Message).To(Equal("forbidden")) + Expect(gqlErr.Extensions).To(HaveKeyWithValue("code", "FORBIDDEN")) + }) + + It("maps k8s conflicts to CONFLICT", func() { + statusErr := apierrors.NewConflict( + schema.GroupResource{Group: "organization", Resource: "teams"}, + "team-alpha", + fmt.Errorf("resource version conflict"), + ) + gqlErr := cpgraphql.ErrorPresenter(newPathContext("testField"), statusErr) + Expect(gqlErr).To(HaveOccurred()) + Expect(gqlErr.Message).To(Equal("conflict")) + Expect(gqlErr.Extensions).To(HaveKeyWithValue("code", "CONFLICT")) + }) + + It("sanitizes unknown errors to INTERNAL", func() { + gqlErr := cpgraphql.ErrorPresenter(newPathContext("testField"), fmt.Errorf("db connection reset by peer")) + Expect(gqlErr).To(HaveOccurred()) + Expect(gqlErr.Message).To(Equal("internal error while processing request")) + Expect(gqlErr.Extensions).To(HaveKeyWithValue("code", "INTERNAL")) + }) + + It("passes through existing gqlerror values", func() { + raw := &gqlerror.Error{ + Message: "graphql parse error", + Extensions: map[string]any{ + "code": "GRAPHQL_PARSE_FAILED", + }, + } + gqlErr := cpgraphql.ErrorPresenter(newPathContext("testField"), raw) + Expect(gqlErr).To(HaveOccurred()) + Expect(gqlErr.Message).To(Equal("graphql parse error")) + Expect(gqlErr.Extensions).To(HaveKeyWithValue("code", "GRAPHQL_PARSE_FAILED")) + }) + + It("retains graphql path information", func() { + err := apierrors.NewNotFound(schema.GroupResource{Resource: "teams"}, "team-alpha") + gqlErr := cpgraphql.ErrorPresenter(newPathContext("updateTeam"), err) + Expect(gqlErr).To(HaveOccurred()) + Expect(gqlErr.Path).NotTo(BeEmpty()) + }) + + It("returns nil for nil errors", func() { + Expect(cpgraphql.ErrorPresenter(newPathContext("testField"), nil)).To(Succeed()) + }) + + Context("HttpError from external services", func() { + It("sanitizes HttpError to INTERNAL without leaking details", func() { + httpErr := client.RetryableErrorf("server error (500): {\"detail\":\"vault seal check failed\"}").WithStatusCode(500) + gqlErr := cpgraphql.ErrorPresenter(newPathContext("clientSecret"), httpErr) + Expect(gqlErr).To(HaveOccurred()) + Expect(gqlErr.Message).To(Equal("internal error while processing request")) + Expect(gqlErr.Message).NotTo(ContainSubstring("vault")) + Expect(gqlErr.Extensions).To(HaveKeyWithValue("code", "INTERNAL")) + }) + + It("sanitizes wrapped HttpError without leaking details", func() { + httpErr := client.BlockedErrorf("bad request error (401): {\"detail\":\"Invalid token\"}").WithStatusCode(401) + wrapped := fmt.Errorf("resolving secret clientSecret: %w", httpErr) + gqlErr := cpgraphql.ErrorPresenter(newPathContext("clientSecret"), wrapped) + Expect(gqlErr).To(HaveOccurred()) + Expect(gqlErr.Message).To(Equal("internal error while processing request")) + Expect(gqlErr.Message).NotTo(ContainSubstring("token")) + Expect(gqlErr.Extensions).To(HaveKeyWithValue("code", "INTERNAL")) + }) + + It("sanitizes blocked HttpError without leaking details", func() { + httpErr := client.BlockedErrorf("resource not found").WithStatusCode(404) + gqlErr := cpgraphql.ErrorPresenter(newPathContext("clientSecret"), httpErr) + Expect(gqlErr).To(HaveOccurred()) + Expect(gqlErr.Message).To(Equal("internal error while processing request")) + Expect(gqlErr.Extensions).To(HaveKeyWithValue("code", "INTERNAL")) + }) + }) +}) diff --git a/controlplane-api/internal/graphql/mutation_logging_middleware.go b/controlplane-api/internal/graphql/mutation_logging_middleware.go new file mode 100644 index 000000000..585a1dba5 --- /dev/null +++ b/controlplane-api/internal/graphql/mutation_logging_middleware.go @@ -0,0 +1,40 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package graphql + +import ( + "context" + + "github.com/99designs/gqlgen/graphql" + "github.com/go-logr/logr" + "github.com/vektah/gqlparser/v2/ast" + + "github.com/telekom/controlplane/controlplane-api/internal/viewer" +) + +// LogMutationUser returns a gqlgen AroundOperations middleware that logs the +// requesting user's name and email for every GraphQL mutation. +// It must be registered after ViewerFromBusinessContext so that the Viewer is +// available in the context. +func LogMutationUser() graphql.OperationMiddleware { + return func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { + oc := graphql.GetOperationContext(ctx) + if oc.Operation != nil && oc.Operation.Operation == ast.Mutation { + log := logr.FromContextOrDiscard(ctx) + operationName := oc.OperationName + var userName, userEmail string + if v := viewer.FromContext(ctx); v != nil { + userName = v.UserName + userEmail = v.UserEmail + } + log.Info("Mutation requested", + "operation", operationName, + "userName", userName, + "userEmail", userEmail, + ) + } + return next(ctx) + } +} diff --git a/controlplane-api/internal/graphql/mutation_logging_middleware_test.go b/controlplane-api/internal/graphql/mutation_logging_middleware_test.go new file mode 100644 index 000000000..5578ee49f --- /dev/null +++ b/controlplane-api/internal/graphql/mutation_logging_middleware_test.go @@ -0,0 +1,92 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package graphql_test + +import ( + "bytes" + "context" + + "github.com/99designs/gqlgen/graphql" + "github.com/go-logr/logr" + "github.com/go-logr/logr/funcr" + "github.com/vektah/gqlparser/v2/ast" + + cpgraphql "github.com/telekom/controlplane/controlplane-api/internal/graphql" + "github.com/telekom/controlplane/controlplane-api/internal/viewer" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("LogMutationUser", func() { + var ( + buf bytes.Buffer + log logr.Logger + ) + + BeforeEach(func() { + buf.Reset() + log = funcr.New(func(prefix, args string) { + buf.WriteString(args) + }, funcr.Options{}) + }) + + // withOperationContext sets up a gqlgen OperationContext on ctx. + withOperationContext := func(ctx context.Context, opType ast.Operation, opName string) context.Context { + oc := &graphql.OperationContext{ + OperationName: opName, + Operation: &ast.OperationDefinition{Operation: opType}, + } + return graphql.WithOperationContext(ctx, oc) + } + + noopNext := func(ctx context.Context) graphql.ResponseHandler { + return func(ctx context.Context) *graphql.Response { return nil } + } + + It("should log user name and email for mutations", func() { + ctx := logr.NewContext(context.Background(), log) + ctx = viewer.NewContext(ctx, &viewer.Viewer{ + UserName: "Jane Doe", + UserEmail: "jane@example.com", + }) + ctx = withOperationContext(ctx, ast.Mutation, "CreateTeam") + + mw := cpgraphql.LogMutationUser() + mw(ctx, noopNext) + + output := buf.String() + Expect(output).To(ContainSubstring("Mutation requested")) + Expect(output).To(ContainSubstring("CreateTeam")) + Expect(output).To(ContainSubstring("Jane Doe")) + Expect(output).To(ContainSubstring("jane@example.com")) + }) + + It("should not log for query operations", func() { + ctx := logr.NewContext(context.Background(), log) + ctx = viewer.NewContext(ctx, &viewer.Viewer{ + UserName: "Jane Doe", + UserEmail: "jane@example.com", + }) + ctx = withOperationContext(ctx, ast.Query, "GetTeams") + + mw := cpgraphql.LogMutationUser() + mw(ctx, noopNext) + + Expect(buf.String()).To(BeEmpty()) + }) + + It("should handle nil viewer gracefully", func() { + ctx := logr.NewContext(context.Background(), log) + ctx = withOperationContext(ctx, ast.Mutation, "CreateTeam") + + mw := cpgraphql.LogMutationUser() + mw(ctx, noopNext) + + output := buf.String() + Expect(output).To(ContainSubstring("Mutation requested")) + Expect(output).To(ContainSubstring("CreateTeam")) + }) +}) diff --git a/controlplane-api/internal/graphql/viewer_middleware.go b/controlplane-api/internal/graphql/viewer_middleware.go index dacd08d53..1c59a16d3 100644 --- a/controlplane-api/internal/graphql/viewer_middleware.go +++ b/controlplane-api/internal/graphql/viewer_middleware.go @@ -9,9 +9,11 @@ import ( "github.com/99designs/gqlgen/graphql" "github.com/go-logr/logr" + "github.com/telekom/controlplane/common-server/pkg/server/middleware/security" "github.com/telekom/controlplane/controlplane-api/ent" entgroup "github.com/telekom/controlplane/controlplane-api/ent/group" + "github.com/telekom/controlplane/controlplane-api/ent/member" entteam "github.com/telekom/controlplane/controlplane-api/ent/team" "github.com/telekom/controlplane/controlplane-api/internal/viewer" ) @@ -20,40 +22,88 @@ import ( // common-server's BusinessContext (from JWT) to ent's privacy system via the Viewer. // When securityEnabled is false and no BusinessContext is present, an admin viewer // is injected so that the GraphQL playground works without authentication. -func ViewerFromBusinessContext(client *ent.Client, securityEnabled ...bool) graphql.OperationMiddleware { - secEnabled := true - if len(securityEnabled) > 0 { - secEnabled = securityEnabled[0] - } +func ViewerFromBusinessContext(client *ent.Client, securityEnabled bool) graphql.OperationMiddleware { return func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { + v := &viewer.Viewer{} + logger := logr.FromContextOrDiscard(ctx).WithName("viewer-middleware") + bCtx, ok := security.FromContext(ctx) - if !ok { - if !secEnabled { - ctx = viewer.NewContext(ctx, &viewer.Viewer{Admin: true}) - } - return next(ctx) + if !ok && securityEnabled { + // If security is enabled but no BusinessContext is found, return an error response. + // This should not happen in practice since the security middleware should reject unauthenticated requests, + // but we add this check for extra safety. + return graphql.OneShot(graphql.ErrorResponse(ctx, "no business context found")) } - v := &viewer.Viewer{} + if ok { + switch bCtx.ClientType { + case security.ClientTypeAdmin: + v.Admin = true + + case security.ClientTypeGroup: + v.Group = bCtx.Group + // SystemContext: No Viewer exists yet — we need to query teams for + // this group in order to build the Viewer that privacy rules will use. + sysCtx := viewer.SystemContext(ctx) + teams, err := client.Team.Query(). + Where(entteam.HasGroupWith(entgroup.Name(bCtx.Group))). + Select(entteam.FieldName). + Strings(sysCtx) + if err != nil { + logger.Error(err, "failed to resolve teams for group", "group", bCtx.Group) + return graphql.OneShot(graphql.ErrorResponse(ctx, "failed to resolve teams for group")) + + } else { + v.Teams = teams + } - switch bCtx.ClientType { - case security.ClientTypeAdmin: + case security.ClientTypeTeam: + v.Teams = []string{bCtx.Team} + } + } else if !securityEnabled { + logger.Info("No business context found, but security is disabled - injecting admin viewer for playground access") v.Admin = true - case security.ClientTypeGroup: - v.Group = bCtx.Group - // Look up all teams in the group - sysCtx := viewer.SystemContext(ctx) - teams, err := client.Team.Query(). - Where(entteam.HasGroupWith(entgroup.Name(bCtx.Group))). - Select(entteam.FieldName). - Strings(sysCtx) - if err != nil { - logr.FromContextOrDiscard(ctx).Error(err, "failed to resolve teams for group", "group", bCtx.Group) + + } + + // Populate forwarded user identity if present in context. + // Only accept forwarded user identity from admin-scoped clients (i.e. the BFF), + // preventing non-admin services from injecting identity headers to escalate privileges. + // TODO: X-Forwarded-User-Is-Admin should be verified against an authoritative + // source (e.g. DB role lookup) rather than trusted from the header. Additionally, + // restrict forwarded identity acceptance to a specific BFF client ID allowlist. + + if fu, hasFU := viewer.ForwardedUserFromContext(ctx); hasFU { + if !v.Admin { + logger.Info("Ignoring forwarded user identity from non-admin client", + "userName", fu.Name, "userEmail", fu.Email) } else { - v.Teams = teams + logger.Info("Processing forwarded user identity", + "userName", fu.Name, "userEmail", fu.Email, "claimedAdmin", fu.IsAdmin) + + v.UserName = fu.Name + v.UserEmail = fu.Email + + // When a user email is present (BFF request on behalf of a user), + // scope access based on the user's actual team memberships. + if fu.Email != "" { + // SystemContext: No Viewer exists yet — we need to resolve the user's + // team memberships to build the Viewer that privacy rules will use. + sysCtx := viewer.SystemContext(ctx) + userTeams, err := client.Team.Query(). + Where(entteam.HasMembersWith(member.EmailEQ(fu.Email))). + Select(entteam.FieldName). + Strings(sysCtx) + if err != nil { + logger.Error(err, "failed to resolve teams for user", "userEmail", fu.Email) + return graphql.OneShot(graphql.ErrorResponse(ctx, "failed to resolve teams for user")) + } + + // Allow X-Forwarded-User-Is-Admin header to override admin status when email is present, for flexibility in BFF behavior. + v.Admin = fu.IsAdmin + v.Teams = userTeams + } } - case security.ClientTypeTeam: - v.Teams = []string{bCtx.Team} } ctx = viewer.NewContext(ctx, v) diff --git a/controlplane-api/internal/graphql/viewer_middleware_test.go b/controlplane-api/internal/graphql/viewer_middleware_test.go index 5f14813ba..81e57d045 100644 --- a/controlplane-api/internal/graphql/viewer_middleware_test.go +++ b/controlplane-api/internal/graphql/viewer_middleware_test.go @@ -8,19 +8,23 @@ import ( "context" "github.com/99designs/gqlgen/graphql" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/telekom/controlplane/common-server/pkg/server/middleware/security" "github.com/telekom/controlplane/controlplane-api/ent" cpgraphql "github.com/telekom/controlplane/controlplane-api/internal/graphql" "github.com/telekom/controlplane/controlplane-api/internal/testutil" "github.com/telekom/controlplane/controlplane-api/internal/viewer" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) var _ = Describe("ViewerFromBusinessContext", func() { var client *ent.Client + const disableSecurity = false + const enableSecurity = true + BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) }) @@ -30,8 +34,8 @@ var _ = Describe("ViewerFromBusinessContext", func() { }) // captureViewer invokes the middleware and returns the Viewer that was set in the context. - captureViewer := func(ctx context.Context, securityEnabled ...bool) *viewer.Viewer { - mw := cpgraphql.ViewerFromBusinessContext(client, securityEnabled...) + captureViewer := func(ctx context.Context, securityEnabled bool) *viewer.Viewer { + mw := cpgraphql.ViewerFromBusinessContext(client, securityEnabled) var captured *viewer.Viewer next := func(ctx context.Context) graphql.ResponseHandler { captured = viewer.FromContext(ctx) @@ -43,18 +47,18 @@ var _ = Describe("ViewerFromBusinessContext", func() { Context("when no BusinessContext is present", func() { It("should inject admin viewer when security is disabled", func() { - v := captureViewer(context.Background(), false) + v := captureViewer(context.Background(), disableSecurity) Expect(v).NotTo(BeNil()) Expect(v.Admin).To(BeTrue()) }) It("should not inject a viewer when security is enabled", func() { - v := captureViewer(context.Background(), true) + v := captureViewer(context.Background(), enableSecurity) Expect(v).To(BeNil()) }) It("should default to security enabled", func() { - v := captureViewer(context.Background()) + v := captureViewer(context.Background(), enableSecurity) Expect(v).To(BeNil()) }) }) @@ -64,7 +68,7 @@ var _ = Describe("ViewerFromBusinessContext", func() { ctx := security.ToContext(context.Background(), &security.BusinessContext{ ClientType: security.ClientTypeAdmin, }) - v := captureViewer(ctx) + v := captureViewer(ctx, disableSecurity) Expect(v).NotTo(BeNil()) Expect(v.Admin).To(BeTrue()) Expect(v.Teams).To(BeEmpty()) @@ -77,7 +81,7 @@ var _ = Describe("ViewerFromBusinessContext", func() { ClientType: security.ClientTypeTeam, Team: "team-alpha", }) - v := captureViewer(ctx) + v := captureViewer(ctx, disableSecurity) Expect(v).NotTo(BeNil()) Expect(v.Admin).To(BeFalse()) Expect(v.Teams).To(ConsistOf("team-alpha")) @@ -94,7 +98,7 @@ var _ = Describe("ViewerFromBusinessContext", func() { ClientType: security.ClientTypeGroup, Group: "group-a", }) - v := captureViewer(ctx) + v := captureViewer(ctx, disableSecurity) Expect(v).NotTo(BeNil()) Expect(v.Admin).To(BeFalse()) Expect(v.Teams).To(ConsistOf("team-alpha")) @@ -105,9 +109,112 @@ var _ = Describe("ViewerFromBusinessContext", func() { ClientType: security.ClientTypeGroup, Group: "nonexistent-group", }) - v := captureViewer(ctx) + v := captureViewer(ctx, disableSecurity) Expect(v).NotTo(BeNil()) Expect(v.Teams).To(BeEmpty()) }) }) + + Context("when ForwardedUser is in context", func() { + It("should populate UserName and UserEmail on the viewer", func() { + ctx := security.ToContext(context.Background(), &security.BusinessContext{ + ClientType: security.ClientTypeAdmin, + }) + ctx = viewer.NewForwardedUserContext(ctx, viewer.ForwardedUser{ + Name: "Jane Doe", + Email: "jane@example.com", + }) + v := captureViewer(ctx, disableSecurity) + Expect(v).NotTo(BeNil()) + Expect(v.UserName).To(Equal("Jane Doe")) + Expect(v.UserEmail).To(Equal("jane@example.com")) + }) + + It("should leave UserName and UserEmail empty when no ForwardedUser", func() { + ctx := security.ToContext(context.Background(), &security.BusinessContext{ + ClientType: security.ClientTypeTeam, + Team: "team-alpha", + }) + v := captureViewer(ctx, disableSecurity) + Expect(v).NotTo(BeNil()) + Expect(v.UserName).To(BeEmpty()) + Expect(v.UserEmail).To(BeEmpty()) + }) + }) + + Context("user-scoped access via ForwardedUser email", func() { + It("should scope admin JWT down to user's team memberships", func() { + s := testutil.SeedStandard(client) + _ = s + + ctx := security.ToContext(context.Background(), &security.BusinessContext{ + ClientType: security.ClientTypeAdmin, + }) + ctx = viewer.NewForwardedUserContext(ctx, viewer.ForwardedUser{ + Email: "alice@test.dev", + }) + v := captureViewer(ctx, disableSecurity) + Expect(v).NotTo(BeNil()) + Expect(v.Admin).To(BeFalse(), "admin should be overridden when user email is present") + Expect(v.Teams).To(ConsistOf("team-alpha")) + }) + + It("should keep admin=true when ForwardedUser has IsAdmin=true", func() { + testutil.SeedStandard(client) + + ctx := security.ToContext(context.Background(), &security.BusinessContext{ + ClientType: security.ClientTypeAdmin, + }) + ctx = viewer.NewForwardedUserContext(ctx, viewer.ForwardedUser{ + Email: "alice@test.dev", + IsAdmin: true, + }) + v := captureViewer(ctx, disableSecurity) + Expect(v).NotTo(BeNil()) + Expect(v.Admin).To(BeTrue(), "admin bypass should be preserved when IsAdmin header is set") + }) + + It("should return empty teams when user has no memberships", func() { + testutil.SeedStandard(client) + + ctx := security.ToContext(context.Background(), &security.BusinessContext{ + ClientType: security.ClientTypeAdmin, + }) + ctx = viewer.NewForwardedUserContext(ctx, viewer.ForwardedUser{ + Email: "unknown@test.dev", + }) + v := captureViewer(ctx, disableSecurity) + Expect(v).NotTo(BeNil()) + Expect(v.Admin).To(BeFalse()) + Expect(v.Teams).To(BeEmpty()) + }) + + It("should scope group JWT down to user's team memberships", func() { + testutil.SeedStandard(client) + + ctx := security.ToContext(context.Background(), &security.BusinessContext{ + ClientType: security.ClientTypeGroup, + Group: "group-a", + }) + ctx = viewer.NewForwardedUserContext(ctx, viewer.ForwardedUser{ + Email: "alice@test.dev", + }) + v := captureViewer(ctx, disableSecurity) + Expect(v).NotTo(BeNil()) + Expect(v.Admin).To(BeFalse()) + Expect(v.Teams).To(ConsistOf("team-alpha")) + }) + + It("should not alter viewer when ForwardedUser has no email", func() { + ctx := security.ToContext(context.Background(), &security.BusinessContext{ + ClientType: security.ClientTypeAdmin, + }) + ctx = viewer.NewForwardedUserContext(ctx, viewer.ForwardedUser{ + Name: "Jane Doe", + }) + v := captureViewer(ctx, disableSecurity) + Expect(v).NotTo(BeNil()) + Expect(v.Admin).To(BeTrue(), "admin should remain when no email is forwarded") + }) + }) }) diff --git a/controlplane-api/internal/interceptor/team_filter.go b/controlplane-api/internal/interceptor/team_filter.go index f0c9cceda..d0d5fe310 100644 --- a/controlplane-api/internal/interceptor/team_filter.go +++ b/controlplane-api/internal/interceptor/team_filter.go @@ -16,7 +16,10 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/member" + "github.com/telekom/controlplane/controlplane-api/ent/privacy" "github.com/telekom/controlplane/controlplane-api/ent/team" "github.com/telekom/controlplane/controlplane-api/internal/viewer" ) @@ -25,6 +28,11 @@ import ( func TeamFilterInterceptor() ent.Interceptor { return ent.InterceptFunc(func(next ent.Querier) ent.Querier { return ent.QuerierFunc(func(ctx context.Context, query ent.Query) (ent.Value, error) { + // If privacy.Allow set in the context? If so, skip team filtering (e.g. for system resolvers) + if _, ok := privacy.DecisionFromContext(ctx); ok { + return next.Query(ctx, query) + } + v := viewer.FromContext(ctx) if v == nil || v.Admin { return next.Query(ctx, query) @@ -67,6 +75,18 @@ func TeamFilterInterceptor() ent.Interceptor { ), ), ), + approval.HasEventSubscriptionWith( + eventsubscription.HasOwnerWith( + application.HasOwnerTeamWith(team.NameIn(teams...)), + ), + ), + approval.HasEventSubscriptionWith( + eventsubscription.HasTargetWith( + eventexposure.HasOwnerWith( + application.HasOwnerTeamWith(team.NameIn(teams...)), + ), + ), + ), )) case *entgen.ApprovalRequestQuery: @@ -83,11 +103,33 @@ func TeamFilterInterceptor() ent.Interceptor { ), ), ), + approvalrequest.HasEventSubscriptionWith( + eventsubscription.HasOwnerWith( + application.HasOwnerTeamWith(team.NameIn(teams...)), + ), + ), + approvalrequest.HasEventSubscriptionWith( + eventsubscription.HasTargetWith( + eventexposure.HasOwnerWith( + application.HasOwnerTeamWith(team.NameIn(teams...)), + ), + ), + ), )) case *entgen.MemberQuery: q.Where(member.HasTeamWith(team.NameIn(teams...))) + case *entgen.EventExposureQuery: + q.Where(eventexposure.HasOwnerWith( + application.HasOwnerTeamWith(team.NameIn(teams...)), + )) + + case *entgen.EventSubscriptionQuery: + q.Where(eventsubscription.HasOwnerWith( + application.HasOwnerTeamWith(team.NameIn(teams...)), + )) + case *entgen.GroupQuery, *entgen.ZoneQuery: // No team filtering for public entities diff --git a/controlplane-api/internal/interceptor/team_filter_test.go b/controlplane-api/internal/interceptor/team_filter_test.go index 544da9fb3..4d8b3fb35 100644 --- a/controlplane-api/internal/interceptor/team_filter_test.go +++ b/controlplane-api/internal/interceptor/team_filter_test.go @@ -7,17 +7,16 @@ package interceptor_test import ( "context" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - entgen "github.com/telekom/controlplane/controlplane-api/ent" "github.com/telekom/controlplane/controlplane-api/internal/interceptor" "github.com/telekom/controlplane/controlplane-api/internal/testutil" "github.com/telekom/controlplane/controlplane-api/internal/viewer" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) var _ = Describe("TeamFilterInterceptor", func() { - var client *entgen.Client BeforeEach(func() { @@ -29,9 +28,10 @@ var _ = Describe("TeamFilterInterceptor", func() { client.Close() }) - // viewerCtx creates a context with the given viewer and privacy bypass. + // viewerCtx creates a context with the given viewer (no privacy bypass, + // so the team-filter interceptor is exercised). viewerCtx := func(v *viewer.Viewer) context.Context { - return viewer.NewContext(testutil.AllowContext(), v) + return viewer.NewContext(context.Background(), v) } seed := func() { @@ -51,8 +51,8 @@ var _ = Describe("TeamFilterInterceptor", func() { }) It("should pass through without filtering", func() { - ctx := viewerCtx(&viewer.Viewer{Teams: []string{}}) - // Interceptor passes through; privacy would deny in production. + // AllowContext bypasses privacy (which would deny empty teams in production). + ctx := viewer.NewContext(testutil.AllowContext(), &viewer.Viewer{Teams: []string{}}) teams, err := client.Team.Query().All(ctx) Expect(err).NotTo(HaveOccurred()) Expect(teams).To(HaveLen(2)) @@ -100,6 +100,14 @@ var _ = Describe("TeamFilterInterceptor", func() { r, e := client.Member.Query().All(ctx) return len(r), e }, 2), + Entry("event exposures", func(ctx context.Context) (int, error) { + r, e := client.EventExposure.Query().All(ctx) + return len(r), e + }, 1), + Entry("event subscriptions", func(ctx context.Context) (int, error) { + r, e := client.EventSubscription.Query().All(ctx) + return len(r), e + }, 1), ) }) @@ -144,6 +152,14 @@ var _ = Describe("TeamFilterInterceptor", func() { r, e := client.Member.Query().All(ctx) return len(r), e }, 1), + Entry("event exposures (team-alpha owns one)", func(ctx context.Context) (int, error) { + r, e := client.EventExposure.Query().All(ctx) + return len(r), e + }, 1), + Entry("event subscriptions (team-alpha has none)", func(ctx context.Context) (int, error) { + r, e := client.EventSubscription.Query().All(ctx) + return len(r), e + }, 0), ) }) @@ -176,6 +192,14 @@ var _ = Describe("TeamFilterInterceptor", func() { r, e := client.ApiSubscription.Query().All(ctx) return len(r), e }, 1), + Entry("event exposures", func(ctx context.Context) (int, error) { + r, e := client.EventExposure.Query().All(ctx) + return len(r), e + }, 1), + Entry("event subscriptions", func(ctx context.Context) (int, error) { + r, e := client.EventSubscription.Query().All(ctx) + return len(r), e + }, 1), ) }) @@ -195,7 +219,6 @@ var _ = Describe("TeamFilterInterceptor", func() { Expect(err).NotTo(HaveOccurred()) Expect(groups).To(HaveLen(2)) }) - }) Context("when an unsupported query type is encountered", func() { diff --git a/controlplane-api/internal/resolvers/ent.generated.go b/controlplane-api/internal/resolvers/ent.generated.go index 471cb9579..547679d2c 100644 --- a/controlplane-api/internal/resolvers/ent.generated.go +++ b/controlplane-api/internal/resolvers/ent.generated.go @@ -1,7 +1,6 @@ -// Copyright 2026 Deutsche Telekom IT GmbH +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. package resolvers @@ -10,18 +9,22 @@ import ( "context" "errors" "fmt" + "math" "strconv" "sync/atomic" "time" "entgo.io/contrib/entgql" "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" "github.com/telekom/controlplane/controlplane-api/ent" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" "github.com/telekom/controlplane/controlplane-api/ent/team" "github.com/telekom/controlplane/controlplane-api/ent/zone" "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" @@ -40,15 +43,24 @@ type ApiSubscriptionResolver interface { Target(ctx context.Context, obj *ent.ApiSubscription) (*model1.ApiExposureInfo, error) } type ApplicationResolver interface { + ClientSecret(ctx context.Context, obj *ent.Application) (*string, error) + RotatedClientSecret(ctx context.Context, obj *ent.Application) (*string, error) + OwnerTeam(ctx context.Context, obj *ent.Application) (*model1.TeamInfo, error) } type ApprovalResolver interface { - APISubscription(ctx context.Context, obj *ent.Approval) (*model1.ApiSubscriptionInfo, error) + Subscription(ctx context.Context, obj *ent.Approval) (model.SubscriptionInfo, error) } type ApprovalRequestResolver interface { - APISubscription(ctx context.Context, obj *ent.ApprovalRequest) (*model1.ApiSubscriptionInfo, error) + Subscription(ctx context.Context, obj *ent.ApprovalRequest) (model.SubscriptionInfo, error) Approval(ctx context.Context, obj *ent.ApprovalRequest) (*ent.Approval, error) } +type EventExposureResolver interface { + Subscriptions(ctx context.Context, obj *ent.EventExposure) ([]*model1.EventSubscriptionInfo, error) +} +type EventSubscriptionResolver interface { + Target(ctx context.Context, obj *ent.EventSubscription) (*model1.EventExposureInfo, error) +} type QueryResolver interface { Node(ctx context.Context, id int) (ent.Noder, error) Nodes(ctx context.Context, ids []int) ([]ent.Noder, error) @@ -57,9 +69,17 @@ type QueryResolver interface { Applications(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ApplicationOrder, where *ent.ApplicationWhereInput) (*ent.ApplicationConnection, error) Approvals(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ApprovalOrder, where *ent.ApprovalWhereInput) (*ent.ApprovalConnection, error) ApprovalRequests(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ApprovalRequestOrder, where *ent.ApprovalRequestWhereInput) (*ent.ApprovalRequestConnection, error) + EventExposures(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventExposureOrder, where *ent.EventExposureWhereInput) (*ent.EventExposureConnection, error) + EventSubscriptions(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventSubscriptionOrder, where *ent.EventSubscriptionWhereInput) (*ent.EventSubscriptionConnection, error) Teams(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.TeamOrder, where *ent.TeamWhereInput) (*ent.TeamConnection, error) Zones(ctx context.Context) ([]*ent.Zone, error) } +type TeamResolver interface { + TeamToken(ctx context.Context, obj *ent.Team) (*string, error) +} +type ZoneResolver interface { + TokenURL(ctx context.Context, obj *ent.Zone) (*string, error) +} // endregion ************************** generated!.gotpl ************************** @@ -68,32 +88,104 @@ type QueryResolver interface { func (ec *executionContext) field_Application_exposedApis_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["after"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["before"] = arg2 + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["last"] = arg3 + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) (*ent.ApiExposureOrder, error) { + return ec.unmarshalOApiExposureOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrder(ctx, v) + }) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.ApiExposureWhereInput, error) { + return ec.unmarshalOApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + +func (ec *executionContext) field_Application_exposedEvents_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["before"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg3 - arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOApiExposureOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrder) + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) (*ent.EventExposureOrder, error) { + return ec.unmarshalOEventExposureOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureOrder(ctx, v) + }) if err != nil { return nil, err } args["orderBy"] = arg4 - arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput) + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.EventExposureWhereInput, error) { + return ec.unmarshalOEventExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInput(ctx, v) + }) if err != nil { return nil, err } @@ -104,32 +196,104 @@ func (ec *executionContext) field_Application_exposedApis_args(ctx context.Conte func (ec *executionContext) field_Application_subscribedApis_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["after"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["before"] = arg2 + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["last"] = arg3 + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) (*ent.ApiSubscriptionOrder, error) { + return ec.unmarshalOApiSubscriptionOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrder(ctx, v) + }) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.ApiSubscriptionWhereInput, error) { + return ec.unmarshalOApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + +func (ec *executionContext) field_Application_subscribedEvents_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["before"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg3 - arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOApiSubscriptionOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrder) + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) (*ent.EventSubscriptionOrder, error) { + return ec.unmarshalOEventSubscriptionOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionOrder(ctx, v) + }) if err != nil { return nil, err } args["orderBy"] = arg4 - arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput) + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.EventSubscriptionWhereInput, error) { + return ec.unmarshalOEventSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInput(ctx, v) + }) if err != nil { return nil, err } @@ -140,7 +304,10 @@ func (ec *executionContext) field_Application_subscribedApis_args(ctx context.Co func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "name", ec.unmarshalNString2string) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "name", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) if err != nil { return nil, err } @@ -151,32 +318,50 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs func (ec *executionContext) field_Query_apiExposures_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["before"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg3 - arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOApiExposureOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrder) + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) (*ent.ApiExposureOrder, error) { + return ec.unmarshalOApiExposureOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrder(ctx, v) + }) if err != nil { return nil, err } args["orderBy"] = arg4 - arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput) + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.ApiExposureWhereInput, error) { + return ec.unmarshalOApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput(ctx, v) + }) if err != nil { return nil, err } @@ -187,32 +372,50 @@ func (ec *executionContext) field_Query_apiExposures_args(ctx context.Context, r func (ec *executionContext) field_Query_apiSubscriptions_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["before"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg3 - arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOApiSubscriptionOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrder) + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) (*ent.ApiSubscriptionOrder, error) { + return ec.unmarshalOApiSubscriptionOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrder(ctx, v) + }) if err != nil { return nil, err } args["orderBy"] = arg4 - arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput) + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.ApiSubscriptionWhereInput, error) { + return ec.unmarshalOApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput(ctx, v) + }) if err != nil { return nil, err } @@ -223,32 +426,50 @@ func (ec *executionContext) field_Query_apiSubscriptions_args(ctx context.Contex func (ec *executionContext) field_Query_applications_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["before"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg3 - arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOApplicationOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderᚄ) + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) ([]*ent.ApplicationOrder, error) { + return ec.unmarshalOApplicationOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderᚄ(ctx, v) + }) if err != nil { return nil, err } args["orderBy"] = arg4 - arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput) + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.ApplicationWhereInput, error) { + return ec.unmarshalOApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput(ctx, v) + }) if err != nil { return nil, err } @@ -259,32 +480,50 @@ func (ec *executionContext) field_Query_applications_args(ctx context.Context, r func (ec *executionContext) field_Query_approvalRequests_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["before"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg3 - arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOApprovalRequestOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderᚄ) + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) ([]*ent.ApprovalRequestOrder, error) { + return ec.unmarshalOApprovalRequestOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderᚄ(ctx, v) + }) if err != nil { return nil, err } args["orderBy"] = arg4 - arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOApprovalRequestWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInput) + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.ApprovalRequestWhereInput, error) { + return ec.unmarshalOApprovalRequestWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInput(ctx, v) + }) if err != nil { return nil, err } @@ -295,32 +534,158 @@ func (ec *executionContext) field_Query_approvalRequests_args(ctx context.Contex func (ec *executionContext) field_Query_approvals_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["after"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["before"] = arg2 + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["last"] = arg3 + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) ([]*ent.ApprovalOrder, error) { + return ec.unmarshalOApprovalOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrderᚄ(ctx, v) + }) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.ApprovalWhereInput, error) { + return ec.unmarshalOApprovalWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + +func (ec *executionContext) field_Query_eventExposures_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["after"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["before"] = arg2 + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["last"] = arg3 + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) (*ent.EventExposureOrder, error) { + return ec.unmarshalOEventExposureOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureOrder(ctx, v) + }) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.EventExposureWhereInput, error) { + return ec.unmarshalOEventExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + +func (ec *executionContext) field_Query_eventSubscriptions_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["before"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg3 - arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOApprovalOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrderᚄ) + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) (*ent.EventSubscriptionOrder, error) { + return ec.unmarshalOEventSubscriptionOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionOrder(ctx, v) + }) if err != nil { return nil, err } args["orderBy"] = arg4 - arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOApprovalWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInput) + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.EventSubscriptionWhereInput, error) { + return ec.unmarshalOEventSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInput(ctx, v) + }) if err != nil { return nil, err } @@ -331,7 +696,10 @@ func (ec *executionContext) field_Query_approvals_args(ctx context.Context, rawA func (ec *executionContext) field_Query_node_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2int) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", + func(ctx context.Context, v any) (int, error) { + return ec.unmarshalNID2int(ctx, v) + }) if err != nil { return nil, err } @@ -342,7 +710,10 @@ func (ec *executionContext) field_Query_node_args(ctx context.Context, rawArgs m func (ec *executionContext) field_Query_nodes_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "ids", ec.unmarshalNID2ᚕintᚄ) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "ids", + func(ctx context.Context, v any) ([]int, error) { + return ec.unmarshalNID2ᚕintᚄ(ctx, v) + }) if err != nil { return nil, err } @@ -353,32 +724,50 @@ func (ec *executionContext) field_Query_nodes_args(ctx context.Context, rawArgs func (ec *executionContext) field_Query_teams_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["before"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg3 - arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOTeamOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamOrderᚄ) + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) ([]*ent.TeamOrder, error) { + return ec.unmarshalOTeamOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamOrderᚄ(ctx, v) + }) if err != nil { return nil, err } args["orderBy"] = arg4 - arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOTeamWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInput) + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.TeamWhereInput, error) { + return ec.unmarshalOTeamWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInput(ctx, v) + }) if err != nil { return nil, err } @@ -389,32 +778,50 @@ func (ec *executionContext) field_Query_teams_args(ctx context.Context, rawArgs func (ec *executionContext) field_Team_applications_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["after"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["first"] = arg1 - arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*entgql.Cursor[int], error) { + return ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, v) + }) if err != nil { return nil, err } args["before"] = arg2 - arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) if err != nil { return nil, err } args["last"] = arg3 - arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOApplicationOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderᚄ) + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", + func(ctx context.Context, v any) ([]*ent.ApplicationOrder, error) { + return ec.unmarshalOApplicationOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderᚄ(ctx, v) + }) if err != nil { return nil, err } args["orderBy"] = arg4 - arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput) + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", + func(ctx context.Context, v any) (*ent.ApplicationWhereInput, error) { + return ec.unmarshalOApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput(ctx, v) + }) if err != nil { return nil, err } @@ -435,28 +842,22 @@ func (ec *executionContext) _ApiExposure_id(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposure_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _ApiExposure_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -464,28 +865,22 @@ func (ec *executionContext) _ApiExposure_createdAt(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_createdAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, + 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_ApiExposure_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type Time does not have child fields")) } func (ec *executionContext) _ApiExposure_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -493,28 +888,22 @@ func (ec *executionContext) _ApiExposure_lastModifiedAt(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_lastModifiedAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_lastModifiedAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, + 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_ApiExposure_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type Time does not have child fields")) } func (ec *executionContext) _ApiExposure_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -522,28 +911,22 @@ func (ec *executionContext) _ApiExposure_statusPhase(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_statusPhase, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_statusPhase(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.StatusPhase, nil }, nil, - ec.marshalOApiExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase, + func(ctx context.Context, selections ast.SelectionSet, v *apiexposure.StatusPhase) graphql.Marshaler { + return ec.marshalOApiExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiExposure_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApiExposureStatusPhase does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type ApiExposureStatusPhase does not have child fields")) } func (ec *executionContext) _ApiExposure_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -551,28 +934,22 @@ func (ec *executionContext) _ApiExposure_statusMessage(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_statusMessage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_statusMessage(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiExposure_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiExposure_environment(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -580,28 +957,22 @@ func (ec *executionContext) _ApiExposure_environment(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_environment, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_environment(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Environment, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiExposure_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiExposure_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -609,28 +980,22 @@ func (ec *executionContext) _ApiExposure_namespace(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_namespace, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_namespace(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Namespace, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposure_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiExposure_basePath(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -638,28 +1003,22 @@ func (ec *executionContext) _ApiExposure_basePath(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_basePath, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_basePath(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.BasePath, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposure_basePath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiExposure_visibility(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -667,28 +1026,22 @@ func (ec *executionContext) _ApiExposure_visibility(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_visibility, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_visibility(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Visibility, nil }, nil, - ec.marshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility, + func(ctx context.Context, selections ast.SelectionSet, v apiexposure.Visibility) graphql.Marshaler { + return ec.marshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposure_visibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApiExposureVisibility does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type ApiExposureVisibility does not have child fields")) } func (ec *executionContext) _ApiExposure_active(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -696,28 +1049,22 @@ func (ec *executionContext) _ApiExposure_active(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_active, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_active(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Active, nil }, nil, - ec.marshalOBoolean2ᚖbool, + func(ctx context.Context, selections ast.SelectionSet, v *bool) graphql.Marshaler { + return ec.marshalOBoolean2ᚖbool(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiExposure_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type Boolean does not have child fields")) } func (ec *executionContext) _ApiExposure_features(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -725,28 +1072,22 @@ func (ec *executionContext) _ApiExposure_features(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_features, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_features(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.ApiExposure().Features(ctx, obj) }, nil, - ec.marshalNApiExposureFeature2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAPIExposureFeatureᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []model.APIExposureFeature) graphql.Marshaler { + return ec.marshalNApiExposureFeature2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAPIExposureFeatureᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposure_features(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApiExposureFeature does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, true, true, errors.New("field of type ApiExposureFeature does not have child fields")) } func (ec *executionContext) _ApiExposure_upstreams(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -754,17 +1095,20 @@ func (ec *executionContext) _ApiExposure_upstreams(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_upstreams, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_upstreams(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Upstreams, nil }, nil, - ec.marshalNUpstream2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐUpstreamᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []model1.Upstream) graphql.Marshaler { + return ec.marshalNUpstream2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐUpstreamᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposure_upstreams(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiExposure", @@ -772,13 +1116,7 @@ func (ec *executionContext) fieldContext_ApiExposure_upstreams(_ context.Context IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "url": - return ec.fieldContext_Upstream_url(ctx, field) - case "weight": - return ec.fieldContext_Upstream_weight(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Upstream", field.Name) + return ec.childFields_Upstream(ctx, field) }, } return fc, nil @@ -789,17 +1127,20 @@ func (ec *executionContext) _ApiExposure_approvalConfig(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_approvalConfig, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_approvalConfig(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ApprovalConfig, nil }, nil, - ec.marshalNApprovalConfig2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApprovalConfig, + func(ctx context.Context, selections ast.SelectionSet, v model1.ApprovalConfig) graphql.Marshaler { + return ec.marshalNApprovalConfig2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApprovalConfig(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposure_approvalConfig(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiExposure", @@ -807,13 +1148,7 @@ func (ec *executionContext) fieldContext_ApiExposure_approvalConfig(_ context.Co IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "strategy": - return ec.fieldContext_ApprovalConfig_strategy(ctx, field) - case "trustedTeams": - return ec.fieldContext_ApprovalConfig_trustedTeams(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApprovalConfig", field.Name) + return ec.childFields_ApprovalConfig(ctx, field) }, } return fc, nil @@ -824,28 +1159,22 @@ func (ec *executionContext) _ApiExposure_apiVersion(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_apiVersion, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_apiVersion(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.APIVersion, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiExposure_apiVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposure", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiExposure_owner(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { @@ -853,17 +1182,20 @@ func (ec *executionContext) _ApiExposure_owner(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_owner, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_owner(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Owner(ctx) }, nil, - ec.marshalNApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Application) graphql.Marshaler { + return ec.marshalNApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposure_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiExposure", @@ -871,39 +1203,7 @@ func (ec *executionContext) fieldContext_ApiExposure_owner(_ context.Context, fi IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Application_id(ctx, field) - case "createdAt": - return ec.fieldContext_Application_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Application_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_Application_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_Application_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_Application_environment(ctx, field) - case "namespace": - return ec.fieldContext_Application_namespace(ctx, field) - case "name": - return ec.fieldContext_Application_name(ctx, field) - case "clientID": - return ec.fieldContext_Application_clientID(ctx, field) - case "clientSecret": - return ec.fieldContext_Application_clientSecret(ctx, field) - case "issuerURL": - return ec.fieldContext_Application_issuerURL(ctx, field) - case "zone": - return ec.fieldContext_Application_zone(ctx, field) - case "exposedApis": - return ec.fieldContext_Application_exposedApis(ctx, field) - case "subscribedApis": - return ec.fieldContext_Application_subscribedApis(ctx, field) - case "ownerTeam": - return ec.fieldContext_Application_ownerTeam(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Application", field.Name) + return ec.childFields_Application(ctx, field) }, } return fc, nil @@ -914,17 +1214,20 @@ func (ec *executionContext) _ApiExposure_subscriptions(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposure_subscriptions, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposure_subscriptions(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.ApiExposure().Subscriptions(ctx, obj) }, nil, - ec.marshalNApiSubscriptionInfo2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiSubscriptionInfoᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*model1.ApiSubscriptionInfo) graphql.Marshaler { + return ec.marshalNApiSubscriptionInfo2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiSubscriptionInfoᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposure_subscriptions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiExposure", @@ -932,21 +1235,7 @@ func (ec *executionContext) fieldContext_ApiExposure_subscriptions(_ context.Con IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ApiSubscriptionInfo_id(ctx, field) - case "basePath": - return ec.fieldContext_ApiSubscriptionInfo_basePath(ctx, field) - case "statusPhase": - return ec.fieldContext_ApiSubscriptionInfo_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_ApiSubscriptionInfo_statusMessage(ctx, field) - case "ownerApplicationName": - return ec.fieldContext_ApiSubscriptionInfo_ownerApplicationName(ctx, field) - case "ownerTeam": - return ec.fieldContext_ApiSubscriptionInfo_ownerTeam(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiSubscriptionInfo", field.Name) + return ec.childFields_ApiSubscriptionInfo(ctx, field) }, } return fc, nil @@ -957,17 +1246,20 @@ func (ec *executionContext) _ApiExposureConnection_edges(ctx context.Context, fi ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureConnection_edges, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureConnection_edges(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - ec.marshalOApiExposureEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureEdge, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.ApiExposureEdge) graphql.Marshaler { + return ec.marshalOApiExposureEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureEdge(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiExposureConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiExposureConnection", @@ -975,13 +1267,7 @@ func (ec *executionContext) fieldContext_ApiExposureConnection_edges(_ context.C IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_ApiExposureEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_ApiExposureEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiExposureEdge", field.Name) + return ec.childFields_ApiExposureEdge(ctx, field) }, } return fc, nil @@ -992,17 +1278,20 @@ func (ec *executionContext) _ApiExposureConnection_pageInfo(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureConnection_pageInfo, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureConnection_pageInfo(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.PageInfo, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + func(ctx context.Context, selections ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposureConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiExposureConnection", @@ -1010,17 +1299,7 @@ func (ec *executionContext) fieldContext_ApiExposureConnection_pageInfo(_ contex IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return ec.childFields_PageInfo(ctx, field) }, } return fc, nil @@ -1031,28 +1310,22 @@ func (ec *executionContext) _ApiExposureConnection_totalCount(ctx context.Contex ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureConnection_totalCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureConnection_totalCount(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.TotalCount, nil }, nil, - ec.marshalNInt2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposureConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposureConnection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposureConnection", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _ApiExposureEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposureEdge) (ret graphql.Marshaler) { @@ -1060,17 +1333,20 @@ func (ec *executionContext) _ApiExposureEdge_node(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureEdge_node, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureEdge_node(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - ec.marshalOApiExposure2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposure, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApiExposure) graphql.Marshaler { + return ec.marshalOApiExposure2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposure(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiExposureEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiExposureEdge", @@ -1078,41 +1354,7 @@ func (ec *executionContext) fieldContext_ApiExposureEdge_node(_ context.Context, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ApiExposure_id(ctx, field) - case "createdAt": - return ec.fieldContext_ApiExposure_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_ApiExposure_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_ApiExposure_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_ApiExposure_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_ApiExposure_environment(ctx, field) - case "namespace": - return ec.fieldContext_ApiExposure_namespace(ctx, field) - case "basePath": - return ec.fieldContext_ApiExposure_basePath(ctx, field) - case "visibility": - return ec.fieldContext_ApiExposure_visibility(ctx, field) - case "active": - return ec.fieldContext_ApiExposure_active(ctx, field) - case "features": - return ec.fieldContext_ApiExposure_features(ctx, field) - case "upstreams": - return ec.fieldContext_ApiExposure_upstreams(ctx, field) - case "approvalConfig": - return ec.fieldContext_ApiExposure_approvalConfig(ctx, field) - case "apiVersion": - return ec.fieldContext_ApiExposure_apiVersion(ctx, field) - case "owner": - return ec.fieldContext_ApiExposure_owner(ctx, field) - case "subscriptions": - return ec.fieldContext_ApiExposure_subscriptions(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiExposure", field.Name) + return ec.childFields_ApiExposure(ctx, field) }, } return fc, nil @@ -1123,28 +1365,22 @@ func (ec *executionContext) _ApiExposureEdge_cursor(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureEdge_cursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureEdge_cursor(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Cursor, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + func(ctx context.Context, selections ast.SelectionSet, v entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposureEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposureEdge", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposureEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } func (ec *executionContext) _ApiSubscription_id(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1152,28 +1388,22 @@ func (ec *executionContext) _ApiSubscription_id(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscription_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _ApiSubscription_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1181,28 +1411,22 @@ func (ec *executionContext) _ApiSubscription_createdAt(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_createdAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, + 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_ApiSubscription_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type Time does not have child fields")) } func (ec *executionContext) _ApiSubscription_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1210,28 +1434,22 @@ func (ec *executionContext) _ApiSubscription_lastModifiedAt(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_lastModifiedAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_lastModifiedAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, + 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_ApiSubscription_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type Time does not have child fields")) } func (ec *executionContext) _ApiSubscription_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1239,28 +1457,22 @@ func (ec *executionContext) _ApiSubscription_statusPhase(ctx context.Context, fi ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_statusPhase, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_statusPhase(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.StatusPhase, nil }, nil, - ec.marshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase, + func(ctx context.Context, selections ast.SelectionSet, v *apisubscription.StatusPhase) graphql.Marshaler { + return ec.marshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiSubscription_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApiSubscriptionStatusPhase does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type ApiSubscriptionStatusPhase does not have child fields")) } func (ec *executionContext) _ApiSubscription_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1268,28 +1480,22 @@ func (ec *executionContext) _ApiSubscription_statusMessage(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_statusMessage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_statusMessage(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiSubscription_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiSubscription_environment(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1297,28 +1503,22 @@ func (ec *executionContext) _ApiSubscription_environment(ctx context.Context, fi ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_environment, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_environment(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Environment, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiSubscription_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiSubscription_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1326,28 +1526,22 @@ func (ec *executionContext) _ApiSubscription_namespace(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_namespace, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_namespace(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Namespace, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscription_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiSubscription_name(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1355,28 +1549,22 @@ func (ec *executionContext) _ApiSubscription_name(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscription_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiSubscription_basePath(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1384,28 +1572,22 @@ func (ec *executionContext) _ApiSubscription_basePath(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_basePath, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_basePath(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.BasePath, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscription_basePath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiSubscription_m2mAuthMethod(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1413,28 +1595,22 @@ func (ec *executionContext) _ApiSubscription_m2mAuthMethod(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_m2mAuthMethod, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_m2mAuthMethod(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.M2mAuthMethod, nil }, nil, - ec.marshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod, + func(ctx context.Context, selections ast.SelectionSet, v apisubscription.M2mAuthMethod) graphql.Marshaler { + return ec.marshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscription_m2mAuthMethod(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApiSubscriptionM2mAuthMethod does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type ApiSubscriptionM2mAuthMethod does not have child fields")) } func (ec *executionContext) _ApiSubscription_approvedScopes(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1442,28 +1618,22 @@ func (ec *executionContext) _ApiSubscription_approvedScopes(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_approvedScopes, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_approvedScopes(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ApprovedScopes, nil }, nil, - ec.marshalNString2ᚕstringᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalNString2ᚕstringᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscription_approvedScopes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscription", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiSubscription_owner(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { @@ -1471,17 +1641,20 @@ func (ec *executionContext) _ApiSubscription_owner(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_owner, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_owner(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Owner(ctx) }, nil, - ec.marshalNApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Application) graphql.Marshaler { + return ec.marshalNApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscription_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiSubscription", @@ -1489,39 +1662,7 @@ func (ec *executionContext) fieldContext_ApiSubscription_owner(_ context.Context IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Application_id(ctx, field) - case "createdAt": - return ec.fieldContext_Application_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Application_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_Application_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_Application_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_Application_environment(ctx, field) - case "namespace": - return ec.fieldContext_Application_namespace(ctx, field) - case "name": - return ec.fieldContext_Application_name(ctx, field) - case "clientID": - return ec.fieldContext_Application_clientID(ctx, field) - case "clientSecret": - return ec.fieldContext_Application_clientSecret(ctx, field) - case "issuerURL": - return ec.fieldContext_Application_issuerURL(ctx, field) - case "zone": - return ec.fieldContext_Application_zone(ctx, field) - case "exposedApis": - return ec.fieldContext_Application_exposedApis(ctx, field) - case "subscribedApis": - return ec.fieldContext_Application_subscribedApis(ctx, field) - case "ownerTeam": - return ec.fieldContext_Application_ownerTeam(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Application", field.Name) + return ec.childFields_Application(ctx, field) }, } return fc, nil @@ -1532,17 +1673,20 @@ func (ec *executionContext) _ApiSubscription_failoverZones(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_failoverZones, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_failoverZones(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.FailoverZones(ctx) }, nil, - ec.marshalOZone2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.Zone) graphql.Marshaler { + return ec.marshalOZone2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiSubscription_failoverZones(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiSubscription", @@ -1550,21 +1694,7 @@ func (ec *executionContext) fieldContext_ApiSubscription_failoverZones(_ context IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Zone_id(ctx, field) - case "environment": - return ec.fieldContext_Zone_environment(ctx, field) - case "name": - return ec.fieldContext_Zone_name(ctx, field) - case "gatewayURL": - return ec.fieldContext_Zone_gatewayURL(ctx, field) - case "visibility": - return ec.fieldContext_Zone_visibility(ctx, field) - case "applications": - return ec.fieldContext_Zone_applications(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Zone", field.Name) + return ec.childFields_Zone(ctx, field) }, } return fc, nil @@ -1575,17 +1705,20 @@ func (ec *executionContext) _ApiSubscription_approval(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_approval, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_approval(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Approval(ctx) }, nil, - ec.marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Approval) graphql.Marshaler { + return ec.marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiSubscription_approval(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiSubscription", @@ -1593,43 +1726,7 @@ func (ec *executionContext) fieldContext_ApiSubscription_approval(_ context.Cont IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Approval_id(ctx, field) - case "createdAt": - return ec.fieldContext_Approval_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Approval_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_Approval_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_Approval_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_Approval_environment(ctx, field) - case "namespace": - return ec.fieldContext_Approval_namespace(ctx, field) - case "action": - return ec.fieldContext_Approval_action(ctx, field) - case "strategy": - return ec.fieldContext_Approval_strategy(ctx, field) - case "requester": - return ec.fieldContext_Approval_requester(ctx, field) - case "decider": - return ec.fieldContext_Approval_decider(ctx, field) - case "deciderTeamName": - return ec.fieldContext_Approval_deciderTeamName(ctx, field) - case "decisions": - return ec.fieldContext_Approval_decisions(ctx, field) - case "availableTransitions": - return ec.fieldContext_Approval_availableTransitions(ctx, field) - case "name": - return ec.fieldContext_Approval_name(ctx, field) - case "state": - return ec.fieldContext_Approval_state(ctx, field) - case "apiSubscription": - return ec.fieldContext_Approval_apiSubscription(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Approval", field.Name) + return ec.childFields_Approval(ctx, field) }, } return fc, nil @@ -1640,17 +1737,20 @@ func (ec *executionContext) _ApiSubscription_approvalRequests(ctx context.Contex ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_approvalRequests, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_approvalRequests(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ApprovalRequests(ctx) }, nil, - ec.marshalOApprovalRequest2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.ApprovalRequest) graphql.Marshaler { + return ec.marshalOApprovalRequest2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiSubscription_approvalRequests(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiSubscription", @@ -1658,45 +1758,7 @@ func (ec *executionContext) fieldContext_ApiSubscription_approvalRequests(_ cont IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ApprovalRequest_id(ctx, field) - case "createdAt": - return ec.fieldContext_ApprovalRequest_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_ApprovalRequest_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_ApprovalRequest_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_ApprovalRequest_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_ApprovalRequest_environment(ctx, field) - case "namespace": - return ec.fieldContext_ApprovalRequest_namespace(ctx, field) - case "action": - return ec.fieldContext_ApprovalRequest_action(ctx, field) - case "strategy": - return ec.fieldContext_ApprovalRequest_strategy(ctx, field) - case "requester": - return ec.fieldContext_ApprovalRequest_requester(ctx, field) - case "decider": - return ec.fieldContext_ApprovalRequest_decider(ctx, field) - case "deciderTeamName": - return ec.fieldContext_ApprovalRequest_deciderTeamName(ctx, field) - case "decisions": - return ec.fieldContext_ApprovalRequest_decisions(ctx, field) - case "availableTransitions": - return ec.fieldContext_ApprovalRequest_availableTransitions(ctx, field) - case "name": - return ec.fieldContext_ApprovalRequest_name(ctx, field) - case "state": - return ec.fieldContext_ApprovalRequest_state(ctx, field) - case "apiSubscription": - return ec.fieldContext_ApprovalRequest_apiSubscription(ctx, field) - case "approval": - return ec.fieldContext_ApprovalRequest_approval(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApprovalRequest", field.Name) + return ec.childFields_ApprovalRequest(ctx, field) }, } return fc, nil @@ -1707,17 +1769,20 @@ func (ec *executionContext) _ApiSubscription_target(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscription_target, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscription_target(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.ApiSubscription().Target(ctx, obj) }, nil, - ec.marshalNApiExposureInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiExposureInfo, + func(ctx context.Context, selections ast.SelectionSet, v *model1.ApiExposureInfo) graphql.Marshaler { + return ec.marshalNApiExposureInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiExposureInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscription_target(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiSubscription", @@ -1725,27 +1790,7 @@ func (ec *executionContext) fieldContext_ApiSubscription_target(_ context.Contex IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ApiExposureInfo_id(ctx, field) - case "basePath": - return ec.fieldContext_ApiExposureInfo_basePath(ctx, field) - case "visibility": - return ec.fieldContext_ApiExposureInfo_visibility(ctx, field) - case "active": - return ec.fieldContext_ApiExposureInfo_active(ctx, field) - case "apiVersion": - return ec.fieldContext_ApiExposureInfo_apiVersion(ctx, field) - case "features": - return ec.fieldContext_ApiExposureInfo_features(ctx, field) - case "approvalConfig": - return ec.fieldContext_ApiExposureInfo_approvalConfig(ctx, field) - case "ownerApplicationName": - return ec.fieldContext_ApiExposureInfo_ownerApplicationName(ctx, field) - case "ownerTeam": - return ec.fieldContext_ApiExposureInfo_ownerTeam(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiExposureInfo", field.Name) + return ec.childFields_ApiExposureInfo(ctx, field) }, } return fc, nil @@ -1756,17 +1801,20 @@ func (ec *executionContext) _ApiSubscriptionConnection_edges(ctx context.Context ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionConnection_edges, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionConnection_edges(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - ec.marshalOApiSubscriptionEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionEdge, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.ApiSubscriptionEdge) graphql.Marshaler { + return ec.marshalOApiSubscriptionEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionEdge(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiSubscriptionConnection", @@ -1774,13 +1822,7 @@ func (ec *executionContext) fieldContext_ApiSubscriptionConnection_edges(_ conte IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_ApiSubscriptionEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_ApiSubscriptionEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiSubscriptionEdge", field.Name) + return ec.childFields_ApiSubscriptionEdge(ctx, field) }, } return fc, nil @@ -1791,17 +1833,20 @@ func (ec *executionContext) _ApiSubscriptionConnection_pageInfo(ctx context.Cont ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionConnection_pageInfo, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionConnection_pageInfo(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.PageInfo, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + func(ctx context.Context, selections ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiSubscriptionConnection", @@ -1809,17 +1854,7 @@ func (ec *executionContext) fieldContext_ApiSubscriptionConnection_pageInfo(_ co IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return ec.childFields_PageInfo(ctx, field) }, } return fc, nil @@ -1830,28 +1865,22 @@ func (ec *executionContext) _ApiSubscriptionConnection_totalCount(ctx context.Co ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionConnection_totalCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionConnection_totalCount(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.TotalCount, nil }, nil, - ec.marshalNInt2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscriptionConnection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscriptionConnection", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _ApiSubscriptionEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscriptionEdge) (ret graphql.Marshaler) { @@ -1859,17 +1888,20 @@ func (ec *executionContext) _ApiSubscriptionEdge_node(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionEdge_node, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionEdge_node(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - ec.marshalOApiSubscription2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscription, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApiSubscription) graphql.Marshaler { + return ec.marshalOApiSubscription2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscription(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiSubscriptionEdge", @@ -1877,41 +1909,7 @@ func (ec *executionContext) fieldContext_ApiSubscriptionEdge_node(_ context.Cont IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ApiSubscription_id(ctx, field) - case "createdAt": - return ec.fieldContext_ApiSubscription_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_ApiSubscription_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_ApiSubscription_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_ApiSubscription_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_ApiSubscription_environment(ctx, field) - case "namespace": - return ec.fieldContext_ApiSubscription_namespace(ctx, field) - case "name": - return ec.fieldContext_ApiSubscription_name(ctx, field) - case "basePath": - return ec.fieldContext_ApiSubscription_basePath(ctx, field) - case "m2mAuthMethod": - return ec.fieldContext_ApiSubscription_m2mAuthMethod(ctx, field) - case "approvedScopes": - return ec.fieldContext_ApiSubscription_approvedScopes(ctx, field) - case "owner": - return ec.fieldContext_ApiSubscription_owner(ctx, field) - case "failoverZones": - return ec.fieldContext_ApiSubscription_failoverZones(ctx, field) - case "approval": - return ec.fieldContext_ApiSubscription_approval(ctx, field) - case "approvalRequests": - return ec.fieldContext_ApiSubscription_approvalRequests(ctx, field) - case "target": - return ec.fieldContext_ApiSubscription_target(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiSubscription", field.Name) + return ec.childFields_ApiSubscription(ctx, field) }, } return fc, nil @@ -1922,28 +1920,22 @@ func (ec *executionContext) _ApiSubscriptionEdge_cursor(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionEdge_cursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionEdge_cursor(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Cursor, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + func(ctx context.Context, selections ast.SelectionSet, v entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscriptionEdge", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscriptionEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } func (ec *executionContext) _Application_id(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { @@ -1951,28 +1943,22 @@ func (ec *executionContext) _Application_id(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext_Application_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Application_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _Application_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { @@ -1980,28 +1966,22 @@ func (ec *executionContext) _Application_createdAt(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_Application_createdAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, + 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_Application_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type Time does not have child fields")) } func (ec *executionContext) _Application_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { @@ -2009,28 +1989,22 @@ func (ec *executionContext) _Application_lastModifiedAt(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_Application_lastModifiedAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_lastModifiedAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, + 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_Application_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type Time does not have child fields")) } func (ec *executionContext) _Application_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { @@ -2038,28 +2012,22 @@ func (ec *executionContext) _Application_statusPhase(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Application_statusPhase, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_statusPhase(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.StatusPhase, nil }, nil, - ec.marshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase, + func(ctx context.Context, selections ast.SelectionSet, v *application.StatusPhase) graphql.Marshaler { + return ec.marshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Application_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApplicationStatusPhase does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type ApplicationStatusPhase does not have child fields")) } func (ec *executionContext) _Application_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { @@ -2067,28 +2035,22 @@ func (ec *executionContext) _Application_statusMessage(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_Application_statusMessage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_statusMessage(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Application_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Application_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { @@ -2096,28 +2058,22 @@ func (ec *executionContext) _Application_environment(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Application_environment, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_environment(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Environment, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Application_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Application_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { @@ -2125,28 +2081,22 @@ func (ec *executionContext) _Application_namespace(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_Application_namespace, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_namespace(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Namespace, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Application_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Application_name(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { @@ -2154,28 +2104,22 @@ func (ec *executionContext) _Application_name(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext_Application_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Application_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Application_clientID(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { @@ -2183,28 +2127,22 @@ func (ec *executionContext) _Application_clientID(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_Application_clientID, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_clientID(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ClientID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Application_clientID(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Application_clientSecret(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { @@ -2212,633 +2150,680 @@ func (ec *executionContext) _Application_clientSecret(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Application_clientSecret, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_clientSecret(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.ClientSecret, nil + return ec.Resolvers.Application().ClientSecret(ctx, obj) }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Application_clientSecret(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Application", field, true, true, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Application_issuerURL(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_rotatedClientSecret(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Application_issuerURL, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_rotatedClientSecret(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.IssuerURL, nil + return ec.Resolvers.Application().RotatedClientSecret(ctx, obj) }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_Application_issuerURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Application_rotatedClientSecret(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Application", field, true, true, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Application_zone(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_rotatedExpiresAt(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Application_zone, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_rotatedExpiresAt(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Zone(ctx) + return obj.RotatedExpiresAt, nil }, nil, - ec.marshalNZone2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZone, - true, + func(ctx context.Context, selections ast.SelectionSet, v *time.Time) graphql.Marshaler { + return ec.marshalOTime2ᚖtimeᚐTime(ctx, selections, v) + }, true, + false, ) } - -func (ec *executionContext) fieldContext_Application_zone(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Zone_id(ctx, field) - case "environment": - return ec.fieldContext_Zone_environment(ctx, field) - case "name": - return ec.fieldContext_Zone_name(ctx, field) - case "gatewayURL": - return ec.fieldContext_Zone_gatewayURL(ctx, field) - case "visibility": - return ec.fieldContext_Zone_visibility(ctx, field) - case "applications": - return ec.fieldContext_Zone_applications(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Zone", field.Name) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Application_rotatedExpiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _Application_exposedApis(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_currentExpiresAt(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Application_exposedApis, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_currentExpiresAt(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.ExposedApis(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.ApiExposureOrder), fc.Args["where"].(*ent.ApiExposureWhereInput)) + return obj.CurrentExpiresAt, nil }, nil, - ec.marshalNApiExposureConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureConnection, - true, + func(ctx context.Context, selections ast.SelectionSet, v *time.Time) graphql.Marshaler { + return ec.marshalOTime2ᚖtimeᚐTime(ctx, selections, v) + }, true, + false, ) } - -func (ec *executionContext) fieldContext_Application_exposedApis(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ApiExposureConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ApiExposureConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ApiExposureConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiExposureConnection", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Application_exposedApis_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) fieldContext_Application_currentExpiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _Application_subscribedApis(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_secretRotationPhase(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Application_subscribedApis, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_secretRotationPhase(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.SubscribedApis(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.ApiSubscriptionOrder), fc.Args["where"].(*ent.ApiSubscriptionWhereInput)) + return obj.SecretRotationPhase, nil }, nil, - ec.marshalNApiSubscriptionConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionConnection, + func(ctx context.Context, selections ast.SelectionSet, v application.SecretRotationPhase) graphql.Marshaler { + return ec.marshalNApplicationSecretRotationPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhase(ctx, selections, v) + }, true, true, ) } +func (ec *executionContext) fieldContext_Application_secretRotationPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type ApplicationSecretRotationPhase does not have child fields")) +} -func (ec *executionContext) fieldContext_Application_subscribedApis(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ApiSubscriptionConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ApiSubscriptionConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ApiSubscriptionConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiSubscriptionConnection", field.Name) +func (ec *executionContext) _Application_secretRotationMessage(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_secretRotationMessage(ctx, field) }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Application_subscribedApis_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil + func(ctx context.Context) (any, error) { + return obj.SecretRotationMessage, 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_Application_secretRotationMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Application_ownerTeam(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_zone(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Application_ownerTeam, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_zone(ctx, field) + }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Application().OwnerTeam(ctx, obj) + return obj.Zone(ctx) }, nil, - ec.marshalNTeamInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐTeamInfo, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Zone) graphql.Marshaler { + return ec.marshalNZone2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZone(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Application_ownerTeam(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Application_zone(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Application", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_TeamInfo_id(ctx, field) - case "name": - return ec.fieldContext_TeamInfo_name(ctx, field) - case "groupName": - return ec.fieldContext_TeamInfo_groupName(ctx, field) - case "email": - return ec.fieldContext_TeamInfo_email(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TeamInfo", field.Name) + return ec.childFields_Zone(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApplicationConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_exposedApis(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApplicationConnection_edges, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_exposedApis(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Edges, nil + fc := graphql.GetFieldContext(ctx) + return obj.ExposedApis(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.ApiExposureOrder), fc.Args["where"].(*ent.ApiExposureWhereInput)) }, nil, - ec.marshalOApplicationEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationEdge, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApiExposureConnection) graphql.Marshaler { + return ec.marshalNApiExposureConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureConnection(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_ApplicationConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Application_exposedApis(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApplicationConnection", + Object: "Application", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_ApplicationEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_ApplicationEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApplicationEdge", field.Name) + return ec.childFields_ApiExposureConnection(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Application_exposedApis_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _ApplicationConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_subscribedApis(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApplicationConnection_pageInfo, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_subscribedApis(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + fc := graphql.GetFieldContext(ctx) + return obj.SubscribedApis(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.ApiSubscriptionOrder), fc.Args["where"].(*ent.ApiSubscriptionWhereInput)) }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApiSubscriptionConnection) graphql.Marshaler { + return ec.marshalNApiSubscriptionConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionConnection(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_ApplicationConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Application_subscribedApis(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApplicationConnection", + Object: "Application", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return ec.childFields_ApiSubscriptionConnection(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Application_subscribedApis_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _ApplicationConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_exposedEvents(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApplicationConnection_totalCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_exposedEvents(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + fc := graphql.GetFieldContext(ctx) + return obj.ExposedEvents(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.EventExposureOrder), fc.Args["where"].(*ent.EventExposureWhereInput)) }, nil, - ec.marshalNInt2int, + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventExposureConnection) graphql.Marshaler { + return ec.marshalNEventExposureConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureConnection(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_ApplicationConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Application_exposedEvents(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApplicationConnection", + Object: "Application", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return ec.childFields_EventExposureConnection(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Application_exposedEvents_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _ApplicationEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_subscribedEvents(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApplicationEdge_node, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_subscribedEvents(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Node, nil + fc := graphql.GetFieldContext(ctx) + return obj.SubscribedEvents(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.EventSubscriptionOrder), fc.Args["where"].(*ent.EventSubscriptionWhereInput)) }, nil, - ec.marshalOApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication, + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventSubscriptionConnection) graphql.Marshaler { + return ec.marshalNEventSubscriptionConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionConnection(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_ApplicationEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Application_subscribedEvents(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApplicationEdge", + Object: "Application", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Application_id(ctx, field) - case "createdAt": - return ec.fieldContext_Application_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Application_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_Application_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_Application_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_Application_environment(ctx, field) - case "namespace": - return ec.fieldContext_Application_namespace(ctx, field) - case "name": - return ec.fieldContext_Application_name(ctx, field) - case "clientID": - return ec.fieldContext_Application_clientID(ctx, field) - case "clientSecret": - return ec.fieldContext_Application_clientSecret(ctx, field) - case "issuerURL": - return ec.fieldContext_Application_issuerURL(ctx, field) - case "zone": - return ec.fieldContext_Application_zone(ctx, field) - case "exposedApis": - return ec.fieldContext_Application_exposedApis(ctx, field) - case "subscribedApis": - return ec.fieldContext_Application_subscribedApis(ctx, field) - case "ownerTeam": - return ec.fieldContext_Application_ownerTeam(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Application", field.Name) + return ec.childFields_EventSubscriptionConnection(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Application_subscribedEvents_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _ApplicationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_ownerTeam(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApplicationEdge_cursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_ownerTeam(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return ec.Resolvers.Application().OwnerTeam(ctx, obj) }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + func(ctx context.Context, selections ast.SelectionSet, v *model1.TeamInfo) graphql.Marshaler { + return ec.marshalNTeamInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐTeamInfo(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_ApplicationEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Application_ownerTeam(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApplicationEdge", + Object: "Application", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return ec.childFields_TeamInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Approval_id(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _ApplicationConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Approval_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApplicationConnection_edges(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Edges, nil }, nil, - ec.marshalNID2int, - true, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.ApplicationEdge) graphql.Marshaler { + return ec.marshalOApplicationEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationEdge(ctx, selections, v) + }, true, + false, ) } - -func (ec *executionContext) fieldContext_Approval_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApplicationConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Approval", + Object: "ApplicationConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return ec.childFields_ApplicationEdge(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Approval_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _ApplicationConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Approval_createdAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApplicationConnection_pageInfo(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.PageInfo, nil }, nil, - ec.marshalNTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Approval_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApplicationConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Approval", + Object: "ApplicationConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return ec.childFields_PageInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Approval_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _ApplicationConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Approval_lastModifiedAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApplicationConnection_totalCount(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.TotalCount, nil }, nil, - ec.marshalNTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Approval_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Approval", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_ApplicationConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApplicationConnection", field, false, false, errors.New("field of type Int does not have child fields")) } -func (ec *executionContext) _Approval_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _ApplicationEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Approval_statusPhase, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApplicationEdge_node(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.StatusPhase, nil + return obj.Node, nil }, nil, - ec.marshalOApprovalStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Application) graphql.Marshaler { + return ec.marshalOApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_Approval_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApplicationEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Approval", + Object: "ApplicationEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApprovalStatusPhase does not have child fields") + return ec.childFields_Application(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Approval_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _ApplicationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Approval_statusMessage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApplicationEdge_cursor(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.StatusMessage, nil + return obj.Cursor, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Approval_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Approval", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_ApplicationEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApplicationEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } -func (ec *executionContext) _Approval_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_id(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Approval_environment, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_id(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Environment, nil + return obj.ID, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Approval_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Approval", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Approval_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _Approval_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Approval_namespace, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Namespace, nil + return obj.CreatedAt, nil }, nil, - ec.marshalNString2string, + 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_Approval_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type Time does not have child fields")) +} -func (ec *executionContext) fieldContext_Approval_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Approval", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") +func (ec *executionContext) _Approval_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_lastModifiedAt(ctx, field) }, - } - return fc, nil + func(ctx context.Context) (any, error) { + return obj.LastModifiedAt, 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_Approval_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _Approval_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_statusPhase(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.StatusPhase, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *approval.StatusPhase) graphql.Marshaler { + return ec.marshalOApprovalStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Approval_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type ApprovalStatusPhase does not have child fields")) +} + +func (ec *executionContext) _Approval_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_statusMessage(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.StatusMessage, 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_Approval_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Approval_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_environment(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Environment, 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_Approval_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Approval_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_namespace(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Namespace, 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_Approval_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Approval_action(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { @@ -2846,28 +2831,22 @@ func (ec *executionContext) _Approval_action(ctx context.Context, field graphql. ctx, ec.OperationContext, field, - ec.fieldContext_Approval_action, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_action(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Action, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Approval_action(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Approval", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Approval_strategy(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { @@ -2875,28 +2854,22 @@ func (ec *executionContext) _Approval_strategy(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext_Approval_strategy, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_strategy(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Strategy, nil }, nil, - ec.marshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy, + func(ctx context.Context, selections ast.SelectionSet, v approval.Strategy) graphql.Marshaler { + return ec.marshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Approval_strategy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Approval", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApprovalStrategy does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type ApprovalStrategy does not have child fields")) } func (ec *executionContext) _Approval_requester(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { @@ -2904,17 +2877,20 @@ func (ec *executionContext) _Approval_requester(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_Approval_requester, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_requester(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Requester, nil }, nil, - ec.marshalNRequesterInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐRequesterInfo, + func(ctx context.Context, selections ast.SelectionSet, v model1.RequesterInfo) graphql.Marshaler { + return ec.marshalNRequesterInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐRequesterInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Approval_requester(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Approval", @@ -2922,17 +2898,7 @@ func (ec *executionContext) fieldContext_Approval_requester(_ context.Context, f IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "teamName": - return ec.fieldContext_RequesterInfo_teamName(ctx, field) - case "teamEmail": - return ec.fieldContext_RequesterInfo_teamEmail(ctx, field) - case "reason": - return ec.fieldContext_RequesterInfo_reason(ctx, field) - case "applicationName": - return ec.fieldContext_RequesterInfo_applicationName(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type RequesterInfo", field.Name) + return ec.childFields_RequesterInfo(ctx, field) }, } return fc, nil @@ -2943,17 +2909,20 @@ func (ec *executionContext) _Approval_decider(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext_Approval_decider, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_decider(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Decider, nil }, nil, - ec.marshalNDeciderInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐDeciderInfo, + func(ctx context.Context, selections ast.SelectionSet, v model1.DeciderInfo) graphql.Marshaler { + return ec.marshalNDeciderInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐDeciderInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Approval_decider(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Approval", @@ -2961,13 +2930,7 @@ func (ec *executionContext) fieldContext_Approval_decider(_ context.Context, fie IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "teamName": - return ec.fieldContext_DeciderInfo_teamName(ctx, field) - case "teamEmail": - return ec.fieldContext_DeciderInfo_teamEmail(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DeciderInfo", field.Name) + return ec.childFields_DeciderInfo(ctx, field) }, } return fc, nil @@ -2978,28 +2941,22 @@ func (ec *executionContext) _Approval_deciderTeamName(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Approval_deciderTeamName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_deciderTeamName(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DeciderTeamName, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Approval_deciderTeamName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Approval", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Approval_decisions(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { @@ -3007,17 +2964,20 @@ func (ec *executionContext) _Approval_decisions(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_Approval_decisions, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_decisions(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Decisions, nil }, nil, - ec.marshalNDecision2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐDecisionᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []model1.Decision) graphql.Marshaler { + return ec.marshalNDecision2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐDecisionᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Approval_decisions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Approval", @@ -3025,19 +2985,7 @@ func (ec *executionContext) fieldContext_Approval_decisions(_ context.Context, f IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_Decision_name(ctx, field) - case "email": - return ec.fieldContext_Decision_email(ctx, field) - case "comment": - return ec.fieldContext_Decision_comment(ctx, field) - case "timestamp": - return ec.fieldContext_Decision_timestamp(ctx, field) - case "resultingState": - return ec.fieldContext_Decision_resultingState(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Decision", field.Name) + return ec.childFields_Decision(ctx, field) }, } return fc, nil @@ -3048,17 +2996,20 @@ func (ec *executionContext) _Approval_availableTransitions(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_Approval_availableTransitions, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_availableTransitions(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.AvailableTransitions, nil }, nil, - ec.marshalOAvailableTransition2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐAvailableTransitionᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []model1.AvailableTransition) graphql.Marshaler { + return ec.marshalOAvailableTransition2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐAvailableTransitionᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Approval_availableTransitions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Approval", @@ -3066,13 +3017,7 @@ func (ec *executionContext) fieldContext_Approval_availableTransitions(_ context IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "action": - return ec.fieldContext_AvailableTransition_action(ctx, field) - case "toState": - return ec.fieldContext_AvailableTransition_toState(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type AvailableTransition", field.Name) + return ec.childFields_AvailableTransition(ctx, field) }, } return fc, nil @@ -3083,28 +3028,22 @@ func (ec *executionContext) _Approval_name(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_Approval_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Approval_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Approval", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Approval_state(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { @@ -3112,71 +3051,45 @@ func (ec *executionContext) _Approval_state(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext_Approval_state, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_state(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.State, nil }, nil, - ec.marshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState, + func(ctx context.Context, selections ast.SelectionSet, v approval.State) graphql.Marshaler { + return ec.marshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Approval_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Approval", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApprovalState does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type ApprovalState does not have child fields")) } -func (ec *executionContext) _Approval_apiSubscription(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_subscription(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Approval_apiSubscription, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Approval_subscription(ctx, field) + }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Approval().APISubscription(ctx, obj) + return ec.Resolvers.Approval().Subscription(ctx, obj) }, nil, - ec.marshalOApiSubscriptionInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiSubscriptionInfo, + func(ctx context.Context, selections ast.SelectionSet, v model.SubscriptionInfo) graphql.Marshaler { + return ec.marshalNSubscriptionInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐSubscriptionInfo(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Approval_apiSubscription(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Approval", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ApiSubscriptionInfo_id(ctx, field) - case "basePath": - return ec.fieldContext_ApiSubscriptionInfo_basePath(ctx, field) - case "statusPhase": - return ec.fieldContext_ApiSubscriptionInfo_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_ApiSubscriptionInfo_statusMessage(ctx, field) - case "ownerApplicationName": - return ec.fieldContext_ApiSubscriptionInfo_ownerApplicationName(ctx, field) - case "ownerTeam": - return ec.fieldContext_ApiSubscriptionInfo_ownerTeam(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiSubscriptionInfo", field.Name) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Approval_subscription(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Approval", field, true, true, errors.New("field of type SubscriptionInfo does not have child fields")) } func (ec *executionContext) _ApprovalConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalConnection) (ret graphql.Marshaler) { @@ -3184,17 +3097,20 @@ func (ec *executionContext) _ApprovalConnection_edges(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalConnection_edges, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalConnection_edges(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - ec.marshalOApprovalEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalEdge, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.ApprovalEdge) graphql.Marshaler { + return ec.marshalOApprovalEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalEdge(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApprovalConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalConnection", @@ -3202,13 +3118,7 @@ func (ec *executionContext) fieldContext_ApprovalConnection_edges(_ context.Cont IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_ApprovalEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_ApprovalEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApprovalEdge", field.Name) + return ec.childFields_ApprovalEdge(ctx, field) }, } return fc, nil @@ -3219,17 +3129,20 @@ func (ec *executionContext) _ApprovalConnection_pageInfo(ctx context.Context, fi ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalConnection_pageInfo, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalConnection_pageInfo(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.PageInfo, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + func(ctx context.Context, selections ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalConnection", @@ -3237,17 +3150,7 @@ func (ec *executionContext) fieldContext_ApprovalConnection_pageInfo(_ context.C IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return ec.childFields_PageInfo(ctx, field) }, } return fc, nil @@ -3258,28 +3161,22 @@ func (ec *executionContext) _ApprovalConnection_totalCount(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalConnection_totalCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalConnection_totalCount(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.TotalCount, nil }, nil, - ec.marshalNInt2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalConnection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalConnection", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _ApprovalEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalEdge) (ret graphql.Marshaler) { @@ -3287,17 +3184,20 @@ func (ec *executionContext) _ApprovalEdge_node(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalEdge_node, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalEdge_node(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - ec.marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Approval) graphql.Marshaler { + return ec.marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApprovalEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalEdge", @@ -3305,43 +3205,7 @@ func (ec *executionContext) fieldContext_ApprovalEdge_node(_ context.Context, fi IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Approval_id(ctx, field) - case "createdAt": - return ec.fieldContext_Approval_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Approval_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_Approval_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_Approval_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_Approval_environment(ctx, field) - case "namespace": - return ec.fieldContext_Approval_namespace(ctx, field) - case "action": - return ec.fieldContext_Approval_action(ctx, field) - case "strategy": - return ec.fieldContext_Approval_strategy(ctx, field) - case "requester": - return ec.fieldContext_Approval_requester(ctx, field) - case "decider": - return ec.fieldContext_Approval_decider(ctx, field) - case "deciderTeamName": - return ec.fieldContext_Approval_deciderTeamName(ctx, field) - case "decisions": - return ec.fieldContext_Approval_decisions(ctx, field) - case "availableTransitions": - return ec.fieldContext_Approval_availableTransitions(ctx, field) - case "name": - return ec.fieldContext_Approval_name(ctx, field) - case "state": - return ec.fieldContext_Approval_state(ctx, field) - case "apiSubscription": - return ec.fieldContext_Approval_apiSubscription(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Approval", field.Name) + return ec.childFields_Approval(ctx, field) }, } return fc, nil @@ -3352,28 +3216,22 @@ func (ec *executionContext) _ApprovalEdge_cursor(ctx context.Context, field grap ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalEdge_cursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalEdge_cursor(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Cursor, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + func(ctx context.Context, selections ast.SelectionSet, v entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalEdge", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } func (ec *executionContext) _ApprovalRequest_id(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3381,28 +3239,22 @@ func (ec *executionContext) _ApprovalRequest_id(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _ApprovalRequest_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3410,28 +3262,22 @@ func (ec *executionContext) _ApprovalRequest_createdAt(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_createdAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, + 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_ApprovalRequest_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type Time does not have child fields")) } func (ec *executionContext) _ApprovalRequest_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3439,28 +3285,22 @@ func (ec *executionContext) _ApprovalRequest_lastModifiedAt(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_lastModifiedAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_lastModifiedAt(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil }, nil, - ec.marshalNTime2timeᚐTime, + 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_ApprovalRequest_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type Time does not have child fields")) } func (ec *executionContext) _ApprovalRequest_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3468,28 +3308,22 @@ func (ec *executionContext) _ApprovalRequest_statusPhase(ctx context.Context, fi ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_statusPhase, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_statusPhase(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.StatusPhase, nil }, nil, - ec.marshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase, + func(ctx context.Context, selections ast.SelectionSet, v *approvalrequest.StatusPhase) graphql.Marshaler { + return ec.marshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApprovalRequestStatusPhase does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ApprovalRequestStatusPhase does not have child fields")) } func (ec *executionContext) _ApprovalRequest_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3497,28 +3331,22 @@ func (ec *executionContext) _ApprovalRequest_statusMessage(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_statusMessage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_statusMessage(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApprovalRequest_environment(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3526,28 +3354,22 @@ func (ec *executionContext) _ApprovalRequest_environment(ctx context.Context, fi ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_environment, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_environment(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Environment, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApprovalRequest_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3555,28 +3377,22 @@ func (ec *executionContext) _ApprovalRequest_namespace(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_namespace, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_namespace(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Namespace, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApprovalRequest_action(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3584,28 +3400,22 @@ func (ec *executionContext) _ApprovalRequest_action(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_action, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_action(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Action, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_action(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApprovalRequest_strategy(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3613,28 +3423,22 @@ func (ec *executionContext) _ApprovalRequest_strategy(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_strategy, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_strategy(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Strategy, nil }, nil, - ec.marshalNApprovalRequestStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy, + func(ctx context.Context, selections ast.SelectionSet, v approvalrequest.Strategy) graphql.Marshaler { + return ec.marshalNApprovalRequestStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_strategy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApprovalRequestStrategy does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ApprovalRequestStrategy does not have child fields")) } func (ec *executionContext) _ApprovalRequest_requester(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3642,17 +3446,20 @@ func (ec *executionContext) _ApprovalRequest_requester(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_requester, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_requester(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Requester, nil }, nil, - ec.marshalNRequesterInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐRequesterInfo, + func(ctx context.Context, selections ast.SelectionSet, v model1.RequesterInfo) graphql.Marshaler { + return ec.marshalNRequesterInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐRequesterInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_requester(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalRequest", @@ -3660,17 +3467,7 @@ func (ec *executionContext) fieldContext_ApprovalRequest_requester(_ context.Con IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "teamName": - return ec.fieldContext_RequesterInfo_teamName(ctx, field) - case "teamEmail": - return ec.fieldContext_RequesterInfo_teamEmail(ctx, field) - case "reason": - return ec.fieldContext_RequesterInfo_reason(ctx, field) - case "applicationName": - return ec.fieldContext_RequesterInfo_applicationName(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type RequesterInfo", field.Name) + return ec.childFields_RequesterInfo(ctx, field) }, } return fc, nil @@ -3681,17 +3478,20 @@ func (ec *executionContext) _ApprovalRequest_decider(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_decider, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_decider(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Decider, nil }, nil, - ec.marshalNDeciderInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐDeciderInfo, + func(ctx context.Context, selections ast.SelectionSet, v model1.DeciderInfo) graphql.Marshaler { + return ec.marshalNDeciderInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐDeciderInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_decider(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalRequest", @@ -3699,13 +3499,7 @@ func (ec *executionContext) fieldContext_ApprovalRequest_decider(_ context.Conte IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "teamName": - return ec.fieldContext_DeciderInfo_teamName(ctx, field) - case "teamEmail": - return ec.fieldContext_DeciderInfo_teamEmail(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DeciderInfo", field.Name) + return ec.childFields_DeciderInfo(ctx, field) }, } return fc, nil @@ -3716,28 +3510,22 @@ func (ec *executionContext) _ApprovalRequest_deciderTeamName(ctx context.Context ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_deciderTeamName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_deciderTeamName(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DeciderTeamName, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_deciderTeamName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApprovalRequest_decisions(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3745,17 +3533,20 @@ func (ec *executionContext) _ApprovalRequest_decisions(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_decisions, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_decisions(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Decisions, nil }, nil, - ec.marshalNDecision2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐDecisionᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []model1.Decision) graphql.Marshaler { + return ec.marshalNDecision2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐDecisionᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_decisions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalRequest", @@ -3763,19 +3554,7 @@ func (ec *executionContext) fieldContext_ApprovalRequest_decisions(_ context.Con IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_Decision_name(ctx, field) - case "email": - return ec.fieldContext_Decision_email(ctx, field) - case "comment": - return ec.fieldContext_Decision_comment(ctx, field) - case "timestamp": - return ec.fieldContext_Decision_timestamp(ctx, field) - case "resultingState": - return ec.fieldContext_Decision_resultingState(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Decision", field.Name) + return ec.childFields_Decision(ctx, field) }, } return fc, nil @@ -3786,17 +3565,20 @@ func (ec *executionContext) _ApprovalRequest_availableTransitions(ctx context.Co ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_availableTransitions, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_availableTransitions(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.AvailableTransitions, nil }, nil, - ec.marshalOAvailableTransition2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐAvailableTransitionᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []model1.AvailableTransition) graphql.Marshaler { + return ec.marshalOAvailableTransition2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐAvailableTransitionᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_availableTransitions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalRequest", @@ -3804,13 +3586,7 @@ func (ec *executionContext) fieldContext_ApprovalRequest_availableTransitions(_ IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "action": - return ec.fieldContext_AvailableTransition_action(ctx, field) - case "toState": - return ec.fieldContext_AvailableTransition_toState(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type AvailableTransition", field.Name) + return ec.childFields_AvailableTransition(ctx, field) }, } return fc, nil @@ -3821,28 +3597,22 @@ func (ec *executionContext) _ApprovalRequest_name(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApprovalRequest_state(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3850,71 +3620,45 @@ func (ec *executionContext) _ApprovalRequest_state(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_state, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_state(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.State, nil }, nil, - ec.marshalNApprovalRequestState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState, + func(ctx context.Context, selections ast.SelectionSet, v approvalrequest.State) graphql.Marshaler { + return ec.marshalNApprovalRequestState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApprovalRequestState does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ApprovalRequestState does not have child fields")) } -func (ec *executionContext) _ApprovalRequest_apiSubscription(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_subscription(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_apiSubscription, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_subscription(ctx, field) + }, func(ctx context.Context) (any, error) { - return ec.Resolvers.ApprovalRequest().APISubscription(ctx, obj) + return ec.Resolvers.ApprovalRequest().Subscription(ctx, obj) }, nil, - ec.marshalOApiSubscriptionInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiSubscriptionInfo, + func(ctx context.Context, selections ast.SelectionSet, v model.SubscriptionInfo) graphql.Marshaler { + return ec.marshalNSubscriptionInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐSubscriptionInfo(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_ApprovalRequest_apiSubscription(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequest", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ApiSubscriptionInfo_id(ctx, field) - case "basePath": - return ec.fieldContext_ApiSubscriptionInfo_basePath(ctx, field) - case "statusPhase": - return ec.fieldContext_ApiSubscriptionInfo_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_ApiSubscriptionInfo_statusMessage(ctx, field) - case "ownerApplicationName": - return ec.fieldContext_ApiSubscriptionInfo_ownerApplicationName(ctx, field) - case "ownerTeam": - return ec.fieldContext_ApiSubscriptionInfo_ownerTeam(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiSubscriptionInfo", field.Name) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_ApprovalRequest_subscription(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, true, true, errors.New("field of type SubscriptionInfo does not have child fields")) } func (ec *executionContext) _ApprovalRequest_approval(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { @@ -3922,17 +3666,20 @@ func (ec *executionContext) _ApprovalRequest_approval(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequest_approval, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequest_approval(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.ApprovalRequest().Approval(ctx, obj) }, nil, - ec.marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Approval) graphql.Marshaler { + return ec.marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApprovalRequest_approval(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalRequest", @@ -3940,43 +3687,7 @@ func (ec *executionContext) fieldContext_ApprovalRequest_approval(_ context.Cont IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Approval_id(ctx, field) - case "createdAt": - return ec.fieldContext_Approval_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Approval_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_Approval_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_Approval_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_Approval_environment(ctx, field) - case "namespace": - return ec.fieldContext_Approval_namespace(ctx, field) - case "action": - return ec.fieldContext_Approval_action(ctx, field) - case "strategy": - return ec.fieldContext_Approval_strategy(ctx, field) - case "requester": - return ec.fieldContext_Approval_requester(ctx, field) - case "decider": - return ec.fieldContext_Approval_decider(ctx, field) - case "deciderTeamName": - return ec.fieldContext_Approval_deciderTeamName(ctx, field) - case "decisions": - return ec.fieldContext_Approval_decisions(ctx, field) - case "availableTransitions": - return ec.fieldContext_Approval_availableTransitions(ctx, field) - case "name": - return ec.fieldContext_Approval_name(ctx, field) - case "state": - return ec.fieldContext_Approval_state(ctx, field) - case "apiSubscription": - return ec.fieldContext_Approval_apiSubscription(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Approval", field.Name) + return ec.childFields_Approval(ctx, field) }, } return fc, nil @@ -3987,17 +3698,20 @@ func (ec *executionContext) _ApprovalRequestConnection_edges(ctx context.Context ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequestConnection_edges, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequestConnection_edges(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - ec.marshalOApprovalRequestEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestEdge, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.ApprovalRequestEdge) graphql.Marshaler { + return ec.marshalOApprovalRequestEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestEdge(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApprovalRequestConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalRequestConnection", @@ -4005,13 +3719,7 @@ func (ec *executionContext) fieldContext_ApprovalRequestConnection_edges(_ conte IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_ApprovalRequestEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_ApprovalRequestEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApprovalRequestEdge", field.Name) + return ec.childFields_ApprovalRequestEdge(ctx, field) }, } return fc, nil @@ -4022,17 +3730,20 @@ func (ec *executionContext) _ApprovalRequestConnection_pageInfo(ctx context.Cont ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequestConnection_pageInfo, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequestConnection_pageInfo(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.PageInfo, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + func(ctx context.Context, selections ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequestConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalRequestConnection", @@ -4040,17 +3751,7 @@ func (ec *executionContext) fieldContext_ApprovalRequestConnection_pageInfo(_ co IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return ec.childFields_PageInfo(ctx, field) }, } return fc, nil @@ -4061,28 +3762,22 @@ func (ec *executionContext) _ApprovalRequestConnection_totalCount(ctx context.Co ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequestConnection_totalCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequestConnection_totalCount(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.TotalCount, nil }, nil, - ec.marshalNInt2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequestConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequestConnection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequestConnection", field, false, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _ApprovalRequestEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequestEdge) (ret graphql.Marshaler) { @@ -4090,17 +3785,20 @@ func (ec *executionContext) _ApprovalRequestEdge_node(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequestEdge_node, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequestEdge_node(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - ec.marshalOApprovalRequest2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequest, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApprovalRequest) graphql.Marshaler { + return ec.marshalOApprovalRequest2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequest(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApprovalRequestEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApprovalRequestEdge", @@ -4108,45 +3806,7 @@ func (ec *executionContext) fieldContext_ApprovalRequestEdge_node(_ context.Cont IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ApprovalRequest_id(ctx, field) - case "createdAt": - return ec.fieldContext_ApprovalRequest_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_ApprovalRequest_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_ApprovalRequest_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_ApprovalRequest_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_ApprovalRequest_environment(ctx, field) - case "namespace": - return ec.fieldContext_ApprovalRequest_namespace(ctx, field) - case "action": - return ec.fieldContext_ApprovalRequest_action(ctx, field) - case "strategy": - return ec.fieldContext_ApprovalRequest_strategy(ctx, field) - case "requester": - return ec.fieldContext_ApprovalRequest_requester(ctx, field) - case "decider": - return ec.fieldContext_ApprovalRequest_decider(ctx, field) - case "deciderTeamName": - return ec.fieldContext_ApprovalRequest_deciderTeamName(ctx, field) - case "decisions": - return ec.fieldContext_ApprovalRequest_decisions(ctx, field) - case "availableTransitions": - return ec.fieldContext_ApprovalRequest_availableTransitions(ctx, field) - case "name": - return ec.fieldContext_ApprovalRequest_name(ctx, field) - case "state": - return ec.fieldContext_ApprovalRequest_state(ctx, field) - case "apiSubscription": - return ec.fieldContext_ApprovalRequest_apiSubscription(ctx, field) - case "approval": - return ec.fieldContext_ApprovalRequest_approval(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApprovalRequest", field.Name) + return ec.childFields_ApprovalRequest(ctx, field) }, } return fc, nil @@ -4157,2036 +3817,5691 @@ func (ec *executionContext) _ApprovalRequestEdge_cursor(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalRequestEdge_cursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalRequestEdge_cursor(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Cursor, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + func(ctx context.Context, selections ast.SelectionSet, v entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalRequestEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalRequestEdge", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalRequestEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } -func (ec *executionContext) _Group_id(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_id(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Group_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Group_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Group", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventExposure_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposure", field, false, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _Group_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Group_environment, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Environment, nil + return obj.CreatedAt, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Group_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Group", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventExposure_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposure", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _Group_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Group_namespace, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_lastModifiedAt(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Namespace, nil + return obj.LastModifiedAt, nil }, nil, - ec.marshalNString2string, + 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_Group_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Group", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventExposure_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposure", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _Group_name(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Group_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_statusPhase(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.StatusPhase, nil }, nil, - ec.marshalNString2string, - true, + func(ctx context.Context, selections ast.SelectionSet, v *eventexposure.StatusPhase) graphql.Marshaler { + return ec.marshalOEventExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(ctx, selections, v) + }, true, + false, ) } - -func (ec *executionContext) fieldContext_Group_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Group", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventExposure_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposure", field, false, false, errors.New("field of type EventExposureStatusPhase does not have child fields")) } -func (ec *executionContext) _Group_displayName(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Group_displayName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_statusMessage(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.DisplayName, nil + return obj.StatusMessage, nil }, nil, - ec.marshalNString2string, - true, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, + false, ) } +func (ec *executionContext) fieldContext_EventExposure_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposure", field, false, false, errors.New("field of type String does not have child fields")) +} -func (ec *executionContext) fieldContext_Group_displayName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Group", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") +func (ec *executionContext) _EventExposure_environment(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_environment(ctx, field) }, - } - return fc, nil + func(ctx context.Context) (any, error) { + return obj.Environment, 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_EventExposure_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposure", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Group_description(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Group_description, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_namespace(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Description, nil + return obj.Namespace, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Group_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Group", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventExposure_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposure", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Group_teams(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_eventType(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Group_teams, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_eventType(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Teams(ctx) + return obj.EventType, nil }, nil, - ec.marshalOTeam2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamᚄ, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Group_teams(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Group", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Team_id(ctx, field) - case "createdAt": - return ec.fieldContext_Team_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Team_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_Team_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_Team_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_Team_environment(ctx, field) - case "namespace": - return ec.fieldContext_Team_namespace(ctx, field) - case "name": - return ec.fieldContext_Team_name(ctx, field) - case "email": - return ec.fieldContext_Team_email(ctx, field) - case "category": - return ec.fieldContext_Team_category(ctx, field) - case "roverTokenRef": - return ec.fieldContext_Team_roverTokenRef(ctx, field) - case "group": - return ec.fieldContext_Team_group(ctx, field) - case "members": - return ec.fieldContext_Team_members(ctx, field) - case "applications": - return ec.fieldContext_Team_applications(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventExposure_eventType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposure", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Member_id(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_visibility(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Member_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_visibility(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Visibility, nil }, nil, - ec.marshalNID2int, + func(ctx context.Context, selections ast.SelectionSet, v eventexposure.Visibility) graphql.Marshaler { + return ec.marshalNEventExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibility(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Member_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Member", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventExposure_visibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposure", field, false, false, errors.New("field of type EventExposureVisibility does not have child fields")) } -func (ec *executionContext) _Member_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_active(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Member_environment, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_active(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Environment, nil + return obj.Active, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *bool) graphql.Marshaler { + return ec.marshalOBoolean2ᚖbool(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_Member_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Member", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventExposure_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposure", field, false, false, errors.New("field of type Boolean does not have child fields")) } -func (ec *executionContext) _Member_name(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_approvalConfig(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Member_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_approvalConfig(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.ApprovalConfig, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v model1.ApprovalConfig) graphql.Marshaler { + return ec.marshalNApprovalConfig2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApprovalConfig(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Member_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventExposure_approvalConfig(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Member", + Object: "EventExposure", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_ApprovalConfig(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Member_email(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_owner(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Member_email, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_owner(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Email, nil + return obj.Owner(ctx) }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Application) graphql.Marshaler { + return ec.marshalNApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Member_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventExposure_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Member", + Object: "EventExposure", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_Application(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Member_team(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_subscriptions(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Member_team, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposure_subscriptions(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Team(ctx) + return ec.Resolvers.EventExposure().Subscriptions(ctx, obj) }, nil, - ec.marshalOTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam, + func(ctx context.Context, selections ast.SelectionSet, v []*model1.EventSubscriptionInfo) graphql.Marshaler { + return ec.marshalNEventSubscriptionInfo2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventSubscriptionInfoᚄ(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Member_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventExposure_subscriptions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Member", + Object: "EventExposure", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Team_id(ctx, field) - case "createdAt": - return ec.fieldContext_Team_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Team_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_Team_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_Team_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_Team_environment(ctx, field) - case "namespace": - return ec.fieldContext_Team_namespace(ctx, field) - case "name": - return ec.fieldContext_Team_name(ctx, field) - case "email": - return ec.fieldContext_Team_email(ctx, field) - case "category": - return ec.fieldContext_Team_category(ctx, field) - case "roverTokenRef": - return ec.fieldContext_Team_roverTokenRef(ctx, field) - case "group": - return ec.fieldContext_Team_group(ctx, field) - case "members": - return ec.fieldContext_Team_members(ctx, field) - case "applications": - return ec.fieldContext_Team_applications(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + return ec.childFields_EventSubscriptionInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposureConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposureConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_hasNextPage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureConnection_edges(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.HasNextPage, nil + return obj.Edges, nil }, nil, - ec.marshalNBoolean2bool, - true, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.EventExposureEdge) graphql.Marshaler { + return ec.marshalOEventExposureEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureEdge(ctx, selections, v) + }, true, + false, ) } - -func (ec *executionContext) fieldContext_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventExposureConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "EventExposureConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return ec.childFields_EventExposureEdge(ctx, field) }, } return fc, nil } -func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposureConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposureConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_hasPreviousPage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureConnection_pageInfo(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.HasPreviousPage, nil + return obj.PageInfo, nil }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventExposureConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "EventExposureConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return ec.childFields_PageInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposureConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposureConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_startCursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureConnection_totalCount(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.StartCursor, nil + return obj.TotalCount, nil }, nil, - ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PageInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventExposureConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposureConnection", field, false, false, errors.New("field of type Int does not have child fields")) } -func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposureEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposureEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_PageInfo_endCursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureEdge_node(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.EndCursor, nil + return obj.Node, nil }, nil, - ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor, + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventExposure) graphql.Marshaler { + return ec.marshalOEventExposure2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposure(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_PageInfo_endCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventExposureEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PageInfo", + Object: "EventExposureEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return ec.childFields_EventExposure(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Query_node(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposureEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposureEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_node, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureEdge_cursor(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().Node(ctx, fc.Args["id"].(int)) + return obj.Cursor, nil }, nil, - ec.marshalONode2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐNoder, + func(ctx context.Context, selections ast.SelectionSet, v entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Query_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_node_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) fieldContext_EventExposureEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposureEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } -func (ec *executionContext) _Query_nodes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_id(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_nodes, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_id(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().Nodes(ctx, fc.Args["ids"].([]int)) + return obj.ID, nil }, nil, - ec.marshalNNode2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐNoder, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Query_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_nodes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) fieldContext_EventSubscription_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _Query_apiExposures(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_apiExposures, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_createdAt(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().APIExposures(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.ApiExposureOrder), fc.Args["where"].(*ent.ApiExposureWhereInput)) + return obj.CreatedAt, nil }, nil, - ec.marshalNApiExposureConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureConnection, + 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_Query_apiExposures(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ApiExposureConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ApiExposureConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ApiExposureConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiExposureConnection", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_apiExposures_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) fieldContext_EventSubscription_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _Query_apiSubscriptions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_apiSubscriptions, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_lastModifiedAt(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().APISubscriptions(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.ApiSubscriptionOrder), fc.Args["where"].(*ent.ApiSubscriptionWhereInput)) + return obj.LastModifiedAt, nil }, nil, - ec.marshalNApiSubscriptionConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionConnection, + 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_EventSubscription_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type Time does not have child fields")) +} -func (ec *executionContext) fieldContext_Query_apiSubscriptions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ApiSubscriptionConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ApiSubscriptionConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ApiSubscriptionConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApiSubscriptionConnection", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_apiSubscriptions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) _EventSubscription_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_statusPhase(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.StatusPhase, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *eventsubscription.StatusPhase) graphql.Marshaler { + return ec.marshalOEventSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_EventSubscription_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type EventSubscriptionStatusPhase does not have child fields")) } -func (ec *executionContext) _Query_applications(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_applications, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_statusMessage(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().Applications(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ApplicationOrder), fc.Args["where"].(*ent.ApplicationWhereInput)) + return obj.StatusMessage, nil }, nil, - ec.marshalNApplicationConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationConnection, - true, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, + false, ) } +func (ec *executionContext) fieldContext_EventSubscription_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type String does not have child fields")) +} -func (ec *executionContext) fieldContext_Query_applications(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ApplicationConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ApplicationConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ApplicationConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApplicationConnection", field.Name) +func (ec *executionContext) _EventSubscription_environment(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_environment(ctx, field) }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_applications_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil + func(ctx context.Context) (any, error) { + return obj.Environment, 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_EventSubscription_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Query_approvals(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_approvals, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_namespace(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().Approvals(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ApprovalOrder), fc.Args["where"].(*ent.ApprovalWhereInput)) + return obj.Namespace, nil }, nil, - ec.marshalNApprovalConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalConnection, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Query_approvals(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ApprovalConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ApprovalConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ApprovalConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApprovalConnection", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_approvals_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) fieldContext_EventSubscription_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Query_approvalRequests(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_name(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_approvalRequests, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_name(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().ApprovalRequests(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ApprovalRequestOrder), fc.Args["where"].(*ent.ApprovalRequestWhereInput)) + return obj.Name, nil }, nil, - ec.marshalNApprovalRequestConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestConnection, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Query_approvalRequests(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ApprovalRequestConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ApprovalRequestConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ApprovalRequestConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApprovalRequestConnection", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_approvalRequests_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) fieldContext_EventSubscription_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Query_teams(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_eventType(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_teams, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_eventType(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().Teams(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TeamOrder), fc.Args["where"].(*ent.TeamWhereInput)) + return obj.EventType, nil }, nil, - ec.marshalNTeamConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamConnection, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Query_teams(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_TeamConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_TeamConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_TeamConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TeamConnection", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_teams_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) fieldContext_EventSubscription_eventType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Query_zones(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_deliveryType(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_zones, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_deliveryType(ctx, field) + }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Query().Zones(ctx) + return obj.DeliveryType, nil }, nil, - ec.marshalNZone2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneᚄ, + func(ctx context.Context, selections ast.SelectionSet, v eventsubscription.DeliveryType) graphql.Marshaler { + return ec.marshalNEventSubscriptionDeliveryType2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Query_zones(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Zone_id(ctx, field) - case "environment": - return ec.fieldContext_Zone_environment(ctx, field) - case "name": - return ec.fieldContext_Zone_name(ctx, field) - case "gatewayURL": - return ec.fieldContext_Zone_gatewayURL(ctx, field) - case "visibility": - return ec.fieldContext_Zone_visibility(ctx, field) - case "applications": - return ec.fieldContext_Zone_applications(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Zone", field.Name) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventSubscription_deliveryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type EventSubscriptionDeliveryType does not have child fields")) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_callbackURL(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query___type, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_callbackURL(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.IntrospectType(fc.Args["name"].(string)) + return obj.CallbackURL, nil }, nil, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } +func (ec *executionContext) fieldContext_EventSubscription_callbackURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscription", field, false, false, errors.New("field of type String does not have child fields")) +} -func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _EventSubscription_owner(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_owner(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Owner(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Application) graphql.Marshaler { + return ec.marshalNApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_EventSubscription_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "EventSubscription", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields_Application(ctx, field) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_approval(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query___schema, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_approval(ctx, field) + }, func(ctx context.Context) (any, error) { - return ec.IntrospectSchema() + return obj.Approval(ctx) }, nil, - ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Approval) graphql.Marshaler { + return ec.marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventSubscription_approval(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "EventSubscription", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "description": - return ec.fieldContext___Schema_description(ctx, field) - case "types": - return ec.fieldContext___Schema_types(ctx, field) - case "queryType": - return ec.fieldContext___Schema_queryType(ctx, field) - case "mutationType": - return ec.fieldContext___Schema_mutationType(ctx, field) - case "subscriptionType": - return ec.fieldContext___Schema_subscriptionType(ctx, field) - case "directives": - return ec.fieldContext___Schema_directives(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + return ec.childFields_Approval(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Team_id(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_approvalRequests(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_approvalRequests(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.ApprovalRequests(ctx) }, nil, - ec.marshalNID2int, - true, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.ApprovalRequest) graphql.Marshaler { + return ec.marshalOApprovalRequest2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestᚄ(ctx, selections, v) + }, true, + false, ) } - -func (ec *executionContext) fieldContext_Team_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventSubscription_approvalRequests(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Team", + Object: "EventSubscription", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return ec.childFields_ApprovalRequest(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Team_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscription_target(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_createdAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscription_target(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return ec.Resolvers.EventSubscription().Target(ctx, obj) }, nil, - ec.marshalNTime2timeᚐTime, + func(ctx context.Context, selections ast.SelectionSet, v *model1.EventExposureInfo) graphql.Marshaler { + return ec.marshalNEventExposureInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventExposureInfo(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Team_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventSubscription_target(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Team", + Object: "EventSubscription", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return ec.childFields_EventExposureInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Team_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscriptionConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscriptionConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_lastModifiedAt, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionConnection_edges(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return obj.Edges, nil }, nil, - ec.marshalNTime2timeᚐTime, - true, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.EventSubscriptionEdge) graphql.Marshaler { + return ec.marshalOEventSubscriptionEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionEdge(ctx, selections, v) + }, true, + false, ) } - -func (ec *executionContext) fieldContext_Team_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventSubscriptionConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Team", + Object: "EventSubscriptionConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return ec.childFields_EventSubscriptionEdge(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Team_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscriptionConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscriptionConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_statusPhase, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionConnection_pageInfo(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.StatusPhase, nil + return obj.PageInfo, nil }, nil, - ec.marshalOTeamStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhase, + func(ctx context.Context, selections ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Team_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventSubscriptionConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Team", + Object: "EventSubscriptionConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type TeamStatusPhase does not have child fields") + return ec.childFields_PageInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Team_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscriptionConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscriptionConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_statusMessage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionConnection_totalCount(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.StatusMessage, nil + return obj.TotalCount, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Team_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Team", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventSubscriptionConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscriptionConnection", field, false, false, errors.New("field of type Int does not have child fields")) } -func (ec *executionContext) _Team_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscriptionEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscriptionEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_environment, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionEdge_node(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Environment, nil + return obj.Node, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventSubscription) graphql.Marshaler { + return ec.marshalOEventSubscription2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscription(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_Team_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventSubscriptionEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Team", + Object: "EventSubscriptionEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_EventSubscription(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Team_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscriptionEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscriptionEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_namespace, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionEdge_cursor(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Namespace, nil + return obj.Cursor, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Team_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Team", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_EventSubscriptionEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscriptionEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } -func (ec *executionContext) _Team_name(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _Group_id(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Group_id(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.ID, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } +func (ec *executionContext) fieldContext_Group_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Group", field, false, false, errors.New("field of type ID does not have child fields")) +} -func (ec *executionContext) fieldContext_Team_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Team", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") +func (ec *executionContext) _Group_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Group_environment(ctx, field) }, - } - return fc, nil + func(ctx context.Context) (any, error) { + return obj.Environment, 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_Group_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Group", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Team_email(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _Group_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_email, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Group_namespace(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Email, nil + return obj.Namespace, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Team_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Team", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Group_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Group", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Team_category(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _Group_name(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_category, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Group_name(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Category, nil + return obj.Name, nil }, nil, - ec.marshalNTeamCategory2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategory, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Team_category(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Team", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type TeamCategory does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Group_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Group", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Team_roverTokenRef(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _Group_displayName(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_roverTokenRef, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Group_displayName(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.RoverTokenRef, nil + return obj.DisplayName, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Team_roverTokenRef(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Team", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Group_displayName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Group", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Team_group(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _Group_description(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_group, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Group_description(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Group(ctx) + return obj.Description, nil }, nil, - ec.marshalOGroup2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroup, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Team_group(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Team", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Group_id(ctx, field) - case "environment": - return ec.fieldContext_Group_environment(ctx, field) - case "namespace": - return ec.fieldContext_Group_namespace(ctx, field) - case "name": - return ec.fieldContext_Group_name(ctx, field) - case "displayName": - return ec.fieldContext_Group_displayName(ctx, field) - case "description": - return ec.fieldContext_Group_description(ctx, field) - case "teams": - return ec.fieldContext_Group_teams(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Group", field.Name) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Group_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Group", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Team_members(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _Group_teams(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_members, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Group_teams(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Members(ctx) + return obj.Teams(ctx) }, nil, - ec.marshalOMember2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.Team) graphql.Marshaler { + return ec.marshalOTeam2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamᚄ(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_Team_members(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Group_teams(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Team", + Object: "Group", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Member_id(ctx, field) - case "environment": - return ec.fieldContext_Member_environment(ctx, field) - case "name": - return ec.fieldContext_Member_name(ctx, field) - case "email": - return ec.fieldContext_Member_email(ctx, field) - case "team": - return ec.fieldContext_Member_team(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Member", field.Name) + return ec.childFields_Team(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Team_applications(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _Member_id(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Team_applications, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Member_id(ctx, field) + }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Applications(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ApplicationOrder), fc.Args["where"].(*ent.ApplicationWhereInput)) + return obj.ID, nil }, nil, - ec.marshalNApplicationConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationConnection, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Team_applications(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Team", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_ApplicationConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_ApplicationConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_ApplicationConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApplicationConnection", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Team_applications_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) fieldContext_Member_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Member", field, false, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _TeamConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.TeamConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Member_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TeamConnection_edges, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Member_environment(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.Environment, nil }, nil, - ec.marshalOTeamEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamEdge, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_TeamConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "TeamConnection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_TeamEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_TeamEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TeamEdge", field.Name) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Member_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Member", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _TeamConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TeamConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Member_name(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TeamConnection_pageInfo, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Member_name(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.Name, nil }, nil, - ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_TeamConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "TeamConnection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Member_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Member", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _TeamConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TeamConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _Member_email(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TeamConnection_totalCount, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Member_email(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.Email, nil }, nil, - ec.marshalNInt2int, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_TeamConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "TeamConnection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Member_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Member", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _TeamEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TeamEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _Member_team(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TeamEdge_node, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Member_team(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.Team(ctx) }, nil, - ec.marshalOTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Team) graphql.Marshaler { + return ec.marshalOTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_TeamEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Member_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TeamEdge", + Object: "Member", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Team_id(ctx, field) - case "createdAt": - return ec.fieldContext_Team_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Team_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_Team_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_Team_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_Team_environment(ctx, field) - case "namespace": - return ec.fieldContext_Team_namespace(ctx, field) - case "name": - return ec.fieldContext_Team_name(ctx, field) - case "email": - return ec.fieldContext_Team_email(ctx, field) - case "category": - return ec.fieldContext_Team_category(ctx, field) - case "roverTokenRef": - return ec.fieldContext_Team_roverTokenRef(ctx, field) - case "group": - return ec.fieldContext_Team_group(ctx, field) - case "members": - return ec.fieldContext_Team_members(ctx, field) - case "applications": - return ec.fieldContext_Team_applications(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + return ec.childFields_Team(ctx, field) }, } return fc, nil } -func (ec *executionContext) _TeamEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TeamEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TeamEdge_cursor, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.HasNextPage, nil }, nil, - ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, true, true, ) } +func (ec *executionContext) fieldContext_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PageInfo", field, false, false, errors.New("field of type Boolean does not have child fields")) +} -func (ec *executionContext) fieldContext_TeamEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.HasPreviousPage, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PageInfo", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PageInfo_startCursor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.StartCursor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PageInfo", field, false, false, errors.New("field of type Cursor does not have child fields")) +} + +func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PageInfo_endCursor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.EndCursor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_PageInfo_endCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PageInfo", field, false, false, errors.New("field of type Cursor does not have child fields")) +} + +func (ec *executionContext) _Query_node(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_node(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().Node(ctx, fc.Args["id"].(int)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v ent.Noder) graphql.Marshaler { + return ec.marshalONode2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐNoder(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Query_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TeamEdge", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_node_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Zone_id(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_nodes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Zone_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_nodes(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.ID, nil + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().Nodes(ctx, fc.Args["ids"].([]int)) }, nil, - ec.marshalNID2int, + func(ctx context.Context, selections ast.SelectionSet, v []ent.Noder) graphql.Marshaler { + return ec.marshalNNode2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐNoder(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Zone_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Zone", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_nodes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Zone_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_apiExposures(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Zone_environment, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_apiExposures(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Environment, nil + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().APIExposures(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.ApiExposureOrder), fc.Args["where"].(*ent.ApiExposureWhereInput)) }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApiExposureConnection) graphql.Marshaler { + return ec.marshalNApiExposureConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureConnection(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Zone_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_apiExposures(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Zone", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_ApiExposureConnection(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_apiExposures_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Zone_name(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_apiSubscriptions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Zone_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_apiSubscriptions(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Name, nil + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().APISubscriptions(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.ApiSubscriptionOrder), fc.Args["where"].(*ent.ApiSubscriptionWhereInput)) }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApiSubscriptionConnection) graphql.Marshaler { + return ec.marshalNApiSubscriptionConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionConnection(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Zone_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_apiSubscriptions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Zone", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_ApiSubscriptionConnection(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_apiSubscriptions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Zone_gatewayURL(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_applications(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Zone_gatewayURL, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_applications(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.GatewayURL, nil + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().Applications(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ApplicationOrder), fc.Args["where"].(*ent.ApplicationWhereInput)) }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApplicationConnection) graphql.Marshaler { + return ec.marshalNApplicationConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationConnection(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Zone_gatewayURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_applications(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Zone", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_ApplicationConnection(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_applications_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Zone_visibility(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_approvals(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Zone_visibility, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_approvals(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Visibility, nil + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().Approvals(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ApprovalOrder), fc.Args["where"].(*ent.ApprovalWhereInput)) }, nil, - ec.marshalNZoneVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibility, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApprovalConnection) graphql.Marshaler { + return ec.marshalNApprovalConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalConnection(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Zone_visibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_approvals(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Zone", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ZoneVisibility does not have child fields") + return ec.childFields_ApprovalConnection(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_approvals_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Zone_applications(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_approvalRequests(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Zone_applications, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_approvalRequests(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Applications(ctx) + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().ApprovalRequests(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ApprovalRequestOrder), fc.Args["where"].(*ent.ApprovalRequestWhereInput)) }, nil, - ec.marshalOApplication2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationᚄ, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApprovalRequestConnection) graphql.Marshaler { + return ec.marshalNApprovalRequestConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestConnection(ctx, selections, v) + }, + true, true, - false, ) } - -func (ec *executionContext) fieldContext_Zone_applications(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_approvalRequests(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Zone", + Object: "Query", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Application_id(ctx, field) - case "createdAt": - return ec.fieldContext_Application_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Application_lastModifiedAt(ctx, field) - case "statusPhase": - return ec.fieldContext_Application_statusPhase(ctx, field) - case "statusMessage": - return ec.fieldContext_Application_statusMessage(ctx, field) - case "environment": - return ec.fieldContext_Application_environment(ctx, field) - case "namespace": - return ec.fieldContext_Application_namespace(ctx, field) - case "name": - return ec.fieldContext_Application_name(ctx, field) - case "clientID": - return ec.fieldContext_Application_clientID(ctx, field) - case "clientSecret": - return ec.fieldContext_Application_clientSecret(ctx, field) - case "issuerURL": - return ec.fieldContext_Application_issuerURL(ctx, field) - case "zone": - return ec.fieldContext_Application_zone(ctx, field) - case "exposedApis": - return ec.fieldContext_Application_exposedApis(ctx, field) - case "subscribedApis": - return ec.fieldContext_Application_subscribedApis(ctx, field) - case "ownerTeam": - return ec.fieldContext_Application_ownerTeam(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Application", field.Name) + return ec.childFields_ApprovalRequestConnection(ctx, field) }, } - return fc, nil + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_approvalRequests_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil } -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** - -func (ec *executionContext) unmarshalInputApiExposureOrder(ctx context.Context, obj any) (ent.ApiExposureOrder, error) { - var it ent.ApiExposureOrder - if obj == nil { - return it, nil +func (ec *executionContext) _Query_eventExposures(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_eventExposures(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().EventExposures(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.EventExposureOrder), fc.Args["where"].(*ent.EventExposureWhereInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventExposureConnection) graphql.Marshaler { + return ec.marshalNEventExposureConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_eventExposures(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_EventExposureConnection(ctx, field) + }, } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_eventExposures_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err } + return fc, nil +} - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" +func (ec *executionContext) _Query_eventSubscriptions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_eventSubscriptions(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().EventSubscriptions(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.EventSubscriptionOrder), fc.Args["where"].(*ent.EventSubscriptionWhereInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventSubscriptionConnection) graphql.Marshaler { + return ec.marshalNEventSubscriptionConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_eventSubscriptions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_EventSubscriptionConnection(ctx, field) + }, } - - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) - if err != nil { - return it, err - } - it.Direction = data - case "field": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNApiExposureOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrderField(ctx, v) - if err != nil { - return it, err - } - it.Field = data + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_eventSubscriptions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err } - return it, nil + return fc, nil } -func (ec *executionContext) unmarshalInputApiExposureWhereInput(ctx context.Context, obj any) (ent.ApiExposureWhereInput, error) { - var it ent.ApiExposureWhereInput - if obj == nil { - return it, nil +func (ec *executionContext) _Query_teams(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_teams(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().Teams(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.TeamOrder), fc.Args["where"].(*ent.TeamWhereInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.TeamConnection) graphql.Marshaler { + return ec.marshalNTeamConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_teams(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_TeamConnection(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_teams_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err } + return fc, nil +} - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v +func (ec *executionContext) _Query_zones(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_zones(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Query().Zones(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.Zone) graphql.Marshaler { + return ec.marshalNZone2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_zones(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Zone(ctx, field) + }, } + return fc, nil +} - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "basePath", "basePathNEQ", "basePathIn", "basePathNotIn", "basePathGT", "basePathGTE", "basePathLT", "basePathLTE", "basePathContains", "basePathHasPrefix", "basePathHasSuffix", "basePathEqualFold", "basePathContainsFold", "visibility", "visibilityNEQ", "visibilityIn", "visibilityNotIn", "active", "activeNEQ", "activeIsNil", "activeNotNil", "apiVersion", "apiVersionNEQ", "apiVersionIn", "apiVersionNotIn", "apiVersionGT", "apiVersionGTE", "apiVersionLT", "apiVersionLTE", "apiVersionContains", "apiVersionHasPrefix", "apiVersionHasSuffix", "apiVersionIsNil", "apiVersionNotNil", "apiVersionEqualFold", "apiVersionContainsFold", "hasOwner", "hasOwnerWith", "hasSubscriptions", "hasSubscriptionsWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query___type(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.IntrospectType(fc.Args["name"].(string)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Type(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) } - switch k { - case "not": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput(ctx, v) - if err != nil { - return it, err - } - it.Not = data - case "and": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx, v) - if err != nil { - return it, err - } - it.And = data - case "or": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx, v) - if err != nil { - return it, err - } - it.Or = data - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) - if err != nil { - return it, err - } - it.ID = data - case "idNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) - if err != nil { - return it, err - } - it.IDNEQ = data - case "idIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) - if err != nil { - return it, err - } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query___schema(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.IntrospectSchema() + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields___Schema(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_id(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_id(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Team_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, false, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _Team_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_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_Team_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _Team_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_lastModifiedAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.LastModifiedAt, 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_Team_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _Team_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_statusPhase(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.StatusPhase, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *team.StatusPhase) graphql.Marshaler { + return ec.marshalOTeamStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhase(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Team_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, false, false, errors.New("field of type TeamStatusPhase does not have child fields")) +} + +func (ec *executionContext) _Team_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_statusMessage(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.StatusMessage, 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_Team_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Team_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_environment(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Environment, 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_Team_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Team_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_namespace(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Namespace, 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_Team_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Team_name(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Team_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Team_email(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_email(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Email, 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_Team_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Team_category(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_category(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Category, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v team.Category) graphql.Marshaler { + return ec.marshalNTeamCategory2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategory(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Team_category(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, false, false, errors.New("field of type TeamCategory does not have child fields")) +} + +func (ec *executionContext) _Team_teamToken(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_teamToken(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Team().TeamToken(ctx, obj) + }, + 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_Team_teamToken(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Team", field, true, true, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Team_group(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_group(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Group(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Group) graphql.Marshaler { + return ec.marshalOGroup2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroup(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Team_group(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Group(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_members(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_members(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Members(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.Member) graphql.Marshaler { + return ec.marshalOMember2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Team_members(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Member(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_applications(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Team_applications(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.Applications(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ApplicationOrder), fc.Args["where"].(*ent.ApplicationWhereInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApplicationConnection) graphql.Marshaler { + return ec.marshalNApplicationConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Team_applications(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_ApplicationConnection(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Team_applications_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _TeamConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.TeamConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_TeamConnection_edges(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Edges, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.TeamEdge) graphql.Marshaler { + return ec.marshalOTeamEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamEdge(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_TeamConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_TeamEdge(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TeamConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_TeamConnection_pageInfo(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.PageInfo, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_TeamConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PageInfo(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TeamConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_TeamConnection_totalCount(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TotalCount, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_TeamConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("TeamConnection", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _TeamEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TeamEdge) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_TeamEdge_node(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Node, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Team) graphql.Marshaler { + return ec.marshalOTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_TeamEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Team(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TeamEdge) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_TeamEdge_cursor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Cursor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_TeamEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("TeamEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) +} + +func (ec *executionContext) _Zone_id(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Zone_id(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Zone_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Zone", field, false, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _Zone_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Zone_environment(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Environment, 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_Zone_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Zone", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Zone_name(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Zone_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Zone_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Zone", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Zone_gatewayURL(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Zone_gatewayURL(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.GatewayURL, 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_Zone_gatewayURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Zone", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Zone_issuerURL(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Zone_issuerURL(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.IssuerURL, 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_Zone_issuerURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Zone", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Zone_visibility(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Zone_visibility(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Visibility, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v zone.Visibility) graphql.Marshaler { + return ec.marshalNZoneVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibility(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Zone_visibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Zone", field, false, false, errors.New("field of type ZoneVisibility does not have child fields")) +} + +func (ec *executionContext) _Zone_applications(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Zone_applications(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Applications(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*ent.Application) graphql.Marshaler { + return ec.marshalOApplication2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Zone_applications(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Zone", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Application(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Zone_tokenURL(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Zone_tokenURL(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Zone().TokenURL(ctx, obj) + }, + 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_Zone_tokenURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Zone", field, true, true, errors.New("field of type String does not have child fields")) +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputApiExposureOrder(ctx context.Context, obj any) (ent.ApiExposureOrder, error) { + var it ent.ApiExposureOrder + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + if err != nil { + return it, err + } + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNApiExposureOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputApiExposureWhereInput(ctx context.Context, obj any) (ent.ApiExposureWhereInput, error) { + var it ent.ApiExposureWhereInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "basePath", "basePathNEQ", "basePathIn", "basePathNotIn", "basePathGT", "basePathGTE", "basePathLT", "basePathLTE", "basePathContains", "basePathHasPrefix", "basePathHasSuffix", "basePathEqualFold", "basePathContainsFold", "visibility", "visibilityNEQ", "visibilityIn", "visibilityNotIn", "active", "activeNEQ", "activeIsNil", "activeNotNil", "apiVersion", "apiVersionNEQ", "apiVersionIn", "apiVersionNotIn", "apiVersionGT", "apiVersionGTE", "apiVersionLT", "apiVersionLTE", "apiVersionContains", "apiVersionHasPrefix", "apiVersionHasSuffix", "apiVersionIsNil", "apiVersionNotNil", "apiVersionEqualFold", "apiVersionContainsFold", "hasOwner", "hasOwnerWith", "hasSubscriptions", "hasSubscriptionsWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + case "and": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "or": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "idNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDNEQ = data + case "idIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDIn = data + case "idNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDNotIn = data + case "idGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGT = data + case "idGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGTE = data + case "idLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLT = data + case "idLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLTE = data + case "createdAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAt = data + case "createdAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNEQ = data + case "createdAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtIn = data + case "createdAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNotIn = data + case "createdAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGT = data + case "createdAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGTE = data + case "createdAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLT = data + case "createdAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLTE = data + case "lastModifiedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAt = data + case "lastModifiedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLTE = data + case "statusPhase": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) + data, err := ec.unmarshalOApiExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx, v) + if err != nil { + return it, err + } + it.StatusPhase = data + case "statusPhaseNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) + data, err := ec.unmarshalOApiExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseNEQ = data + case "statusPhaseIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) + data, err := ec.unmarshalOApiExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhaseᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseIn = data + case "statusPhaseNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) + data, err := ec.unmarshalOApiExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhaseᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseNotIn = data + case "statusPhaseIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseIsNil = data + case "statusPhaseNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseNotNil = data + case "statusMessage": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessage")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessage = data + case "statusMessageNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageNEQ = data + case "statusMessageIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageIn = data + case "statusMessageNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageNotIn = data + case "statusMessageGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageGT = data + case "statusMessageGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageGTE = data + case "statusMessageLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageLT = data + case "statusMessageLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageLTE = data + case "statusMessageContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageContains = data + case "statusMessageHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageHasPrefix = data + case "statusMessageHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageHasSuffix = data + case "statusMessageIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageIsNil = data + case "statusMessageNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageNotNil = data + case "statusMessageEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageEqualFold = data + case "statusMessageContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageContainsFold = data + case "environment": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Environment = data + case "environmentNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentNEQ = data + case "environmentIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentIn = data + case "environmentNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentNotIn = data + case "environmentGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentGT = data + case "environmentGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentGTE = data + case "environmentLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentLT = data + case "environmentLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentLTE = data + case "environmentContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentContains = data + case "environmentHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentHasPrefix = data + case "environmentHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentHasSuffix = data + case "environmentIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentIsNil = data + case "environmentNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentNotNil = data + case "environmentEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentEqualFold = data + case "environmentContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentContainsFold = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + case "namespaceNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceNEQ = data + case "namespaceIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NamespaceIn = data + case "namespaceNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NamespaceNotIn = data + case "namespaceGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceGT = data + case "namespaceGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceGTE = data + case "namespaceLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceLT = data + case "namespaceLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceLTE = data + case "namespaceContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceContains = data + case "namespaceHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceHasPrefix = data + case "namespaceHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceHasSuffix = data + case "namespaceEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceEqualFold = data + case "namespaceContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceContainsFold = data + case "basePath": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePath")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePath = data + case "basePathNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathNEQ = data + case "basePathIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.BasePathIn = data + case "basePathNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.BasePathNotIn = data + case "basePathGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathGT = data + case "basePathGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathGTE = data + case "basePathLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathLT = data + case "basePathLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathLTE = data + case "basePathContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathContains = data + case "basePathHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathHasPrefix = data + case "basePathHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathHasSuffix = data + case "basePathEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathEqualFold = data + case "basePathContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathContainsFold = data + case "visibility": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibility")) + data, err := ec.unmarshalOApiExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, v) + if err != nil { + return it, err + } + it.Visibility = data + case "visibilityNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityNEQ")) + data, err := ec.unmarshalOApiExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, v) + if err != nil { + return it, err + } + it.VisibilityNEQ = data + case "visibilityIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityIn")) + data, err := ec.unmarshalOApiExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibilityᚄ(ctx, v) + if err != nil { + return it, err + } + it.VisibilityIn = data + case "visibilityNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityNotIn")) + data, err := ec.unmarshalOApiExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibilityᚄ(ctx, v) + if err != nil { + return it, err + } + it.VisibilityNotIn = data + case "active": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("active")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Active = data + case "activeNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNEQ")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.ActiveNEQ = data + case "activeIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ActiveIsNil = data + case "activeNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ActiveNotNil = data + case "apiVersion": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersion")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersion = data + case "apiVersionNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersionNEQ = data + case "apiVersionIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.APIVersionIn = data + case "apiVersionNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.APIVersionNotIn = data + case "apiVersionGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersionGT = data + case "apiVersionGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersionGTE = data + case "apiVersionLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersionLT = data + case "apiVersionLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersionLTE = data + case "apiVersionContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersionContains = data + case "apiVersionHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersionHasPrefix = data + case "apiVersionHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersionHasSuffix = data + case "apiVersionIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.APIVersionIsNil = data + case "apiVersionNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.APIVersionNotNil = data + case "apiVersionEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersionEqualFold = data + case "apiVersionContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersionContainsFold = data + case "hasOwner": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasOwner = data + case "hasOwnerWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerWith")) + data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasOwnerWith = data + case "hasSubscriptions": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscriptions")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasSubscriptions = data + case "hasSubscriptionsWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscriptionsWith")) + data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasSubscriptionsWith = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputApiSubscriptionOrder(ctx context.Context, obj any) (ent.ApiSubscriptionOrder, error) { + var it ent.ApiSubscriptionOrder + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + if err != nil { + return it, err + } + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNApiSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputApiSubscriptionWhereInput(ctx context.Context, obj any) (ent.ApiSubscriptionWhereInput, error) { + var it ent.ApiSubscriptionWhereInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "basePath", "basePathNEQ", "basePathIn", "basePathNotIn", "basePathGT", "basePathGTE", "basePathLT", "basePathLTE", "basePathContains", "basePathHasPrefix", "basePathHasSuffix", "basePathEqualFold", "basePathContainsFold", "m2mAuthMethod", "m2mAuthMethodNEQ", "m2mAuthMethodIn", "m2mAuthMethodNotIn", "hasOwner", "hasOwnerWith", "hasTarget", "hasTargetWith", "hasFailoverZones", "hasFailoverZonesWith", "hasApproval", "hasApprovalWith", "hasApprovalRequests", "hasApprovalRequestsWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + case "and": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "or": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "idNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDNEQ = data + case "idIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDIn = data + case "idNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDNotIn = data + case "idGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGT = data + case "idGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGTE = data + case "idLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLT = data + case "idLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLTE = data + case "createdAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAt = data + case "createdAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNEQ = data + case "createdAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtIn = data + case "createdAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNotIn = data + case "createdAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGT = data + case "createdAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGTE = data + case "createdAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLT = data + case "createdAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLTE = data + case "lastModifiedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAt = data + case "lastModifiedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLTE = data + case "statusPhase": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) + data, err := ec.unmarshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx, v) + if err != nil { + return it, err + } + it.StatusPhase = data + case "statusPhaseNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) + data, err := ec.unmarshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseNEQ = data + case "statusPhaseIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) + data, err := ec.unmarshalOApiSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhaseᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseIn = data + case "statusPhaseNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) + data, err := ec.unmarshalOApiSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhaseᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseNotIn = data + case "statusPhaseIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseIsNil = data + case "statusPhaseNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseNotNil = data + case "statusMessage": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessage")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessage = data + case "statusMessageNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageNEQ = data + case "statusMessageIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageIn = data + case "statusMessageNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageNotIn = data + case "statusMessageGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageGT = data + case "statusMessageGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageGTE = data + case "statusMessageLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageLT = data + case "statusMessageLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageLTE = data + case "statusMessageContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageContains = data + case "statusMessageHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageHasPrefix = data + case "statusMessageHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageHasSuffix = data + case "statusMessageIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageIsNil = data + case "statusMessageNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageNotNil = data + case "statusMessageEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageEqualFold = data + case "statusMessageContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageContainsFold = data + case "environment": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Environment = data + case "environmentNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentNEQ = data + case "environmentIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentIn = data + case "environmentNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentNotIn = data + case "environmentGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentGT = data + case "environmentGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentGTE = data + case "environmentLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentLT = data + case "environmentLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentLTE = data + case "environmentContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentContains = data + case "environmentHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentHasPrefix = data + case "environmentHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentHasSuffix = data + case "environmentIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentIsNil = data + case "environmentNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentNotNil = data + case "environmentEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentEqualFold = data + case "environmentContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentContainsFold = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + case "namespaceNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceNEQ = data + case "namespaceIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NamespaceIn = data + case "namespaceNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NamespaceNotIn = data + case "namespaceGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceGT = data + case "namespaceGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceGTE = data + case "namespaceLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceLT = data + case "namespaceLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceLTE = data + case "namespaceContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceContains = data + case "namespaceHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceHasPrefix = data + case "namespaceHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceHasSuffix = data + case "namespaceEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceEqualFold = data + case "namespaceContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceContainsFold = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "nameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameNEQ = data + case "nameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NameIn = data + case "nameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NameNotIn = data + case "nameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameGT = data + case "nameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameGTE = data + case "nameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLT = data + case "nameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLTE = data + case "nameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContains = data + case "nameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameHasPrefix = data + case "nameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameHasSuffix = data + case "nameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameEqualFold = data + case "nameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContainsFold = data + case "basePath": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePath")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePath = data + case "basePathNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathNEQ = data + case "basePathIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.BasePathIn = data + case "basePathNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.BasePathNotIn = data + case "basePathGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathGT = data + case "basePathGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathGTE = data + case "basePathLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathLT = data + case "basePathLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathLTE = data + case "basePathContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathContains = data + case "basePathHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathHasPrefix = data + case "basePathHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathHasSuffix = data + case "basePathEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathEqualFold = data + case "basePathContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.BasePathContainsFold = data + case "m2mAuthMethod": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("m2mAuthMethod")) + data, err := ec.unmarshalOApiSubscriptionM2mAuthMethod2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx, v) + if err != nil { + return it, err + } + it.M2mAuthMethod = data + case "m2mAuthMethodNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("m2mAuthMethodNEQ")) + data, err := ec.unmarshalOApiSubscriptionM2mAuthMethod2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx, v) + if err != nil { + return it, err + } + it.M2mAuthMethodNEQ = data + case "m2mAuthMethodIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("m2mAuthMethodIn")) + data, err := ec.unmarshalOApiSubscriptionM2mAuthMethod2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethodᚄ(ctx, v) + if err != nil { + return it, err + } + it.M2mAuthMethodIn = data + case "m2mAuthMethodNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("m2mAuthMethodNotIn")) + data, err := ec.unmarshalOApiSubscriptionM2mAuthMethod2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethodᚄ(ctx, v) + if err != nil { + return it, err + } + it.M2mAuthMethodNotIn = data + case "hasOwner": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasOwner = data + case "hasOwnerWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerWith")) + data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasOwnerWith = data + case "hasTarget": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTarget")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasTarget = data + case "hasTargetWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTargetWith")) + data, err := ec.unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasTargetWith = data + case "hasFailoverZones": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFailoverZones")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasFailoverZones = data + case "hasFailoverZonesWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFailoverZonesWith")) + data, err := ec.unmarshalOZoneWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasFailoverZonesWith = data + case "hasApproval": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApproval")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasApproval = data + case "hasApprovalWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalWith")) + data, err := ec.unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasApprovalWith = data + case "hasApprovalRequests": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalRequests")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasApprovalRequests = data + case "hasApprovalRequestsWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalRequestsWith")) + data, err := ec.unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasApprovalRequestsWith = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputApplicationOrder(ctx context.Context, obj any) (ent.ApplicationOrder, error) { + var it ent.ApplicationOrder + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + if err != nil { + return it, err + } + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNApplicationOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputApplicationWhereInput(ctx context.Context, obj any) (ent.ApplicationWhereInput, error) { + var it ent.ApplicationWhereInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "clientID", "clientIDNEQ", "clientIDIn", "clientIDNotIn", "clientIDGT", "clientIDGTE", "clientIDLT", "clientIDLTE", "clientIDContains", "clientIDHasPrefix", "clientIDHasSuffix", "clientIDIsNil", "clientIDNotNil", "clientIDEqualFold", "clientIDContainsFold", "rotatedExpiresAt", "rotatedExpiresAtNEQ", "rotatedExpiresAtIn", "rotatedExpiresAtNotIn", "rotatedExpiresAtGT", "rotatedExpiresAtGTE", "rotatedExpiresAtLT", "rotatedExpiresAtLTE", "rotatedExpiresAtIsNil", "rotatedExpiresAtNotNil", "currentExpiresAt", "currentExpiresAtNEQ", "currentExpiresAtIn", "currentExpiresAtNotIn", "currentExpiresAtGT", "currentExpiresAtGTE", "currentExpiresAtLT", "currentExpiresAtLTE", "currentExpiresAtIsNil", "currentExpiresAtNotNil", "secretRotationPhase", "secretRotationPhaseNEQ", "secretRotationPhaseIn", "secretRotationPhaseNotIn", "secretRotationMessage", "secretRotationMessageNEQ", "secretRotationMessageIn", "secretRotationMessageNotIn", "secretRotationMessageGT", "secretRotationMessageGTE", "secretRotationMessageLT", "secretRotationMessageLTE", "secretRotationMessageContains", "secretRotationMessageHasPrefix", "secretRotationMessageHasSuffix", "secretRotationMessageIsNil", "secretRotationMessageNotNil", "secretRotationMessageEqualFold", "secretRotationMessageContainsFold", "hasZone", "hasZoneWith", "hasOwnerTeam", "hasOwnerTeamWith", "hasExposedApis", "hasExposedApisWith", "hasSubscribedApis", "hasSubscribedApisWith", "hasExposedEvents", "hasExposedEventsWith", "hasSubscribedEvents", "hasSubscribedEventsWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + case "and": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "or": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "idNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDNEQ = data + case "idIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDIn = data + case "idNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDNotIn = data + case "idGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGT = data + case "idGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGTE = data + case "idLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLT = data + case "idLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLTE = data + case "createdAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAt = data + case "createdAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNEQ = data + case "createdAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtIn = data + case "createdAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNotIn = data + case "createdAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGT = data + case "createdAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGTE = data + case "createdAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLT = data + case "createdAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLTE = data + case "lastModifiedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAt = data + case "lastModifiedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLTE = data + case "statusPhase": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) + data, err := ec.unmarshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx, v) + if err != nil { + return it, err + } + it.StatusPhase = data + case "statusPhaseNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) + data, err := ec.unmarshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseNEQ = data + case "statusPhaseIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) + data, err := ec.unmarshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhaseᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseIn = data + case "statusPhaseNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) + data, err := ec.unmarshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhaseᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseNotIn = data + case "statusPhaseIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseIsNil = data + case "statusPhaseNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseNotNil = data + case "statusMessage": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessage")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessage = data + case "statusMessageNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageNEQ = data + case "statusMessageIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageIn = data + case "statusMessageNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageNotIn = data + case "statusMessageGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageGT = data + case "statusMessageGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageGTE = data + case "statusMessageLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageLT = data + case "statusMessageLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageLTE = data + case "statusMessageContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageContains = data + case "statusMessageHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageHasPrefix = data + case "statusMessageHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageHasSuffix = data + case "statusMessageIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageIsNil = data + case "statusMessageNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageNotNil = data + case "statusMessageEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageEqualFold = data + case "statusMessageContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageContainsFold = data + case "environment": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Environment = data + case "environmentNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentNEQ = data + case "environmentIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentIn = data + case "environmentNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentNotIn = data + case "environmentGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentGT = data + case "environmentGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentGTE = data + case "environmentLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentLT = data + case "environmentLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentLTE = data + case "environmentContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentContains = data + case "environmentHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentHasPrefix = data + case "environmentHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentHasSuffix = data + case "environmentIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentIsNil = data + case "environmentNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentNotNil = data + case "environmentEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentEqualFold = data + case "environmentContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentContainsFold = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + case "namespaceNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceNEQ = data + case "namespaceIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NamespaceIn = data + case "namespaceNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NamespaceNotIn = data + case "namespaceGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceGT = data + case "namespaceGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceGTE = data + case "namespaceLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceLT = data + case "namespaceLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceLTE = data + case "namespaceContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceContains = data + case "namespaceHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceHasPrefix = data + case "namespaceHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceHasSuffix = data + case "namespaceEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceEqualFold = data + case "namespaceContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NamespaceContainsFold = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "nameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameNEQ = data + case "nameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NameIn = data + case "nameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NameNotIn = data + case "nameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameGT = data + case "nameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameGTE = data + case "nameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLT = data + case "nameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLTE = data + case "nameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContains = data + case "nameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameHasPrefix = data + case "nameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameHasSuffix = data + case "nameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameEqualFold = data + case "nameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContainsFold = data + case "clientID": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientID")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientID = data + case "clientIDNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientIDNEQ = data + case "clientIDIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.ClientIDIn = data + case "clientIDNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.ClientIDNotIn = data + case "clientIDGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientIDGT = data + case "clientIDGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientIDGTE = data + case "clientIDLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientIDLT = data + case "clientIDLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientIDLTE = data + case "clientIDContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientIDContains = data + case "clientIDHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientIDHasPrefix = data + case "clientIDHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientIDHasSuffix = data + case "clientIDIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClientIDIsNil = data + case "clientIDNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClientIDNotNil = data + case "clientIDEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientIDEqualFold = data + case "clientIDContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ClientIDContainsFold = data + case "rotatedExpiresAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.RotatedExpiresAt = data + case "rotatedExpiresAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.RotatedExpiresAtNEQ = data + case "rotatedExpiresAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.RotatedExpiresAtIn = data + case "rotatedExpiresAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.RotatedExpiresAtNotIn = data + case "rotatedExpiresAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.RotatedExpiresAtGT = data + case "rotatedExpiresAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.RotatedExpiresAtGTE = data + case "rotatedExpiresAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.RotatedExpiresAtLT = data + case "rotatedExpiresAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.RotatedExpiresAtLTE = data + case "rotatedExpiresAtIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.RotatedExpiresAtIsNil = data + case "rotatedExpiresAtNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.RotatedExpiresAtNotNil = data + case "currentExpiresAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CurrentExpiresAt = data + case "currentExpiresAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CurrentExpiresAtNEQ = data + case "currentExpiresAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CurrentExpiresAtIn = data + case "currentExpiresAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CurrentExpiresAtNotIn = data + case "currentExpiresAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CurrentExpiresAtGT = data + case "currentExpiresAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CurrentExpiresAtGTE = data + case "currentExpiresAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CurrentExpiresAtLT = data + case "currentExpiresAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CurrentExpiresAtLTE = data + case "currentExpiresAtIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.CurrentExpiresAtIsNil = data + case "currentExpiresAtNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.CurrentExpiresAtNotNil = data + case "secretRotationPhase": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationPhase")) + data, err := ec.unmarshalOApplicationSecretRotationPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhase(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationPhase = data + case "secretRotationPhaseNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationPhaseNEQ")) + data, err := ec.unmarshalOApplicationSecretRotationPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhase(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationPhaseNEQ = data + case "secretRotationPhaseIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationPhaseIn")) + data, err := ec.unmarshalOApplicationSecretRotationPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhaseᚄ(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationPhaseIn = data + case "secretRotationPhaseNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationPhaseNotIn")) + data, err := ec.unmarshalOApplicationSecretRotationPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhaseᚄ(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationPhaseNotIn = data + case "secretRotationMessage": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessage")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessage = data + case "secretRotationMessageNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageNEQ = data + case "secretRotationMessageIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageIn = data + case "secretRotationMessageNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageNotIn = data + case "secretRotationMessageGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageGT = data + case "secretRotationMessageGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageGTE = data + case "secretRotationMessageLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageLT = data + case "secretRotationMessageLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageLTE = data + case "secretRotationMessageContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageContains = data + case "secretRotationMessageHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageHasPrefix = data + case "secretRotationMessageHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageHasSuffix = data + case "secretRotationMessageIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageIsNil = data + case "secretRotationMessageNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageNotNil = data + case "secretRotationMessageEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageEqualFold = data + case "secretRotationMessageContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SecretRotationMessageContainsFold = data + case "hasZone": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasZone")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasZone = data + case "hasZoneWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasZoneWith")) + data, err := ec.unmarshalOZoneWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasZoneWith = data + case "hasOwnerTeam": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerTeam")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasOwnerTeam = data + case "hasOwnerTeamWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerTeamWith")) + data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasOwnerTeamWith = data + case "hasExposedApis": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposedApis")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasExposedApis = data + case "hasExposedApisWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposedApisWith")) + data, err := ec.unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasExposedApisWith = data + case "hasSubscribedApis": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscribedApis")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasSubscribedApis = data + case "hasSubscribedApisWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscribedApisWith")) + data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasSubscribedApisWith = data + case "hasExposedEvents": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposedEvents")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasExposedEvents = data + case "hasExposedEventsWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposedEventsWith")) + data, err := ec.unmarshalOEventExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasExposedEventsWith = data + case "hasSubscribedEvents": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscribedEvents")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasSubscribedEvents = data + case "hasSubscribedEventsWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscribedEventsWith")) + data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasSubscribedEventsWith = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputApprovalOrder(ctx context.Context, obj any) (ent.ApprovalOrder, error) { + var it ent.ApprovalOrder + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + if err != nil { + return it, err + } + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNApprovalOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputApprovalRequestOrder(ctx context.Context, obj any) (ent.ApprovalRequestOrder, error) { + var it ent.ApprovalRequestOrder + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + if err != nil { + return it, err + } + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNApprovalRequestOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context.Context, obj any) (ent.ApprovalRequestWhereInput, error) { + var it ent.ApprovalRequestWhereInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "action", "actionNEQ", "actionIn", "actionNotIn", "actionGT", "actionGTE", "actionLT", "actionLTE", "actionContains", "actionHasPrefix", "actionHasSuffix", "actionEqualFold", "actionContainsFold", "strategy", "strategyNEQ", "strategyIn", "strategyNotIn", "deciderTeamName", "deciderTeamNameNEQ", "deciderTeamNameIn", "deciderTeamNameNotIn", "deciderTeamNameGT", "deciderTeamNameGTE", "deciderTeamNameLT", "deciderTeamNameLTE", "deciderTeamNameContains", "deciderTeamNameHasPrefix", "deciderTeamNameHasSuffix", "deciderTeamNameEqualFold", "deciderTeamNameContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "state", "stateNEQ", "stateIn", "stateNotIn", "hasAPISubscription", "hasAPISubscriptionWith", "hasEventSubscription", "hasEventSubscriptionWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOApprovalRequestWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + case "and": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "or": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "idNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDNEQ = data + case "idIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) @@ -6337,28 +9652,28 @@ func (ec *executionContext) unmarshalInputApiExposureWhereInput(ctx context.Cont it.LastModifiedAtLTE = data case "statusPhase": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) - data, err := ec.unmarshalOApiExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx, v) + data, err := ec.unmarshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx, v) if err != nil { return it, err } it.StatusPhase = data case "statusPhaseNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) - data, err := ec.unmarshalOApiExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx, v) + data, err := ec.unmarshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx, v) if err != nil { return it, err } it.StatusPhaseNEQ = data case "statusPhaseIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) - data, err := ec.unmarshalOApiExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } it.StatusPhaseIn = data case "statusPhaseNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) - data, err := ec.unmarshalOApiExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } @@ -6678,334 +9993,370 @@ func (ec *executionContext) unmarshalInputApiExposureWhereInput(ctx context.Cont return it, err } it.NamespaceContainsFold = data - case "basePath": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePath")) + case "action": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePath = data - case "basePathNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNEQ")) + it.Action = data + case "actionNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathNEQ = data - case "basePathIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathIn")) + it.ActionNEQ = data + case "actionIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.BasePathIn = data - case "basePathNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNotIn")) + it.ActionIn = data + case "actionNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.BasePathNotIn = data - case "basePathGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGT")) + it.ActionNotIn = data + case "actionGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathGT = data - case "basePathGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGTE")) + it.ActionGT = data + case "actionGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathGTE = data - case "basePathLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLT")) + it.ActionGTE = data + case "actionLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathLT = data - case "basePathLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLTE")) + it.ActionLT = data + case "actionLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathLTE = data - case "basePathContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContains")) + it.ActionLTE = data + case "actionContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathContains = data - case "basePathHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasPrefix")) + it.ActionContains = data + case "actionHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathHasPrefix = data - case "basePathHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasSuffix")) + it.ActionHasPrefix = data + case "actionHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ActionHasSuffix = data + case "actionEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ActionEqualFold = data + case "actionContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ActionContainsFold = data + case "strategy": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategy")) + data, err := ec.unmarshalOApprovalRequestStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx, v) + if err != nil { + return it, err + } + it.Strategy = data + case "strategyNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyNEQ")) + data, err := ec.unmarshalOApprovalRequestStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx, v) + if err != nil { + return it, err + } + it.StrategyNEQ = data + case "strategyIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyIn")) + data, err := ec.unmarshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategyᚄ(ctx, v) + if err != nil { + return it, err + } + it.StrategyIn = data + case "strategyNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyNotIn")) + data, err := ec.unmarshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategyᚄ(ctx, v) + if err != nil { + return it, err + } + it.StrategyNotIn = data + case "deciderTeamName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamName")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.DeciderTeamName = data + case "deciderTeamNameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathHasSuffix = data - case "basePathEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathEqualFold")) + it.DeciderTeamNameNEQ = data + case "deciderTeamNameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.DeciderTeamNameIn = data + case "deciderTeamNameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.DeciderTeamNameNotIn = data + case "deciderTeamNameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathEqualFold = data - case "basePathContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContainsFold")) + it.DeciderTeamNameGT = data + case "deciderTeamNameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathContainsFold = data - case "visibility": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibility")) - data, err := ec.unmarshalOApiExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, v) - if err != nil { - return it, err - } - it.Visibility = data - case "visibilityNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityNEQ")) - data, err := ec.unmarshalOApiExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, v) + it.DeciderTeamNameGTE = data + case "deciderTeamNameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.VisibilityNEQ = data - case "visibilityIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityIn")) - data, err := ec.unmarshalOApiExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibilityᚄ(ctx, v) + it.DeciderTeamNameLT = data + case "deciderTeamNameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.VisibilityIn = data - case "visibilityNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityNotIn")) - data, err := ec.unmarshalOApiExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibilityᚄ(ctx, v) + it.DeciderTeamNameLTE = data + case "deciderTeamNameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.VisibilityNotIn = data - case "active": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("active")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.DeciderTeamNameContains = data + case "deciderTeamNameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Active = data - case "activeNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNEQ")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.DeciderTeamNameHasPrefix = data + case "deciderTeamNameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActiveNEQ = data - case "activeIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.DeciderTeamNameHasSuffix = data + case "deciderTeamNameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActiveIsNil = data - case "activeNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.DeciderTeamNameEqualFold = data + case "deciderTeamNameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActiveNotNil = data - case "apiVersion": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersion")) + it.DeciderTeamNameContainsFold = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersion = data - case "apiVersionNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionNEQ")) + it.Name = data + case "nameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersionNEQ = data - case "apiVersionIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionIn")) + it.NameNEQ = data + case "nameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.APIVersionIn = data - case "apiVersionNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionNotIn")) + it.NameIn = data + case "nameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.APIVersionNotIn = data - case "apiVersionGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionGT")) + it.NameNotIn = data + case "nameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersionGT = data - case "apiVersionGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionGTE")) + it.NameGT = data + case "nameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersionGTE = data - case "apiVersionLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionLT")) + it.NameGTE = data + case "nameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersionLT = data - case "apiVersionLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionLTE")) + it.NameLT = data + case "nameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersionLTE = data - case "apiVersionContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionContains")) + it.NameLTE = data + case "nameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersionContains = data - case "apiVersionHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionHasPrefix")) + it.NameContains = data + case "nameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersionHasPrefix = data - case "apiVersionHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionHasSuffix")) + it.NameHasPrefix = data + case "nameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersionHasSuffix = data - case "apiVersionIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.NameHasSuffix = data + case "nameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersionIsNil = data - case "apiVersionNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.NameEqualFold = data + case "nameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.APIVersionNotNil = data - case "apiVersionEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.NameContainsFold = data + case "state": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("state")) + data, err := ec.unmarshalOApprovalRequestState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx, v) if err != nil { return it, err } - it.APIVersionEqualFold = data - case "apiVersionContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.State = data + case "stateNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateNEQ")) + data, err := ec.unmarshalOApprovalRequestState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx, v) if err != nil { return it, err } - it.APIVersionContainsFold = data - case "hasOwner": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.StateNEQ = data + case "stateIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateIn")) + data, err := ec.unmarshalOApprovalRequestState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStateᚄ(ctx, v) if err != nil { return it, err } - it.HasOwner = data - case "hasOwnerWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerWith")) - data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + it.StateIn = data + case "stateNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateNotIn")) + data, err := ec.unmarshalOApprovalRequestState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStateᚄ(ctx, v) if err != nil { return it, err } - it.HasOwnerWith = data - case "hasSubscriptions": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscriptions")) + it.StateNotIn = data + case "hasAPISubscription": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPISubscription")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasSubscriptions = data - case "hasSubscriptionsWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscriptionsWith")) + it.HasAPISubscription = data + case "hasAPISubscriptionWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPISubscriptionWith")) data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasSubscriptionsWith = data - } - } - return it, nil -} - -func (ec *executionContext) unmarshalInputApiSubscriptionOrder(ctx context.Context, obj any) (ent.ApiSubscriptionOrder, error) { - var it ent.ApiSubscriptionOrder - if obj == nil { - return it, nil - } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } - - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + it.HasAPISubscriptionWith = data + case "hasEventSubscription": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventSubscription")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNApiSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrderField(ctx, v) + it.HasEventSubscription = data + case "hasEventSubscriptionWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventSubscriptionWith")) + data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.Field = data + it.HasEventSubscriptionWith = data } } return it, nil } -func (ec *executionContext) unmarshalInputApiSubscriptionWhereInput(ctx context.Context, obj any) (ent.ApiSubscriptionWhereInput, error) { - var it ent.ApiSubscriptionWhereInput +func (ec *executionContext) unmarshalInputApprovalWhereInput(ctx context.Context, obj any) (ent.ApprovalWhereInput, error) { + var it ent.ApprovalWhereInput if obj == nil { return it, nil } @@ -7015,7 +10366,7 @@ func (ec *executionContext) unmarshalInputApiSubscriptionWhereInput(ctx context. asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "basePath", "basePathNEQ", "basePathIn", "basePathNotIn", "basePathGT", "basePathGTE", "basePathLT", "basePathLTE", "basePathContains", "basePathHasPrefix", "basePathHasSuffix", "basePathEqualFold", "basePathContainsFold", "m2mAuthMethod", "m2mAuthMethodNEQ", "m2mAuthMethodIn", "m2mAuthMethodNotIn", "hasOwner", "hasOwnerWith", "hasTarget", "hasTargetWith", "hasFailoverZones", "hasFailoverZonesWith", "hasApproval", "hasApprovalWith", "hasApprovalRequests", "hasApprovalRequestsWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "action", "actionNEQ", "actionIn", "actionNotIn", "actionGT", "actionGTE", "actionLT", "actionLTE", "actionContains", "actionHasPrefix", "actionHasSuffix", "actionEqualFold", "actionContainsFold", "strategy", "strategyNEQ", "strategyIn", "strategyNotIn", "deciderTeamName", "deciderTeamNameNEQ", "deciderTeamNameIn", "deciderTeamNameNotIn", "deciderTeamNameGT", "deciderTeamNameGTE", "deciderTeamNameLT", "deciderTeamNameLTE", "deciderTeamNameContains", "deciderTeamNameHasPrefix", "deciderTeamNameHasSuffix", "deciderTeamNameEqualFold", "deciderTeamNameContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "state", "stateNEQ", "stateIn", "stateNotIn", "hasAPISubscription", "hasAPISubscriptionWith", "hasEventSubscription", "hasEventSubscriptionWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -7024,21 +10375,21 @@ func (ec *executionContext) unmarshalInputApiSubscriptionWhereInput(ctx context. switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput(ctx, v) + data, err := ec.unmarshalOApprovalWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -7213,28 +10564,28 @@ func (ec *executionContext) unmarshalInputApiSubscriptionWhereInput(ctx context. it.LastModifiedAtLTE = data case "statusPhase": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) - data, err := ec.unmarshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx, v) + data, err := ec.unmarshalOApprovalStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx, v) if err != nil { return it, err } it.StatusPhase = data case "statusPhaseNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) - data, err := ec.unmarshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx, v) + data, err := ec.unmarshalOApprovalStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx, v) if err != nil { return it, err } it.StatusPhaseNEQ = data case "statusPhaseIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) - data, err := ec.unmarshalOApiSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOApprovalStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } it.StatusPhaseIn = data case "statusPhaseNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) - data, err := ec.unmarshalOApiSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOApprovalStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } @@ -7413,1533 +10764,1282 @@ func (ec *executionContext) unmarshalInputApiSubscriptionWhereInput(ctx context. if err != nil { return it, err } - it.EnvironmentLTE = data - case "environmentContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentContains = data - case "environmentHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentHasPrefix = data - case "environmentHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentHasSuffix = data - case "environmentIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentIsNil = data - case "environmentNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentNotNil = data - case "environmentEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentEqualFold = data - case "environmentContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentContainsFold = data - case "namespace": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Namespace = data - case "namespaceNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceNEQ = data - case "namespaceIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.NamespaceIn = data - case "namespaceNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.NamespaceNotIn = data - case "namespaceGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceGT = data - case "namespaceGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceGTE = data - case "namespaceLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceLT = data - case "namespaceLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceLTE = data - case "namespaceContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceContains = data - case "namespaceHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceHasPrefix = data - case "namespaceHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceHasSuffix = data - case "namespaceEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceEqualFold = data - case "namespaceContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceContainsFold = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "nameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameNEQ = data - case "nameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.NameIn = data - case "nameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.NameNotIn = data - case "nameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameContainsFold = data - case "basePath": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePath")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.BasePath = data - case "basePathNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.BasePathNEQ = data - case "basePathIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.BasePathIn = data - case "basePathNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.EnvironmentLTE = data + case "environmentContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathNotIn = data - case "basePathGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGT")) + it.EnvironmentContains = data + case "environmentHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathGT = data - case "basePathGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGTE")) + it.EnvironmentHasPrefix = data + case "environmentHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathGTE = data - case "basePathLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.EnvironmentHasSuffix = data + case "environmentIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.BasePathLT = data - case "basePathLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.EnvironmentIsNil = data + case "environmentNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.BasePathLTE = data - case "basePathContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContains")) + it.EnvironmentNotNil = data + case "environmentEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathContains = data - case "basePathHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasPrefix")) + it.EnvironmentEqualFold = data + case "environmentContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathHasPrefix = data - case "basePathHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasSuffix")) + it.EnvironmentContainsFold = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathHasSuffix = data - case "basePathEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathEqualFold")) + it.Namespace = data + case "namespaceNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.BasePathEqualFold = data - case "basePathContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.NamespaceNEQ = data + case "namespaceIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.BasePathContainsFold = data - case "m2mAuthMethod": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("m2mAuthMethod")) - data, err := ec.unmarshalOApiSubscriptionM2mAuthMethod2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx, v) + it.NamespaceIn = data + case "namespaceNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.M2mAuthMethod = data - case "m2mAuthMethodNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("m2mAuthMethodNEQ")) - data, err := ec.unmarshalOApiSubscriptionM2mAuthMethod2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx, v) + it.NamespaceNotIn = data + case "namespaceGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.M2mAuthMethodNEQ = data - case "m2mAuthMethodIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("m2mAuthMethodIn")) - data, err := ec.unmarshalOApiSubscriptionM2mAuthMethod2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethodᚄ(ctx, v) + it.NamespaceGT = data + case "namespaceGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.M2mAuthMethodIn = data - case "m2mAuthMethodNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("m2mAuthMethodNotIn")) - data, err := ec.unmarshalOApiSubscriptionM2mAuthMethod2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethodᚄ(ctx, v) + it.NamespaceGTE = data + case "namespaceLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.M2mAuthMethodNotIn = data - case "hasOwner": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.NamespaceLT = data + case "namespaceLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasOwner = data - case "hasOwnerWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerWith")) - data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + it.NamespaceLTE = data + case "namespaceContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasOwnerWith = data - case "hasTarget": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTarget")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.NamespaceContains = data + case "namespaceHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasTarget = data - case "hasTargetWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTargetWith")) - data, err := ec.unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx, v) + it.NamespaceHasPrefix = data + case "namespaceHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasTargetWith = data - case "hasFailoverZones": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFailoverZones")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.NamespaceHasSuffix = data + case "namespaceEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasFailoverZones = data - case "hasFailoverZonesWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFailoverZonesWith")) - data, err := ec.unmarshalOZoneWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInputᚄ(ctx, v) + it.NamespaceEqualFold = data + case "namespaceContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasFailoverZonesWith = data - case "hasApproval": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApproval")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.NamespaceContainsFold = data + case "action": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasApproval = data - case "hasApprovalWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalWith")) - data, err := ec.unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInputᚄ(ctx, v) + it.Action = data + case "actionNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasApprovalWith = data - case "hasApprovalRequests": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalRequests")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.ActionNEQ = data + case "actionIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.HasApprovalRequests = data - case "hasApprovalRequestsWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalRequestsWith")) - data, err := ec.unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx, v) + it.ActionIn = data + case "actionNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.HasApprovalRequestsWith = data - } - } - return it, nil -} - -func (ec *executionContext) unmarshalInputApplicationOrder(ctx context.Context, obj any) (ent.ApplicationOrder, error) { - var it ent.ApplicationOrder - if obj == nil { - return it, nil - } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } - - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + it.ActionNotIn = data + case "actionGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNApplicationOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderField(ctx, v) + it.ActionGT = data + case "actionGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Field = data - } - } - return it, nil -} - -func (ec *executionContext) unmarshalInputApplicationWhereInput(ctx context.Context, obj any) (ent.ApplicationWhereInput, error) { - var it ent.ApplicationWhereInput - if obj == nil { - return it, nil - } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "clientID", "clientIDNEQ", "clientIDIn", "clientIDNotIn", "clientIDGT", "clientIDGTE", "clientIDLT", "clientIDLTE", "clientIDContains", "clientIDHasPrefix", "clientIDHasSuffix", "clientIDIsNil", "clientIDNotNil", "clientIDEqualFold", "clientIDContainsFold", "clientSecret", "clientSecretNEQ", "clientSecretIn", "clientSecretNotIn", "clientSecretGT", "clientSecretGTE", "clientSecretLT", "clientSecretLTE", "clientSecretContains", "clientSecretHasPrefix", "clientSecretHasSuffix", "clientSecretIsNil", "clientSecretNotNil", "clientSecretEqualFold", "clientSecretContainsFold", "issuerURL", "issuerURLNEQ", "issuerURLIn", "issuerURLNotIn", "issuerURLGT", "issuerURLGTE", "issuerURLLT", "issuerURLLTE", "issuerURLContains", "issuerURLHasPrefix", "issuerURLHasSuffix", "issuerURLIsNil", "issuerURLNotNil", "issuerURLEqualFold", "issuerURLContainsFold", "hasZone", "hasZoneWith", "hasOwnerTeam", "hasOwnerTeamWith", "hasExposedApis", "hasExposedApisWith", "hasSubscribedApis", "hasSubscribedApisWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput(ctx, v) + it.ActionGTE = data + case "actionLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ActionLT = data + case "actionLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Not = data - case "and": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + it.ActionLTE = data + case "actionContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.And = data - case "or": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + it.ActionContains = data + case "actionHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.ActionHasPrefix = data + case "actionHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.ActionHasSuffix = data + case "actionEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + it.ActionEqualFold = data + case "actionContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + it.ActionContainsFold = data + case "strategy": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategy")) + data, err := ec.unmarshalOApprovalStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.Strategy = data + case "strategyNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyNEQ")) + data, err := ec.unmarshalOApprovalStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.StrategyNEQ = data + case "strategyIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyIn")) + data, err := ec.unmarshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategyᚄ(ctx, v) if err != nil { return it, err } - it.IDGTE = data - case "idLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.StrategyIn = data + case "strategyNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyNotIn")) + data, err := ec.unmarshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategyᚄ(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.StrategyNotIn = data + case "deciderTeamName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamName")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "createdAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeciderTeamName = data + case "deciderTeamNameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAt = data - case "createdAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeciderTeamNameNEQ = data + case "deciderTeamNameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtNEQ = data - case "createdAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.DeciderTeamNameIn = data + case "deciderTeamNameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtIn = data - case "createdAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.DeciderTeamNameNotIn = data + case "deciderTeamNameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNotIn = data - case "createdAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeciderTeamNameGT = data + case "deciderTeamNameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtGT = data - case "createdAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeciderTeamNameGTE = data + case "deciderTeamNameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtGTE = data - case "createdAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeciderTeamNameLT = data + case "deciderTeamNameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtLT = data - case "createdAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeciderTeamNameLTE = data + case "deciderTeamNameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtLTE = data - case "lastModifiedAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeciderTeamNameContains = data + case "deciderTeamNameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAt = data - case "lastModifiedAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeciderTeamNameHasPrefix = data + case "deciderTeamNameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNEQ = data - case "lastModifiedAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.DeciderTeamNameHasSuffix = data + case "deciderTeamNameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtIn = data - case "lastModifiedAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.DeciderTeamNameEqualFold = data + case "deciderTeamNameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNotIn = data - case "lastModifiedAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeciderTeamNameContainsFold = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGT = data - case "lastModifiedAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.Name = data + case "nameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGTE = data - case "lastModifiedAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.NameNEQ = data + case "nameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLT = data - case "lastModifiedAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.NameIn = data + case "nameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLTE = data - case "statusPhase": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) - data, err := ec.unmarshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx, v) + it.NameNotIn = data + case "nameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhase = data - case "statusPhaseNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) - data, err := ec.unmarshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx, v) + it.NameGT = data + case "nameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseNEQ = data - case "statusPhaseIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) - data, err := ec.unmarshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhaseᚄ(ctx, v) + it.NameGTE = data + case "nameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseIn = data - case "statusPhaseNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) - data, err := ec.unmarshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhaseᚄ(ctx, v) + it.NameLT = data + case "nameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLTE = data + case "nameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContains = data + case "nameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseNotIn = data - case "statusPhaseIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.NameHasPrefix = data + case "nameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseIsNil = data - case "statusPhaseNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.NameHasSuffix = data + case "nameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseNotNil = data - case "statusMessage": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessage")) + it.NameEqualFold = data + case "nameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessage = data - case "statusMessageNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.NameContainsFold = data + case "state": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("state")) + data, err := ec.unmarshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, v) if err != nil { return it, err } - it.StatusMessageNEQ = data - case "statusMessageIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.State = data + case "stateNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateNEQ")) + data, err := ec.unmarshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, v) if err != nil { return it, err } - it.StatusMessageIn = data - case "statusMessageNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.StateNEQ = data + case "stateIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateIn")) + data, err := ec.unmarshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStateᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageNotIn = data - case "statusMessageGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StateIn = data + case "stateNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateNotIn")) + data, err := ec.unmarshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStateᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageGT = data - case "statusMessageGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StateNotIn = data + case "hasAPISubscription": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPISubscription")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.StatusMessageGTE = data - case "statusMessageLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasAPISubscription = data + case "hasAPISubscriptionWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPISubscriptionWith")) + data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageLT = data - case "statusMessageLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasAPISubscriptionWith = data + case "hasEventSubscription": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventSubscription")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.StatusMessageLTE = data - case "statusMessageContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasEventSubscription = data + case "hasEventSubscriptionWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventSubscriptionWith")) + data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageContains = data - case "statusMessageHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasEventSubscriptionWith = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputEventExposureOrder(ctx context.Context, obj any) (ent.EventExposureOrder, error) { + var it ent.EventExposureOrder + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) if err != nil { return it, err } - it.StatusMessageHasPrefix = data - case "statusMessageHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNEventExposureOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureOrderField(ctx, v) if err != nil { return it, err } - it.StatusMessageHasSuffix = data - case "statusMessageIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.Field = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputEventExposureWhereInput(ctx context.Context, obj any) (ent.EventExposureWhereInput, error) { + var it ent.EventExposureWhereInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "eventType", "eventTypeNEQ", "eventTypeIn", "eventTypeNotIn", "eventTypeGT", "eventTypeGTE", "eventTypeLT", "eventTypeLTE", "eventTypeContains", "eventTypeHasPrefix", "eventTypeHasSuffix", "eventTypeEqualFold", "eventTypeContainsFold", "visibility", "visibilityNEQ", "visibilityIn", "visibilityNotIn", "active", "activeNEQ", "activeIsNil", "activeNotNil", "hasOwner", "hasOwnerWith", "hasSubscriptions", "hasSubscriptionsWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOEventExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInput(ctx, v) if err != nil { return it, err } - it.StatusMessageIsNil = data - case "statusMessageNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.Not = data + case "and": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOEventExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageNotNil = data - case "statusMessageEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.And = data + case "or": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOEventExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageEqualFold = data - case "statusMessageContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.Or = data + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.StatusMessageContainsFold = data - case "environment": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.ID = data + case "idNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.Environment = data - case "environmentNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDNEQ = data + case "idIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentNEQ = data - case "environmentIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.IDIn = data + case "idNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentIn = data - case "environmentNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.IDNotIn = data + case "idGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.EnvironmentNotIn = data - case "environmentGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDGT = data + case "idGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.EnvironmentGT = data - case "environmentGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDGTE = data + case "idLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.EnvironmentGTE = data - case "environmentLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDLT = data + case "idLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.EnvironmentLT = data - case "environmentLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDLTE = data + case "createdAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentLTE = data - case "environmentContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAt = data + case "createdAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentContains = data - case "environmentHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAtNEQ = data + case "createdAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtIn = data + case "createdAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentHasPrefix = data - case "environmentHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAtNotIn = data + case "createdAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentHasSuffix = data - case "environmentIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.CreatedAtGT = data + case "createdAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentIsNil = data - case "environmentNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.CreatedAtGTE = data + case "createdAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentNotNil = data - case "environmentEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAtLT = data + case "createdAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentEqualFold = data - case "environmentContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAtLTE = data + case "lastModifiedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentContainsFold = data - case "namespace": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAt = data + case "lastModifiedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.Namespace = data - case "namespaceNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NamespaceNEQ = data - case "namespaceIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NamespaceIn = data - case "namespaceNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NamespaceNotIn = data - case "namespaceGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NamespaceGT = data - case "namespaceGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NamespaceGTE = data - case "namespaceLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NamespaceLT = data - case "namespaceLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAtLTE = data + case "statusPhase": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) + data, err := ec.unmarshalOEventExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(ctx, v) if err != nil { return it, err } - it.NamespaceLTE = data - case "namespaceContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusPhase = data + case "statusPhaseNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) + data, err := ec.unmarshalOEventExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(ctx, v) if err != nil { return it, err } - it.NamespaceContains = data - case "namespaceHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusPhaseNEQ = data + case "statusPhaseIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) + data, err := ec.unmarshalOEventExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } - it.NamespaceHasPrefix = data - case "namespaceHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusPhaseIn = data + case "statusPhaseNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) + data, err := ec.unmarshalOEventExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } - it.NamespaceHasSuffix = data - case "namespaceEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusPhaseNotIn = data + case "statusPhaseIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NamespaceEqualFold = data - case "namespaceContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusPhaseIsNil = data + case "statusPhaseNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NamespaceContainsFold = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + it.StatusPhaseNotNil = data + case "statusMessage": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessage")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + it.StatusMessage = data + case "statusMessageNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + it.StatusMessageNEQ = data + case "statusMessageIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + it.StatusMessageIn = data + case "statusMessageNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + it.StatusMessageNotIn = data + case "statusMessageGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + it.StatusMessageGT = data + case "statusMessageGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + it.StatusMessageGTE = data + case "statusMessageLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + it.StatusMessageLT = data + case "statusMessageLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + it.StatusMessageLTE = data + case "statusMessageContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + it.StatusMessageContains = data + case "statusMessageHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + it.StatusMessageHasPrefix = data + case "statusMessageHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + it.StatusMessageHasSuffix = data + case "statusMessageIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageIsNil = data + case "statusMessageNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.StatusMessageNotNil = data + case "statusMessageEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + it.StatusMessageEqualFold = data + case "statusMessageContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "clientID": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientID")) + it.StatusMessageContainsFold = data + case "environment": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientID = data - case "clientIDNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDNEQ")) + it.Environment = data + case "environmentNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientIDNEQ = data - case "clientIDIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDIn")) + it.EnvironmentNEQ = data + case "environmentIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ClientIDIn = data - case "clientIDNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDNotIn")) + it.EnvironmentIn = data + case "environmentNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ClientIDNotIn = data - case "clientIDGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDGT")) + it.EnvironmentNotIn = data + case "environmentGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientIDGT = data - case "clientIDGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDGTE")) + it.EnvironmentGT = data + case "environmentGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientIDGTE = data - case "clientIDLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDLT")) + it.EnvironmentGTE = data + case "environmentLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientIDLT = data - case "clientIDLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDLTE")) + it.EnvironmentLT = data + case "environmentLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientIDLTE = data - case "clientIDContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDContains")) + it.EnvironmentLTE = data + case "environmentContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientIDContains = data - case "clientIDHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDHasPrefix")) + it.EnvironmentContains = data + case "environmentHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientIDHasPrefix = data - case "clientIDHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDHasSuffix")) + it.EnvironmentHasPrefix = data + case "environmentHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientIDHasSuffix = data - case "clientIDIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDIsNil")) + it.EnvironmentHasSuffix = data + case "environmentIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.ClientIDIsNil = data - case "clientIDNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDNotNil")) + it.EnvironmentIsNil = data + case "environmentNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.ClientIDNotNil = data - case "clientIDEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDEqualFold")) + it.EnvironmentNotNil = data + case "environmentEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientIDEqualFold = data - case "clientIDContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientIDContainsFold")) + it.EnvironmentEqualFold = data + case "environmentContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientIDContainsFold = data - case "clientSecret": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecret")) + it.EnvironmentContainsFold = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecret = data - case "clientSecretNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretNEQ")) + it.Namespace = data + case "namespaceNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecretNEQ = data - case "clientSecretIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretIn")) + it.NamespaceNEQ = data + case "namespaceIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ClientSecretIn = data - case "clientSecretNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretNotIn")) + it.NamespaceIn = data + case "namespaceNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ClientSecretNotIn = data - case "clientSecretGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretGT")) + it.NamespaceNotIn = data + case "namespaceGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecretGT = data - case "clientSecretGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretGTE")) + it.NamespaceGT = data + case "namespaceGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecretGTE = data - case "clientSecretLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretLT")) + it.NamespaceGTE = data + case "namespaceLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecretLT = data - case "clientSecretLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretLTE")) + it.NamespaceLT = data + case "namespaceLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecretLTE = data - case "clientSecretContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretContains")) + it.NamespaceLTE = data + case "namespaceContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecretContains = data - case "clientSecretHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretHasPrefix")) + it.NamespaceContains = data + case "namespaceHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecretHasPrefix = data - case "clientSecretHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretHasSuffix")) + it.NamespaceHasPrefix = data + case "namespaceHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecretHasSuffix = data - case "clientSecretIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.ClientSecretIsNil = data - case "clientSecretNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.ClientSecretNotNil = data - case "clientSecretEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretEqualFold")) + it.NamespaceHasSuffix = data + case "namespaceEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecretEqualFold = data - case "clientSecretContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientSecretContainsFold")) + it.NamespaceEqualFold = data + case "namespaceContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ClientSecretContainsFold = data - case "issuerURL": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURL")) + it.NamespaceContainsFold = data + case "eventType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventType")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURL = data - case "issuerURLNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLNEQ")) + it.EventType = data + case "eventTypeNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURLNEQ = data - case "issuerURLIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLIn")) + it.EventTypeNEQ = data + case "eventTypeIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IssuerURLIn = data - case "issuerURLNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLNotIn")) + it.EventTypeIn = data + case "eventTypeNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IssuerURLNotIn = data - case "issuerURLGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLGT")) + it.EventTypeNotIn = data + case "eventTypeGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURLGT = data - case "issuerURLGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLGTE")) + it.EventTypeGT = data + case "eventTypeGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURLGTE = data - case "issuerURLLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLLT")) + it.EventTypeGTE = data + case "eventTypeLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURLLT = data - case "issuerURLLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLLTE")) + it.EventTypeLT = data + case "eventTypeLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURLLTE = data - case "issuerURLContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLContains")) + it.EventTypeLTE = data + case "eventTypeContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURLContains = data - case "issuerURLHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLHasPrefix")) + it.EventTypeContains = data + case "eventTypeHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURLHasPrefix = data - case "issuerURLHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLHasSuffix")) + it.EventTypeHasPrefix = data + case "eventTypeHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURLHasSuffix = data - case "issuerURLIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.IssuerURLIsNil = data - case "issuerURLNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.IssuerURLNotNil = data - case "issuerURLEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLEqualFold")) + it.EventTypeHasSuffix = data + case "eventTypeEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURLEqualFold = data - case "issuerURLContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLContainsFold")) + it.EventTypeEqualFold = data + case "eventTypeContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IssuerURLContainsFold = data - case "hasZone": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasZone")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.EventTypeContainsFold = data + case "visibility": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibility")) + data, err := ec.unmarshalOEventExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibility(ctx, v) if err != nil { return it, err } - it.HasZone = data - case "hasZoneWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasZoneWith")) - data, err := ec.unmarshalOZoneWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInputᚄ(ctx, v) + it.Visibility = data + case "visibilityNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityNEQ")) + data, err := ec.unmarshalOEventExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibility(ctx, v) if err != nil { return it, err } - it.HasZoneWith = data - case "hasOwnerTeam": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerTeam")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.VisibilityNEQ = data + case "visibilityIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityIn")) + data, err := ec.unmarshalOEventExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibilityᚄ(ctx, v) if err != nil { return it, err } - it.HasOwnerTeam = data - case "hasOwnerTeamWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerTeamWith")) - data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) + it.VisibilityIn = data + case "visibilityNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityNotIn")) + data, err := ec.unmarshalOEventExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibilityᚄ(ctx, v) if err != nil { return it, err } - it.HasOwnerTeamWith = data - case "hasExposedApis": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposedApis")) + it.VisibilityNotIn = data + case "active": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("active")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasExposedApis = data - case "hasExposedApisWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposedApisWith")) - data, err := ec.unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx, v) - if err != nil { - return it, err - } - it.HasExposedApisWith = data - case "hasSubscribedApis": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscribedApis")) + it.Active = data + case "activeNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNEQ")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasSubscribedApis = data - case "hasSubscribedApisWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscribedApisWith")) - data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) + it.ActiveNEQ = data + case "activeIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.HasSubscribedApisWith = data - } - } - return it, nil -} - -func (ec *executionContext) unmarshalInputApprovalOrder(ctx context.Context, obj any) (ent.ApprovalOrder, error) { - var it ent.ApprovalOrder - if obj == nil { - return it, nil - } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } - - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + it.ActiveIsNil = data + case "activeNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNApprovalOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrderField(ctx, v) + it.ActiveNotNil = data + case "hasOwner": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.Field = data + it.HasOwner = data + case "hasOwnerWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerWith")) + data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasOwnerWith = data + case "hasSubscriptions": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscriptions")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasSubscriptions = data + case "hasSubscriptionsWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscriptionsWith")) + data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasSubscriptionsWith = data } } return it, nil } -func (ec *executionContext) unmarshalInputApprovalRequestOrder(ctx context.Context, obj any) (ent.ApprovalRequestOrder, error) { - var it ent.ApprovalRequestOrder +func (ec *executionContext) unmarshalInputEventSubscriptionOrder(ctx context.Context, obj any) (ent.EventSubscriptionOrder, error) { + var it ent.EventSubscriptionOrder if obj == nil { return it, nil } @@ -8969,7 +12069,7 @@ func (ec *executionContext) unmarshalInputApprovalRequestOrder(ctx context.Conte it.Direction = data case "field": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNApprovalRequestOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderField(ctx, v) + data, err := ec.unmarshalNEventSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionOrderField(ctx, v) if err != nil { return it, err } @@ -8979,8 +12079,8 @@ func (ec *executionContext) unmarshalInputApprovalRequestOrder(ctx context.Conte return it, nil } -func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context.Context, obj any) (ent.ApprovalRequestWhereInput, error) { - var it ent.ApprovalRequestWhereInput +func (ec *executionContext) unmarshalInputEventSubscriptionWhereInput(ctx context.Context, obj any) (ent.EventSubscriptionWhereInput, error) { + var it ent.EventSubscriptionWhereInput if obj == nil { return it, nil } @@ -8990,7 +12090,7 @@ func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context. asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "action", "actionNEQ", "actionIn", "actionNotIn", "actionGT", "actionGTE", "actionLT", "actionLTE", "actionContains", "actionHasPrefix", "actionHasSuffix", "actionEqualFold", "actionContainsFold", "strategy", "strategyNEQ", "strategyIn", "strategyNotIn", "deciderTeamName", "deciderTeamNameNEQ", "deciderTeamNameIn", "deciderTeamNameNotIn", "deciderTeamNameGT", "deciderTeamNameGTE", "deciderTeamNameLT", "deciderTeamNameLTE", "deciderTeamNameContains", "deciderTeamNameHasPrefix", "deciderTeamNameHasSuffix", "deciderTeamNameEqualFold", "deciderTeamNameContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "state", "stateNEQ", "stateIn", "stateNotIn", "hasAPISubscription", "hasAPISubscriptionWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "eventType", "eventTypeNEQ", "eventTypeIn", "eventTypeNotIn", "eventTypeGT", "eventTypeGTE", "eventTypeLT", "eventTypeLTE", "eventTypeContains", "eventTypeHasPrefix", "eventTypeHasSuffix", "eventTypeEqualFold", "eventTypeContainsFold", "deliveryType", "deliveryTypeNEQ", "deliveryTypeIn", "deliveryTypeNotIn", "callbackURL", "callbackURLNEQ", "callbackURLIn", "callbackURLNotIn", "callbackURLGT", "callbackURLGTE", "callbackURLLT", "callbackURLLTE", "callbackURLContains", "callbackURLHasPrefix", "callbackURLHasSuffix", "callbackURLIsNil", "callbackURLNotNil", "callbackURLEqualFold", "callbackURLContainsFold", "hasOwner", "hasOwnerWith", "hasTarget", "hasTargetWith", "hasApproval", "hasApprovalWith", "hasApprovalRequests", "hasApprovalRequestsWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -8999,21 +12099,21 @@ func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context. switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOApprovalRequestWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInput(ctx, v) + data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -9188,28 +12288,28 @@ func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context. it.LastModifiedAtLTE = data case "statusPhase": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) - data, err := ec.unmarshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx, v) + data, err := ec.unmarshalOEventSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx, v) if err != nil { return it, err } it.StatusPhase = data case "statusPhaseNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) - data, err := ec.unmarshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx, v) + data, err := ec.unmarshalOEventSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx, v) if err != nil { return it, err } it.StatusPhaseNEQ = data case "statusPhaseIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) - data, err := ec.unmarshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOEventSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } it.StatusPhaseIn = data case "statusPhaseNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) - data, err := ec.unmarshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOEventSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } @@ -9348,397 +12448,187 @@ func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context. } it.EnvironmentNEQ = data case "environmentIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentIn = data - case "environmentNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentNotIn = data - case "environmentGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentGT = data - case "environmentGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentGTE = data - case "environmentLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentLT = data - case "environmentLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentLTE = data - case "environmentContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentContains = data - case "environmentHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentHasPrefix = data - case "environmentHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentHasSuffix = data - case "environmentIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentIsNil = data - case "environmentNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentNotNil = data - case "environmentEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentEqualFold = data - case "environmentContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentContainsFold = data - case "namespace": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Namespace = data - case "namespaceNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceNEQ = data - case "namespaceIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.NamespaceIn = data - case "namespaceNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.NamespaceNotIn = data - case "namespaceGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceGT = data - case "namespaceGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceGTE = data - case "namespaceLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceLT = data - case "namespaceLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceLTE = data - case "namespaceContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceContains = data - case "namespaceHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceHasPrefix = data - case "namespaceHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceHasSuffix = data - case "namespaceEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceEqualFold = data - case "namespaceContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceContainsFold = data - case "action": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Action = data - case "actionNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.ActionNEQ = data - case "actionIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.ActionIn = data - case "actionNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.ActionNotIn = data - case "actionGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ActionGT = data - case "actionGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.EnvironmentIn = data + case "environmentNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ActionGTE = data - case "actionLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionLT")) + it.EnvironmentNotIn = data + case "environmentGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionLT = data - case "actionLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionLTE")) + it.EnvironmentGT = data + case "environmentGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionLTE = data - case "actionContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionContains")) + it.EnvironmentGTE = data + case "environmentLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionContains = data - case "actionHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionHasPrefix")) + it.EnvironmentLT = data + case "environmentLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionHasPrefix = data - case "actionHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionHasSuffix")) + it.EnvironmentLTE = data + case "environmentContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionHasSuffix = data - case "actionEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionEqualFold")) + it.EnvironmentContains = data + case "environmentHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionEqualFold = data - case "actionContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionContainsFold")) + it.EnvironmentHasPrefix = data + case "environmentHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionContainsFold = data - case "strategy": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategy")) - data, err := ec.unmarshalOApprovalRequestStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx, v) + it.EnvironmentHasSuffix = data + case "environmentIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.Strategy = data - case "strategyNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyNEQ")) - data, err := ec.unmarshalOApprovalRequestStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx, v) + it.EnvironmentIsNil = data + case "environmentNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.StrategyNEQ = data - case "strategyIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyIn")) - data, err := ec.unmarshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategyᚄ(ctx, v) + it.EnvironmentNotNil = data + case "environmentEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StrategyIn = data - case "strategyNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyNotIn")) - data, err := ec.unmarshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategyᚄ(ctx, v) + it.EnvironmentEqualFold = data + case "environmentContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StrategyNotIn = data - case "deciderTeamName": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamName")) + it.EnvironmentContainsFold = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamName = data - case "deciderTeamNameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameNEQ")) + it.Namespace = data + case "namespaceNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameNEQ = data - case "deciderTeamNameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameIn")) + it.NamespaceNEQ = data + case "namespaceIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameIn = data - case "deciderTeamNameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameNotIn")) + it.NamespaceIn = data + case "namespaceNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameNotIn = data - case "deciderTeamNameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameGT")) + it.NamespaceNotIn = data + case "namespaceGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameGT = data - case "deciderTeamNameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameGTE")) + it.NamespaceGT = data + case "namespaceGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameGTE = data - case "deciderTeamNameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameLT")) + it.NamespaceGTE = data + case "namespaceLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameLT = data - case "deciderTeamNameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameLTE")) + it.NamespaceLT = data + case "namespaceLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameLTE = data - case "deciderTeamNameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameContains")) + it.NamespaceLTE = data + case "namespaceContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameContains = data - case "deciderTeamNameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameHasPrefix")) + it.NamespaceContains = data + case "namespaceHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameHasPrefix = data - case "deciderTeamNameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameHasSuffix")) + it.NamespaceHasPrefix = data + case "namespaceHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameHasSuffix = data - case "deciderTeamNameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameEqualFold")) + it.NamespaceHasSuffix = data + case "namespaceEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameEqualFold = data - case "deciderTeamNameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameContainsFold")) + it.NamespaceEqualFold = data + case "namespaceContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameContainsFold = data + it.NamespaceContainsFold = data case "name": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -9808,429 +12698,408 @@ func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context. if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameContainsFold = data - case "state": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("state")) - data, err := ec.unmarshalOApprovalRequestState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx, v) - if err != nil { - return it, err - } - it.State = data - case "stateNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateNEQ")) - data, err := ec.unmarshalOApprovalRequestState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx, v) - if err != nil { - return it, err - } - it.StateNEQ = data - case "stateIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateIn")) - data, err := ec.unmarshalOApprovalRequestState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStateᚄ(ctx, v) - if err != nil { - return it, err - } - it.StateIn = data - case "stateNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateNotIn")) - data, err := ec.unmarshalOApprovalRequestState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStateᚄ(ctx, v) - if err != nil { - return it, err - } - it.StateNotIn = data - case "hasAPISubscription": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPISubscription")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) - if err != nil { - return it, err - } - it.HasAPISubscription = data - case "hasAPISubscriptionWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPISubscriptionWith")) - data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) - if err != nil { - return it, err - } - it.HasAPISubscriptionWith = data - } - } - return it, nil -} - -func (ec *executionContext) unmarshalInputApprovalWhereInput(ctx context.Context, obj any) (ent.ApprovalWhereInput, error) { - var it ent.ApprovalWhereInput - if obj == nil { - return it, nil - } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "action", "actionNEQ", "actionIn", "actionNotIn", "actionGT", "actionGTE", "actionLT", "actionLTE", "actionContains", "actionHasPrefix", "actionHasSuffix", "actionEqualFold", "actionContainsFold", "strategy", "strategyNEQ", "strategyIn", "strategyNotIn", "deciderTeamName", "deciderTeamNameNEQ", "deciderTeamNameIn", "deciderTeamNameNotIn", "deciderTeamNameGT", "deciderTeamNameGTE", "deciderTeamNameLT", "deciderTeamNameLTE", "deciderTeamNameContains", "deciderTeamNameHasPrefix", "deciderTeamNameHasSuffix", "deciderTeamNameEqualFold", "deciderTeamNameContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "state", "stateNEQ", "stateIn", "stateNotIn", "hasAPISubscription", "hasAPISubscriptionWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOApprovalWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInput(ctx, v) - if err != nil { - return it, err - } - it.Not = data - case "and": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInputᚄ(ctx, v) + it.NameHasPrefix = data + case "nameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.And = data - case "or": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInputᚄ(ctx, v) + it.NameHasSuffix = data + case "nameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.NameEqualFold = data + case "nameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.NameContainsFold = data + case "eventType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventType")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + it.EventType = data + case "eventTypeNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + it.EventTypeNEQ = data + case "eventTypeIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.EventTypeIn = data + case "eventTypeNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.EventTypeNotIn = data + case "eventTypeGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGTE = data - case "idLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.EventTypeGT = data + case "eventTypeGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.EventTypeGTE = data + case "eventTypeLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "createdAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.EventTypeLT = data + case "eventTypeLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAt = data - case "createdAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.EventTypeLTE = data + case "eventTypeContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNEQ = data - case "createdAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.EventTypeContains = data + case "eventTypeHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtIn = data - case "createdAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.EventTypeHasPrefix = data + case "eventTypeHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNotIn = data - case "createdAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.EventTypeHasSuffix = data + case "eventTypeEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtGT = data - case "createdAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.EventTypeEqualFold = data + case "eventTypeContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventTypeContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtGTE = data - case "createdAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.EventTypeContainsFold = data + case "deliveryType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deliveryType")) + data, err := ec.unmarshalOEventSubscriptionDeliveryType2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx, v) if err != nil { return it, err } - it.CreatedAtLT = data - case "createdAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeliveryType = data + case "deliveryTypeNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deliveryTypeNEQ")) + data, err := ec.unmarshalOEventSubscriptionDeliveryType2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx, v) if err != nil { return it, err } - it.CreatedAtLTE = data - case "lastModifiedAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeliveryTypeNEQ = data + case "deliveryTypeIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deliveryTypeIn")) + data, err := ec.unmarshalOEventSubscriptionDeliveryType2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryTypeᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAt = data - case "lastModifiedAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.DeliveryTypeIn = data + case "deliveryTypeNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deliveryTypeNotIn")) + data, err := ec.unmarshalOEventSubscriptionDeliveryType2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryTypeᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNEQ = data - case "lastModifiedAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.DeliveryTypeNotIn = data + case "callbackURL": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURL")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtIn = data - case "lastModifiedAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.CallbackURL = data + case "callbackURLNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNotIn = data - case "lastModifiedAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.CallbackURLNEQ = data + case "callbackURLIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGT = data - case "lastModifiedAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.CallbackURLIn = data + case "callbackURLNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGTE = data - case "lastModifiedAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.CallbackURLNotIn = data + case "callbackURLGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLT = data - case "lastModifiedAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.CallbackURLGT = data + case "callbackURLGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLTE = data - case "statusPhase": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) - data, err := ec.unmarshalOApprovalStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx, v) + it.CallbackURLGTE = data + case "callbackURLLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhase = data - case "statusPhaseNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) - data, err := ec.unmarshalOApprovalStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx, v) + it.CallbackURLLT = data + case "callbackURLLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseNEQ = data - case "statusPhaseIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) - data, err := ec.unmarshalOApprovalStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhaseᚄ(ctx, v) + it.CallbackURLLTE = data + case "callbackURLContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseIn = data - case "statusPhaseNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) - data, err := ec.unmarshalOApprovalStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhaseᚄ(ctx, v) + it.CallbackURLContains = data + case "callbackURLHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseNotIn = data - case "statusPhaseIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIsNil")) + it.CallbackURLHasPrefix = data + case "callbackURLHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CallbackURLHasSuffix = data + case "callbackURLIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLIsNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.StatusPhaseIsNil = data - case "statusPhaseNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotNil")) + it.CallbackURLIsNil = data + case "callbackURLNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLNotNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.StatusPhaseNotNil = data - case "statusMessage": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessage")) + it.CallbackURLNotNil = data + case "callbackURLEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessage = data - case "statusMessageNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNEQ")) + it.CallbackURLEqualFold = data + case "callbackURLContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageNEQ = data - case "statusMessageIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.CallbackURLContainsFold = data + case "hasOwner": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.StatusMessageIn = data - case "statusMessageNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.HasOwner = data + case "hasOwnerWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerWith")) + data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageNotIn = data - case "statusMessageGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasOwnerWith = data + case "hasTarget": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTarget")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasTarget = data + case "hasTargetWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTargetWith")) + data, err := ec.unmarshalOEventExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasTargetWith = data + case "hasApproval": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApproval")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasApproval = data + case "hasApprovalWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalWith")) + data, err := ec.unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasApprovalWith = data + case "hasApprovalRequests": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalRequests")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasApprovalRequests = data + case "hasApprovalRequestsWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalRequestsWith")) + data, err := ec.unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasApprovalRequestsWith = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputGroupWhereInput(ctx context.Context, obj any) (ent.GroupWhereInput, error) { + var it ent.GroupWhereInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "displayName", "displayNameNEQ", "displayNameIn", "displayNameNotIn", "displayNameGT", "displayNameGTE", "displayNameLT", "displayNameLTE", "displayNameContains", "displayNameHasPrefix", "displayNameHasSuffix", "displayNameEqualFold", "displayNameContainsFold", "description", "descriptionNEQ", "descriptionIn", "descriptionNotIn", "descriptionGT", "descriptionGTE", "descriptionLT", "descriptionLTE", "descriptionContains", "descriptionHasPrefix", "descriptionHasSuffix", "descriptionEqualFold", "descriptionContainsFold", "hasTeams", "hasTeamsWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOGroupWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroupWhereInput(ctx, v) if err != nil { return it, err } - it.StatusMessageGT = data - case "statusMessageGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.Not = data + case "and": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOGroupWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroupWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageGTE = data - case "statusMessageLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.And = data + case "or": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOGroupWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroupWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageLT = data - case "statusMessageLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.Or = data + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.StatusMessageLTE = data - case "statusMessageContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.ID = data + case "idNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.StatusMessageContains = data - case "statusMessageHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDNEQ = data + case "idIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageHasPrefix = data - case "statusMessageHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDIn = data + case "idNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageHasSuffix = data - case "statusMessageIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.IDNotIn = data + case "idGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.StatusMessageIsNil = data - case "statusMessageNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.IDGT = data + case "idGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.StatusMessageNotNil = data - case "statusMessageEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDGTE = data + case "idLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.StatusMessageEqualFold = data - case "statusMessageContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDLT = data + case "idLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.StatusMessageContainsFold = data + it.IDLTE = data case "environment": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -10427,356 +13296,300 @@ func (ec *executionContext) unmarshalInputApprovalWhereInput(ctx context.Context return it, err } it.NamespaceContainsFold = data - case "action": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Action = data - case "actionNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionNEQ")) + it.Name = data + case "nameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionNEQ = data - case "actionIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionIn")) + it.NameNEQ = data + case "nameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ActionIn = data - case "actionNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionNotIn")) + it.NameIn = data + case "nameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ActionNotIn = data - case "actionGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionGT")) + it.NameNotIn = data + case "nameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionGT = data - case "actionGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionGTE")) + it.NameGT = data + case "nameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionGTE = data - case "actionLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionLT")) + it.NameGTE = data + case "nameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionLT = data - case "actionLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionLTE")) + it.NameLT = data + case "nameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionLTE = data - case "actionContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionContains")) + it.NameLTE = data + case "nameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionContains = data - case "actionHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionHasPrefix")) + it.NameContains = data + case "nameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionHasPrefix = data - case "actionHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionHasSuffix")) + it.NameHasPrefix = data + case "nameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionHasSuffix = data - case "actionEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionEqualFold")) + it.NameHasSuffix = data + case "nameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionEqualFold = data - case "actionContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionContainsFold")) + it.NameEqualFold = data + case "nameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ActionContainsFold = data - case "strategy": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategy")) - data, err := ec.unmarshalOApprovalStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx, v) - if err != nil { - return it, err - } - it.Strategy = data - case "strategyNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyNEQ")) - data, err := ec.unmarshalOApprovalStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx, v) - if err != nil { - return it, err - } - it.StrategyNEQ = data - case "strategyIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyIn")) - data, err := ec.unmarshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategyᚄ(ctx, v) - if err != nil { - return it, err - } - it.StrategyIn = data - case "strategyNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("strategyNotIn")) - data, err := ec.unmarshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategyᚄ(ctx, v) - if err != nil { - return it, err - } - it.StrategyNotIn = data - case "deciderTeamName": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamName")) + it.NameContainsFold = data + case "displayName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamName = data - case "deciderTeamNameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameNEQ")) + it.DisplayName = data + case "displayNameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameNEQ = data - case "deciderTeamNameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameIn")) + it.DisplayNameNEQ = data + case "displayNameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameIn = data - case "deciderTeamNameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameNotIn")) + it.DisplayNameIn = data + case "displayNameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameNotIn = data - case "deciderTeamNameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DeciderTeamNameGT = data - case "deciderTeamNameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DeciderTeamNameGTE = data - case "deciderTeamNameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DeciderTeamNameLT = data - case "deciderTeamNameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DeciderTeamNameLTE = data - case "deciderTeamNameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameContains")) + it.DisplayNameNotIn = data + case "displayNameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameContains = data - case "deciderTeamNameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameHasPrefix")) + it.DisplayNameGT = data + case "displayNameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameHasPrefix = data - case "deciderTeamNameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameHasSuffix")) + it.DisplayNameGTE = data + case "displayNameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameHasSuffix = data - case "deciderTeamNameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameEqualFold")) + it.DisplayNameLT = data + case "displayNameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameEqualFold = data - case "deciderTeamNameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deciderTeamNameContainsFold")) + it.DisplayNameLTE = data + case "displayNameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DeciderTeamNameContainsFold = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + it.DisplayNameContains = data + case "displayNameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + it.DisplayNameHasPrefix = data + case "displayNameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.DisplayNameHasSuffix = data + case "displayNameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.DisplayNameEqualFold = data + case "displayNameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + it.DisplayNameContainsFold = data + case "description": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + it.Description = data + case "descriptionNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.DescriptionNEQ = data + case "descriptionIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.DescriptionIn = data + case "descriptionNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + it.DescriptionNotIn = data + case "descriptionGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + it.DescriptionGT = data + case "descriptionGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + it.DescriptionGTE = data + case "descriptionLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + it.DescriptionLT = data + case "descriptionLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + it.DescriptionLTE = data + case "descriptionContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "state": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("state")) - data, err := ec.unmarshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, v) + it.DescriptionContains = data + case "descriptionHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.State = data - case "stateNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateNEQ")) - data, err := ec.unmarshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, v) + it.DescriptionHasPrefix = data + case "descriptionHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StateNEQ = data - case "stateIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateIn")) - data, err := ec.unmarshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStateᚄ(ctx, v) + it.DescriptionHasSuffix = data + case "descriptionEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StateIn = data - case "stateNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("stateNotIn")) - data, err := ec.unmarshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStateᚄ(ctx, v) + it.DescriptionEqualFold = data + case "descriptionContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StateNotIn = data - case "hasAPISubscription": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPISubscription")) + it.DescriptionContainsFold = data + case "hasTeams": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTeams")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasAPISubscription = data - case "hasAPISubscriptionWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPISubscriptionWith")) - data, err := ec.unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx, v) + it.HasTeams = data + case "hasTeamsWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTeamsWith")) + data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasAPISubscriptionWith = data + it.HasTeamsWith = data } } return it, nil } -func (ec *executionContext) unmarshalInputGroupWhereInput(ctx context.Context, obj any) (ent.GroupWhereInput, error) { - var it ent.GroupWhereInput +func (ec *executionContext) unmarshalInputMemberWhereInput(ctx context.Context, obj any) (ent.MemberWhereInput, error) { + var it ent.MemberWhereInput if obj == nil { return it, nil } @@ -10786,7 +13599,7 @@ func (ec *executionContext) unmarshalInputGroupWhereInput(ctx context.Context, o asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "displayName", "displayNameNEQ", "displayNameIn", "displayNameNotIn", "displayNameGT", "displayNameGTE", "displayNameLT", "displayNameLTE", "displayNameContains", "displayNameHasPrefix", "displayNameHasSuffix", "displayNameEqualFold", "displayNameContainsFold", "description", "descriptionNEQ", "descriptionIn", "descriptionNotIn", "descriptionGT", "descriptionGTE", "descriptionLT", "descriptionLTE", "descriptionContains", "descriptionHasPrefix", "descriptionHasSuffix", "descriptionEqualFold", "descriptionContainsFold", "hasTeams", "hasTeamsWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "email", "emailNEQ", "emailIn", "emailNotIn", "emailGT", "emailGTE", "emailLT", "emailLTE", "emailContains", "emailHasPrefix", "emailHasSuffix", "emailEqualFold", "emailContainsFold", "hasTeam", "hasTeamWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -10795,21 +13608,21 @@ func (ec *executionContext) unmarshalInputGroupWhereInput(ctx context.Context, o switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOGroupWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroupWhereInput(ctx, v) + data, err := ec.unmarshalOMemberWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOGroupWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroupWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOMemberWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOGroupWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroupWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOMemberWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -10931,141 +13744,50 @@ func (ec *executionContext) unmarshalInputGroupWhereInput(ctx context.Context, o data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err - } - it.EnvironmentContains = data - case "environmentHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentHasPrefix = data - case "environmentHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentHasSuffix = data - case "environmentIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentIsNil = data - case "environmentNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentNotNil = data - case "environmentEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentEqualFold = data - case "environmentContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentContainsFold = data - case "namespace": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Namespace = data - case "namespaceNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceNEQ = data - case "namespaceIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.NamespaceIn = data - case "namespaceNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.NamespaceNotIn = data - case "namespaceGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceGT = data - case "namespaceGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceGTE = data - case "namespaceLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NamespaceLT = data - case "namespaceLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) + } + it.EnvironmentContains = data + case "environmentHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NamespaceLTE = data - case "namespaceContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) + it.EnvironmentHasPrefix = data + case "environmentHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NamespaceContains = data - case "namespaceHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.EnvironmentHasSuffix = data + case "environmentIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NamespaceHasPrefix = data - case "namespaceHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.EnvironmentIsNil = data + case "environmentNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NamespaceHasSuffix = data - case "namespaceEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) + it.EnvironmentNotNil = data + case "environmentEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NamespaceEqualFold = data - case "namespaceContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) + it.EnvironmentEqualFold = data + case "environmentContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NamespaceContainsFold = data + it.EnvironmentContainsFold = data case "name": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -11157,209 +13879,159 @@ func (ec *executionContext) unmarshalInputGroupWhereInput(ctx context.Context, o return it, err } it.NameContainsFold = data - case "displayName": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName")) + case "email": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DisplayName = data - case "displayNameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameNEQ")) + it.Email = data + case "emailNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DisplayNameNEQ = data - case "displayNameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameIn")) + it.EmailNEQ = data + case "emailIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.DisplayNameIn = data - case "displayNameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameNotIn")) + it.EmailIn = data + case "emailNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.DisplayNameNotIn = data - case "displayNameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DisplayNameGT = data - case "displayNameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DisplayNameGTE = data - case "displayNameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DisplayNameLT = data - case "displayNameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DisplayNameLTE = data - case "displayNameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DisplayNameContains = data - case "displayNameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DisplayNameHasPrefix = data - case "displayNameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DisplayNameHasSuffix = data - case "displayNameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DisplayNameEqualFold = data - case "displayNameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayNameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.DisplayNameContainsFold = data - case "description": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) + it.EmailNotIn = data + case "emailGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Description = data - case "descriptionNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionNEQ")) + it.EmailGT = data + case "emailGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DescriptionNEQ = data - case "descriptionIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.DescriptionIn = data - case "descriptionNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.DescriptionNotIn = data - case "descriptionGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionGT")) + it.EmailGTE = data + case "emailLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DescriptionGT = data - case "descriptionGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionGTE")) + it.EmailLT = data + case "emailLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DescriptionGTE = data - case "descriptionLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionLT")) + it.EmailLTE = data + case "emailContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DescriptionLT = data - case "descriptionLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionLTE")) + it.EmailContains = data + case "emailHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DescriptionLTE = data - case "descriptionContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionContains")) + it.EmailHasPrefix = data + case "emailHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DescriptionContains = data - case "descriptionHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionHasPrefix")) + it.EmailHasSuffix = data + case "emailEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DescriptionHasPrefix = data - case "descriptionHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionHasSuffix")) + it.EmailEqualFold = data + case "emailContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.DescriptionHasSuffix = data - case "descriptionEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.EmailContainsFold = data + case "hasTeam": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTeam")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.DescriptionEqualFold = data - case "descriptionContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasTeam = data + case "hasTeamWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTeamWith")) + data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.DescriptionContainsFold = data - case "hasTeams": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTeams")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.HasTeamWith = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputTeamOrder(ctx context.Context, obj any) (ent.TeamOrder, error) { + var it ent.TeamOrder + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) if err != nil { return it, err } - it.HasTeams = data - case "hasTeamsWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTeamsWith")) - data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNTeamOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamOrderField(ctx, v) if err != nil { return it, err } - it.HasTeamsWith = data + it.Field = data } } return it, nil } -func (ec *executionContext) unmarshalInputMemberWhereInput(ctx context.Context, obj any) (ent.MemberWhereInput, error) { - var it ent.MemberWhereInput +func (ec *executionContext) unmarshalInputTeamWhereInput(ctx context.Context, obj any) (ent.TeamWhereInput, error) { + var it ent.TeamWhereInput if obj == nil { return it, nil } @@ -11369,7 +14041,7 @@ func (ec *executionContext) unmarshalInputMemberWhereInput(ctx context.Context, asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "email", "emailNEQ", "emailIn", "emailNotIn", "emailGT", "emailGTE", "emailLT", "emailLTE", "emailContains", "emailHasPrefix", "emailHasSuffix", "emailEqualFold", "emailContainsFold", "hasTeam", "hasTeamWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "email", "emailNEQ", "emailIn", "emailNotIn", "emailGT", "emailGTE", "emailLT", "emailLTE", "emailContains", "emailHasPrefix", "emailHasSuffix", "emailEqualFold", "emailContainsFold", "category", "categoryNEQ", "categoryIn", "categoryNotIn", "teamToken", "teamTokenNEQ", "teamTokenIn", "teamTokenNotIn", "teamTokenGT", "teamTokenGTE", "teamTokenLT", "teamTokenLTE", "teamTokenContains", "teamTokenHasPrefix", "teamTokenHasSuffix", "teamTokenIsNil", "teamTokenNotNil", "teamTokenEqualFold", "teamTokenContainsFold", "hasGroup", "hasGroupWith", "hasMembers", "hasMembersWith", "hasApplications", "hasApplicationsWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -11378,21 +14050,21 @@ func (ec *executionContext) unmarshalInputMemberWhereInput(ctx context.Context, switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOMemberWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberWhereInput(ctx, v) + data, err := ec.unmarshalOTeamWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOMemberWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOMemberWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -11453,1824 +14125,2258 @@ func (ec *executionContext) unmarshalInputMemberWhereInput(ctx context.Context, return it, err } it.IDLTE = data - case "environment": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Environment = data - case "environmentNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentNEQ = data - case "environmentIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentIn = data - case "environmentNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentNotIn = data - case "environmentGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentGT = data - case "environmentGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentGTE = data - case "environmentLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EnvironmentLT = data - case "environmentLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + case "createdAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentLTE = data - case "environmentContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAt = data + case "createdAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentContains = data - case "environmentHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAtNEQ = data + case "createdAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentHasPrefix = data - case "environmentHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAtIn = data + case "createdAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentHasSuffix = data - case "environmentIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.CreatedAtNotIn = data + case "createdAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentIsNil = data - case "environmentNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.CreatedAtGT = data + case "createdAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentNotNil = data - case "environmentEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAtGTE = data + case "createdAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentEqualFold = data - case "environmentContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAtLT = data + case "createdAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.EnvironmentContainsFold = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CreatedAtLTE = data + case "lastModifiedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAt = data + case "lastModifiedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.LastModifiedAtLTE = data + case "statusPhase": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) + data, err := ec.unmarshalOTeamStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhase(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusPhase = data + case "statusPhaseNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) + data, err := ec.unmarshalOTeamStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhase(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusPhaseNEQ = data + case "statusPhaseIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) + data, err := ec.unmarshalOTeamStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusPhaseIn = data + case "statusPhaseNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) + data, err := ec.unmarshalOTeamStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusPhaseNotIn = data + case "statusPhaseIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "email": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusPhaseIsNil = data + case "statusPhaseNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.Email = data - case "emailNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailNEQ")) + it.StatusPhaseNotNil = data + case "statusMessage": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessage")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err - } - it.EmailNEQ = data - case "emailIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.EmailIn = data - case "emailNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.EmailNotIn = data - case "emailGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailGT")) + } + it.StatusMessage = data + case "statusMessageNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailGT = data - case "emailGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusMessageNEQ = data + case "statusMessageIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EmailGTE = data - case "emailLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.StatusMessageIn = data + case "statusMessageNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EmailLT = data - case "emailLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailLTE")) + it.StatusMessageNotIn = data + case "statusMessageGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailLTE = data - case "emailContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailContains")) + it.StatusMessageGT = data + case "statusMessageGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailContains = data - case "emailHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailHasPrefix")) + it.StatusMessageGTE = data + case "statusMessageLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailHasPrefix = data - case "emailHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailHasSuffix")) + it.StatusMessageLT = data + case "statusMessageLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailHasSuffix = data - case "emailEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailEqualFold")) + it.StatusMessageLTE = data + case "statusMessageContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailEqualFold = data - case "emailContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailContainsFold")) + it.StatusMessageContains = data + case "statusMessageHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailContainsFold = data - case "hasTeam": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTeam")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.StatusMessageHasPrefix = data + case "statusMessageHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasTeam = data - case "hasTeamWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTeamWith")) - data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) + it.StatusMessageHasSuffix = data + case "statusMessageIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.HasTeamWith = data - } - } - return it, nil -} - -func (ec *executionContext) unmarshalInputTeamOrder(ctx context.Context, obj any) (ent.TeamOrder, error) { - var it ent.TeamOrder - if obj == nil { - return it, nil - } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } - - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + it.StatusMessageIsNil = data + case "statusMessageNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNTeamOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamOrderField(ctx, v) + it.StatusMessageNotNil = data + case "statusMessageEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Field = data - } - } - return it, nil -} - -func (ec *executionContext) unmarshalInputTeamWhereInput(ctx context.Context, obj any) (ent.TeamWhereInput, error) { - var it ent.TeamWhereInput - if obj == nil { - return it, nil - } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "statusPhase", "statusPhaseNEQ", "statusPhaseIn", "statusPhaseNotIn", "statusPhaseIsNil", "statusPhaseNotNil", "statusMessage", "statusMessageNEQ", "statusMessageIn", "statusMessageNotIn", "statusMessageGT", "statusMessageGTE", "statusMessageLT", "statusMessageLTE", "statusMessageContains", "statusMessageHasPrefix", "statusMessageHasSuffix", "statusMessageIsNil", "statusMessageNotNil", "statusMessageEqualFold", "statusMessageContainsFold", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "namespace", "namespaceNEQ", "namespaceIn", "namespaceNotIn", "namespaceGT", "namespaceGTE", "namespaceLT", "namespaceLTE", "namespaceContains", "namespaceHasPrefix", "namespaceHasSuffix", "namespaceEqualFold", "namespaceContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "email", "emailNEQ", "emailIn", "emailNotIn", "emailGT", "emailGTE", "emailLT", "emailLTE", "emailContains", "emailHasPrefix", "emailHasSuffix", "emailEqualFold", "emailContainsFold", "category", "categoryNEQ", "categoryIn", "categoryNotIn", "roverTokenRef", "roverTokenRefNEQ", "roverTokenRefIn", "roverTokenRefNotIn", "roverTokenRefGT", "roverTokenRefGTE", "roverTokenRefLT", "roverTokenRefLTE", "roverTokenRefContains", "roverTokenRefHasPrefix", "roverTokenRefHasSuffix", "roverTokenRefIsNil", "roverTokenRefNotNil", "roverTokenRefEqualFold", "roverTokenRefContainsFold", "hasGroup", "hasGroupWith", "hasMembers", "hasMembersWith", "hasApplications", "hasApplicationsWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOTeamWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInput(ctx, v) + it.StatusMessageEqualFold = data + case "statusMessageContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Not = data - case "and": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) + it.StatusMessageContainsFold = data + case "environment": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.And = data - case "or": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) + it.Environment = data + case "environmentNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.EnvironmentNEQ = data + case "environmentIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.EnvironmentIn = data + case "environmentNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + it.EnvironmentNotIn = data + case "environmentGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + it.EnvironmentGT = data + case "environmentGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.EnvironmentGTE = data + case "environmentLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.EnvironmentLT = data + case "environmentLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGTE = data - case "idLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.EnvironmentLTE = data + case "environmentContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.EnvironmentContains = data + case "environmentHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "createdAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.EnvironmentHasPrefix = data + case "environmentHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAt = data - case "createdAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.EnvironmentHasSuffix = data + case "environmentIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAtNEQ = data - case "createdAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.EnvironmentIsNil = data + case "environmentNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAtIn = data - case "createdAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.EnvironmentNotNil = data + case "environmentEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNotIn = data - case "createdAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.EnvironmentEqualFold = data + case "environmentContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtGT = data - case "createdAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.EnvironmentContainsFold = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtGTE = data - case "createdAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.Namespace = data + case "namespaceNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtLT = data - case "createdAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.NamespaceNEQ = data + case "namespaceIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtLTE = data - case "lastModifiedAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.NamespaceIn = data + case "namespaceNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAt = data - case "lastModifiedAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.NamespaceNotIn = data + case "namespaceGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNEQ = data - case "lastModifiedAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.NamespaceGT = data + case "namespaceGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtIn = data - case "lastModifiedAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + it.NamespaceGTE = data + case "namespaceLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNotIn = data - case "lastModifiedAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.NamespaceLT = data + case "namespaceLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGT = data - case "lastModifiedAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.NamespaceLTE = data + case "namespaceContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGTE = data - case "lastModifiedAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.NamespaceContains = data + case "namespaceHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLT = data - case "lastModifiedAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.NamespaceHasPrefix = data + case "namespaceHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLTE = data - case "statusPhase": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) - data, err := ec.unmarshalOTeamStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhase(ctx, v) + it.NamespaceHasSuffix = data + case "namespaceEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhase = data - case "statusPhaseNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) - data, err := ec.unmarshalOTeamStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhase(ctx, v) + it.NamespaceEqualFold = data + case "namespaceContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseNEQ = data - case "statusPhaseIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) - data, err := ec.unmarshalOTeamStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhaseᚄ(ctx, v) + it.NamespaceContainsFold = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseIn = data - case "statusPhaseNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) - data, err := ec.unmarshalOTeamStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhaseᚄ(ctx, v) + it.Name = data + case "nameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusPhaseNotIn = data - case "statusPhaseIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.NameNEQ = data + case "nameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.StatusPhaseIsNil = data - case "statusPhaseNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.NameIn = data + case "nameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.StatusPhaseNotNil = data - case "statusMessage": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessage")) + it.NameNotIn = data + case "nameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessage = data - case "statusMessageNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNEQ")) + it.NameGT = data + case "nameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageNEQ = data - case "statusMessageIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.NameGTE = data + case "nameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageIn = data - case "statusMessageNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.NameLT = data + case "nameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageNotIn = data - case "statusMessageGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGT")) + it.NameLTE = data + case "nameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageGT = data - case "statusMessageGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGTE")) + it.NameContains = data + case "nameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageGTE = data - case "statusMessageLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLT")) + it.NameHasPrefix = data + case "nameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageLT = data - case "statusMessageLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLTE")) + it.NameHasSuffix = data + case "nameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageLTE = data - case "statusMessageContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContains")) + it.NameEqualFold = data + case "nameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageContains = data - case "statusMessageHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasPrefix")) + it.NameContainsFold = data + case "email": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageHasPrefix = data - case "statusMessageHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasSuffix")) + it.Email = data + case "emailNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageHasSuffix = data - case "statusMessageIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.EmailNEQ = data + case "emailIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageIsNil = data - case "statusMessageNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.EmailIn = data + case "emailNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.StatusMessageNotNil = data - case "statusMessageEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageEqualFold")) + it.EmailNotIn = data + case "emailGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageEqualFold = data - case "statusMessageContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContainsFold")) + it.EmailGT = data + case "emailGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusMessageContainsFold = data - case "environment": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) + it.EmailGTE = data + case "emailLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.EmailLT = data + case "emailLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Environment = data - case "environmentNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) + it.EmailLTE = data + case "emailContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentNEQ = data - case "environmentIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.EmailContains = data + case "emailHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentIn = data - case "environmentNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.EmailHasPrefix = data + case "emailHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentNotIn = data - case "environmentGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) + it.EmailHasSuffix = data + case "emailEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentGT = data - case "environmentGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) + it.EmailEqualFold = data + case "emailContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentGTE = data - case "environmentLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.EmailContainsFold = data + case "category": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("category")) + data, err := ec.unmarshalOTeamCategory2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategory(ctx, v) if err != nil { return it, err } - it.EnvironmentLT = data - case "environmentLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.Category = data + case "categoryNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryNEQ")) + data, err := ec.unmarshalOTeamCategory2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategory(ctx, v) if err != nil { return it, err } - it.EnvironmentLTE = data - case "environmentContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.CategoryNEQ = data + case "categoryIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryIn")) + data, err := ec.unmarshalOTeamCategory2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategoryᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentContains = data - case "environmentHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) + it.CategoryIn = data + case "categoryNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryNotIn")) + data, err := ec.unmarshalOTeamCategory2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategoryᚄ(ctx, v) + if err != nil { + return it, err + } + it.CategoryNotIn = data + case "teamToken": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamToken")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentHasPrefix = data - case "environmentHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) + it.TeamToken = data + case "teamTokenNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentHasSuffix = data - case "environmentIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.TeamTokenNEQ = data + case "teamTokenIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentIsNil = data - case "environmentNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + it.TeamTokenIn = data + case "teamTokenNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentNotNil = data - case "environmentEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) + it.TeamTokenNotIn = data + case "teamTokenGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentEqualFold = data - case "environmentContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) + it.TeamTokenGT = data + case "teamTokenGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentContainsFold = data - case "namespace": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + it.TeamTokenGTE = data + case "teamTokenLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Namespace = data - case "namespaceNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) + it.TeamTokenLT = data + case "teamTokenLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NamespaceNEQ = data - case "namespaceIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.TeamTokenLTE = data + case "teamTokenContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NamespaceIn = data - case "namespaceNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.TeamTokenContains = data + case "teamTokenHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NamespaceNotIn = data - case "namespaceGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) + it.TeamTokenHasPrefix = data + case "teamTokenHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NamespaceGT = data - case "namespaceGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.TeamTokenHasSuffix = data + case "teamTokenIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NamespaceGTE = data - case "namespaceLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.TeamTokenIsNil = data + case "teamTokenNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NamespaceLT = data - case "namespaceLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) + it.TeamTokenNotNil = data + case "teamTokenEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NamespaceLTE = data - case "namespaceContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) + it.TeamTokenEqualFold = data + case "teamTokenContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamTokenContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NamespaceContains = data - case "namespaceHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.TeamTokenContainsFold = data + case "hasGroup": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasGroup")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.NamespaceHasPrefix = data - case "namespaceHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasGroup = data + case "hasGroupWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasGroupWith")) + data, err := ec.unmarshalOGroupWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroupWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.NamespaceHasSuffix = data - case "namespaceEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasGroupWith = data + case "hasMembers": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasMembers")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.NamespaceEqualFold = data - case "namespaceContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasMembers = data + case "hasMembersWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasMembersWith")) + data, err := ec.unmarshalOMemberWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.NamespaceContainsFold = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasMembersWith = data + case "hasApplications": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApplications")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.HasApplications = data + case "hasApplicationsWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApplicationsWith")) + data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.HasApplicationsWith = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputZoneWhereInput(ctx context.Context, obj any) (ent.ZoneWhereInput, error) { + var it ent.ZoneWhereInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "gatewayURL", "gatewayURLNEQ", "gatewayURLIn", "gatewayURLNotIn", "gatewayURLGT", "gatewayURLGTE", "gatewayURLLT", "gatewayURLLTE", "gatewayURLContains", "gatewayURLHasPrefix", "gatewayURLHasSuffix", "gatewayURLIsNil", "gatewayURLNotNil", "gatewayURLEqualFold", "gatewayURLContainsFold", "issuerURL", "issuerURLNEQ", "issuerURLIn", "issuerURLNotIn", "issuerURLGT", "issuerURLGTE", "issuerURLLT", "issuerURLLTE", "issuerURLContains", "issuerURLHasPrefix", "issuerURLHasSuffix", "issuerURLIsNil", "issuerURLNotNil", "issuerURLEqualFold", "issuerURLContainsFold", "visibility", "visibilityNEQ", "visibilityIn", "visibilityNotIn", "hasApplications", "hasApplicationsWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOZoneWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInput(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + it.Not = data + case "and": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOZoneWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.And = data + case "or": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOZoneWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.Or = data + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.ID = data + case "idNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDNEQ = data + case "idIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDIn = data + case "idNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDNotIn = data + case "idGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDGT = data + case "idGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDGTE = data + case "idLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.IDLT = data + case "idLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "email": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) + it.IDLTE = data + case "environment": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Email = data - case "emailNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailNEQ")) + it.Environment = data + case "environmentNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailNEQ = data - case "emailIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailIn")) + it.EnvironmentNEQ = data + case "environmentIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EmailIn = data - case "emailNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailNotIn")) + it.EnvironmentIn = data + case "environmentNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EmailNotIn = data - case "emailGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EmailGT = data - case "emailGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.EmailGTE = data - case "emailLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailLT")) + it.EnvironmentNotIn = data + case "environmentGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailLT = data - case "emailLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailLTE")) + it.EnvironmentGT = data + case "environmentGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailLTE = data - case "emailContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailContains")) + it.EnvironmentGTE = data + case "environmentLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailContains = data - case "emailHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailHasPrefix")) + it.EnvironmentLT = data + case "environmentLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailHasPrefix = data - case "emailHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailHasSuffix")) + it.EnvironmentLTE = data + case "environmentContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailHasSuffix = data - case "emailEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailEqualFold")) + it.EnvironmentContains = data + case "environmentHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailEqualFold = data - case "emailContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("emailContainsFold")) + it.EnvironmentHasPrefix = data + case "environmentHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EmailContainsFold = data - case "category": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("category")) - data, err := ec.unmarshalOTeamCategory2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategory(ctx, v) + it.EnvironmentHasSuffix = data + case "environmentIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.Category = data - case "categoryNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryNEQ")) - data, err := ec.unmarshalOTeamCategory2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategory(ctx, v) + it.EnvironmentIsNil = data + case "environmentNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CategoryNEQ = data - case "categoryIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryIn")) - data, err := ec.unmarshalOTeamCategory2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategoryᚄ(ctx, v) + it.EnvironmentNotNil = data + case "environmentEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CategoryIn = data - case "categoryNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryNotIn")) - data, err := ec.unmarshalOTeamCategory2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategoryᚄ(ctx, v) + it.EnvironmentEqualFold = data + case "environmentContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CategoryNotIn = data - case "roverTokenRef": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRef")) + it.EnvironmentContainsFold = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRef = data - case "roverTokenRefNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefNEQ")) + it.Name = data + case "nameNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRefNEQ = data - case "roverTokenRefIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefIn")) + it.NameNEQ = data + case "nameIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.RoverTokenRefIn = data - case "roverTokenRefNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefNotIn")) + it.NameIn = data + case "nameNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.RoverTokenRefNotIn = data - case "roverTokenRefGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefGT")) + it.NameNotIn = data + case "nameGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRefGT = data - case "roverTokenRefGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefGTE")) + it.NameGT = data + case "nameGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRefGTE = data - case "roverTokenRefLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefLT")) + it.NameGTE = data + case "nameLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRefLT = data - case "roverTokenRefLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefLTE")) + it.NameLT = data + case "nameLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRefLTE = data - case "roverTokenRefContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefContains")) + it.NameLTE = data + case "nameContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRefContains = data - case "roverTokenRefHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefHasPrefix")) + it.NameContains = data + case "nameHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRefHasPrefix = data - case "roverTokenRefHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefHasSuffix")) + it.NameHasPrefix = data + case "nameHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRefHasSuffix = data - case "roverTokenRefIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.RoverTokenRefIsNil = data - case "roverTokenRefNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.RoverTokenRefNotNil = data - case "roverTokenRefEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefEqualFold")) + it.NameHasSuffix = data + case "nameEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRefEqualFold = data - case "roverTokenRefContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roverTokenRefContainsFold")) + it.NameEqualFold = data + case "nameContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.RoverTokenRefContainsFold = data - case "hasGroup": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasGroup")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) - if err != nil { - return it, err - } - it.HasGroup = data - case "hasGroupWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasGroupWith")) - data, err := ec.unmarshalOGroupWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroupWhereInputᚄ(ctx, v) - if err != nil { - return it, err - } - it.HasGroupWith = data - case "hasMembers": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasMembers")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.NameContainsFold = data + case "gatewayURL": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURL")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasMembers = data - case "hasMembersWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasMembersWith")) - data, err := ec.unmarshalOMemberWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberWhereInputᚄ(ctx, v) + it.GatewayURL = data + case "gatewayURLNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasMembersWith = data - case "hasApplications": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApplications")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.GatewayURLNEQ = data + case "gatewayURLIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.HasApplications = data - case "hasApplicationsWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApplicationsWith")) - data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + it.GatewayURLIn = data + case "gatewayURLNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err - } - it.HasApplicationsWith = data - } - } - return it, nil -} - -func (ec *executionContext) unmarshalInputZoneWhereInput(ctx context.Context, obj any) (ent.ZoneWhereInput, error) { - var it ent.ZoneWhereInput - if obj == nil { - return it, nil - } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "environment", "environmentNEQ", "environmentIn", "environmentNotIn", "environmentGT", "environmentGTE", "environmentLT", "environmentLTE", "environmentContains", "environmentHasPrefix", "environmentHasSuffix", "environmentIsNil", "environmentNotNil", "environmentEqualFold", "environmentContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "gatewayURL", "gatewayURLNEQ", "gatewayURLIn", "gatewayURLNotIn", "gatewayURLGT", "gatewayURLGTE", "gatewayURLLT", "gatewayURLLTE", "gatewayURLContains", "gatewayURLHasPrefix", "gatewayURLHasSuffix", "gatewayURLIsNil", "gatewayURLNotNil", "gatewayURLEqualFold", "gatewayURLContainsFold", "visibility", "visibilityNEQ", "visibilityIn", "visibilityNotIn", "hasApplications", "hasApplicationsWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOZoneWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInput(ctx, v) + } + it.GatewayURLNotIn = data + case "gatewayURLGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Not = data - case "and": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOZoneWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInputᚄ(ctx, v) + it.GatewayURLGT = data + case "gatewayURLGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.And = data - case "or": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOZoneWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInputᚄ(ctx, v) + it.GatewayURLGTE = data + case "gatewayURLLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.GatewayURLLT = data + case "gatewayURLLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.GatewayURLLTE = data + case "gatewayURLContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + it.GatewayURLContains = data + case "gatewayURLHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + it.GatewayURLHasPrefix = data + case "gatewayURLHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.GatewayURLHasSuffix = data + case "gatewayURLIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.GatewayURLIsNil = data + case "gatewayURLNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.IDGTE = data - case "idLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.GatewayURLNotNil = data + case "gatewayURLEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.GatewayURLEqualFold = data + case "gatewayURLContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "environment": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) + it.GatewayURLContainsFold = data + case "issuerURL": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURL")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Environment = data - case "environmentNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) + it.IssuerURL = data + case "issuerURLNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentNEQ = data - case "environmentIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) + it.IssuerURLNEQ = data + case "issuerURLIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentIn = data - case "environmentNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) + it.IssuerURLIn = data + case "issuerURLNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentNotIn = data - case "environmentGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) + it.IssuerURLNotIn = data + case "issuerURLGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentGT = data - case "environmentGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) + it.IssuerURLGT = data + case "issuerURLGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentGTE = data - case "environmentLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) + it.IssuerURLGTE = data + case "issuerURLLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentLT = data - case "environmentLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) + it.IssuerURLLT = data + case "issuerURLLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentLTE = data - case "environmentContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) + it.IssuerURLLTE = data + case "issuerURLContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentContains = data - case "environmentHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) + it.IssuerURLContains = data + case "issuerURLHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentHasPrefix = data - case "environmentHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) + it.IssuerURLHasPrefix = data + case "issuerURLHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentHasSuffix = data - case "environmentIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) + it.IssuerURLHasSuffix = data + case "issuerURLIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLIsNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.EnvironmentIsNil = data - case "environmentNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) + it.IssuerURLIsNil = data + case "issuerURLNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLNotNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.EnvironmentNotNil = data - case "environmentEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentEqualFold")) + it.IssuerURLNotNil = data + case "issuerURLEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IssuerURLEqualFold = data + case "issuerURLContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("issuerURLContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvironmentEqualFold = data - case "environmentContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + it.IssuerURLContainsFold = data + case "visibility": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibility")) + data, err := ec.unmarshalOZoneVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibility(ctx, v) + if err != nil { + return it, err + } + it.Visibility = data + case "visibilityNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityNEQ")) + data, err := ec.unmarshalOZoneVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibility(ctx, v) + if err != nil { + return it, err + } + it.VisibilityNEQ = data + case "visibilityIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityIn")) + data, err := ec.unmarshalOZoneVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibilityᚄ(ctx, v) + if err != nil { + return it, err + } + it.VisibilityIn = data + case "visibilityNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityNotIn")) + data, err := ec.unmarshalOZoneVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibilityᚄ(ctx, v) + if err != nil { + return it, err + } + it.VisibilityNotIn = data + case "hasApplications": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApplications")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasApplications = data + case "hasApplicationsWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApplicationsWith")) + data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasApplicationsWith = data + } + } + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj ent.Noder) graphql.Marshaler { + switch obj := (obj).(type) { + case nil: + return graphql.Null + case *ent.Zone: + if obj == nil { + return graphql.Null + } + return ec._Zone(ctx, sel, obj) + case *ent.Team: + if obj == nil { + return graphql.Null + } + return ec._Team(ctx, sel, obj) + case *ent.Member: + if obj == nil { + return graphql.Null + } + return ec._Member(ctx, sel, obj) + case *ent.Group: + if obj == nil { + return graphql.Null + } + return ec._Group(ctx, sel, obj) + case *ent.EventSubscription: + if obj == nil { + return graphql.Null + } + return ec._EventSubscription(ctx, sel, obj) + case *ent.EventExposure: + if obj == nil { + return graphql.Null + } + return ec._EventExposure(ctx, sel, obj) + case *ent.ApprovalRequest: + if obj == nil { + return graphql.Null + } + return ec._ApprovalRequest(ctx, sel, obj) + case *ent.Approval: + if obj == nil { + return graphql.Null + } + return ec._Approval(ctx, sel, obj) + case *ent.Application: + if obj == nil { + return graphql.Null + } + return ec._Application(ctx, sel, obj) + case *ent.ApiSubscription: + if obj == nil { + return graphql.Null + } + return ec._ApiSubscription(ctx, sel, obj) + case *ent.ApiExposure: + if obj == nil { + return graphql.Null + } + return ec._ApiExposure(ctx, sel, obj) + default: + if typedObj, ok := obj.(graphql.Marshaler); ok { + return typedObj + } else { + panic(fmt.Errorf("unexpected type %T; non-generated variants of Node must implement graphql.Marshaler", obj)) + } + } +} + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var apiExposureImplementors = []string{"ApiExposure", "Node"} + +func (ec *executionContext) _ApiExposure(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiExposure) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, apiExposureImplementors) + + 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("ApiExposure") + case "id": + out.Values[i] = ec._ApiExposure_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "createdAt": + out.Values[i] = ec._ApiExposure_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.EnvironmentContainsFold = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "lastModifiedAt": + out.Values[i] = ec._ApiExposure_lastModifiedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.Name = data - case "nameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "statusPhase": + out.Values[i] = ec._ApiExposure_statusPhase(ctx, field, obj) + case "statusMessage": + out.Values[i] = ec._ApiExposure_statusMessage(ctx, field, obj) + case "environment": + out.Values[i] = ec._ApiExposure_environment(ctx, field, obj) + case "namespace": + out.Values[i] = ec._ApiExposure_namespace(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.NameNEQ = data - case "nameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err + case "basePath": + out.Values[i] = ec._ApiExposure_basePath(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.NameIn = data - case "nameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err + case "visibility": + out.Values[i] = ec._ApiExposure_visibility(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.NameNotIn = data - case "nameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "active": + out.Values[i] = ec._ApiExposure_active(ctx, field, obj) + case "features": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ApiExposure_features(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - it.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - it.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "upstreams": + out.Values[i] = ec._ApiExposure_upstreams(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "approvalConfig": + out.Values[i] = ec._ApiExposure_approvalConfig(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "apiVersion": + out.Values[i] = ec._ApiExposure_apiVersion(ctx, field, obj) + case "owner": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ApiExposure_owner(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - it.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - it.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "subscriptions": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ApiExposure_subscriptions(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - it.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - it.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + 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 apiExposureConnectionImplementors = []string{"ApiExposureConnection"} + +func (ec *executionContext) _ApiExposureConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiExposureConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, apiExposureConnectionImplementors) + + 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("ApiExposureConnection") + case "edges": + out.Values[i] = ec._ApiExposureConnection_edges(ctx, field, obj) + case "pageInfo": + out.Values[i] = ec._ApiExposureConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.NameContainsFold = data - case "gatewayURL": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURL")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "totalCount": + out.Values[i] = ec._ApiExposureConnection_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.GatewayURL = data - case "gatewayURLNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + 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 apiExposureEdgeImplementors = []string{"ApiExposureEdge"} + +func (ec *executionContext) _ApiExposureEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiExposureEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, apiExposureEdgeImplementors) + + 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("ApiExposureEdge") + case "node": + out.Values[i] = ec._ApiExposureEdge_node(ctx, field, obj) + case "cursor": + out.Values[i] = ec._ApiExposureEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.GatewayURLNEQ = data - case "gatewayURLIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err + 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 apiSubscriptionImplementors = []string{"ApiSubscription", "Node"} + +func (ec *executionContext) _ApiSubscription(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiSubscription) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, apiSubscriptionImplementors) + + 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("ApiSubscription") + case "id": + out.Values[i] = ec._ApiSubscription_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.GatewayURLIn = data - case "gatewayURLNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err + case "createdAt": + out.Values[i] = ec._ApiSubscription_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.GatewayURLNotIn = data - case "gatewayURLGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "lastModifiedAt": + out.Values[i] = ec._ApiSubscription_lastModifiedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.GatewayURLGT = data - case "gatewayURLGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "statusPhase": + out.Values[i] = ec._ApiSubscription_statusPhase(ctx, field, obj) + case "statusMessage": + out.Values[i] = ec._ApiSubscription_statusMessage(ctx, field, obj) + case "environment": + out.Values[i] = ec._ApiSubscription_environment(ctx, field, obj) + case "namespace": + out.Values[i] = ec._ApiSubscription_namespace(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.GatewayURLGTE = data - case "gatewayURLLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "name": + out.Values[i] = ec._ApiSubscription_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.GatewayURLLT = data - case "gatewayURLLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "basePath": + out.Values[i] = ec._ApiSubscription_basePath(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.GatewayURLLTE = data - case "gatewayURLContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "m2mAuthMethod": + out.Values[i] = ec._ApiSubscription_m2mAuthMethod(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.GatewayURLContains = data - case "gatewayURLHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "approvedScopes": + out.Values[i] = ec._ApiSubscription_approvedScopes(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.GatewayURLHasPrefix = data - case "gatewayURLHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + case "owner": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ApiSubscription_owner(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - it.GatewayURLHasSuffix = data - case "gatewayURLIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - it.GatewayURLIsNil = data - case "gatewayURLNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "failoverZones": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ApiSubscription_failoverZones(ctx, field, obj) + return res } - it.GatewayURLNotNil = data - case "gatewayURLEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - it.GatewayURLEqualFold = data - case "gatewayURLContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gatewayURLContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "approval": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ApiSubscription_approval(ctx, field, obj) + return res } - it.GatewayURLContainsFold = data - case "visibility": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibility")) - data, err := ec.unmarshalOZoneVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibility(ctx, v) - if err != nil { - return it, err + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - it.Visibility = data - case "visibilityNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityNEQ")) - data, err := ec.unmarshalOZoneVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibility(ctx, v) - if err != nil { - return it, err + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "approvalRequests": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ApiSubscription_approvalRequests(ctx, field, obj) + return res } - it.VisibilityNEQ = data - case "visibilityIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityIn")) - data, err := ec.unmarshalOZoneVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibilityᚄ(ctx, v) - if err != nil { - return it, err + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - it.VisibilityIn = data - case "visibilityNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visibilityNotIn")) - data, err := ec.unmarshalOZoneVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibilityᚄ(ctx, v) - if err != nil { - return it, err + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "target": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ApiSubscription_target(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - it.VisibilityNotIn = data - case "hasApplications": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApplications")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) - if err != nil { - return it, err + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - it.HasApplications = data - case "hasApplicationsWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApplicationsWith")) - data, err := ec.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) - if err != nil { - return it, err + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + 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 apiSubscriptionConnectionImplementors = []string{"ApiSubscriptionConnection"} + +func (ec *executionContext) _ApiSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiSubscriptionConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, apiSubscriptionConnectionImplementors) + + 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("ApiSubscriptionConnection") + case "edges": + out.Values[i] = ec._ApiSubscriptionConnection_edges(ctx, field, obj) + case "pageInfo": + out.Values[i] = ec._ApiSubscriptionConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.HasApplicationsWith = data + case "totalCount": + out.Values[i] = ec._ApiSubscriptionConnection_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } } - return it, nil + 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 **************************** input.gotpl ***************************** +var apiSubscriptionEdgeImplementors = []string{"ApiSubscriptionEdge"} -// region ************************** interface.gotpl *************************** +func (ec *executionContext) _ApiSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiSubscriptionEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, apiSubscriptionEdgeImplementors) -func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj ent.Noder) graphql.Marshaler { - switch obj := (obj).(type) { - case nil: - return graphql.Null - case *ent.Zone: - if obj == nil { - return graphql.Null - } - return ec._Zone(ctx, sel, obj) - case *ent.Team: - if obj == nil { - return graphql.Null - } - return ec._Team(ctx, sel, obj) - case *ent.Member: - if obj == nil { - return graphql.Null - } - return ec._Member(ctx, sel, obj) - case *ent.Group: - if obj == nil { - return graphql.Null - } - return ec._Group(ctx, sel, obj) - case *ent.ApprovalRequest: - if obj == nil { - return graphql.Null - } - return ec._ApprovalRequest(ctx, sel, obj) - case *ent.Approval: - if obj == nil { - return graphql.Null - } - return ec._Approval(ctx, sel, obj) - case *ent.Application: - if obj == nil { - return graphql.Null - } - return ec._Application(ctx, sel, obj) - case *ent.ApiSubscription: - if obj == nil { - return graphql.Null - } - return ec._ApiSubscription(ctx, sel, obj) - case *ent.ApiExposure: - if obj == nil { - return graphql.Null - } - return ec._ApiExposure(ctx, sel, obj) - default: - if typedObj, ok := obj.(graphql.Marshaler); ok { - return typedObj - } else { - panic(fmt.Errorf("unexpected type %T; non-generated variants of Node must implement graphql.Marshaler", obj)) + 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("ApiSubscriptionEdge") + case "node": + out.Values[i] = ec._ApiSubscriptionEdge_node(ctx, field, obj) + case "cursor": + out.Values[i] = ec._ApiSubscriptionEdge_cursor(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 + } -// endregion ************************** interface.gotpl *************************** + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) -// region **************************** object.gotpl **************************** + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } -var apiExposureImplementors = []string{"ApiExposure", "Node"} + return out +} -func (ec *executionContext) _ApiExposure(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiExposure) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, apiExposureImplementors) +var applicationImplementors = []string{"Application", "Node"} + +func (ec *executionContext) _Application(ctx context.Context, sel ast.SelectionSet, obj *ent.Application) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, applicationImplementors) 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("ApiExposure") + out.Values[i] = graphql.MarshalString("Application") case "id": - out.Values[i] = ec._ApiExposure_id(ctx, field, obj) + out.Values[i] = ec._Application_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "createdAt": - out.Values[i] = ec._ApiExposure_createdAt(ctx, field, obj) + out.Values[i] = ec._Application_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "lastModifiedAt": - out.Values[i] = ec._ApiExposure_lastModifiedAt(ctx, field, obj) + out.Values[i] = ec._Application_lastModifiedAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "statusPhase": - out.Values[i] = ec._ApiExposure_statusPhase(ctx, field, obj) + out.Values[i] = ec._Application_statusPhase(ctx, field, obj) case "statusMessage": - out.Values[i] = ec._ApiExposure_statusMessage(ctx, field, obj) + out.Values[i] = ec._Application_statusMessage(ctx, field, obj) case "environment": - out.Values[i] = ec._ApiExposure_environment(ctx, field, obj) + out.Values[i] = ec._Application_environment(ctx, field, obj) case "namespace": - out.Values[i] = ec._ApiExposure_namespace(ctx, field, obj) + out.Values[i] = ec._Application_namespace(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "basePath": - out.Values[i] = ec._ApiExposure_basePath(ctx, field, obj) + case "name": + out.Values[i] = ec._Application_name(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "visibility": - out.Values[i] = ec._ApiExposure_visibility(ctx, field, obj) + case "clientID": + out.Values[i] = ec._Application_clientID(ctx, field, obj) + case "clientSecret": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Application_clientSecret(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "rotatedClientSecret": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Application_rotatedClientSecret(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "rotatedExpiresAt": + out.Values[i] = ec._Application_rotatedExpiresAt(ctx, field, obj) + case "currentExpiresAt": + out.Values[i] = ec._Application_currentExpiresAt(ctx, field, obj) + case "secretRotationPhase": + out.Values[i] = ec._Application_secretRotationPhase(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "active": - out.Values[i] = ec._ApiExposure_active(ctx, field, obj) - case "features": + case "secretRotationMessage": + out.Values[i] = ec._Application_secretRotationMessage(ctx, field, obj) + case "zone": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Application_zone(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "exposedApis": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Application_exposedApis(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "subscribedApis": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -13279,7 +16385,7 @@ func (ec *executionContext) _ApiExposure(ctx context.Context, sel ast.SelectionS ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ApiExposure_features(ctx, field, obj) + res = ec._Application_subscribedApis(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -13306,19 +16412,43 @@ func (ec *executionContext) _ApiExposure(ctx context.Context, sel ast.SelectionS } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "upstreams": - out.Values[i] = ec._ApiExposure_upstreams(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + case "exposedEvents": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Application_exposedEvents(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - case "approvalConfig": - out.Values[i] = ec._ApiExposure_approvalConfig(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - case "apiVersion": - out.Values[i] = ec._ApiExposure_apiVersion(ctx, field, obj) - case "owner": + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "subscribedEvents": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -13327,7 +16457,7 @@ func (ec *executionContext) _ApiExposure(ctx context.Context, sel ast.SelectionS ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ApiExposure_owner(ctx, field, obj) + res = ec._Application_subscribedEvents(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -13354,7 +16484,7 @@ func (ec *executionContext) _ApiExposure(ctx context.Context, sel ast.SelectionS } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "subscriptions": + case "ownerTeam": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -13363,7 +16493,7 @@ func (ec *executionContext) _ApiExposure(ctx context.Context, sel ast.SelectionS ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ApiExposure_subscriptions(ctx, field, obj) + res = ec._Application_ownerTeam(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -13399,7 +16529,7 @@ func (ec *executionContext) _ApiExposure(ctx context.Context, sel ast.SelectionS return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -13413,26 +16543,26 @@ func (ec *executionContext) _ApiExposure(ctx context.Context, sel ast.SelectionS return out } -var apiExposureConnectionImplementors = []string{"ApiExposureConnection"} +var applicationConnectionImplementors = []string{"ApplicationConnection"} -func (ec *executionContext) _ApiExposureConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiExposureConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, apiExposureConnectionImplementors) +func (ec *executionContext) _ApplicationConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApplicationConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, applicationConnectionImplementors) 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("ApiExposureConnection") + out.Values[i] = graphql.MarshalString("ApplicationConnection") case "edges": - out.Values[i] = ec._ApiExposureConnection_edges(ctx, field, obj) + out.Values[i] = ec._ApplicationConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._ApiExposureConnection_pageInfo(ctx, field, obj) + out.Values[i] = ec._ApplicationConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": - out.Values[i] = ec._ApiExposureConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._ApplicationConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -13445,7 +16575,7 @@ func (ec *executionContext) _ApiExposureConnection(ctx context.Context, sel ast. return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -13459,21 +16589,21 @@ func (ec *executionContext) _ApiExposureConnection(ctx context.Context, sel ast. return out } -var apiExposureEdgeImplementors = []string{"ApiExposureEdge"} +var applicationEdgeImplementors = []string{"ApplicationEdge"} -func (ec *executionContext) _ApiExposureEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiExposureEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, apiExposureEdgeImplementors) +func (ec *executionContext) _ApplicationEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApplicationEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, applicationEdgeImplementors) 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("ApiExposureEdge") + out.Values[i] = graphql.MarshalString("ApplicationEdge") case "node": - out.Values[i] = ec._ApiExposureEdge_node(ctx, field, obj) + out.Values[i] = ec._ApplicationEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._ApiExposureEdge_cursor(ctx, field, obj) + out.Values[i] = ec._ApplicationEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -13486,7 +16616,7 @@ func (ec *executionContext) _ApiExposureEdge(ctx context.Context, sel ast.Select return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -13500,199 +16630,86 @@ func (ec *executionContext) _ApiExposureEdge(ctx context.Context, sel ast.Select return out } -var apiSubscriptionImplementors = []string{"ApiSubscription", "Node"} +var approvalImplementors = []string{"Approval", "Node"} -func (ec *executionContext) _ApiSubscription(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiSubscription) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, apiSubscriptionImplementors) +func (ec *executionContext) _Approval(ctx context.Context, sel ast.SelectionSet, obj *ent.Approval) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, approvalImplementors) 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("ApiSubscription") + out.Values[i] = graphql.MarshalString("Approval") case "id": - out.Values[i] = ec._ApiSubscription_id(ctx, field, obj) + out.Values[i] = ec._Approval_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "createdAt": - out.Values[i] = ec._ApiSubscription_createdAt(ctx, field, obj) + out.Values[i] = ec._Approval_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "lastModifiedAt": - out.Values[i] = ec._ApiSubscription_lastModifiedAt(ctx, field, obj) + out.Values[i] = ec._Approval_lastModifiedAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "statusPhase": - out.Values[i] = ec._ApiSubscription_statusPhase(ctx, field, obj) + out.Values[i] = ec._Approval_statusPhase(ctx, field, obj) case "statusMessage": - out.Values[i] = ec._ApiSubscription_statusMessage(ctx, field, obj) + out.Values[i] = ec._Approval_statusMessage(ctx, field, obj) case "environment": - out.Values[i] = ec._ApiSubscription_environment(ctx, field, obj) + out.Values[i] = ec._Approval_environment(ctx, field, obj) case "namespace": - out.Values[i] = ec._ApiSubscription_namespace(ctx, field, obj) + out.Values[i] = ec._Approval_namespace(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "name": - out.Values[i] = ec._ApiSubscription_name(ctx, field, obj) + case "action": + out.Values[i] = ec._Approval_action(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "basePath": - out.Values[i] = ec._ApiSubscription_basePath(ctx, field, obj) + case "strategy": + out.Values[i] = ec._Approval_strategy(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "m2mAuthMethod": - out.Values[i] = ec._ApiSubscription_m2mAuthMethod(ctx, field, obj) + case "requester": + out.Values[i] = ec._Approval_requester(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "approvedScopes": - out.Values[i] = ec._ApiSubscription_approvedScopes(ctx, field, obj) + case "decider": + out.Values[i] = ec._Approval_decider(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "owner": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._ApiSubscription_owner(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "failoverZones": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._ApiSubscription_failoverZones(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "approval": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._ApiSubscription_approval(ctx, field, obj) - return res + case "deciderTeamName": + out.Values[i] = ec._Approval_deciderTeamName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue + case "decisions": + out.Values[i] = ec._Approval_decisions(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "approvalRequests": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._ApiSubscription_approvalRequests(ctx, field, obj) - return res + case "availableTransitions": + out.Values[i] = ec._Approval_availableTransitions(ctx, field, obj) + case "name": + out.Values[i] = ec._Approval_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue + case "state": + out.Values[i] = ec._Approval_state(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "target": + case "subscription": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -13701,7 +16718,7 @@ func (ec *executionContext) _ApiSubscription(ctx context.Context, sel ast.Select ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ApiSubscription_target(ctx, field, obj) + res = ec._Approval_subscription(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -13737,7 +16754,7 @@ func (ec *executionContext) _ApiSubscription(ctx context.Context, sel ast.Select return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -13751,26 +16768,26 @@ func (ec *executionContext) _ApiSubscription(ctx context.Context, sel ast.Select return out } -var apiSubscriptionConnectionImplementors = []string{"ApiSubscriptionConnection"} +var approvalConnectionImplementors = []string{"ApprovalConnection"} -func (ec *executionContext) _ApiSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiSubscriptionConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, apiSubscriptionConnectionImplementors) +func (ec *executionContext) _ApprovalConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApprovalConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, approvalConnectionImplementors) 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("ApiSubscriptionConnection") + out.Values[i] = graphql.MarshalString("ApprovalConnection") case "edges": - out.Values[i] = ec._ApiSubscriptionConnection_edges(ctx, field, obj) + out.Values[i] = ec._ApprovalConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._ApiSubscriptionConnection_pageInfo(ctx, field, obj) + out.Values[i] = ec._ApprovalConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": - out.Values[i] = ec._ApiSubscriptionConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._ApprovalConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -13783,7 +16800,7 @@ func (ec *executionContext) _ApiSubscriptionConnection(ctx context.Context, sel return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -13797,21 +16814,21 @@ func (ec *executionContext) _ApiSubscriptionConnection(ctx context.Context, sel return out } -var apiSubscriptionEdgeImplementors = []string{"ApiSubscriptionEdge"} +var approvalEdgeImplementors = []string{"ApprovalEdge"} -func (ec *executionContext) _ApiSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiSubscriptionEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, apiSubscriptionEdgeImplementors) +func (ec *executionContext) _ApprovalEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApprovalEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, approvalEdgeImplementors) 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("ApiSubscriptionEdge") + out.Values[i] = graphql.MarshalString("ApprovalEdge") case "node": - out.Values[i] = ec._ApiSubscriptionEdge_node(ctx, field, obj) + out.Values[i] = ec._ApprovalEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._ApiSubscriptionEdge_cursor(ctx, field, obj) + out.Values[i] = ec._ApprovalEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -13824,7 +16841,7 @@ func (ec *executionContext) _ApiSubscriptionEdge(ctx context.Context, sel ast.Se return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -13838,127 +16855,86 @@ func (ec *executionContext) _ApiSubscriptionEdge(ctx context.Context, sel ast.Se return out } -var applicationImplementors = []string{"Application", "Node"} +var approvalRequestImplementors = []string{"ApprovalRequest", "Node"} -func (ec *executionContext) _Application(ctx context.Context, sel ast.SelectionSet, obj *ent.Application) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, applicationImplementors) +func (ec *executionContext) _ApprovalRequest(ctx context.Context, sel ast.SelectionSet, obj *ent.ApprovalRequest) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, approvalRequestImplementors) 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("Application") + out.Values[i] = graphql.MarshalString("ApprovalRequest") case "id": - out.Values[i] = ec._Application_id(ctx, field, obj) + out.Values[i] = ec._ApprovalRequest_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "createdAt": - out.Values[i] = ec._Application_createdAt(ctx, field, obj) + out.Values[i] = ec._ApprovalRequest_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "lastModifiedAt": - out.Values[i] = ec._Application_lastModifiedAt(ctx, field, obj) + out.Values[i] = ec._ApprovalRequest_lastModifiedAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "statusPhase": - out.Values[i] = ec._Application_statusPhase(ctx, field, obj) + out.Values[i] = ec._ApprovalRequest_statusPhase(ctx, field, obj) case "statusMessage": - out.Values[i] = ec._Application_statusMessage(ctx, field, obj) + out.Values[i] = ec._ApprovalRequest_statusMessage(ctx, field, obj) case "environment": - out.Values[i] = ec._Application_environment(ctx, field, obj) + out.Values[i] = ec._ApprovalRequest_environment(ctx, field, obj) case "namespace": - out.Values[i] = ec._Application_namespace(ctx, field, obj) + out.Values[i] = ec._ApprovalRequest_namespace(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "name": - out.Values[i] = ec._Application_name(ctx, field, obj) + case "action": + out.Values[i] = ec._ApprovalRequest_action(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "clientID": - out.Values[i] = ec._Application_clientID(ctx, field, obj) - case "clientSecret": - out.Values[i] = ec._Application_clientSecret(ctx, field, obj) - case "issuerURL": - out.Values[i] = ec._Application_issuerURL(ctx, field, obj) - case "zone": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Application_zone(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res + case "strategy": + out.Values[i] = ec._ApprovalRequest_strategy(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue + case "requester": + out.Values[i] = ec._ApprovalRequest_requester(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "exposedApis": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Application_exposedApis(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res + case "decider": + out.Values[i] = ec._ApprovalRequest_decider(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue + case "deciderTeamName": + out.Values[i] = ec._ApprovalRequest_deciderTeamName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "subscribedApis": + case "decisions": + out.Values[i] = ec._ApprovalRequest_decisions(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "availableTransitions": + out.Values[i] = ec._ApprovalRequest_availableTransitions(ctx, field, obj) + case "name": + out.Values[i] = ec._ApprovalRequest_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "state": + out.Values[i] = ec._ApprovalRequest_state(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "subscription": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -13967,7 +16943,7 @@ func (ec *executionContext) _Application(ctx context.Context, sel ast.SelectionS ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Application_subscribedApis(ctx, field, obj) + res = ec._ApprovalRequest_subscription(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -13994,19 +16970,16 @@ func (ec *executionContext) _Application(ctx context.Context, sel ast.SelectionS } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "ownerTeam": + case "approval": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Application_ownerTeam(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } + res = ec._ApprovalRequest_approval(ctx, field, obj) return res } @@ -14039,7 +17012,7 @@ func (ec *executionContext) _Application(ctx context.Context, sel ast.SelectionS return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14053,26 +17026,26 @@ func (ec *executionContext) _Application(ctx context.Context, sel ast.SelectionS return out } -var applicationConnectionImplementors = []string{"ApplicationConnection"} +var approvalRequestConnectionImplementors = []string{"ApprovalRequestConnection"} -func (ec *executionContext) _ApplicationConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApplicationConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, applicationConnectionImplementors) +func (ec *executionContext) _ApprovalRequestConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApprovalRequestConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, approvalRequestConnectionImplementors) 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("ApplicationConnection") + out.Values[i] = graphql.MarshalString("ApprovalRequestConnection") case "edges": - out.Values[i] = ec._ApplicationConnection_edges(ctx, field, obj) + out.Values[i] = ec._ApprovalRequestConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._ApplicationConnection_pageInfo(ctx, field, obj) + out.Values[i] = ec._ApprovalRequestConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": - out.Values[i] = ec._ApplicationConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._ApprovalRequestConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -14085,7 +17058,7 @@ func (ec *executionContext) _ApplicationConnection(ctx context.Context, sel ast. return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14099,21 +17072,21 @@ func (ec *executionContext) _ApplicationConnection(ctx context.Context, sel ast. return out } -var applicationEdgeImplementors = []string{"ApplicationEdge"} +var approvalRequestEdgeImplementors = []string{"ApprovalRequestEdge"} -func (ec *executionContext) _ApplicationEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApplicationEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, applicationEdgeImplementors) +func (ec *executionContext) _ApprovalRequestEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApprovalRequestEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, approvalRequestEdgeImplementors) 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("ApplicationEdge") + out.Values[i] = graphql.MarshalString("ApprovalRequestEdge") case "node": - out.Values[i] = ec._ApplicationEdge_node(ctx, field, obj) + out.Values[i] = ec._ApprovalRequestEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._ApplicationEdge_cursor(ctx, field, obj) + out.Values[i] = ec._ApprovalRequestEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -14126,7 +17099,7 @@ func (ec *executionContext) _ApplicationEdge(ctx context.Context, sel ast.Select return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14140,95 +17113,109 @@ func (ec *executionContext) _ApplicationEdge(ctx context.Context, sel ast.Select return out } -var approvalImplementors = []string{"Approval", "Node"} +var eventExposureImplementors = []string{"EventExposure", "Node"} -func (ec *executionContext) _Approval(ctx context.Context, sel ast.SelectionSet, obj *ent.Approval) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, approvalImplementors) +func (ec *executionContext) _EventExposure(ctx context.Context, sel ast.SelectionSet, obj *ent.EventExposure) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventExposureImplementors) - 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("Approval") - case "id": - out.Values[i] = ec._Approval_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "createdAt": - out.Values[i] = ec._Approval_createdAt(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "lastModifiedAt": - out.Values[i] = ec._Approval_lastModifiedAt(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "statusPhase": - out.Values[i] = ec._Approval_statusPhase(ctx, field, obj) - case "statusMessage": - out.Values[i] = ec._Approval_statusMessage(ctx, field, obj) - case "environment": - out.Values[i] = ec._Approval_environment(ctx, field, obj) - case "namespace": - out.Values[i] = ec._Approval_namespace(ctx, field, obj) + 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("EventExposure") + case "id": + out.Values[i] = ec._EventExposure_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "action": - out.Values[i] = ec._Approval_action(ctx, field, obj) + case "createdAt": + out.Values[i] = ec._EventExposure_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "strategy": - out.Values[i] = ec._Approval_strategy(ctx, field, obj) + case "lastModifiedAt": + out.Values[i] = ec._EventExposure_lastModifiedAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "requester": - out.Values[i] = ec._Approval_requester(ctx, field, obj) + case "statusPhase": + out.Values[i] = ec._EventExposure_statusPhase(ctx, field, obj) + case "statusMessage": + out.Values[i] = ec._EventExposure_statusMessage(ctx, field, obj) + case "environment": + out.Values[i] = ec._EventExposure_environment(ctx, field, obj) + case "namespace": + out.Values[i] = ec._EventExposure_namespace(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "decider": - out.Values[i] = ec._Approval_decider(ctx, field, obj) + case "eventType": + out.Values[i] = ec._EventExposure_eventType(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "deciderTeamName": - out.Values[i] = ec._Approval_deciderTeamName(ctx, field, obj) + case "visibility": + out.Values[i] = ec._EventExposure_visibility(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "decisions": - out.Values[i] = ec._Approval_decisions(ctx, field, obj) + case "active": + out.Values[i] = ec._EventExposure_active(ctx, field, obj) + case "approvalConfig": + out.Values[i] = ec._EventExposure_approvalConfig(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "availableTransitions": - out.Values[i] = ec._Approval_availableTransitions(ctx, field, obj) - case "name": - out.Values[i] = ec._Approval_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + case "owner": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._EventExposure_owner(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - case "state": - out.Values[i] = ec._Approval_state(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - case "apiSubscription": + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "subscriptions": field := field - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Approval_apiSubscription(ctx, field, obj) + res = ec._EventExposure_subscriptions(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } return res } @@ -14261,7 +17248,7 @@ func (ec *executionContext) _Approval(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14275,26 +17262,26 @@ func (ec *executionContext) _Approval(ctx context.Context, sel ast.SelectionSet, return out } -var approvalConnectionImplementors = []string{"ApprovalConnection"} +var eventExposureConnectionImplementors = []string{"EventExposureConnection"} -func (ec *executionContext) _ApprovalConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApprovalConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, approvalConnectionImplementors) +func (ec *executionContext) _EventExposureConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.EventExposureConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventExposureConnectionImplementors) 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("ApprovalConnection") + out.Values[i] = graphql.MarshalString("EventExposureConnection") case "edges": - out.Values[i] = ec._ApprovalConnection_edges(ctx, field, obj) + out.Values[i] = ec._EventExposureConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._ApprovalConnection_pageInfo(ctx, field, obj) + out.Values[i] = ec._EventExposureConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": - out.Values[i] = ec._ApprovalConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._EventExposureConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -14307,7 +17294,7 @@ func (ec *executionContext) _ApprovalConnection(ctx context.Context, sel ast.Sel return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14321,21 +17308,21 @@ func (ec *executionContext) _ApprovalConnection(ctx context.Context, sel ast.Sel return out } -var approvalEdgeImplementors = []string{"ApprovalEdge"} +var eventExposureEdgeImplementors = []string{"EventExposureEdge"} -func (ec *executionContext) _ApprovalEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApprovalEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, approvalEdgeImplementors) +func (ec *executionContext) _EventExposureEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.EventExposureEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventExposureEdgeImplementors) 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("ApprovalEdge") + out.Values[i] = graphql.MarshalString("EventExposureEdge") case "node": - out.Values[i] = ec._ApprovalEdge_node(ctx, field, obj) + out.Values[i] = ec._EventExposureEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._ApprovalEdge_cursor(ctx, field, obj) + out.Values[i] = ec._EventExposureEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -14348,7 +17335,7 @@ func (ec *executionContext) _ApprovalEdge(ctx context.Context, sel ast.Selection return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14362,86 +17349,130 @@ func (ec *executionContext) _ApprovalEdge(ctx context.Context, sel ast.Selection return out } -var approvalRequestImplementors = []string{"ApprovalRequest", "Node"} +var eventSubscriptionImplementors = []string{"EventSubscription", "Node"} -func (ec *executionContext) _ApprovalRequest(ctx context.Context, sel ast.SelectionSet, obj *ent.ApprovalRequest) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, approvalRequestImplementors) +func (ec *executionContext) _EventSubscription(ctx context.Context, sel ast.SelectionSet, obj *ent.EventSubscription) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventSubscriptionImplementors) 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("ApprovalRequest") + out.Values[i] = graphql.MarshalString("EventSubscription") case "id": - out.Values[i] = ec._ApprovalRequest_id(ctx, field, obj) + out.Values[i] = ec._EventSubscription_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "createdAt": - out.Values[i] = ec._ApprovalRequest_createdAt(ctx, field, obj) + out.Values[i] = ec._EventSubscription_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "lastModifiedAt": - out.Values[i] = ec._ApprovalRequest_lastModifiedAt(ctx, field, obj) + out.Values[i] = ec._EventSubscription_lastModifiedAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "statusPhase": - out.Values[i] = ec._ApprovalRequest_statusPhase(ctx, field, obj) + out.Values[i] = ec._EventSubscription_statusPhase(ctx, field, obj) case "statusMessage": - out.Values[i] = ec._ApprovalRequest_statusMessage(ctx, field, obj) + out.Values[i] = ec._EventSubscription_statusMessage(ctx, field, obj) case "environment": - out.Values[i] = ec._ApprovalRequest_environment(ctx, field, obj) + out.Values[i] = ec._EventSubscription_environment(ctx, field, obj) case "namespace": - out.Values[i] = ec._ApprovalRequest_namespace(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "action": - out.Values[i] = ec._ApprovalRequest_action(ctx, field, obj) + out.Values[i] = ec._EventSubscription_namespace(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "strategy": - out.Values[i] = ec._ApprovalRequest_strategy(ctx, field, obj) + case "name": + out.Values[i] = ec._EventSubscription_name(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "requester": - out.Values[i] = ec._ApprovalRequest_requester(ctx, field, obj) + case "eventType": + out.Values[i] = ec._EventSubscription_eventType(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "decider": - out.Values[i] = ec._ApprovalRequest_decider(ctx, field, obj) + case "deliveryType": + out.Values[i] = ec._EventSubscription_deliveryType(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "deciderTeamName": - out.Values[i] = ec._ApprovalRequest_deciderTeamName(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + case "callbackURL": + out.Values[i] = ec._EventSubscription_callbackURL(ctx, field, obj) + case "owner": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._EventSubscription_owner(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - case "decisions": - out.Values[i] = ec._ApprovalRequest_decisions(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - case "availableTransitions": - out.Values[i] = ec._ApprovalRequest_availableTransitions(ctx, field, obj) - case "name": - out.Values[i] = ec._ApprovalRequest_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "approval": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._EventSubscription_approval(ctx, field, obj) + return res } - case "state": - out.Values[i] = ec._ApprovalRequest_state(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - case "apiSubscription": + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "approvalRequests": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -14450,7 +17481,7 @@ func (ec *executionContext) _ApprovalRequest(ctx context.Context, sel ast.Select ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ApprovalRequest_apiSubscription(ctx, field, obj) + res = ec._EventSubscription_approvalRequests(ctx, field, obj) return res } @@ -14474,16 +17505,19 @@ func (ec *executionContext) _ApprovalRequest(ctx context.Context, sel ast.Select } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "approval": + case "target": field := field - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ApprovalRequest_approval(ctx, field, obj) + res = ec._EventSubscription_target(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } return res } @@ -14516,7 +17550,7 @@ func (ec *executionContext) _ApprovalRequest(ctx context.Context, sel ast.Select return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14530,26 +17564,26 @@ func (ec *executionContext) _ApprovalRequest(ctx context.Context, sel ast.Select return out } -var approvalRequestConnectionImplementors = []string{"ApprovalRequestConnection"} +var eventSubscriptionConnectionImplementors = []string{"EventSubscriptionConnection"} -func (ec *executionContext) _ApprovalRequestConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApprovalRequestConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, approvalRequestConnectionImplementors) +func (ec *executionContext) _EventSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.EventSubscriptionConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventSubscriptionConnectionImplementors) 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("ApprovalRequestConnection") + out.Values[i] = graphql.MarshalString("EventSubscriptionConnection") case "edges": - out.Values[i] = ec._ApprovalRequestConnection_edges(ctx, field, obj) + out.Values[i] = ec._EventSubscriptionConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._ApprovalRequestConnection_pageInfo(ctx, field, obj) + out.Values[i] = ec._EventSubscriptionConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": - out.Values[i] = ec._ApprovalRequestConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._EventSubscriptionConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -14562,7 +17596,7 @@ func (ec *executionContext) _ApprovalRequestConnection(ctx context.Context, sel return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14576,21 +17610,21 @@ func (ec *executionContext) _ApprovalRequestConnection(ctx context.Context, sel return out } -var approvalRequestEdgeImplementors = []string{"ApprovalRequestEdge"} +var eventSubscriptionEdgeImplementors = []string{"EventSubscriptionEdge"} -func (ec *executionContext) _ApprovalRequestEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApprovalRequestEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, approvalRequestEdgeImplementors) +func (ec *executionContext) _EventSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.EventSubscriptionEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventSubscriptionEdgeImplementors) 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("ApprovalRequestEdge") + out.Values[i] = graphql.MarshalString("EventSubscriptionEdge") case "node": - out.Values[i] = ec._ApprovalRequestEdge_node(ctx, field, obj) + out.Values[i] = ec._EventSubscriptionEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._ApprovalRequestEdge_cursor(ctx, field, obj) + out.Values[i] = ec._EventSubscriptionEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -14603,7 +17637,7 @@ func (ec *executionContext) _ApprovalRequestEdge(ctx context.Context, sel ast.Se return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14697,7 +17731,7 @@ func (ec *executionContext) _Group(ctx context.Context, sel ast.SelectionSet, ob return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14781,7 +17815,7 @@ func (ec *executionContext) _Member(ctx context.Context, sel ast.SelectionSet, o return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14829,7 +17863,7 @@ func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -14881,7 +17915,51 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "nodes": + case "nodes": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_nodes(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "apiExposures": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_apiExposures(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "apiSubscriptions": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -14890,7 +17968,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_nodes(ctx, field) + res = ec._Query_apiSubscriptions(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -14903,7 +17981,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "apiExposures": + case "applications": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -14912,7 +17990,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_apiExposures(ctx, field) + res = ec._Query_applications(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -14925,7 +18003,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "apiSubscriptions": + case "approvals": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -14934,7 +18012,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_apiSubscriptions(ctx, field) + res = ec._Query_approvals(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -14947,7 +18025,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "applications": + case "approvalRequests": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -14956,7 +18034,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_applications(ctx, field) + res = ec._Query_approvalRequests(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -14969,7 +18047,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "approvals": + case "eventExposures": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -14978,7 +18056,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_approvals(ctx, field) + res = ec._Query_eventExposures(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -14991,7 +18069,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "approvalRequests": + case "eventSubscriptions": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -15000,7 +18078,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_approvalRequests(ctx, field) + res = ec._Query_eventSubscriptions(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -15074,7 +18152,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -15140,8 +18218,39 @@ func (ec *executionContext) _Team(ctx context.Context, sel ast.SelectionSet, obj if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "roverTokenRef": - out.Values[i] = ec._Team_roverTokenRef(ctx, field, obj) + case "teamToken": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Team_teamToken(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "group": field := field @@ -15173,9 +18282,220 @@ func (ec *executionContext) _Team(ctx context.Context, sel ast.SelectionSet, obj out.Values[i] = graphql.Null continue } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "members": + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "members": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Team_members(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "applications": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Team_applications(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + 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 teamConnectionImplementors = []string{"TeamConnection"} + +func (ec *executionContext) _TeamConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.TeamConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, teamConnectionImplementors) + + 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("TeamConnection") + case "edges": + out.Values[i] = ec._TeamConnection_edges(ctx, field, obj) + case "pageInfo": + out.Values[i] = ec._TeamConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "totalCount": + out.Values[i] = ec._TeamConnection_totalCount(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 teamEdgeImplementors = []string{"TeamEdge"} + +func (ec *executionContext) _TeamEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.TeamEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, teamEdgeImplementors) + + 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("TeamEdge") + case "node": + out.Values[i] = ec._TeamEdge_node(ctx, field, obj) + case "cursor": + out.Values[i] = ec._TeamEdge_cursor(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 zoneImplementors = []string{"Zone", "Node"} + +func (ec *executionContext) _Zone(ctx context.Context, sel ast.SelectionSet, obj *ent.Zone) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, zoneImplementors) + + 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("Zone") + case "id": + out.Values[i] = ec._Zone_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "environment": + out.Values[i] = ec._Zone_environment(ctx, field, obj) + case "name": + out.Values[i] = ec._Zone_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "gatewayURL": + out.Values[i] = ec._Zone_gatewayURL(ctx, field, obj) + case "issuerURL": + out.Values[i] = ec._Zone_issuerURL(ctx, field, obj) + case "visibility": + out.Values[i] = ec._Zone_visibility(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "applications": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -15184,7 +18504,7 @@ func (ec *executionContext) _Team(ctx context.Context, sel ast.SelectionSet, obj ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Team_members(ctx, field, obj) + res = ec._Zone_applications(ctx, field, obj) return res } @@ -15208,19 +18528,16 @@ func (ec *executionContext) _Team(ctx context.Context, sel ast.SelectionSet, obj } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "applications": + case "tokenURL": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Team_applications(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } + res = ec._Zone_tokenURL(ctx, field, obj) return res } @@ -15253,7 +18570,7 @@ func (ec *executionContext) _Team(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -15267,204 +18584,371 @@ func (ec *executionContext) _Team(ctx context.Context, sel ast.SelectionSet, obj return out } -var teamConnectionImplementors = []string{"TeamConnection"} +// endregion **************************** object.gotpl **************************** -func (ec *executionContext) _TeamConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.TeamConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, teamConnectionImplementors) +// region ***************************** type.gotpl ***************************** - 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("TeamConnection") - case "edges": - out.Values[i] = ec._TeamConnection_edges(ctx, field, obj) - case "pageInfo": - out.Values[i] = ec._TeamConnection_pageInfo(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "totalCount": - out.Values[i] = ec._TeamConnection_totalCount(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) +func (ec *executionContext) marshalNApiExposureConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApiExposureConnection) graphql.Marshaler { + return ec._ApiExposureConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNApiExposureConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApiExposureConnection) 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._ApiExposureConnection(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNApiExposureOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrderField(ctx context.Context, v any) (*ent.ApiExposureOrderField, error) { + var res = new(ent.ApiExposureOrderField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApiExposureOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApiExposureOrderField) 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 v +} + +func (ec *executionContext) unmarshalNApiExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx context.Context, v any) (apiexposure.StatusPhase, error) { + var res apiexposure.StatusPhase + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApiExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v apiexposure.StatusPhase) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx context.Context, v any) (apiexposure.Visibility, error) { + var res apiexposure.Visibility + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx context.Context, sel ast.SelectionSet, v apiexposure.Visibility) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput(ctx context.Context, v any) (*ent.ApiExposureWhereInput, error) { + res, err := ec.unmarshalInputApiExposureWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApiSubscriptionConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApiSubscriptionConnection) graphql.Marshaler { + return ec._ApiSubscriptionConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNApiSubscriptionConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApiSubscriptionConnection) 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._ApiSubscriptionConnection(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx context.Context, v any) (apisubscription.M2mAuthMethod, error) { + var res apisubscription.M2mAuthMethod + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx context.Context, sel ast.SelectionSet, v apisubscription.M2mAuthMethod) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNApiSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrderField(ctx context.Context, v any) (*ent.ApiSubscriptionOrderField, error) { + var res = new(ent.ApiSubscriptionOrderField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApiSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApiSubscriptionOrderField) 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 v +} + +func (ec *executionContext) unmarshalNApiSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx context.Context, v any) (apisubscription.StatusPhase, error) { + var res apisubscription.StatusPhase + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApiSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v apisubscription.StatusPhase) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput(ctx context.Context, v any) (*ent.ApiSubscriptionWhereInput, error) { + res, err := ec.unmarshalInputApiSubscriptionWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx context.Context, sel ast.SelectionSet, v *ent.Application) 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._Application(ctx, sel, v) +} + +func (ec *executionContext) marshalNApplicationConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApplicationConnection) graphql.Marshaler { + return ec._ApplicationConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNApplicationConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApplicationConnection) 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._ApplicationConnection(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNApplicationOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrder(ctx context.Context, v any) (*ent.ApplicationOrder, error) { + res, err := ec.unmarshalInputApplicationOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNApplicationOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderField(ctx context.Context, v any) (*ent.ApplicationOrderField, error) { + var res = new(ent.ApplicationOrderField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApplicationOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApplicationOrderField) 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 v +} + +func (ec *executionContext) unmarshalNApplicationSecretRotationPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhase(ctx context.Context, v any) (application.SecretRotationPhase, error) { + var res application.SecretRotationPhase + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApplicationSecretRotationPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhase(ctx context.Context, sel ast.SelectionSet, v application.SecretRotationPhase) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNApplicationStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx context.Context, v any) (application.StatusPhase, error) { + var res application.StatusPhase + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApplicationStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v application.StatusPhase) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput(ctx context.Context, v any) (*ent.ApplicationWhereInput, error) { + res, err := ec.unmarshalInputApplicationWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApprovalConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApprovalConnection) graphql.Marshaler { + return ec._ApprovalConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNApprovalConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalConnection) 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._ApprovalConnection(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNApprovalOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrder(ctx context.Context, v any) (*ent.ApprovalOrder, error) { + res, err := ec.unmarshalInputApprovalOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNApprovalOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrderField(ctx context.Context, v any) (*ent.ApprovalOrderField, error) { + var res = new(ent.ApprovalOrderField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApprovalOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalOrderField) 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 v +} + +func (ec *executionContext) marshalNApprovalRequest2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequest(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalRequest) 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") } - } - out.Dispatch(ctx) - if out.Invalids > 0 { return graphql.Null } + return ec._ApprovalRequest(ctx, sel, v) +} - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) +func (ec *executionContext) marshalNApprovalRequestConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApprovalRequestConnection) graphql.Marshaler { + return ec._ApprovalRequestConnection(ctx, sel, &v) +} - for label, dfs := range deferred { - ec.ProcessDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) +func (ec *executionContext) marshalNApprovalRequestConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalRequestConnection) 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 out + return ec._ApprovalRequestConnection(ctx, sel, v) } -var teamEdgeImplementors = []string{"TeamEdge"} +func (ec *executionContext) unmarshalNApprovalRequestOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrder(ctx context.Context, v any) (*ent.ApprovalRequestOrder, error) { + res, err := ec.unmarshalInputApprovalRequestOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} -func (ec *executionContext) _TeamEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.TeamEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, teamEdgeImplementors) +func (ec *executionContext) unmarshalNApprovalRequestOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderField(ctx context.Context, v any) (*ent.ApprovalRequestOrderField, error) { + var res = new(ent.ApprovalRequestOrderField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("TeamEdge") - case "node": - out.Values[i] = ec._TeamEdge_node(ctx, field, obj) - case "cursor": - out.Values[i] = ec._TeamEdge_cursor(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) +func (ec *executionContext) marshalNApprovalRequestOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalRequestOrderField) 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") } - } - out.Dispatch(ctx) - if out.Invalids > 0 { return graphql.Null } + return v +} - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) +func (ec *executionContext) unmarshalNApprovalRequestState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx context.Context, v any) (approvalrequest.State, error) { + var res approvalrequest.State + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} - for label, dfs := range deferred { - ec.ProcessDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } +func (ec *executionContext) marshalNApprovalRequestState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx context.Context, sel ast.SelectionSet, v approvalrequest.State) graphql.Marshaler { + return v +} - return out +func (ec *executionContext) unmarshalNApprovalRequestStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx context.Context, v any) (approvalrequest.StatusPhase, error) { + var res approvalrequest.StatusPhase + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) } -var zoneImplementors = []string{"Zone", "Node"} +func (ec *executionContext) marshalNApprovalRequestStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v approvalrequest.StatusPhase) graphql.Marshaler { + return v +} -func (ec *executionContext) _Zone(ctx context.Context, sel ast.SelectionSet, obj *ent.Zone) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, zoneImplementors) +func (ec *executionContext) unmarshalNApprovalRequestStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx context.Context, v any) (approvalrequest.Strategy, error) { + var res approvalrequest.Strategy + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Zone") - case "id": - out.Values[i] = ec._Zone_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "environment": - out.Values[i] = ec._Zone_environment(ctx, field, obj) - case "name": - out.Values[i] = ec._Zone_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "gatewayURL": - out.Values[i] = ec._Zone_gatewayURL(ctx, field, obj) - case "visibility": - out.Values[i] = ec._Zone_visibility(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "applications": - field := field +func (ec *executionContext) marshalNApprovalRequestStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx context.Context, sel ast.SelectionSet, v approvalrequest.Strategy) graphql.Marshaler { + return v +} - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Zone_applications(ctx, field, obj) - return res - } +func (ec *executionContext) unmarshalNApprovalRequestWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInput(ctx context.Context, v any) (*ent.ApprovalRequestWhereInput, error) { + res, err := ec.unmarshalInputApprovalRequestWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) +func (ec *executionContext) unmarshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx context.Context, v any) (approval.State, error) { + var res approval.State + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } +func (ec *executionContext) marshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx context.Context, sel ast.SelectionSet, v approval.State) graphql.Marshaler { + return v +} - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } +func (ec *executionContext) unmarshalNApprovalStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx context.Context, v any) (approval.StatusPhase, error) { + var res approval.StatusPhase + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) +func (ec *executionContext) marshalNApprovalStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v approval.StatusPhase) graphql.Marshaler { + return v +} - for label, dfs := range deferred { - ec.ProcessDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } +func (ec *executionContext) unmarshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx context.Context, v any) (approval.Strategy, error) { + var res approval.Strategy + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} - return out +func (ec *executionContext) marshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx context.Context, sel ast.SelectionSet, v approval.Strategy) graphql.Marshaler { + return v } -// endregion **************************** object.gotpl **************************** +func (ec *executionContext) unmarshalNApprovalWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInput(ctx context.Context, v any) (*ent.ApprovalWhereInput, error) { + res, err := ec.unmarshalInputApprovalWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} -// region ***************************** type.gotpl ***************************** +func (ec *executionContext) unmarshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, v any) (entgql.Cursor[int], error) { + var res entgql.Cursor[int] + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} -func (ec *executionContext) marshalNApiExposureConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApiExposureConnection) graphql.Marshaler { - return ec._ApiExposureConnection(ctx, sel, &v) +func (ec *executionContext) marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, sel ast.SelectionSet, v entgql.Cursor[int]) graphql.Marshaler { + return v } -func (ec *executionContext) marshalNApiExposureConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApiExposureConnection) graphql.Marshaler { +func (ec *executionContext) marshalNEventExposureConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureConnection(ctx context.Context, sel ast.SelectionSet, v ent.EventExposureConnection) graphql.Marshaler { + return ec._EventExposureConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEventExposureConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureConnection(ctx context.Context, sel ast.SelectionSet, v *ent.EventExposureConnection) 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._ApiExposureConnection(ctx, sel, v) + return ec._EventExposureConnection(ctx, sel, v) } -func (ec *executionContext) unmarshalNApiExposureOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrderField(ctx context.Context, v any) (*ent.ApiExposureOrderField, error) { - var res = new(ent.ApiExposureOrderField) +func (ec *executionContext) unmarshalNEventExposureOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureOrderField(ctx context.Context, v any) (*ent.EventExposureOrderField, error) { + var res = new(ent.EventExposureOrderField) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApiExposureOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApiExposureOrderField) graphql.Marshaler { +func (ec *executionContext) marshalNEventExposureOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.EventExposureOrderField) 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") @@ -15474,122 +18958,176 @@ func (ec *executionContext) marshalNApiExposureOrderField2ᚖgithubᚗcomᚋtele return v } -func (ec *executionContext) unmarshalNApiExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx context.Context, v any) (apiexposure.StatusPhase, error) { - var res apiexposure.StatusPhase +func (ec *executionContext) unmarshalNEventExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(ctx context.Context, v any) (eventexposure.StatusPhase, error) { + var res eventexposure.StatusPhase err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApiExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v apiexposure.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalNEventExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v eventexposure.StatusPhase) graphql.Marshaler { return v } -func (ec *executionContext) unmarshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx context.Context, v any) (apiexposure.Visibility, error) { - var res apiexposure.Visibility +func (ec *executionContext) unmarshalNEventExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibility(ctx context.Context, v any) (eventexposure.Visibility, error) { + var res eventexposure.Visibility err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx context.Context, sel ast.SelectionSet, v apiexposure.Visibility) graphql.Marshaler { +func (ec *executionContext) marshalNEventExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibility(ctx context.Context, sel ast.SelectionSet, v eventexposure.Visibility) graphql.Marshaler { return v } -func (ec *executionContext) unmarshalNApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput(ctx context.Context, v any) (*ent.ApiExposureWhereInput, error) { - res, err := ec.unmarshalInputApiExposureWhereInput(ctx, v) +func (ec *executionContext) unmarshalNEventExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInput(ctx context.Context, v any) (*ent.EventExposureWhereInput, error) { + res, err := ec.unmarshalInputEventExposureWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApiSubscriptionConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApiSubscriptionConnection) graphql.Marshaler { - return ec._ApiSubscriptionConnection(ctx, sel, &v) +func (ec *executionContext) marshalNEventSubscriptionConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, v ent.EventSubscriptionConnection) graphql.Marshaler { + return ec._EventSubscriptionConnection(ctx, sel, &v) } -func (ec *executionContext) marshalNApiSubscriptionConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApiSubscriptionConnection) graphql.Marshaler { +func (ec *executionContext) marshalNEventSubscriptionConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, v *ent.EventSubscriptionConnection) 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._ApiSubscriptionConnection(ctx, sel, v) + return ec._EventSubscriptionConnection(ctx, sel, v) } -func (ec *executionContext) unmarshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx context.Context, v any) (apisubscription.M2mAuthMethod, error) { - var res apisubscription.M2mAuthMethod +func (ec *executionContext) unmarshalNEventSubscriptionDeliveryType2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx context.Context, v any) (eventsubscription.DeliveryType, error) { + var res eventsubscription.DeliveryType err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx context.Context, sel ast.SelectionSet, v apisubscription.M2mAuthMethod) graphql.Marshaler { +func (ec *executionContext) marshalNEventSubscriptionDeliveryType2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx context.Context, sel ast.SelectionSet, v eventsubscription.DeliveryType) graphql.Marshaler { return v } -func (ec *executionContext) unmarshalNApiSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrderField(ctx context.Context, v any) (*ent.ApiSubscriptionOrderField, error) { - var res = new(ent.ApiSubscriptionOrderField) +func (ec *executionContext) unmarshalNEventSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionOrderField(ctx context.Context, v any) (*ent.EventSubscriptionOrderField, error) { + var res = new(ent.EventSubscriptionOrderField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNEventSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.EventSubscriptionOrderField) 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 v +} + +func (ec *executionContext) unmarshalNEventSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx context.Context, v any) (eventsubscription.StatusPhase, error) { + var res eventsubscription.StatusPhase err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApiSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApiSubscriptionOrderField) graphql.Marshaler { +func (ec *executionContext) marshalNEventSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v eventsubscription.StatusPhase) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNEventSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInput(ctx context.Context, v any) (*ent.EventSubscriptionWhereInput, error) { + res, err := ec.unmarshalInputEventSubscriptionWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNGroupWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroupWhereInput(ctx context.Context, v any) (*ent.GroupWhereInput, error) { + res, err := ec.unmarshalInputGroupWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNMember2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMember(ctx context.Context, sel ast.SelectionSet, v *ent.Member) 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 v + return ec._Member(ctx, sel, v) } -func (ec *executionContext) unmarshalNApiSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx context.Context, v any) (apisubscription.StatusPhase, error) { - var res apisubscription.StatusPhase +func (ec *executionContext) unmarshalNMemberWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberWhereInput(ctx context.Context, v any) (*ent.MemberWhereInput, error) { + res, err := ec.unmarshalInputMemberWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNNode2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐNoder(ctx context.Context, sel ast.SelectionSet, v []ent.Noder) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalONode2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐNoder(ctx, sel, v[i]) + }) + + return ret +} + +func (ec *executionContext) unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx context.Context, v any) (entgql.OrderDirection, error) { + var res entgql.OrderDirection err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApiSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v apisubscription.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx context.Context, sel ast.SelectionSet, v entgql.OrderDirection) graphql.Marshaler { return v } -func (ec *executionContext) unmarshalNApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput(ctx context.Context, v any) (*ent.ApiSubscriptionWhereInput, error) { - res, err := ec.unmarshalInputApiSubscriptionWhereInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { + return ec._PageInfo(ctx, sel, &v) } -func (ec *executionContext) marshalNApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx context.Context, sel ast.SelectionSet, v *ent.Application) graphql.Marshaler { +func (ec *executionContext) marshalNTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam(ctx context.Context, sel ast.SelectionSet, v *ent.Team) 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._Application(ctx, sel, v) + return ec._Team(ctx, sel, v) } -func (ec *executionContext) marshalNApplicationConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApplicationConnection) graphql.Marshaler { - return ec._ApplicationConnection(ctx, sel, &v) +func (ec *executionContext) unmarshalNTeamCategory2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategory(ctx context.Context, v any) (team.Category, error) { + var res team.Category + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApplicationConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApplicationConnection) graphql.Marshaler { +func (ec *executionContext) marshalNTeamCategory2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategory(ctx context.Context, sel ast.SelectionSet, v team.Category) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNTeamConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamConnection(ctx context.Context, sel ast.SelectionSet, v ent.TeamConnection) graphql.Marshaler { + return ec._TeamConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTeamConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamConnection(ctx context.Context, sel ast.SelectionSet, v *ent.TeamConnection) 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._ApplicationConnection(ctx, sel, v) + return ec._TeamConnection(ctx, sel, v) } -func (ec *executionContext) unmarshalNApplicationOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrder(ctx context.Context, v any) (*ent.ApplicationOrder, error) { - res, err := ec.unmarshalInputApplicationOrder(ctx, v) +func (ec *executionContext) unmarshalNTeamOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamOrder(ctx context.Context, v any) (*ent.TeamOrder, error) { + res, err := ec.unmarshalInputTeamOrder(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalNApplicationOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderField(ctx context.Context, v any) (*ent.ApplicationOrderField, error) { - var res = new(ent.ApplicationOrderField) +func (ec *executionContext) unmarshalNTeamOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamOrderField(ctx context.Context, v any) (*ent.TeamOrderField, error) { + var res = new(ent.TeamOrderField) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApplicationOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApplicationOrderField) graphql.Marshaler { +func (ec *executionContext) marshalNTeamOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.TeamOrderField) 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") @@ -15599,316 +19137,420 @@ func (ec *executionContext) marshalNApplicationOrderField2ᚖgithubᚗcomᚋtele return v } -func (ec *executionContext) unmarshalNApplicationStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx context.Context, v any) (application.StatusPhase, error) { - var res application.StatusPhase +func (ec *executionContext) unmarshalNTeamStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhase(ctx context.Context, v any) (team.StatusPhase, error) { + var res team.StatusPhase err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApplicationStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v application.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalNTeamStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v team.StatusPhase) graphql.Marshaler { return v } -func (ec *executionContext) unmarshalNApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput(ctx context.Context, v any) (*ent.ApplicationWhereInput, error) { - res, err := ec.unmarshalInputApplicationWhereInput(ctx, v) +func (ec *executionContext) unmarshalNTeamWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInput(ctx context.Context, v any) (*ent.TeamWhereInput, error) { + res, err := ec.unmarshalInputTeamWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApprovalConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApprovalConnection) graphql.Marshaler { - return ec._ApprovalConnection(ctx, sel, &v) +func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v any) (time.Time, error) { + res, err := graphql.UnmarshalTime(v) + return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApprovalConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalConnection) graphql.Marshaler { - if v == nil { +func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { + _ = sel + res := graphql.MarshalTime(v) + if res == graphql.Null { 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._ApprovalConnection(ctx, sel, v) + return res } -func (ec *executionContext) unmarshalNApprovalOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrder(ctx context.Context, v any) (*ent.ApprovalOrder, error) { - res, err := ec.unmarshalInputApprovalOrder(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} +func (ec *executionContext) marshalNZone2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Zone) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNZone2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZone(ctx, sel, v[i]) + }) -func (ec *executionContext) unmarshalNApprovalOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrderField(ctx context.Context, v any) (*ent.ApprovalOrderField, error) { - var res = new(ent.ApprovalOrderField) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret } -func (ec *executionContext) marshalNApprovalOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalOrderField) graphql.Marshaler { +func (ec *executionContext) marshalNZone2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZone(ctx context.Context, sel ast.SelectionSet, v *ent.Zone) 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._Zone(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNZoneVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibility(ctx context.Context, v any) (zone.Visibility, error) { + var res zone.Visibility + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNZoneVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibility(ctx context.Context, sel ast.SelectionSet, v zone.Visibility) graphql.Marshaler { return v } -func (ec *executionContext) marshalNApprovalRequest2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequest(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalRequest) graphql.Marshaler { +func (ec *executionContext) unmarshalNZoneWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInput(ctx context.Context, v any) (*ent.ZoneWhereInput, error) { + res, err := ec.unmarshalInputZoneWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOApiExposure2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposure(ctx context.Context, sel ast.SelectionSet, v *ent.ApiExposure) 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._ApprovalRequest(ctx, sel, v) + return ec._ApiExposure(ctx, sel, v) } -func (ec *executionContext) marshalNApprovalRequestConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApprovalRequestConnection) graphql.Marshaler { - return ec._ApprovalRequestConnection(ctx, sel, &v) +func (ec *executionContext) marshalOApiExposureEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApiExposureEdge) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalOApiExposureEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureEdge(ctx, sel, v[i]) + }) + + return ret } -func (ec *executionContext) marshalNApprovalRequestConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalRequestConnection) graphql.Marshaler { +func (ec *executionContext) marshalOApiExposureEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApiExposureEdge) 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._ApprovalRequestConnection(ctx, sel, v) + return ec._ApiExposureEdge(ctx, sel, v) } -func (ec *executionContext) unmarshalNApprovalRequestOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrder(ctx context.Context, v any) (*ent.ApprovalRequestOrder, error) { - res, err := ec.unmarshalInputApprovalRequestOrder(ctx, v) +func (ec *executionContext) unmarshalOApiExposureOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrder(ctx context.Context, v any) (*ent.ApiExposureOrder, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputApiExposureOrder(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalNApprovalRequestOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderField(ctx context.Context, v any) (*ent.ApprovalRequestOrderField, error) { - var res = new(ent.ApprovalRequestOrderField) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) unmarshalOApiExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhaseᚄ(ctx context.Context, v any) ([]apiexposure.StatusPhase, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]apiexposure.StatusPhase, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApiExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil } -func (ec *executionContext) marshalNApprovalRequestOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalRequestOrderField) graphql.Marshaler { +func (ec *executionContext) marshalOApiExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []apiexposure.StatusPhase) 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 v -} + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNApiExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx, sel, v[i]) + }) -func (ec *executionContext) unmarshalNApprovalRequestState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx context.Context, v any) (approvalrequest.State, error) { - var res approvalrequest.State - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } -func (ec *executionContext) marshalNApprovalRequestState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx context.Context, sel ast.SelectionSet, v approvalrequest.State) graphql.Marshaler { - return v + return ret } -func (ec *executionContext) unmarshalNApprovalRequestStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx context.Context, v any) (approvalrequest.StatusPhase, error) { - var res approvalrequest.StatusPhase +func (ec *executionContext) unmarshalOApiExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx context.Context, v any) (*apiexposure.StatusPhase, error) { + if v == nil { + return nil, nil + } + var res = new(apiexposure.StatusPhase) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApprovalRequestStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v approvalrequest.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOApiExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *apiexposure.StatusPhase) graphql.Marshaler { + if v == nil { + return graphql.Null + } return v } -func (ec *executionContext) unmarshalNApprovalRequestStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx context.Context, v any) (approvalrequest.Strategy, error) { - var res approvalrequest.Strategy - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNApprovalRequestStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx context.Context, sel ast.SelectionSet, v approvalrequest.Strategy) graphql.Marshaler { - return v +func (ec *executionContext) unmarshalOApiExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibilityᚄ(ctx context.Context, v any) ([]apiexposure.Visibility, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]apiexposure.Visibility, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil } -func (ec *executionContext) unmarshalNApprovalRequestWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInput(ctx context.Context, v any) (*ent.ApprovalRequestWhereInput, error) { - res, err := ec.unmarshalInputApprovalRequestWhereInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} +func (ec *executionContext) marshalOApiExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibilityᚄ(ctx context.Context, sel ast.SelectionSet, v []apiexposure.Visibility) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, sel, v[i]) + }) -func (ec *executionContext) unmarshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx context.Context, v any) (approval.State, error) { - var res approval.State - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } -func (ec *executionContext) marshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx context.Context, sel ast.SelectionSet, v approval.State) graphql.Marshaler { - return v + return ret } -func (ec *executionContext) unmarshalNApprovalStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx context.Context, v any) (approval.StatusPhase, error) { - var res approval.StatusPhase +func (ec *executionContext) unmarshalOApiExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx context.Context, v any) (*apiexposure.Visibility, error) { + if v == nil { + return nil, nil + } + var res = new(apiexposure.Visibility) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNApprovalStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v approval.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOApiExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx context.Context, sel ast.SelectionSet, v *apiexposure.Visibility) graphql.Marshaler { + if v == nil { + return graphql.Null + } return v } -func (ec *executionContext) unmarshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx context.Context, v any) (approval.Strategy, error) { - var res approval.Strategy - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx context.Context, sel ast.SelectionSet, v approval.Strategy) graphql.Marshaler { - return v +func (ec *executionContext) unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApiExposureWhereInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*ent.ApiExposureWhereInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil } -func (ec *executionContext) unmarshalNApprovalWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInput(ctx context.Context, v any) (*ent.ApprovalWhereInput, error) { - res, err := ec.unmarshalInputApprovalWhereInput(ctx, v) +func (ec *executionContext) unmarshalOApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput(ctx context.Context, v any) (*ent.ApiExposureWhereInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputApiExposureWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, v any) (entgql.Cursor[int], error) { - var res entgql.Cursor[int] - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) marshalOApiSubscription2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscription(ctx context.Context, sel ast.SelectionSet, v *ent.ApiSubscription) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ApiSubscription(ctx, sel, v) } -func (ec *executionContext) marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, sel ast.SelectionSet, v entgql.Cursor[int]) graphql.Marshaler { - return v -} +func (ec *executionContext) marshalOApiSubscriptionEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApiSubscriptionEdge) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalOApiSubscriptionEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionEdge(ctx, sel, v[i]) + }) -func (ec *executionContext) unmarshalNGroupWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroupWhereInput(ctx context.Context, v any) (*ent.GroupWhereInput, error) { - res, err := ec.unmarshalInputGroupWhereInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) + return ret } -func (ec *executionContext) marshalNMember2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMember(ctx context.Context, sel ast.SelectionSet, v *ent.Member) graphql.Marshaler { +func (ec *executionContext) marshalOApiSubscriptionEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApiSubscriptionEdge) 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._Member(ctx, sel, v) + return ec._ApiSubscriptionEdge(ctx, sel, v) } -func (ec *executionContext) unmarshalNMemberWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐMemberWhereInput(ctx context.Context, v any) (*ent.MemberWhereInput, error) { - res, err := ec.unmarshalInputMemberWhereInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) unmarshalOApiSubscriptionM2mAuthMethod2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethodᚄ(ctx context.Context, v any) ([]apisubscription.M2mAuthMethod, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]apisubscription.M2mAuthMethod, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil } -func (ec *executionContext) marshalNNode2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐNoder(ctx context.Context, sel ast.SelectionSet, v []ent.Noder) graphql.Marshaler { +func (ec *executionContext) marshalOApiSubscriptionM2mAuthMethod2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethodᚄ(ctx context.Context, sel ast.SelectionSet, v []apisubscription.M2mAuthMethod) graphql.Marshaler { + if v == nil { + return graphql.Null + } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalONode2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐNoder(ctx, sel, v[i]) + return ec.marshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx, sel, v[i]) }) + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } -func (ec *executionContext) unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx context.Context, v any) (entgql.OrderDirection, error) { - var res entgql.OrderDirection +func (ec *executionContext) unmarshalOApiSubscriptionM2mAuthMethod2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx context.Context, v any) (*apisubscription.M2mAuthMethod, error) { + if v == nil { + return nil, nil + } + var res = new(apisubscription.M2mAuthMethod) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx context.Context, sel ast.SelectionSet, v entgql.OrderDirection) graphql.Marshaler { +func (ec *executionContext) marshalOApiSubscriptionM2mAuthMethod2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx context.Context, sel ast.SelectionSet, v *apisubscription.M2mAuthMethod) graphql.Marshaler { + if v == nil { + return graphql.Null + } return v } -func (ec *executionContext) marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { - return ec._PageInfo(ctx, sel, &v) +func (ec *executionContext) unmarshalOApiSubscriptionOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrder(ctx context.Context, v any) (*ent.ApiSubscriptionOrder, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputApiSubscriptionOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam(ctx context.Context, sel ast.SelectionSet, v *ent.Team) graphql.Marshaler { +func (ec *executionContext) unmarshalOApiSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhaseᚄ(ctx context.Context, v any) ([]apisubscription.StatusPhase, error) { 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 nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]apisubscription.StatusPhase, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApiSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx, vSlice[i]) + if err != nil { + return nil, err } - return graphql.Null } - return ec._Team(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNTeamCategory2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategory(ctx context.Context, v any) (team.Category, error) { - var res team.Category - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNTeamCategory2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐCategory(ctx context.Context, sel ast.SelectionSet, v team.Category) graphql.Marshaler { - return v -} - -func (ec *executionContext) marshalNTeamConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamConnection(ctx context.Context, sel ast.SelectionSet, v ent.TeamConnection) graphql.Marshaler { - return ec._TeamConnection(ctx, sel, &v) + return res, nil } -func (ec *executionContext) marshalNTeamConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamConnection(ctx context.Context, sel ast.SelectionSet, v *ent.TeamConnection) graphql.Marshaler { +func (ec *executionContext) marshalOApiSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []apisubscription.StatusPhase) 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._TeamConnection(ctx, sel, v) -} + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNApiSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx, sel, v[i]) + }) -func (ec *executionContext) unmarshalNTeamOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamOrder(ctx context.Context, v any) (*ent.TeamOrder, error) { - res, err := ec.unmarshalInputTeamOrder(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } -func (ec *executionContext) unmarshalNTeamOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamOrderField(ctx context.Context, v any) (*ent.TeamOrderField, error) { - var res = new(ent.TeamOrderField) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) + return ret } -func (ec *executionContext) marshalNTeamOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.TeamOrderField) graphql.Marshaler { +func (ec *executionContext) unmarshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx context.Context, v any) (*apisubscription.StatusPhase, error) { 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 nil, nil } - return v -} - -func (ec *executionContext) unmarshalNTeamStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhase(ctx context.Context, v any) (team.StatusPhase, error) { - var res team.StatusPhase + var res = new(apisubscription.StatusPhase) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNTeamStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋteamᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v team.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *apisubscription.StatusPhase) graphql.Marshaler { + if v == nil { + return graphql.Null + } return v } -func (ec *executionContext) unmarshalNTeamWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInput(ctx context.Context, v any) (*ent.TeamWhereInput, error) { - res, err := ec.unmarshalInputTeamWhereInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v any) (time.Time, error) { - res, err := graphql.UnmarshalTime(v) - return res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApiSubscriptionWhereInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*ent.ApiSubscriptionWhereInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil } -func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { - _ = sel - res := graphql.MarshalTime(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") - } +func (ec *executionContext) unmarshalOApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput(ctx context.Context, v any) (*ent.ApiSubscriptionWhereInput, error) { + if v == nil { + return nil, nil } - return res + res, err := ec.unmarshalInputApiSubscriptionWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNZone2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Zone) graphql.Marshaler { +func (ec *executionContext) marshalOApplication2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Application) graphql.Marshaler { + if v == nil { + return graphql.Null + } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNZone2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZone(ctx, sel, v[i]) + return ec.marshalNApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx, sel, v[i]) }) for _, e := range ret { @@ -15920,77 +19562,62 @@ func (ec *executionContext) marshalNZone2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolp return ret } -func (ec *executionContext) marshalNZone2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZone(ctx context.Context, sel ast.SelectionSet, v *ent.Zone) 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._Zone(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNZoneVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibility(ctx context.Context, v any) (zone.Visibility, error) { - var res zone.Visibility - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNZoneVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋzoneᚐVisibility(ctx context.Context, sel ast.SelectionSet, v zone.Visibility) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNZoneWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneWhereInput(ctx context.Context, v any) (*ent.ZoneWhereInput, error) { - res, err := ec.unmarshalInputZoneWhereInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOApiExposure2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposure(ctx context.Context, sel ast.SelectionSet, v *ent.ApiExposure) graphql.Marshaler { +func (ec *executionContext) marshalOApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx context.Context, sel ast.SelectionSet, v *ent.Application) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._ApiExposure(ctx, sel, v) + return ec._Application(ctx, sel, v) } -func (ec *executionContext) marshalOApiExposureEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApiExposureEdge) graphql.Marshaler { +func (ec *executionContext) marshalOApplicationEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApplicationEdge) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalOApiExposureEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureEdge(ctx, sel, v[i]) + return ec.marshalOApplicationEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationEdge(ctx, sel, v[i]) }) return ret } -func (ec *executionContext) marshalOApiExposureEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApiExposureEdge) graphql.Marshaler { +func (ec *executionContext) marshalOApplicationEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApplicationEdge) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._ApiExposureEdge(ctx, sel, v) + return ec._ApplicationEdge(ctx, sel, v) } -func (ec *executionContext) unmarshalOApiExposureOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureOrder(ctx context.Context, v any) (*ent.ApiExposureOrder, error) { +func (ec *executionContext) unmarshalOApplicationOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderᚄ(ctx context.Context, v any) ([]*ent.ApplicationOrder, error) { if v == nil { return nil, nil } - res, err := ec.unmarshalInputApiExposureOrder(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*ent.ApplicationOrder, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApplicationOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrder(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil } -func (ec *executionContext) unmarshalOApiExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhaseᚄ(ctx context.Context, v any) ([]apiexposure.StatusPhase, error) { +func (ec *executionContext) unmarshalOApplicationSecretRotationPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhaseᚄ(ctx context.Context, v any) ([]application.SecretRotationPhase, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]apiexposure.StatusPhase, len(vSlice)) + res := make([]application.SecretRotationPhase, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApiExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApplicationSecretRotationPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhase(ctx, vSlice[i]) if err != nil { return nil, err } @@ -15998,14 +19625,14 @@ func (ec *executionContext) unmarshalOApiExposureStatusPhase2ᚕgithubᚗcomᚋt return res, nil } -func (ec *executionContext) marshalOApiExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []apiexposure.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOApplicationSecretRotationPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []application.SecretRotationPhase) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApiExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx, sel, v[i]) + return ec.marshalNApplicationSecretRotationPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhase(ctx, sel, v[i]) }) for _, e := range ret { @@ -16017,33 +19644,33 @@ func (ec *executionContext) marshalOApiExposureStatusPhase2ᚕgithubᚗcomᚋtel return ret } -func (ec *executionContext) unmarshalOApiExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx context.Context, v any) (*apiexposure.StatusPhase, error) { +func (ec *executionContext) unmarshalOApplicationSecretRotationPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhase(ctx context.Context, v any) (*application.SecretRotationPhase, error) { if v == nil { return nil, nil } - var res = new(apiexposure.StatusPhase) + var res = new(application.SecretRotationPhase) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApiExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *apiexposure.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOApplicationSecretRotationPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐSecretRotationPhase(ctx context.Context, sel ast.SelectionSet, v *application.SecretRotationPhase) graphql.Marshaler { if v == nil { return graphql.Null } return v } -func (ec *executionContext) unmarshalOApiExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibilityᚄ(ctx context.Context, v any) ([]apiexposure.Visibility, error) { +func (ec *executionContext) unmarshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhaseᚄ(ctx context.Context, v any) ([]application.StatusPhase, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]apiexposure.Visibility, len(vSlice)) + res := make([]application.StatusPhase, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApplicationStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16051,14 +19678,14 @@ func (ec *executionContext) unmarshalOApiExposureVisibility2ᚕgithubᚗcomᚋte return res, nil } -func (ec *executionContext) marshalOApiExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibilityᚄ(ctx context.Context, sel ast.SelectionSet, v []apiexposure.Visibility) graphql.Marshaler { +func (ec *executionContext) marshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []application.StatusPhase) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, sel, v[i]) + return ec.marshalNApplicationStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx, sel, v[i]) }) for _, e := range ret { @@ -16070,33 +19697,33 @@ func (ec *executionContext) marshalOApiExposureVisibility2ᚕgithubᚗcomᚋtele return ret } -func (ec *executionContext) unmarshalOApiExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx context.Context, v any) (*apiexposure.Visibility, error) { +func (ec *executionContext) unmarshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx context.Context, v any) (*application.StatusPhase, error) { if v == nil { return nil, nil } - var res = new(apiexposure.Visibility) + var res = new(application.StatusPhase) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApiExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx context.Context, sel ast.SelectionSet, v *apiexposure.Visibility) graphql.Marshaler { +func (ec *executionContext) marshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *application.StatusPhase) graphql.Marshaler { if v == nil { return graphql.Null } return v } -func (ec *executionContext) unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApiExposureWhereInput, error) { +func (ec *executionContext) unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApplicationWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]*ent.ApiExposureWhereInput, len(vSlice)) + res := make([]*ent.ApplicationWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16104,52 +19731,52 @@ func (ec *executionContext) unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcom return res, nil } -func (ec *executionContext) unmarshalOApiExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInput(ctx context.Context, v any) (*ent.ApiExposureWhereInput, error) { +func (ec *executionContext) unmarshalOApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput(ctx context.Context, v any) (*ent.ApplicationWhereInput, error) { if v == nil { return nil, nil } - res, err := ec.unmarshalInputApiExposureWhereInput(ctx, v) + res, err := ec.unmarshalInputApplicationWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApiSubscription2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscription(ctx context.Context, sel ast.SelectionSet, v *ent.ApiSubscription) graphql.Marshaler { +func (ec *executionContext) marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval(ctx context.Context, sel ast.SelectionSet, v *ent.Approval) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._ApiSubscription(ctx, sel, v) + return ec._Approval(ctx, sel, v) } -func (ec *executionContext) marshalOApiSubscriptionEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApiSubscriptionEdge) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApprovalEdge) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalOApiSubscriptionEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionEdge(ctx, sel, v[i]) + return ec.marshalOApprovalEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalEdge(ctx, sel, v[i]) }) return ret } -func (ec *executionContext) marshalOApiSubscriptionEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApiSubscriptionEdge) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalEdge) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._ApiSubscriptionEdge(ctx, sel, v) + return ec._ApprovalEdge(ctx, sel, v) } -func (ec *executionContext) unmarshalOApiSubscriptionM2mAuthMethod2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethodᚄ(ctx context.Context, v any) ([]apisubscription.M2mAuthMethod, error) { +func (ec *executionContext) unmarshalOApprovalOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrderᚄ(ctx context.Context, v any) ([]*ent.ApprovalOrder, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]apisubscription.M2mAuthMethod, len(vSlice)) + res := make([]*ent.ApprovalOrder, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApprovalOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrder(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16157,14 +19784,14 @@ func (ec *executionContext) unmarshalOApiSubscriptionM2mAuthMethod2ᚕgithubᚗc return res, nil } -func (ec *executionContext) marshalOApiSubscriptionM2mAuthMethod2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethodᚄ(ctx context.Context, sel ast.SelectionSet, v []apisubscription.M2mAuthMethod) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalRequest2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.ApprovalRequest) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx, sel, v[i]) + return ec.marshalNApprovalRequest2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequest(ctx, sel, v[i]) }) for _, e := range ret { @@ -16176,41 +19803,62 @@ func (ec *executionContext) marshalOApiSubscriptionM2mAuthMethod2ᚕgithubᚗcom return ret } -func (ec *executionContext) unmarshalOApiSubscriptionM2mAuthMethod2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx context.Context, v any) (*apisubscription.M2mAuthMethod, error) { +func (ec *executionContext) marshalOApprovalRequest2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequest(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalRequest) graphql.Marshaler { if v == nil { - return nil, nil + return graphql.Null } - var res = new(apisubscription.M2mAuthMethod) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) + return ec._ApprovalRequest(ctx, sel, v) } -func (ec *executionContext) marshalOApiSubscriptionM2mAuthMethod2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx context.Context, sel ast.SelectionSet, v *apisubscription.M2mAuthMethod) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalRequestEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApprovalRequestEdge) graphql.Marshaler { if v == nil { return graphql.Null } - return v + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalOApprovalRequestEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestEdge(ctx, sel, v[i]) + }) + + return ret } -func (ec *executionContext) unmarshalOApiSubscriptionOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionOrder(ctx context.Context, v any) (*ent.ApiSubscriptionOrder, error) { +func (ec *executionContext) marshalOApprovalRequestEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalRequestEdge) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ApprovalRequestEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOApprovalRequestOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderᚄ(ctx context.Context, v any) ([]*ent.ApprovalRequestOrder, error) { if v == nil { return nil, nil } - res, err := ec.unmarshalInputApiSubscriptionOrder(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*ent.ApprovalRequestOrder, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApprovalRequestOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrder(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil } -func (ec *executionContext) unmarshalOApiSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhaseᚄ(ctx context.Context, v any) ([]apisubscription.StatusPhase, error) { +func (ec *executionContext) unmarshalOApprovalRequestState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStateᚄ(ctx context.Context, v any) ([]approvalrequest.State, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]apisubscription.StatusPhase, len(vSlice)) + res := make([]approvalrequest.State, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApiSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApprovalRequestState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16218,14 +19866,14 @@ func (ec *executionContext) unmarshalOApiSubscriptionStatusPhase2ᚕgithubᚗcom return res, nil } -func (ec *executionContext) marshalOApiSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []apisubscription.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalRequestState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStateᚄ(ctx context.Context, sel ast.SelectionSet, v []approvalrequest.State) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApiSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx, sel, v[i]) + return ec.marshalNApprovalRequestState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx, sel, v[i]) }) for _, e := range ret { @@ -16237,33 +19885,33 @@ func (ec *executionContext) marshalOApiSubscriptionStatusPhase2ᚕgithubᚗcom return ret } -func (ec *executionContext) unmarshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx context.Context, v any) (*apisubscription.StatusPhase, error) { +func (ec *executionContext) unmarshalOApprovalRequestState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx context.Context, v any) (*approvalrequest.State, error) { if v == nil { return nil, nil } - var res = new(apisubscription.StatusPhase) + var res = new(approvalrequest.State) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *apisubscription.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalRequestState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx context.Context, sel ast.SelectionSet, v *approvalrequest.State) graphql.Marshaler { if v == nil { return graphql.Null } return v } -func (ec *executionContext) unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApiSubscriptionWhereInput, error) { +func (ec *executionContext) unmarshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhaseᚄ(ctx context.Context, v any) ([]approvalrequest.StatusPhase, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]*ent.ApiSubscriptionWhereInput, len(vSlice)) + res := make([]approvalrequest.StatusPhase, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApprovalRequestStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16271,22 +19919,14 @@ func (ec *executionContext) unmarshalOApiSubscriptionWhereInput2ᚕᚖgithubᚗc return res, nil } -func (ec *executionContext) unmarshalOApiSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiSubscriptionWhereInput(ctx context.Context, v any) (*ent.ApiSubscriptionWhereInput, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalInputApiSubscriptionWhereInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOApplication2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Application) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []approvalrequest.StatusPhase) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx, sel, v[i]) + return ec.marshalNApprovalRequestStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx, sel, v[i]) }) for _, e := range ret { @@ -16298,44 +19938,86 @@ func (ec *executionContext) marshalOApplication2ᚕᚖgithubᚗcomᚋtelekomᚋc return ret } -func (ec *executionContext) marshalOApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx context.Context, sel ast.SelectionSet, v *ent.Application) graphql.Marshaler { +func (ec *executionContext) unmarshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx context.Context, v any) (*approvalrequest.StatusPhase, error) { + if v == nil { + return nil, nil + } + var res = new(approvalrequest.StatusPhase) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *approvalrequest.StatusPhase) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._Application(ctx, sel, v) + return v } -func (ec *executionContext) marshalOApplicationEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApplicationEdge) graphql.Marshaler { +func (ec *executionContext) unmarshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategyᚄ(ctx context.Context, v any) ([]approvalrequest.Strategy, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]approvalrequest.Strategy, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApprovalRequestStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategyᚄ(ctx context.Context, sel ast.SelectionSet, v []approvalrequest.Strategy) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalOApplicationEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationEdge(ctx, sel, v[i]) + return ec.marshalNApprovalRequestStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx, sel, v[i]) }) + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } -func (ec *executionContext) marshalOApplicationEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApplicationEdge) graphql.Marshaler { +func (ec *executionContext) unmarshalOApprovalRequestStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx context.Context, v any) (*approvalrequest.Strategy, error) { + if v == nil { + return nil, nil + } + var res = new(approvalrequest.Strategy) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOApprovalRequestStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx context.Context, sel ast.SelectionSet, v *approvalrequest.Strategy) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._ApplicationEdge(ctx, sel, v) + return v } -func (ec *executionContext) unmarshalOApplicationOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrderᚄ(ctx context.Context, v any) ([]*ent.ApplicationOrder, error) { +func (ec *executionContext) unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApprovalRequestWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]*ent.ApplicationOrder, len(vSlice)) + res := make([]*ent.ApprovalRequestWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApplicationOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationOrder(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApprovalRequestWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16343,17 +20025,25 @@ func (ec *executionContext) unmarshalOApplicationOrder2ᚕᚖgithubᚗcomᚋtele return res, nil } -func (ec *executionContext) unmarshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhaseᚄ(ctx context.Context, v any) ([]application.StatusPhase, error) { +func (ec *executionContext) unmarshalOApprovalRequestWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInput(ctx context.Context, v any) (*ent.ApprovalRequestWhereInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputApprovalRequestWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStateᚄ(ctx context.Context, v any) ([]approval.State, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]application.StatusPhase, len(vSlice)) + res := make([]approval.State, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApplicationStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16361,14 +20051,14 @@ func (ec *executionContext) unmarshalOApplicationStatusPhase2ᚕgithubᚗcomᚋt return res, nil } -func (ec *executionContext) marshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []application.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStateᚄ(ctx context.Context, sel ast.SelectionSet, v []approval.State) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApplicationStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx, sel, v[i]) + return ec.marshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, sel, v[i]) }) for _, e := range ret { @@ -16380,33 +20070,33 @@ func (ec *executionContext) marshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtel return ret } -func (ec *executionContext) unmarshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx context.Context, v any) (*application.StatusPhase, error) { +func (ec *executionContext) unmarshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx context.Context, v any) (*approval.State, error) { if v == nil { return nil, nil } - var res = new(application.StatusPhase) + var res = new(approval.State) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *application.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx context.Context, sel ast.SelectionSet, v *approval.State) graphql.Marshaler { if v == nil { return graphql.Null } return v } -func (ec *executionContext) unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApplicationWhereInput, error) { +func (ec *executionContext) unmarshalOApprovalStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhaseᚄ(ctx context.Context, v any) ([]approval.StatusPhase, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]*ent.ApplicationWhereInput, len(vSlice)) + res := make([]approval.StatusPhase, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApprovalStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16414,52 +20104,52 @@ func (ec *executionContext) unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcom return res, nil } -func (ec *executionContext) unmarshalOApplicationWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInput(ctx context.Context, v any) (*ent.ApplicationWhereInput, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalInputApplicationWhereInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval(ctx context.Context, sel ast.SelectionSet, v *ent.Approval) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Approval(ctx, sel, v) -} - -func (ec *executionContext) marshalOApprovalEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApprovalEdge) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []approval.StatusPhase) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalOApprovalEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalEdge(ctx, sel, v[i]) + return ec.marshalNApprovalStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx, sel, v[i]) }) + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } -func (ec *executionContext) marshalOApprovalEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalEdge) graphql.Marshaler { +func (ec *executionContext) unmarshalOApprovalStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx context.Context, v any) (*approval.StatusPhase, error) { + if v == nil { + return nil, nil + } + var res = new(approval.StatusPhase) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOApprovalStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *approval.StatusPhase) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._ApprovalEdge(ctx, sel, v) + return v } -func (ec *executionContext) unmarshalOApprovalOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrderᚄ(ctx context.Context, v any) ([]*ent.ApprovalOrder, error) { +func (ec *executionContext) unmarshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategyᚄ(ctx context.Context, v any) ([]approval.Strategy, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]*ent.ApprovalOrder, len(vSlice)) + res := make([]approval.Strategy, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApprovalOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalOrder(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16467,14 +20157,14 @@ func (ec *executionContext) unmarshalOApprovalOrder2ᚕᚖgithubᚗcomᚋtelekom return res, nil } -func (ec *executionContext) marshalOApprovalRequest2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.ApprovalRequest) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategyᚄ(ctx context.Context, sel ast.SelectionSet, v []approval.Strategy) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApprovalRequest2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequest(ctx, sel, v[i]) + return ec.marshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx, sel, v[i]) }) for _, e := range ret { @@ -16486,44 +20176,33 @@ func (ec *executionContext) marshalOApprovalRequest2ᚕᚖgithubᚗcomᚋtelekom return ret } -func (ec *executionContext) marshalOApprovalRequest2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequest(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalRequest) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._ApprovalRequest(ctx, sel, v) -} - -func (ec *executionContext) marshalOApprovalRequestEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApprovalRequestEdge) graphql.Marshaler { +func (ec *executionContext) unmarshalOApprovalStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx context.Context, v any) (*approval.Strategy, error) { if v == nil { - return graphql.Null + return nil, nil } - ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { - fc := graphql.GetFieldContext(ctx) - fc.Result = &v[i] - return ec.marshalOApprovalRequestEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestEdge(ctx, sel, v[i]) - }) - - return ret + var res = new(approval.Strategy) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApprovalRequestEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApprovalRequestEdge) graphql.Marshaler { +func (ec *executionContext) marshalOApprovalStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx context.Context, sel ast.SelectionSet, v *approval.Strategy) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._ApprovalRequestEdge(ctx, sel, v) + return v } -func (ec *executionContext) unmarshalOApprovalRequestOrder2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderᚄ(ctx context.Context, v any) ([]*ent.ApprovalRequestOrder, error) { +func (ec *executionContext) unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApprovalWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]*ent.ApprovalRequestOrder, len(vSlice)) + res := make([]*ent.ApprovalWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApprovalRequestOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrder(ctx, vSlice[i]) + res[i], err = ec.unmarshalNApprovalWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16531,70 +20210,76 @@ func (ec *executionContext) unmarshalOApprovalRequestOrder2ᚕᚖgithubᚗcomᚋ return res, nil } -func (ec *executionContext) unmarshalOApprovalRequestState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStateᚄ(ctx context.Context, v any) ([]approvalrequest.State, error) { +func (ec *executionContext) unmarshalOApprovalWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInput(ctx context.Context, v any) (*ent.ApprovalWhereInput, error) { if v == nil { return nil, nil } - var vSlice []any - vSlice = graphql.CoerceList(v) - var err error - res := make([]approvalrequest.State, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApprovalRequestState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx, vSlice[i]) - if err != nil { - return nil, err - } + res, err := ec.unmarshalInputApprovalWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, v any) (*entgql.Cursor[int], error) { + if v == nil { + return nil, nil } - return res, nil + var res = new(entgql.Cursor[int]) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApprovalRequestState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStateᚄ(ctx context.Context, sel ast.SelectionSet, v []approvalrequest.State) graphql.Marshaler { +func (ec *executionContext) marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, sel ast.SelectionSet, v *entgql.Cursor[int]) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func (ec *executionContext) marshalOEventExposure2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposure(ctx context.Context, sel ast.SelectionSet, v *ent.EventExposure) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._EventExposure(ctx, sel, v) +} + +func (ec *executionContext) marshalOEventExposureEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.EventExposureEdge) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApprovalRequestState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx, sel, v[i]) + return ec.marshalOEventExposureEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureEdge(ctx, sel, v[i]) }) - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - return ret } -func (ec *executionContext) unmarshalOApprovalRequestState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx context.Context, v any) (*approvalrequest.State, error) { +func (ec *executionContext) marshalOEventExposureEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureEdge(ctx context.Context, sel ast.SelectionSet, v *ent.EventExposureEdge) graphql.Marshaler { if v == nil { - return nil, nil + return graphql.Null } - var res = new(approvalrequest.State) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) + return ec._EventExposureEdge(ctx, sel, v) } -func (ec *executionContext) marshalOApprovalRequestState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐState(ctx context.Context, sel ast.SelectionSet, v *approvalrequest.State) graphql.Marshaler { +func (ec *executionContext) unmarshalOEventExposureOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureOrder(ctx context.Context, v any) (*ent.EventExposureOrder, error) { if v == nil { - return graphql.Null + return nil, nil } - return v + res, err := ec.unmarshalInputEventExposureOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhaseᚄ(ctx context.Context, v any) ([]approvalrequest.StatusPhase, error) { +func (ec *executionContext) unmarshalOEventExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhaseᚄ(ctx context.Context, v any) ([]eventexposure.StatusPhase, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]approvalrequest.StatusPhase, len(vSlice)) + res := make([]eventexposure.StatusPhase, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApprovalRequestStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx, vSlice[i]) + res[i], err = ec.unmarshalNEventExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16602,14 +20287,14 @@ func (ec *executionContext) unmarshalOApprovalRequestStatusPhase2ᚕgithubᚗcom return res, nil } -func (ec *executionContext) marshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []approvalrequest.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOEventExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []eventexposure.StatusPhase) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApprovalRequestStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx, sel, v[i]) + return ec.marshalNEventExposureStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(ctx, sel, v[i]) }) for _, e := range ret { @@ -16621,33 +20306,33 @@ func (ec *executionContext) marshalOApprovalRequestStatusPhase2ᚕgithubᚗcom return ret } -func (ec *executionContext) unmarshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx context.Context, v any) (*approvalrequest.StatusPhase, error) { +func (ec *executionContext) unmarshalOEventExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(ctx context.Context, v any) (*eventexposure.StatusPhase, error) { if v == nil { return nil, nil } - var res = new(approvalrequest.StatusPhase) + var res = new(eventexposure.StatusPhase) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *approvalrequest.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOEventExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *eventexposure.StatusPhase) graphql.Marshaler { if v == nil { return graphql.Null } return v } -func (ec *executionContext) unmarshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategyᚄ(ctx context.Context, v any) ([]approvalrequest.Strategy, error) { +func (ec *executionContext) unmarshalOEventExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibilityᚄ(ctx context.Context, v any) ([]eventexposure.Visibility, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]approvalrequest.Strategy, len(vSlice)) + res := make([]eventexposure.Visibility, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApprovalRequestStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx, vSlice[i]) + res[i], err = ec.unmarshalNEventExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibility(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16655,14 +20340,14 @@ func (ec *executionContext) unmarshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋ return res, nil } -func (ec *executionContext) marshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategyᚄ(ctx context.Context, sel ast.SelectionSet, v []approvalrequest.Strategy) graphql.Marshaler { +func (ec *executionContext) marshalOEventExposureVisibility2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibilityᚄ(ctx context.Context, sel ast.SelectionSet, v []eventexposure.Visibility) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApprovalRequestStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx, sel, v[i]) + return ec.marshalNEventExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibility(ctx, sel, v[i]) }) for _, e := range ret { @@ -16674,33 +20359,33 @@ func (ec *executionContext) marshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋte return ret } -func (ec *executionContext) unmarshalOApprovalRequestStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx context.Context, v any) (*approvalrequest.Strategy, error) { +func (ec *executionContext) unmarshalOEventExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibility(ctx context.Context, v any) (*eventexposure.Visibility, error) { if v == nil { return nil, nil } - var res = new(approvalrequest.Strategy) + var res = new(eventexposure.Visibility) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApprovalRequestStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx context.Context, sel ast.SelectionSet, v *approvalrequest.Strategy) graphql.Marshaler { +func (ec *executionContext) marshalOEventExposureVisibility2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibility(ctx context.Context, sel ast.SelectionSet, v *eventexposure.Visibility) graphql.Marshaler { if v == nil { return graphql.Null } return v } -func (ec *executionContext) unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApprovalRequestWhereInput, error) { +func (ec *executionContext) unmarshalOEventExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInputᚄ(ctx context.Context, v any) ([]*ent.EventExposureWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]*ent.ApprovalRequestWhereInput, len(vSlice)) + res := make([]*ent.EventExposureWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApprovalRequestWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInput(ctx, vSlice[i]) + res[i], err = ec.unmarshalNEventExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16708,25 +20393,32 @@ func (ec *executionContext) unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗc return res, nil } -func (ec *executionContext) unmarshalOApprovalRequestWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInput(ctx context.Context, v any) (*ent.ApprovalRequestWhereInput, error) { +func (ec *executionContext) unmarshalOEventExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInput(ctx context.Context, v any) (*ent.EventExposureWhereInput, error) { if v == nil { return nil, nil } - res, err := ec.unmarshalInputApprovalRequestWhereInput(ctx, v) + res, err := ec.unmarshalInputEventExposureWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStateᚄ(ctx context.Context, v any) ([]approval.State, error) { +func (ec *executionContext) marshalOEventSubscription2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscription(ctx context.Context, sel ast.SelectionSet, v *ent.EventSubscription) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._EventSubscription(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOEventSubscriptionDeliveryType2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryTypeᚄ(ctx context.Context, v any) ([]eventsubscription.DeliveryType, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]approval.State, len(vSlice)) + res := make([]eventsubscription.DeliveryType, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, vSlice[i]) + res[i], err = ec.unmarshalNEventSubscriptionDeliveryType2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16734,14 +20426,14 @@ func (ec *executionContext) unmarshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋ return res, nil } -func (ec *executionContext) marshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStateᚄ(ctx context.Context, sel ast.SelectionSet, v []approval.State) graphql.Marshaler { +func (ec *executionContext) marshalOEventSubscriptionDeliveryType2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []eventsubscription.DeliveryType) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, sel, v[i]) + return ec.marshalNEventSubscriptionDeliveryType2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx, sel, v[i]) }) for _, e := range ret { @@ -16753,86 +20445,61 @@ func (ec *executionContext) marshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋco return ret } -func (ec *executionContext) unmarshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx context.Context, v any) (*approval.State, error) { +func (ec *executionContext) unmarshalOEventSubscriptionDeliveryType2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx context.Context, v any) (*eventsubscription.DeliveryType, error) { if v == nil { return nil, nil } - var res = new(approval.State) + var res = new(eventsubscription.DeliveryType) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx context.Context, sel ast.SelectionSet, v *approval.State) graphql.Marshaler { +func (ec *executionContext) marshalOEventSubscriptionDeliveryType2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx context.Context, sel ast.SelectionSet, v *eventsubscription.DeliveryType) graphql.Marshaler { if v == nil { return graphql.Null } return v } -func (ec *executionContext) unmarshalOApprovalStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhaseᚄ(ctx context.Context, v any) ([]approval.StatusPhase, error) { - if v == nil { - return nil, nil - } - var vSlice []any - vSlice = graphql.CoerceList(v) - var err error - res := make([]approval.StatusPhase, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApprovalStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -func (ec *executionContext) marshalOApprovalStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []approval.StatusPhase) graphql.Marshaler { +func (ec *executionContext) marshalOEventSubscriptionEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.EventSubscriptionEdge) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApprovalStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx, sel, v[i]) + return ec.marshalOEventSubscriptionEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionEdge(ctx, sel, v[i]) }) - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - return ret } -func (ec *executionContext) unmarshalOApprovalStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx context.Context, v any) (*approval.StatusPhase, error) { +func (ec *executionContext) marshalOEventSubscriptionEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, v *ent.EventSubscriptionEdge) graphql.Marshaler { if v == nil { - return nil, nil + return graphql.Null } - var res = new(approval.StatusPhase) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) + return ec._EventSubscriptionEdge(ctx, sel, v) } -func (ec *executionContext) marshalOApprovalStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *approval.StatusPhase) graphql.Marshaler { +func (ec *executionContext) unmarshalOEventSubscriptionOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionOrder(ctx context.Context, v any) (*ent.EventSubscriptionOrder, error) { if v == nil { - return graphql.Null + return nil, nil } - return v + res, err := ec.unmarshalInputEventSubscriptionOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategyᚄ(ctx context.Context, v any) ([]approval.Strategy, error) { +func (ec *executionContext) unmarshalOEventSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhaseᚄ(ctx context.Context, v any) ([]eventsubscription.StatusPhase, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]approval.Strategy, len(vSlice)) + res := make([]eventsubscription.StatusPhase, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx, vSlice[i]) + res[i], err = ec.unmarshalNEventSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16840,14 +20507,14 @@ func (ec *executionContext) unmarshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekom return res, nil } -func (ec *executionContext) marshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategyᚄ(ctx context.Context, sel ast.SelectionSet, v []approval.Strategy) graphql.Marshaler { +func (ec *executionContext) marshalOEventSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []eventsubscription.StatusPhase) graphql.Marshaler { if v == nil { return graphql.Null } ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) fc.Result = &v[i] - return ec.marshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx, sel, v[i]) + return ec.marshalNEventSubscriptionStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx, sel, v[i]) }) for _, e := range ret { @@ -16859,33 +20526,33 @@ func (ec *executionContext) marshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekom return ret } -func (ec *executionContext) unmarshalOApprovalStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx context.Context, v any) (*approval.Strategy, error) { +func (ec *executionContext) unmarshalOEventSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx context.Context, v any) (*eventsubscription.StatusPhase, error) { if v == nil { return nil, nil } - var res = new(approval.Strategy) + var res = new(eventsubscription.StatusPhase) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOApprovalStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx context.Context, sel ast.SelectionSet, v *approval.Strategy) graphql.Marshaler { +func (ec *executionContext) marshalOEventSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *eventsubscription.StatusPhase) graphql.Marshaler { if v == nil { return graphql.Null } return v } -func (ec *executionContext) unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApprovalWhereInput, error) { +func (ec *executionContext) unmarshalOEventSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInputᚄ(ctx context.Context, v any) ([]*ent.EventSubscriptionWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error - res := make([]*ent.ApprovalWhereInput, len(vSlice)) + res := make([]*ent.EventSubscriptionWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNApprovalWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInput(ctx, vSlice[i]) + res[i], err = ec.unmarshalNEventSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } @@ -16893,30 +20560,14 @@ func (ec *executionContext) unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋte return res, nil } -func (ec *executionContext) unmarshalOApprovalWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInput(ctx context.Context, v any) (*ent.ApprovalWhereInput, error) { +func (ec *executionContext) unmarshalOEventSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInput(ctx context.Context, v any) (*ent.EventSubscriptionWhereInput, error) { if v == nil { return nil, nil } - res, err := ec.unmarshalInputApprovalWhereInput(ctx, v) + res, err := ec.unmarshalInputEventSubscriptionWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, v any) (*entgql.Cursor[int], error) { - if v == nil { - return nil, nil - } - var res = new(entgql.Cursor[int]) - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, sel ast.SelectionSet, v *entgql.Cursor[int]) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return v -} - func (ec *executionContext) marshalOGroup2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐGroup(ctx context.Context, sel ast.SelectionSet, v *ent.Group) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/controlplane-api/internal/resolvers/ent.resolvers.go b/controlplane-api/internal/resolvers/ent.resolvers.go index ab9127a67..fbbd08d77 100644 --- a/controlplane-api/internal/resolvers/ent.resolvers.go +++ b/controlplane-api/internal/resolvers/ent.resolvers.go @@ -1,13 +1,12 @@ -// Copyright 2026 Deutsche Telekom IT GmbH +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - package resolvers // This file will be automatically regenerated based on the schema, any resolver // implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.88 +// Code generated by github.com/99designs/gqlgen version v0.17.90 import ( "context" @@ -26,6 +25,20 @@ func (r *apiExposureResolver) Features(ctx context.Context, obj *ent.ApiExposure return result, nil } +// ClientSecret is the resolver for the clientSecret field. +// Resolves secret references just-in-time from the secret manager. +// Returns masked value for obfuscated callers. +func (r *applicationResolver) ClientSecret(ctx context.Context, obj *ent.Application) (*string, error) { + return r.secrets.Resolve(ctx, obj.ClientSecret, "clientSecret") +} + +// RotatedClientSecret is the resolver for the rotatedClientSecret field. +// Resolves secret references just-in-time from the secret manager. +// Returns masked value for obfuscated callers. +func (r *applicationResolver) RotatedClientSecret(ctx context.Context, obj *ent.Application) (*string, error) { + return r.secrets.Resolve(ctx, obj.RotatedClientSecret, "rotatedClientSecret") +} + // Node is the resolver for the node field. func (r *queryResolver) Node(ctx context.Context, id int) (ent.Noder, error) { return r.client.Noder(ctx, id) @@ -81,6 +94,24 @@ func (r *queryResolver) ApprovalRequests(ctx context.Context, after *entgql.Curs ) } +// EventExposures is the resolver for the eventExposures field. +func (r *queryResolver) EventExposures(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventExposureOrder, where *ent.EventExposureWhereInput) (*ent.EventExposureConnection, error) { + return r.client.EventExposure.Query(). + Paginate(ctx, after, first, before, last, + ent.WithEventExposureOrder(orderBy), + ent.WithEventExposureFilter(where.Filter), + ) +} + +// EventSubscriptions is the resolver for the eventSubscriptions field. +func (r *queryResolver) EventSubscriptions(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventSubscriptionOrder, where *ent.EventSubscriptionWhereInput) (*ent.EventSubscriptionConnection, error) { + return r.client.EventSubscription.Query(). + Paginate(ctx, after, first, before, last, + ent.WithEventSubscriptionOrder(orderBy), + ent.WithEventSubscriptionFilter(where.Filter), + ) +} + // Teams is the resolver for the teams field. func (r *queryResolver) Teams(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.TeamOrder, where *ent.TeamWhereInput) (*ent.TeamConnection, error) { return r.client.Team.Query(). @@ -95,6 +126,13 @@ func (r *queryResolver) Zones(ctx context.Context) ([]*ent.Zone, error) { return r.client.Zone.Query().All(ctx) } +// TeamToken is the resolver for the teamToken field. +// Resolves secret references just-in-time from the secret manager. +// Returns masked value for obfuscated callers. +func (r *teamResolver) TeamToken(ctx context.Context, obj *ent.Team) (*string, error) { + return r.secrets.Resolve(ctx, obj.TeamToken, "teamToken") +} + // ApiExposure returns ApiExposureResolver implementation. func (r *Resolver) ApiExposure() ApiExposureResolver { return &apiExposureResolver{r} } @@ -110,12 +148,30 @@ func (r *Resolver) Approval() ApprovalResolver { return &approvalResolver{r} } // ApprovalRequest returns ApprovalRequestResolver implementation. func (r *Resolver) ApprovalRequest() ApprovalRequestResolver { return &approvalRequestResolver{r} } +// EventExposure returns EventExposureResolver implementation. +func (r *Resolver) EventExposure() EventExposureResolver { return &eventExposureResolver{r} } + +// EventSubscription returns EventSubscriptionResolver implementation. +func (r *Resolver) EventSubscription() EventSubscriptionResolver { + return &eventSubscriptionResolver{r} +} + // Query returns QueryResolver implementation. func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } +// Team returns TeamResolver implementation. +func (r *Resolver) Team() TeamResolver { return &teamResolver{r} } + +// Zone returns ZoneResolver implementation. +func (r *Resolver) Zone() ZoneResolver { return &zoneResolver{r} } + type apiExposureResolver struct{ *Resolver } type apiSubscriptionResolver struct{ *Resolver } type applicationResolver struct{ *Resolver } type approvalResolver struct{ *Resolver } type approvalRequestResolver struct{ *Resolver } +type eventExposureResolver struct{ *Resolver } +type eventSubscriptionResolver struct{ *Resolver } type queryResolver struct{ *Resolver } +type teamResolver struct{ *Resolver } +type zoneResolver struct{ *Resolver } diff --git a/controlplane-api/internal/resolvers/mapper.go b/controlplane-api/internal/resolvers/mapper.go index 3a2005248..82747722c 100644 --- a/controlplane-api/internal/resolvers/mapper.go +++ b/controlplane-api/internal/resolvers/mapper.go @@ -5,6 +5,9 @@ package resolvers import ( + "context" + "fmt" + "github.com/telekom/controlplane/controlplane-api/ent" "github.com/telekom/controlplane/controlplane-api/pkg/model" ) @@ -58,3 +61,95 @@ func mapApiSubscriptionInfo(sub *ent.ApiSubscription, app *ent.Application, team OwnerTeam: mapTeamInfo(team, group), } } + +func mapEventSubscriptionInfo(sub *ent.EventSubscription, app *ent.Application, team *ent.Team, group *ent.Group) *model.EventSubscriptionInfo { + var statusPhase *string + if sub.StatusPhase != nil { + s := string(*sub.StatusPhase) + statusPhase = &s + } + return &model.EventSubscriptionInfo{ + ID: sub.ID, + EventType: sub.EventType, + DeliveryType: string(sub.DeliveryType), + StatusPhase: statusPhase, + StatusMessage: sub.StatusMessage, + OwnerApplicationName: app.Name, + OwnerTeam: mapTeamInfo(team, group), + } +} + +func mapEventExposureInfo(exposure *ent.EventExposure, app *ent.Application, team *ent.Team, group *ent.Group) *model.EventExposureInfo { + return &model.EventExposureInfo{ + ID: exposure.ID, + EventType: exposure.EventType, + Visibility: string(exposure.Visibility), + Active: exposure.Active, + ApprovalConfig: model.ApprovalConfig{ + Strategy: exposure.ApprovalConfig.Strategy, + TrustedTeams: exposure.ApprovalConfig.TrustedTeams, + }, + OwnerApplicationName: app.Name, + OwnerTeam: mapTeamInfo(team, group), + } +} + +// loadOwnerChain traverses subscription → owner application → team → group. +// Used by both API and event subscription info loaders. +func loadOwnerChain(ctx context.Context, ownerQuery interface { + Only(context.Context) (*ent.Application, error) +}, +) (*ent.Application, *ent.Team, *ent.Group, error) { + app, err := ownerQuery.Only(ctx) + if err != nil { + return nil, nil, nil, fmt.Errorf("loading owner application: %w", err) + } + team, err := app.QueryOwnerTeam().Only(ctx) + if err != nil { + return nil, nil, nil, fmt.Errorf("loading owner team for application %d: %w", app.ID, err) + } + group, err := team.QueryGroup().Only(ctx) + if err != nil && !ent.IsNotFound(err) { + return nil, nil, nil, fmt.Errorf("loading group for team %d: %w", team.ID, err) + } + if ent.IsNotFound(err) { + group = nil + } + return app, team, group, nil +} + +// loadApiSubscriptionInfo loads the full owner chain for an API subscription and maps it to ApiSubscriptionInfo. +func loadApiSubscriptionInfo(ctx context.Context, sub *ent.ApiSubscription) (*model.ApiSubscriptionInfo, error) { + app, team, group, err := loadOwnerChain(ctx, sub.QueryOwner()) + if err != nil { + return nil, fmt.Errorf("api subscription %d: %w", sub.ID, err) + } + return mapApiSubscriptionInfo(sub, app, team, group), nil +} + +// loadEventSubscriptionInfo loads the full owner chain for an event subscription and maps it to EventSubscriptionInfo. +func loadEventSubscriptionInfo(ctx context.Context, sub *ent.EventSubscription) (*model.EventSubscriptionInfo, error) { + app, team, group, err := loadOwnerChain(ctx, sub.QueryOwner()) + if err != nil { + return nil, fmt.Errorf("event subscription %d: %w", sub.ID, err) + } + return mapEventSubscriptionInfo(sub, app, team, group), nil +} + +// loadApiExposureInfo loads the full owner chain for an API exposure and maps it to ApiExposureInfo. +func loadApiExposureInfo(ctx context.Context, exposure *ent.ApiExposure) (*model.ApiExposureInfo, error) { + app, team, group, err := loadOwnerChain(ctx, exposure.QueryOwner()) + if err != nil { + return nil, fmt.Errorf("api exposure %d: %w", exposure.ID, err) + } + return mapApiExposureInfo(exposure, app, team, group), nil +} + +// loadEventExposureInfo loads the full owner chain for an event exposure and maps it to EventExposureInfo. +func loadEventExposureInfo(ctx context.Context, exposure *ent.EventExposure) (*model.EventExposureInfo, error) { + app, team, group, err := loadOwnerChain(ctx, exposure.QueryOwner()) + if err != nil { + return nil, fmt.Errorf("event exposure %d: %w", exposure.ID, err) + } + return mapEventExposureInfo(exposure, app, team, group), nil +} diff --git a/controlplane-api/internal/resolvers/mapper_test.go b/controlplane-api/internal/resolvers/mapper_test.go index d97aa463e..811d29bf3 100644 --- a/controlplane-api/internal/resolvers/mapper_test.go +++ b/controlplane-api/internal/resolvers/mapper_test.go @@ -7,14 +7,15 @@ package resolvers_test import ( "context" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "github.com/telekom/controlplane/controlplane-api/ent" "github.com/telekom/controlplane/controlplane-api/internal/resolvers" + "github.com/telekom/controlplane/controlplane-api/internal/service" "github.com/telekom/controlplane/controlplane-api/internal/testutil" "github.com/telekom/controlplane/controlplane-api/internal/viewer" "github.com/telekom/controlplane/controlplane-api/pkg/model" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) var _ = Describe("Subscriptions resolver (cross-tenant)", func() { @@ -26,7 +27,7 @@ var _ = Describe("Subscriptions resolver (cross-tenant)", func() { BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client) + r = resolvers.NewResolver(client, service.Services{}, nil) s = testutil.SeedStandard(client) }) @@ -63,7 +64,7 @@ var _ = Describe("Target resolver (cross-tenant)", func() { BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client) + r = resolvers.NewResolver(client, service.Services{}, nil) s = testutil.SeedStandard(client) }) @@ -93,7 +94,7 @@ var _ = Describe("Approval.APISubscription resolver (cross-tenant)", func() { BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client) + r = resolvers.NewResolver(client, service.Services{}, nil) s = testutil.SeedStandard(client) }) @@ -103,12 +104,14 @@ var _ = Describe("Approval.APISubscription resolver (cross-tenant)", func() { It("should return ApiSubscriptionInfo from an approval", func() { ctx := viewer.NewContext(testutil.AllowContext(), &viewer.Viewer{Admin: true}) - info, err := r.Approval().APISubscription(ctx, s.Approval) + info, err := r.Approval().Subscription(ctx, s.Approval) Expect(err).NotTo(HaveOccurred()) Expect(info).NotTo(BeNil()) - Expect(info.BasePath).To(Equal("/alpha")) - Expect(info.OwnerApplicationName).To(Equal("app-beta")) - Expect(info.OwnerTeam.Name).To(Equal("team-beta")) + apiInfo, ok := info.(*model.ApiSubscriptionInfo) + Expect(ok).To(BeTrue(), "expected ApiSubscriptionInfo union member") + Expect(apiInfo.BasePath).To(Equal("/alpha")) + Expect(apiInfo.OwnerApplicationName).To(Equal("app-beta")) + Expect(apiInfo.OwnerTeam.Name).To(Equal("team-beta")) }) }) @@ -121,7 +124,7 @@ var _ = Describe("ApprovalRequest.APISubscription resolver (cross-tenant)", func BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client) + r = resolvers.NewResolver(client, service.Services{}, nil) s = testutil.SeedStandard(client) }) @@ -131,17 +134,19 @@ var _ = Describe("ApprovalRequest.APISubscription resolver (cross-tenant)", func It("should return ApiSubscriptionInfo from an approval request", func() { ctx := viewer.NewContext(testutil.AllowContext(), &viewer.Viewer{Admin: true}) - info, err := r.ApprovalRequest().APISubscription(ctx, s.ApprovalRequest) + info, err := r.ApprovalRequest().Subscription(ctx, s.ApprovalRequest) Expect(err).NotTo(HaveOccurred()) Expect(info).NotTo(BeNil()) - Expect(info.BasePath).To(Equal("/alpha")) - Expect(info.OwnerApplicationName).To(Equal("app-beta")) - Expect(info.OwnerTeam.Name).To(Equal("team-beta")) + apiInfo, ok := info.(*model.ApiSubscriptionInfo) + Expect(ok).To(BeTrue(), "expected ApiSubscriptionInfo union member") + Expect(apiInfo.BasePath).To(Equal("/alpha")) + Expect(apiInfo.OwnerApplicationName).To(Equal("app-beta")) + Expect(apiInfo.OwnerTeam.Name).To(Equal("team-beta")) }) }) var _ = Describe("ApiExposureInfo resolvers", func() { - r := resolvers.NewResolver(nil) + r := resolvers.NewResolver(nil, service.Services{}, nil) It("should convert visibility string to enum", func() { v, err := r.ApiExposureInfo().Visibility(context.TODO(), &model.ApiExposureInfo{Visibility: "WORLD"}) @@ -166,8 +171,78 @@ var _ = Describe("ApiExposureInfo resolvers", func() { }) }) +var _ = Describe("EventExposure.Subscriptions resolver (cross-tenant)", func() { + var ( + client *ent.Client + r *resolvers.Resolver + s *testutil.SeedData + ) + + BeforeEach(func() { + client = testutil.NewTestClient(GinkgoT()) + r = resolvers.NewResolver(client, service.Services{}, nil) + s = testutil.SeedStandard(client) + }) + + AfterEach(func() { + client.Close() + }) + + It("should return EventSubscriptionInfo for an event exposure's subscriptions", func() { + ctx := viewer.NewContext(testutil.AllowContext(), &viewer.Viewer{Teams: []string{"team-alpha"}}) + subs, err := r.EventExposure().Subscriptions(ctx, s.EventExposureAlpha) + Expect(err).NotTo(HaveOccurred()) + Expect(subs).To(HaveLen(1)) + Expect(subs[0].EventType).To(Equal("order.created")) + Expect(subs[0].OwnerApplicationName).To(Equal("app-beta")) + Expect(subs[0].OwnerTeam).NotTo(BeNil()) + Expect(subs[0].OwnerTeam.Name).To(Equal("team-beta")) + Expect(subs[0].OwnerTeam.GroupName).To(Equal("group-b")) + }) +}) + +var _ = Describe("EventSubscription.Target resolver (cross-tenant)", func() { + var ( + client *ent.Client + r *resolvers.Resolver + s *testutil.SeedData + ) + + BeforeEach(func() { + client = testutil.NewTestClient(GinkgoT()) + r = resolvers.NewResolver(client, service.Services{}, nil) + s = testutil.SeedStandard(client) + }) + + AfterEach(func() { + client.Close() + }) + + It("should return EventExposureInfo for an event subscription's target", func() { + ctx := viewer.NewContext(testutil.AllowContext(), &viewer.Viewer{Teams: []string{"team-beta"}}) + info, err := r.EventSubscription().Target(ctx, s.EventSubscription) + Expect(err).NotTo(HaveOccurred()) + Expect(info).NotTo(BeNil()) + Expect(info.EventType).To(Equal("order.created")) + Expect(info.OwnerApplicationName).To(Equal("app-alpha")) + Expect(info.OwnerTeam).NotTo(BeNil()) + Expect(info.OwnerTeam.Name).To(Equal("team-alpha")) + Expect(info.OwnerTeam.GroupName).To(Equal("group-a")) + }) +}) + +var _ = Describe("EventExposureInfo.Visibility resolver", func() { + r := resolvers.NewResolver(nil, service.Services{}, nil) + + It("should convert visibility string to enum", func() { + v, err := r.EventExposureInfo().Visibility(context.TODO(), &model.EventExposureInfo{Visibility: "WORLD"}) + Expect(err).NotTo(HaveOccurred()) + Expect(string(v)).To(Equal("WORLD")) + }) +}) + var _ = Describe("ApiSubscriptionInfo.StatusPhase resolver", func() { - r := resolvers.NewResolver(nil) + r := resolvers.NewResolver(nil, service.Services{}, nil) It("should convert status phase string to enum", func() { sp := "SUBSCRIBED" diff --git a/controlplane-api/internal/resolvers/model/models.generated.go b/controlplane-api/internal/resolvers/model/models.generated.go index 4f7d7abb9..f20b4f12c 100644 --- a/controlplane-api/internal/resolvers/model/models.generated.go +++ b/controlplane-api/internal/resolvers/model/models.generated.go @@ -1,7 +1,6 @@ -// Copyright 2026 Deutsche Telekom IT GmbH +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. package model @@ -13,6 +12,11 @@ import ( "strconv" ) +// A subscription related to an approval — either an API or event subscription. +type SubscriptionInfo interface { + IsSubscriptionInfo() +} + type APIExposureFeature string const ( @@ -148,3 +152,64 @@ func (e ApprovalAction) MarshalJSON() ([]byte, error) { e.MarshalGQL(&buf) return buf.Bytes(), nil } + +type ErrorCode string + +const ( + ErrorCodeNotFound ErrorCode = "NOT_FOUND" + ErrorCodeForbidden ErrorCode = "FORBIDDEN" + ErrorCodeConflict ErrorCode = "CONFLICT" + ErrorCodeValidationFailed ErrorCode = "VALIDATION_FAILED" + ErrorCodePreconditionFailed ErrorCode = "PRECONDITION_FAILED" +) + +var AllErrorCode = []ErrorCode{ + ErrorCodeNotFound, + ErrorCodeForbidden, + ErrorCodeConflict, + ErrorCodeValidationFailed, + ErrorCodePreconditionFailed, +} + +func (e ErrorCode) IsValid() bool { + switch e { + case ErrorCodeNotFound, ErrorCodeForbidden, ErrorCodeConflict, ErrorCodeValidationFailed, ErrorCodePreconditionFailed: + return true + } + return false +} + +func (e ErrorCode) String() string { + return string(e) +} + +func (e *ErrorCode) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ErrorCode(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ErrorCode", str) + } + return nil +} + +func (e ErrorCode) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *ErrorCode) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e ErrorCode) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} diff --git a/controlplane-api/internal/resolvers/model/mutation_types.go b/controlplane-api/internal/resolvers/model/mutation_types.go index 1e20d249d..34bd42876 100644 --- a/controlplane-api/internal/resolvers/model/mutation_types.go +++ b/controlplane-api/internal/resolvers/model/mutation_types.go @@ -1,17 +1,28 @@ -// Copyright 2025 Deutsche Telekom IT GmbH +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 package model -// TeamMutationResult is the response type for team mutations. -type TeamMutationResult struct { - Success bool `json:"success"` - Message string `json:"message"` - Namespace *string `json:"namespace,omitempty"` - ResourceName *string `json:"resourceName,omitempty"` +import ( + "github.com/telekom/controlplane/controlplane-api/ent" +) + +// ────────────────────────────────────────────────────────────────────────────── +// Shared types +// ────────────────────────────────────────────────────────────────────────────── + +// MutationError represents a domain error returned in mutation payloads. +type MutationError struct { + Code ErrorCode `json:"code"` + Message string `json:"message"` + Field *string `json:"field,omitempty"` } +// ────────────────────────────────────────────────────────────────────────────── +// Input types +// ────────────────────────────────────────────────────────────────────────────── + // CreateTeamInput is the input for creating a new team. type CreateTeamInput struct { Environment string `json:"environment"` @@ -21,13 +32,10 @@ type CreateTeamInput struct { Members []MemberInput `json:"members"` } -// UpdateTeamInput is the input for updating an existing team. +// UpdateTeamInput is the input for updating team metadata. type UpdateTeamInput struct { - Environment string `json:"environment"` - Group string `json:"group"` - Name string `json:"name"` - Email *string `json:"email,omitempty"` - Members []MemberInput `json:"members,omitempty"` + TeamID int `json:"teamId"` + Email *string `json:"email,omitempty"` } // MemberInput represents a team member in mutation inputs. @@ -36,58 +44,74 @@ type MemberInput struct { Email string `json:"email"` } -// RotateApplicationSecretInput is the input for rotating an application's client secret. -type RotateApplicationSecretInput struct { - Environment string `json:"environment"` - Team string `json:"team"` - Name string `json:"name"` +// DecisionInput represents the decision for approval mutations. +type DecisionInput struct { + Action ApprovalAction `json:"action"` + Comment *string `json:"comment,omitempty"` } -// RotateApplicationSecretResult is the response type for application mutations. -type RotateApplicationSecretResult struct { - Success bool `json:"success"` - Message string `json:"message"` - Namespace *string `json:"namespace,omitempty"` - ResourceName *string `json:"resourceName,omitempty"` +// ────────────────────────────────────────────────────────────────────────────── +// Payload types — Team +// ────────────────────────────────────────────────────────────────────────────── + +// CreateTeamPayload is the response for createTeam. +type CreateTeamPayload struct { + Team *ent.Team `json:"team,omitempty"` + Accepted bool `json:"accepted"` + Errors []MutationError `json:"errors"` } -// RotateTeamTokenInput is the input for rotating a team's token. -type RotateTeamTokenInput struct { - Environment string `json:"environment"` - Group string `json:"group"` - Name string `json:"name"` +// UpdateTeamPayload is the response for updateTeam. +type UpdateTeamPayload struct { + Team *ent.Team `json:"team,omitempty"` + Accepted bool `json:"accepted"` + Errors []MutationError `json:"errors"` } -// DecisionInput represents the decision details for approval mutations. -type DecisionInput struct { - Name string `json:"name"` - Email string `json:"email"` - Comment *string `json:"comment,omitempty"` +// AddTeamMemberPayload is the response for addTeamMember. +type AddTeamMemberPayload struct { + Team *ent.Team `json:"team,omitempty"` + Errors []MutationError `json:"errors"` } -// DecideApprovalRequestInput is the input for deciding on an ApprovalRequest. -type DecideApprovalRequestInput struct { - Environment string `json:"environment"` - Team string `json:"team"` - Name string `json:"name"` - Action string `json:"action"` - Decision DecisionInput `json:"decision"` +// RemoveTeamMemberPayload is the response for removeTeamMember. +type RemoveTeamMemberPayload struct { + Team *ent.Team `json:"team,omitempty"` + Errors []MutationError `json:"errors"` } -// DecideApprovalInput is the input for deciding on an existing Approval. -type DecideApprovalInput struct { - Environment string `json:"environment"` - Team string `json:"team"` - Name string `json:"name"` - Action string `json:"action"` - Decision DecisionInput `json:"decision"` +// RotateTeamTokenPayload is the response for rotateTeamToken. +type RotateTeamTokenPayload struct { + Team *ent.Team `json:"team,omitempty"` + Accepted bool `json:"accepted"` + Errors []MutationError `json:"errors"` +} + +// ────────────────────────────────────────────────────────────────────────────── +// Payload types — Application +// ────────────────────────────────────────────────────────────────────────────── + +// RotateApplicationSecretPayload is the response for rotateApplicationSecret. +type RotateApplicationSecretPayload struct { + Application *ent.Application `json:"application,omitempty"` + Accepted bool `json:"accepted"` + Errors []MutationError `json:"errors"` +} + +// ────────────────────────────────────────────────────────────────────────────── +// Payload types — Approval +// ────────────────────────────────────────────────────────────────────────────── + +// DecideApprovalRequestPayload is the response for decideApprovalRequest. +type DecideApprovalRequestPayload struct { + ApprovalRequest *ent.ApprovalRequest `json:"approvalRequest,omitempty"` + Accepted bool `json:"accepted"` + Errors []MutationError `json:"errors"` } -// ApprovalMutationResult is the response type for approval mutations. -type ApprovalMutationResult struct { - Success bool `json:"success"` - Message string `json:"message"` - NewState *string `json:"newState,omitempty"` - Namespace *string `json:"namespace,omitempty"` - ResourceName *string `json:"resourceName,omitempty"` +// DecideApprovalPayload is the response for decideApproval. +type DecideApprovalPayload struct { + Approval *ent.Approval `json:"approval,omitempty"` + Accepted bool `json:"accepted"` + Errors []MutationError `json:"errors"` } diff --git a/controlplane-api/internal/resolvers/mutation.generated.go b/controlplane-api/internal/resolvers/mutation.generated.go index c36c68b32..a74e29793 100644 --- a/controlplane-api/internal/resolvers/mutation.generated.go +++ b/controlplane-api/internal/resolvers/mutation.generated.go @@ -8,11 +8,12 @@ package resolvers import ( "context" "errors" - "fmt" + "math" "strconv" "sync/atomic" "github.com/99designs/gqlgen/graphql" + "github.com/telekom/controlplane/controlplane-api/ent" "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" "github.com/vektah/gqlparser/v2/ast" ) @@ -20,29 +21,49 @@ import ( // region ************************** generated!.gotpl ************************** type MutationResolver interface { - CreateTeam(ctx context.Context, input model.CreateTeamInput) (*model.TeamMutationResult, error) - UpdateTeam(ctx context.Context, input model.UpdateTeamInput) (*model.TeamMutationResult, error) - RotateTeamToken(ctx context.Context, input model.RotateTeamTokenInput) (*model.TeamMutationResult, error) - RotateApplicationSecret(ctx context.Context, input model.RotateApplicationSecretInput) (*model.RotateApplicationSecretResult, error) - DecideApprovalRequest(ctx context.Context, input model.DecideApprovalRequestInput) (*model.ApprovalMutationResult, error) - DecideApproval(ctx context.Context, input model.DecideApprovalInput) (*model.ApprovalMutationResult, error) -} - -type DecideApprovalInputResolver interface { - Action(ctx context.Context, obj *model.DecideApprovalInput, data model.ApprovalAction) error -} -type DecideApprovalRequestInputResolver interface { - Action(ctx context.Context, obj *model.DecideApprovalRequestInput, data model.ApprovalAction) error + CreateTeam(ctx context.Context, input model.CreateTeamInput) (*model.CreateTeamPayload, error) + UpdateTeam(ctx context.Context, input model.UpdateTeamInput) (*model.UpdateTeamPayload, error) + AddTeamMember(ctx context.Context, teamID int, member model.MemberInput) (*model.AddTeamMemberPayload, error) + RemoveTeamMember(ctx context.Context, teamID int, memberEmail string) (*model.RemoveTeamMemberPayload, error) + RotateTeamToken(ctx context.Context, teamID int) (*model.RotateTeamTokenPayload, error) + RotateApplicationSecret(ctx context.Context, applicationID int) (*model.RotateApplicationSecretPayload, error) + DecideApprovalRequest(ctx context.Context, approvalRequestID int, input model.DecisionInput) (*model.DecideApprovalRequestPayload, error) + DecideApproval(ctx context.Context, approvalID int, input model.DecisionInput) (*model.DecideApprovalPayload, error) } // endregion ************************** generated!.gotpl ************************** // region ***************************** args.gotpl ***************************** +func (ec *executionContext) field_Mutation_addTeamMember_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "teamId", + func(ctx context.Context, v any) (int, error) { + return ec.unmarshalNID2int(ctx, v) + }) + if err != nil { + return nil, err + } + args["teamId"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "member", + func(ctx context.Context, v any) (model.MemberInput, error) { + return ec.unmarshalNMemberInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMemberInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["member"] = arg1 + return args, nil +} + func (ec *executionContext) field_Mutation_createTeam_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNCreateTeamInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐCreateTeamInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.CreateTeamInput, error) { + return ec.unmarshalNCreateTeamInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐCreateTeamInput(ctx, v) + }) if err != nil { return nil, err } @@ -53,51 +74,104 @@ func (ec *executionContext) field_Mutation_createTeam_args(ctx context.Context, func (ec *executionContext) field_Mutation_decideApprovalRequest_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNDecideApprovalRequestInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecideApprovalRequestInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "approvalRequestId", + func(ctx context.Context, v any) (int, error) { + return ec.unmarshalNID2int(ctx, v) + }) if err != nil { return nil, err } - args["input"] = arg0 + args["approvalRequestId"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.DecisionInput, error) { + return ec.unmarshalNDecisionInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecisionInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["input"] = arg1 return args, nil } func (ec *executionContext) field_Mutation_decideApproval_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNDecideApprovalInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecideApprovalInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "approvalId", + func(ctx context.Context, v any) (int, error) { + return ec.unmarshalNID2int(ctx, v) + }) if err != nil { return nil, err } - args["input"] = arg0 + args["approvalId"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.DecisionInput, error) { + return ec.unmarshalNDecisionInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecisionInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["input"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_removeTeamMember_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "teamId", + func(ctx context.Context, v any) (int, error) { + return ec.unmarshalNID2int(ctx, v) + }) + if err != nil { + return nil, err + } + args["teamId"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "memberEmail", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["memberEmail"] = arg1 return args, nil } func (ec *executionContext) field_Mutation_rotateApplicationSecret_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNRotateApplicationSecretInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateApplicationSecretInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "applicationId", + func(ctx context.Context, v any) (int, error) { + return ec.unmarshalNID2int(ctx, v) + }) if err != nil { return nil, err } - args["input"] = arg0 + args["applicationId"] = arg0 return args, nil } func (ec *executionContext) field_Mutation_rotateTeamToken_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNRotateTeamTokenInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateTeamTokenInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "teamId", + func(ctx context.Context, v any) (int, error) { + return ec.unmarshalNID2int(ctx, v) + }) if err != nil { return nil, err } - args["input"] = arg0 + args["teamId"] = arg0 return args, nil } func (ec *executionContext) field_Mutation_updateTeam_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", ec.unmarshalNUpdateTeamInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐUpdateTeamInput) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.UpdateTeamInput, error) { + return ec.unmarshalNUpdateTeamInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐUpdateTeamInput(ctx, v) + }) if err != nil { return nil, err } @@ -113,146 +187,326 @@ func (ec *executionContext) field_Mutation_updateTeam_args(ctx context.Context, // region **************************** field.gotpl ***************************** -func (ec *executionContext) _ApprovalMutationResult_success(ctx context.Context, field graphql.CollectedField, obj *model.ApprovalMutationResult) (ret graphql.Marshaler) { +func (ec *executionContext) _AddTeamMemberPayload_team(ctx context.Context, field graphql.CollectedField, obj *model.AddTeamMemberPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AddTeamMemberPayload_team(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Team, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Team) graphql.Marshaler { + return ec.marshalOTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_AddTeamMemberPayload_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AddTeamMemberPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Team(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _AddTeamMemberPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.AddTeamMemberPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalMutationResult_success, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AddTeamMemberPayload_errors(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Success, nil + return obj.Errors, nil }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v []model.MutationError) graphql.Marshaler { + return ec.marshalNMutationError2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationErrorᚄ(ctx, selections, v) + }, true, true, ) } +func (ec *executionContext) fieldContext_AddTeamMemberPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AddTeamMemberPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_MutationError(ctx, field) + }, + } + return fc, nil +} -func (ec *executionContext) fieldContext_ApprovalMutationResult_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _CreateTeamPayload_team(ctx context.Context, field graphql.CollectedField, obj *model.CreateTeamPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreateTeamPayload_team(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Team, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Team) graphql.Marshaler { + return ec.marshalOTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_CreateTeamPayload_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalMutationResult", + Object: "CreateTeamPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return ec.childFields_Team(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApprovalMutationResult_message(ctx context.Context, field graphql.CollectedField, obj *model.ApprovalMutationResult) (ret graphql.Marshaler) { +func (ec *executionContext) _CreateTeamPayload_accepted(ctx context.Context, field graphql.CollectedField, obj *model.CreateTeamPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalMutationResult_message, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreateTeamPayload_accepted(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Message, nil + return obj.Accepted, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, true, true, ) } +func (ec *executionContext) fieldContext_CreateTeamPayload_accepted(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("CreateTeamPayload", field, false, false, errors.New("field of type Boolean does not have child fields")) +} -func (ec *executionContext) fieldContext_ApprovalMutationResult_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _CreateTeamPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.CreateTeamPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreateTeamPayload_errors(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Errors, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []model.MutationError) graphql.Marshaler { + return ec.marshalNMutationError2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationErrorᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_CreateTeamPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalMutationResult", + Object: "CreateTeamPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_MutationError(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApprovalMutationResult_newState(ctx context.Context, field graphql.CollectedField, obj *model.ApprovalMutationResult) (ret graphql.Marshaler) { +func (ec *executionContext) _DecideApprovalPayload_approval(ctx context.Context, field graphql.CollectedField, obj *model.DecideApprovalPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalMutationResult_newState, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DecideApprovalPayload_approval(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.NewState, nil + return obj.Approval, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Approval) graphql.Marshaler { + return ec.marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_ApprovalMutationResult_newState(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_DecideApprovalPayload_approval(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalMutationResult", + Object: "DecideApprovalPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_Approval(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApprovalMutationResult_namespace(ctx context.Context, field graphql.CollectedField, obj *model.ApprovalMutationResult) (ret graphql.Marshaler) { +func (ec *executionContext) _DecideApprovalPayload_accepted(ctx context.Context, field graphql.CollectedField, obj *model.DecideApprovalPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalMutationResult_namespace, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DecideApprovalPayload_accepted(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Namespace, nil + return obj.Accepted, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, true, - false, ) } +func (ec *executionContext) fieldContext_DecideApprovalPayload_accepted(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("DecideApprovalPayload", field, false, false, errors.New("field of type Boolean does not have child fields")) +} -func (ec *executionContext) fieldContext_ApprovalMutationResult_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _DecideApprovalPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.DecideApprovalPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DecideApprovalPayload_errors(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Errors, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []model.MutationError) graphql.Marshaler { + return ec.marshalNMutationError2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationErrorᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_DecideApprovalPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalMutationResult", + Object: "DecideApprovalPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_MutationError(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApprovalMutationResult_resourceName(ctx context.Context, field graphql.CollectedField, obj *model.ApprovalMutationResult) (ret graphql.Marshaler) { +func (ec *executionContext) _DecideApprovalRequestPayload_approvalRequest(ctx context.Context, field graphql.CollectedField, obj *model.DecideApprovalRequestPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalMutationResult_resourceName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DecideApprovalRequestPayload_approvalRequest(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.ResourceName, nil + return obj.ApprovalRequest, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApprovalRequest) graphql.Marshaler { + return ec.marshalOApprovalRequest2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequest(ctx, selections, v) + }, true, false, ) } +func (ec *executionContext) fieldContext_DecideApprovalRequestPayload_approvalRequest(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DecideApprovalRequestPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_ApprovalRequest(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _DecideApprovalRequestPayload_accepted(ctx context.Context, field graphql.CollectedField, obj *model.DecideApprovalRequestPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DecideApprovalRequestPayload_accepted(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Accepted, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_DecideApprovalRequestPayload_accepted(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("DecideApprovalRequestPayload", field, false, false, errors.New("field of type Boolean does not have child fields")) +} -func (ec *executionContext) fieldContext_ApprovalMutationResult_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _DecideApprovalRequestPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.DecideApprovalRequestPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DecideApprovalRequestPayload_errors(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Errors, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []model.MutationError) graphql.Marshaler { + return ec.marshalNMutationError2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationErrorᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_DecideApprovalRequestPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalMutationResult", + Object: "DecideApprovalRequestPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_MutationError(ctx, field) }, } return fc, nil @@ -263,18 +517,21 @@ func (ec *executionContext) _Mutation_createTeam(ctx context.Context, field grap ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_createTeam, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_createTeam(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().CreateTeam(ctx, fc.Args["input"].(model.CreateTeamInput)) }, nil, - ec.marshalNTeamMutationResult2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐTeamMutationResult, + func(ctx context.Context, selections ast.SelectionSet, v *model.CreateTeamPayload) graphql.Marshaler { + return ec.marshalNCreateTeamPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐCreateTeamPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_createTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -282,17 +539,7 @@ func (ec *executionContext) fieldContext_Mutation_createTeam(ctx context.Context IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "success": - return ec.fieldContext_TeamMutationResult_success(ctx, field) - case "message": - return ec.fieldContext_TeamMutationResult_message(ctx, field) - case "namespace": - return ec.fieldContext_TeamMutationResult_namespace(ctx, field) - case "resourceName": - return ec.fieldContext_TeamMutationResult_resourceName(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TeamMutationResult", field.Name) + return ec.childFields_CreateTeamPayload(ctx, field) }, } defer func() { @@ -314,18 +561,21 @@ func (ec *executionContext) _Mutation_updateTeam(ctx context.Context, field grap ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_updateTeam, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_updateTeam(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return ec.Resolvers.Mutation().UpdateTeam(ctx, fc.Args["input"].(model.UpdateTeamInput)) }, nil, - ec.marshalNTeamMutationResult2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐTeamMutationResult, + func(ctx context.Context, selections ast.SelectionSet, v *model.UpdateTeamPayload) graphql.Marshaler { + return ec.marshalNUpdateTeamPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐUpdateTeamPayload(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Mutation_updateTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", @@ -333,17 +583,7 @@ func (ec *executionContext) fieldContext_Mutation_updateTeam(ctx context.Context IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "success": - return ec.fieldContext_TeamMutationResult_success(ctx, field) - case "message": - return ec.fieldContext_TeamMutationResult_message(ctx, field) - case "namespace": - return ec.fieldContext_TeamMutationResult_namespace(ctx, field) - case "resourceName": - return ec.fieldContext_TeamMutationResult_resourceName(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TeamMutationResult", field.Name) + return ec.childFields_UpdateTeamPayload(ctx, field) }, } defer func() { @@ -360,41 +600,34 @@ func (ec *executionContext) fieldContext_Mutation_updateTeam(ctx context.Context return fc, nil } -func (ec *executionContext) _Mutation_rotateTeamToken(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Mutation_addTeamMember(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_rotateTeamToken, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_addTeamMember(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Mutation().RotateTeamToken(ctx, fc.Args["input"].(model.RotateTeamTokenInput)) + return ec.Resolvers.Mutation().AddTeamMember(ctx, fc.Args["teamId"].(int), fc.Args["member"].(model.MemberInput)) }, nil, - ec.marshalNTeamMutationResult2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐTeamMutationResult, + func(ctx context.Context, selections ast.SelectionSet, v *model.AddTeamMemberPayload) graphql.Marshaler { + return ec.marshalNAddTeamMemberPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAddTeamMemberPayload(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Mutation_rotateTeamToken(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_addTeamMember(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "success": - return ec.fieldContext_TeamMutationResult_success(ctx, field) - case "message": - return ec.fieldContext_TeamMutationResult_message(ctx, field) - case "namespace": - return ec.fieldContext_TeamMutationResult_namespace(ctx, field) - case "resourceName": - return ec.fieldContext_TeamMutationResult_resourceName(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TeamMutationResult", field.Name) + return ec.childFields_AddTeamMemberPayload(ctx, field) }, } defer func() { @@ -404,48 +637,41 @@ func (ec *executionContext) fieldContext_Mutation_rotateTeamToken(ctx context.Co } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_rotateTeamToken_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_addTeamMember_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Mutation_rotateApplicationSecret(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Mutation_removeTeamMember(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_rotateApplicationSecret, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_removeTeamMember(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Mutation().RotateApplicationSecret(ctx, fc.Args["input"].(model.RotateApplicationSecretInput)) + return ec.Resolvers.Mutation().RemoveTeamMember(ctx, fc.Args["teamId"].(int), fc.Args["memberEmail"].(string)) }, nil, - ec.marshalNRotateApplicationSecretResult2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateApplicationSecretResult, + func(ctx context.Context, selections ast.SelectionSet, v *model.RemoveTeamMemberPayload) graphql.Marshaler { + return ec.marshalNRemoveTeamMemberPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRemoveTeamMemberPayload(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Mutation_rotateApplicationSecret(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_removeTeamMember(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "success": - return ec.fieldContext_RotateApplicationSecretResult_success(ctx, field) - case "message": - return ec.fieldContext_RotateApplicationSecretResult_message(ctx, field) - case "namespace": - return ec.fieldContext_RotateApplicationSecretResult_namespace(ctx, field) - case "resourceName": - return ec.fieldContext_RotateApplicationSecretResult_resourceName(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type RotateApplicationSecretResult", field.Name) + return ec.childFields_RemoveTeamMemberPayload(ctx, field) }, } defer func() { @@ -455,50 +681,41 @@ func (ec *executionContext) fieldContext_Mutation_rotateApplicationSecret(ctx co } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_rotateApplicationSecret_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_removeTeamMember_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Mutation_decideApprovalRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Mutation_rotateTeamToken(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_decideApprovalRequest, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_rotateTeamToken(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Mutation().DecideApprovalRequest(ctx, fc.Args["input"].(model.DecideApprovalRequestInput)) + return ec.Resolvers.Mutation().RotateTeamToken(ctx, fc.Args["teamId"].(int)) }, nil, - ec.marshalNApprovalMutationResult2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐApprovalMutationResult, + func(ctx context.Context, selections ast.SelectionSet, v *model.RotateTeamTokenPayload) graphql.Marshaler { + return ec.marshalNRotateTeamTokenPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateTeamTokenPayload(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Mutation_decideApprovalRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_rotateTeamToken(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "success": - return ec.fieldContext_ApprovalMutationResult_success(ctx, field) - case "message": - return ec.fieldContext_ApprovalMutationResult_message(ctx, field) - case "newState": - return ec.fieldContext_ApprovalMutationResult_newState(ctx, field) - case "namespace": - return ec.fieldContext_ApprovalMutationResult_namespace(ctx, field) - case "resourceName": - return ec.fieldContext_ApprovalMutationResult_resourceName(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApprovalMutationResult", field.Name) + return ec.childFields_RotateTeamTokenPayload(ctx, field) }, } defer func() { @@ -508,50 +725,41 @@ func (ec *executionContext) fieldContext_Mutation_decideApprovalRequest(ctx cont } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_decideApprovalRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_rotateTeamToken_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Mutation_decideApproval(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Mutation_rotateApplicationSecret(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Mutation_decideApproval, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_rotateApplicationSecret(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Mutation().DecideApproval(ctx, fc.Args["input"].(model.DecideApprovalInput)) + return ec.Resolvers.Mutation().RotateApplicationSecret(ctx, fc.Args["applicationId"].(int)) }, nil, - ec.marshalNApprovalMutationResult2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐApprovalMutationResult, + func(ctx context.Context, selections ast.SelectionSet, v *model.RotateApplicationSecretPayload) graphql.Marshaler { + return ec.marshalNRotateApplicationSecretPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateApplicationSecretPayload(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_Mutation_decideApproval(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_rotateApplicationSecret(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "success": - return ec.fieldContext_ApprovalMutationResult_success(ctx, field) - case "message": - return ec.fieldContext_ApprovalMutationResult_message(ctx, field) - case "newState": - return ec.fieldContext_ApprovalMutationResult_newState(ctx, field) - case "namespace": - return ec.fieldContext_ApprovalMutationResult_namespace(ctx, field) - case "resourceName": - return ec.fieldContext_ApprovalMutationResult_resourceName(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApprovalMutationResult", field.Name) + return ec.childFields_RotateApplicationSecretPayload(ctx, field) }, } defer func() { @@ -561,240 +769,490 @@ func (ec *executionContext) fieldContext_Mutation_decideApproval(ctx context.Con } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_decideApproval_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_rotateApplicationSecret_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _RotateApplicationSecretResult_success(ctx context.Context, field graphql.CollectedField, obj *model.RotateApplicationSecretResult) (ret graphql.Marshaler) { +func (ec *executionContext) _Mutation_decideApprovalRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RotateApplicationSecretResult_success, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_decideApprovalRequest(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Success, nil + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().DecideApprovalRequest(ctx, fc.Args["approvalRequestId"].(int), fc.Args["input"].(model.DecisionInput)) }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v *model.DecideApprovalRequestPayload) graphql.Marshaler { + return ec.marshalNDecideApprovalRequestPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecideApprovalRequestPayload(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_RotateApplicationSecretResult_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_decideApprovalRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RotateApplicationSecretResult", + Object: "Mutation", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return ec.childFields_DecideApprovalRequestPayload(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_decideApprovalRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _RotateApplicationSecretResult_message(ctx context.Context, field graphql.CollectedField, obj *model.RotateApplicationSecretResult) (ret graphql.Marshaler) { +func (ec *executionContext) _Mutation_decideApproval(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RotateApplicationSecretResult_message, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_decideApproval(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Message, nil + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().DecideApproval(ctx, fc.Args["approvalId"].(int), fc.Args["input"].(model.DecisionInput)) }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v *model.DecideApprovalPayload) graphql.Marshaler { + return ec.marshalNDecideApprovalPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecideApprovalPayload(ctx, selections, v) + }, true, true, ) } - -func (ec *executionContext) fieldContext_RotateApplicationSecretResult_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_decideApproval(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RotateApplicationSecretResult", + Object: "Mutation", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_DecideApprovalPayload(ctx, field) }, } - return fc, nil -} - -func (ec *executionContext) _RotateApplicationSecretResult_namespace(ctx context.Context, field graphql.CollectedField, obj *model.RotateApplicationSecretResult) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_RotateApplicationSecretResult_namespace, - func(ctx context.Context) (any, error) { - return obj.Namespace, nil - }, + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_decideApproval_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _MutationError_code(ctx context.Context, field graphql.CollectedField, obj *model.MutationError) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_MutationError_code(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Code, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v model.ErrorCode) graphql.Marshaler { + return ec.marshalNErrorCode2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐErrorCode(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_MutationError_code(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("MutationError", field, false, false, errors.New("field of type ErrorCode does not have child fields")) +} + +func (ec *executionContext) _MutationError_message(ctx context.Context, field graphql.CollectedField, obj *model.MutationError) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_MutationError_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_MutationError_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("MutationError", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _MutationError_field(ctx context.Context, field graphql.CollectedField, obj *model.MutationError) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_MutationError_field(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Field, nil + }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } +func (ec *executionContext) fieldContext_MutationError_field(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("MutationError", field, false, false, errors.New("field of type String does not have child fields")) +} -func (ec *executionContext) fieldContext_RotateApplicationSecretResult_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _RemoveTeamMemberPayload_team(ctx context.Context, field graphql.CollectedField, obj *model.RemoveTeamMemberPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RemoveTeamMemberPayload_team(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Team, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Team) graphql.Marshaler { + return ec.marshalOTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_RemoveTeamMemberPayload_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RotateApplicationSecretResult", + Object: "RemoveTeamMemberPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_Team(ctx, field) }, } return fc, nil } -func (ec *executionContext) _RotateApplicationSecretResult_resourceName(ctx context.Context, field graphql.CollectedField, obj *model.RotateApplicationSecretResult) (ret graphql.Marshaler) { +func (ec *executionContext) _RemoveTeamMemberPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.RemoveTeamMemberPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RotateApplicationSecretResult_resourceName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RemoveTeamMemberPayload_errors(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.ResourceName, nil + return obj.Errors, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v []model.MutationError) graphql.Marshaler { + return ec.marshalNMutationError2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationErrorᚄ(ctx, selections, v) + }, + true, true, - false, ) } +func (ec *executionContext) fieldContext_RemoveTeamMemberPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "RemoveTeamMemberPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_MutationError(ctx, field) + }, + } + return fc, nil +} -func (ec *executionContext) fieldContext_RotateApplicationSecretResult_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _RotateApplicationSecretPayload_application(ctx context.Context, field graphql.CollectedField, obj *model.RotateApplicationSecretPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RotateApplicationSecretPayload_application(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Application, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Application) graphql.Marshaler { + return ec.marshalOApplication2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplication(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_RotateApplicationSecretPayload_application(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RotateApplicationSecretResult", + Object: "RotateApplicationSecretPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_Application(ctx, field) }, } return fc, nil } -func (ec *executionContext) _TeamMutationResult_success(ctx context.Context, field graphql.CollectedField, obj *model.TeamMutationResult) (ret graphql.Marshaler) { +func (ec *executionContext) _RotateApplicationSecretPayload_accepted(ctx context.Context, field graphql.CollectedField, obj *model.RotateApplicationSecretPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RotateApplicationSecretPayload_accepted(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Accepted, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_RotateApplicationSecretPayload_accepted(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("RotateApplicationSecretPayload", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) _RotateApplicationSecretPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.RotateApplicationSecretPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TeamMutationResult_success, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RotateApplicationSecretPayload_errors(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Success, nil + return obj.Errors, nil }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v []model.MutationError) graphql.Marshaler { + return ec.marshalNMutationError2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationErrorᚄ(ctx, selections, v) + }, true, true, ) } +func (ec *executionContext) fieldContext_RotateApplicationSecretPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "RotateApplicationSecretPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_MutationError(ctx, field) + }, + } + return fc, nil +} -func (ec *executionContext) fieldContext_TeamMutationResult_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _RotateTeamTokenPayload_team(ctx context.Context, field graphql.CollectedField, obj *model.RotateTeamTokenPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RotateTeamTokenPayload_team(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Team, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Team) graphql.Marshaler { + return ec.marshalOTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_RotateTeamTokenPayload_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TeamMutationResult", + Object: "RotateTeamTokenPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return ec.childFields_Team(ctx, field) }, } return fc, nil } -func (ec *executionContext) _TeamMutationResult_message(ctx context.Context, field graphql.CollectedField, obj *model.TeamMutationResult) (ret graphql.Marshaler) { +func (ec *executionContext) _RotateTeamTokenPayload_accepted(ctx context.Context, field graphql.CollectedField, obj *model.RotateTeamTokenPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TeamMutationResult_message, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RotateTeamTokenPayload_accepted(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Message, nil + return obj.Accepted, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, true, true, ) } +func (ec *executionContext) fieldContext_RotateTeamTokenPayload_accepted(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("RotateTeamTokenPayload", field, false, false, errors.New("field of type Boolean does not have child fields")) +} -func (ec *executionContext) fieldContext_TeamMutationResult_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _RotateTeamTokenPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.RotateTeamTokenPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RotateTeamTokenPayload_errors(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Errors, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []model.MutationError) graphql.Marshaler { + return ec.marshalNMutationError2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationErrorᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_RotateTeamTokenPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TeamMutationResult", + Object: "RotateTeamTokenPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_MutationError(ctx, field) }, } return fc, nil } -func (ec *executionContext) _TeamMutationResult_namespace(ctx context.Context, field graphql.CollectedField, obj *model.TeamMutationResult) (ret graphql.Marshaler) { +func (ec *executionContext) _UpdateTeamPayload_team(ctx context.Context, field graphql.CollectedField, obj *model.UpdateTeamPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TeamMutationResult_namespace, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateTeamPayload_team(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Namespace, nil + return obj.Team, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *ent.Team) graphql.Marshaler { + return ec.marshalOTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam(ctx, selections, v) + }, true, false, ) } - -func (ec *executionContext) fieldContext_TeamMutationResult_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UpdateTeamPayload_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TeamMutationResult", + Object: "UpdateTeamPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_Team(ctx, field) }, } return fc, nil } -func (ec *executionContext) _TeamMutationResult_resourceName(ctx context.Context, field graphql.CollectedField, obj *model.TeamMutationResult) (ret graphql.Marshaler) { +func (ec *executionContext) _UpdateTeamPayload_accepted(ctx context.Context, field graphql.CollectedField, obj *model.UpdateTeamPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_TeamMutationResult_resourceName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateTeamPayload_accepted(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.ResourceName, nil + return obj.Accepted, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, true, - false, ) } +func (ec *executionContext) fieldContext_UpdateTeamPayload_accepted(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("UpdateTeamPayload", field, false, false, errors.New("field of type Boolean does not have child fields")) +} -func (ec *executionContext) fieldContext_TeamMutationResult_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _UpdateTeamPayload_errors(ctx context.Context, field graphql.CollectedField, obj *model.UpdateTeamPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_UpdateTeamPayload_errors(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Errors, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []model.MutationError) graphql.Marshaler { + return ec.marshalNMutationError2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationErrorᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_UpdateTeamPayload_errors(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TeamMutationResult", + Object: "UpdateTeamPayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_MutationError(ctx, field) }, } return fc, nil @@ -862,68 +1320,8 @@ func (ec *executionContext) unmarshalInputCreateTeamInput(ctx context.Context, o return it, nil } -func (ec *executionContext) unmarshalInputDecideApprovalInput(ctx context.Context, obj any) (model.DecideApprovalInput, error) { - var it model.DecideApprovalInput - if obj == nil { - return it, nil - } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"environment", "team", "name", "action", "decision"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "environment": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Environment = data - case "team": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("team")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Team = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "action": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) - data, err := ec.unmarshalNApprovalAction2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐApprovalAction(ctx, v) - if err != nil { - return it, err - } - if err = ec.Resolvers.DecideApprovalInput().Action(ctx, &it, data); err != nil { - return it, err - } - case "decision": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("decision")) - data, err := ec.unmarshalNDecisionInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecisionInput(ctx, v) - if err != nil { - return it, err - } - it.Decision = data - } - } - return it, nil -} - -func (ec *executionContext) unmarshalInputDecideApprovalRequestInput(ctx context.Context, obj any) (model.DecideApprovalRequestInput, error) { - var it model.DecideApprovalRequestInput +func (ec *executionContext) unmarshalInputDecisionInput(ctx context.Context, obj any) (model.DecisionInput, error) { + var it model.DecisionInput if obj == nil { return it, nil } @@ -933,87 +1331,20 @@ func (ec *executionContext) unmarshalInputDecideApprovalRequestInput(ctx context asMap[k] = v } - fieldsInOrder := [...]string{"environment", "team", "name", "action", "decision"} + fieldsInOrder := [...]string{"action", "comment"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "environment": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Environment = data - case "team": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("team")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Team = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data case "action": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) data, err := ec.unmarshalNApprovalAction2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐApprovalAction(ctx, v) if err != nil { return it, err } - if err = ec.Resolvers.DecideApprovalRequestInput().Action(ctx, &it, data); err != nil { - return it, err - } - case "decision": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("decision")) - data, err := ec.unmarshalNDecisionInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecisionInput(ctx, v) - if err != nil { - return it, err - } - it.Decision = data - } - } - return it, nil -} - -func (ec *executionContext) unmarshalInputDecisionInput(ctx context.Context, obj any) (model.DecisionInput, error) { - var it model.DecisionInput - if obj == nil { - return it, nil - } - - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"name", "email", "comment"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "email": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Email = data + it.Action = data case "comment": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("comment")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -1063,8 +1394,8 @@ func (ec *executionContext) unmarshalInputMemberInput(ctx context.Context, obj a return it, nil } -func (ec *executionContext) unmarshalInputRotateApplicationSecretInput(ctx context.Context, obj any) (model.RotateApplicationSecretInput, error) { - var it model.RotateApplicationSecretInput +func (ec *executionContext) unmarshalInputUpdateTeamInput(ctx context.Context, obj any) (model.UpdateTeamInput, error) { + var it model.UpdateTeamInput if obj == nil { return it, nil } @@ -1074,176 +1405,196 @@ func (ec *executionContext) unmarshalInputRotateApplicationSecretInput(ctx conte asMap[k] = v } - fieldsInOrder := [...]string{"environment", "team", "name"} + fieldsInOrder := [...]string{"teamId", "email"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "environment": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) - data, err := ec.unmarshalNString2string(ctx, v) + case "teamId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamId")) + data, err := ec.unmarshalNID2int(ctx, v) if err != nil { return it, err } - it.Environment = data - case "team": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("team")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Team = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) + it.TeamID = data + case "email": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Name = data + it.Email = data } } return it, nil } -func (ec *executionContext) unmarshalInputRotateTeamTokenInput(ctx context.Context, obj any) (model.RotateTeamTokenInput, error) { - var it model.RotateTeamTokenInput - if obj == nil { - return it, nil - } +// endregion **************************** input.gotpl ***************************** - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } +// region ************************** interface.gotpl *************************** - fieldsInOrder := [...]string{"environment", "group", "name"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "environment": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Environment = data - case "group": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("group")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Group = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var addTeamMemberPayloadImplementors = []string{"AddTeamMemberPayload"} + +func (ec *executionContext) _AddTeamMemberPayload(ctx context.Context, sel ast.SelectionSet, obj *model.AddTeamMemberPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, addTeamMemberPayloadImplementors) + + 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("AddTeamMemberPayload") + case "team": + out.Values[i] = ec._AddTeamMemberPayload_team(ctx, field, obj) + case "errors": + out.Values[i] = ec._AddTeamMemberPayload_errors(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Name = data + default: + panic("unknown field " + strconv.Quote(field.Name)) } } - return it, nil -} - -func (ec *executionContext) unmarshalInputUpdateTeamInput(ctx context.Context, obj any) (model.UpdateTeamInput, error) { - var it model.UpdateTeamInput - if obj == nil { - return it, nil + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null } - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) } - fieldsInOrder := [...]string{"environment", "group", "name", "email", "members"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "environment": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Environment = data - case "group": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("group")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Group = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "email": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + return out +} + +var createTeamPayloadImplementors = []string{"CreateTeamPayload"} + +func (ec *executionContext) _CreateTeamPayload(ctx context.Context, sel ast.SelectionSet, obj *model.CreateTeamPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, createTeamPayloadImplementors) + + 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("CreateTeamPayload") + case "team": + out.Values[i] = ec._CreateTeamPayload_team(ctx, field, obj) + case "accepted": + out.Values[i] = ec._CreateTeamPayload_accepted(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Email = data - case "members": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("members")) - data, err := ec.unmarshalOMemberInput2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMemberInputᚄ(ctx, v) - if err != nil { - return it, err + case "errors": + out.Values[i] = ec._CreateTeamPayload_errors(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Members = data + default: + panic("unknown field " + strconv.Quote(field.Name)) } } - return it, nil + 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 **************************** input.gotpl ***************************** +var decideApprovalPayloadImplementors = []string{"DecideApprovalPayload"} -// region ************************** interface.gotpl *************************** +func (ec *executionContext) _DecideApprovalPayload(ctx context.Context, sel ast.SelectionSet, obj *model.DecideApprovalPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, decideApprovalPayloadImplementors) -// endregion ************************** interface.gotpl *************************** + 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("DecideApprovalPayload") + case "approval": + out.Values[i] = ec._DecideApprovalPayload_approval(ctx, field, obj) + case "accepted": + out.Values[i] = ec._DecideApprovalPayload_accepted(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._DecideApprovalPayload_errors(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 + } -// region **************************** object.gotpl **************************** + 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 approvalMutationResultImplementors = []string{"ApprovalMutationResult"} +var decideApprovalRequestPayloadImplementors = []string{"DecideApprovalRequestPayload"} -func (ec *executionContext) _ApprovalMutationResult(ctx context.Context, sel ast.SelectionSet, obj *model.ApprovalMutationResult) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, approvalMutationResultImplementors) +func (ec *executionContext) _DecideApprovalRequestPayload(ctx context.Context, sel ast.SelectionSet, obj *model.DecideApprovalRequestPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, decideApprovalRequestPayloadImplementors) 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("ApprovalMutationResult") - case "success": - out.Values[i] = ec._ApprovalMutationResult_success(ctx, field, obj) + out.Values[i] = graphql.MarshalString("DecideApprovalRequestPayload") + case "approvalRequest": + out.Values[i] = ec._DecideApprovalRequestPayload_approvalRequest(ctx, field, obj) + case "accepted": + out.Values[i] = ec._DecideApprovalRequestPayload_accepted(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "message": - out.Values[i] = ec._ApprovalMutationResult_message(ctx, field, obj) + case "errors": + out.Values[i] = ec._DecideApprovalRequestPayload_errors(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "newState": - out.Values[i] = ec._ApprovalMutationResult_newState(ctx, field, obj) - case "namespace": - out.Values[i] = ec._ApprovalMutationResult_namespace(ctx, field, obj) - case "resourceName": - out.Values[i] = ec._ApprovalMutationResult_resourceName(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -1253,7 +1604,7 @@ func (ec *executionContext) _ApprovalMutationResult(ctx context.Context, sel ast return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1300,6 +1651,20 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "addTeamMember": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_addTeamMember(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "removeTeamMember": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_removeTeamMember(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "rotateTeamToken": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_rotateTeamToken(ctx, field) @@ -1337,7 +1702,7 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1351,31 +1716,29 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return out } -var rotateApplicationSecretResultImplementors = []string{"RotateApplicationSecretResult"} +var mutationErrorImplementors = []string{"MutationError"} -func (ec *executionContext) _RotateApplicationSecretResult(ctx context.Context, sel ast.SelectionSet, obj *model.RotateApplicationSecretResult) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, rotateApplicationSecretResultImplementors) +func (ec *executionContext) _MutationError(ctx context.Context, sel ast.SelectionSet, obj *model.MutationError) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationErrorImplementors) 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("RotateApplicationSecretResult") - case "success": - out.Values[i] = ec._RotateApplicationSecretResult_success(ctx, field, obj) + out.Values[i] = graphql.MarshalString("MutationError") + case "code": + out.Values[i] = ec._MutationError_code(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "message": - out.Values[i] = ec._RotateApplicationSecretResult_message(ctx, field, obj) + out.Values[i] = ec._MutationError_message(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "namespace": - out.Values[i] = ec._RotateApplicationSecretResult_namespace(ctx, field, obj) - case "resourceName": - out.Values[i] = ec._RotateApplicationSecretResult_resourceName(ctx, field, obj) + case "field": + out.Values[i] = ec._MutationError_field(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -1385,7 +1748,7 @@ func (ec *executionContext) _RotateApplicationSecretResult(ctx context.Context, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1399,31 +1762,162 @@ func (ec *executionContext) _RotateApplicationSecretResult(ctx context.Context, return out } -var teamMutationResultImplementors = []string{"TeamMutationResult"} +var removeTeamMemberPayloadImplementors = []string{"RemoveTeamMemberPayload"} -func (ec *executionContext) _TeamMutationResult(ctx context.Context, sel ast.SelectionSet, obj *model.TeamMutationResult) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, teamMutationResultImplementors) +func (ec *executionContext) _RemoveTeamMemberPayload(ctx context.Context, sel ast.SelectionSet, obj *model.RemoveTeamMemberPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, removeTeamMemberPayloadImplementors) 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("TeamMutationResult") - case "success": - out.Values[i] = ec._TeamMutationResult_success(ctx, field, obj) + out.Values[i] = graphql.MarshalString("RemoveTeamMemberPayload") + case "team": + out.Values[i] = ec._RemoveTeamMemberPayload_team(ctx, field, obj) + case "errors": + out.Values[i] = ec._RemoveTeamMemberPayload_errors(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "message": - out.Values[i] = ec._TeamMutationResult_message(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var rotateApplicationSecretPayloadImplementors = []string{"RotateApplicationSecretPayload"} + +func (ec *executionContext) _RotateApplicationSecretPayload(ctx context.Context, sel ast.SelectionSet, obj *model.RotateApplicationSecretPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, rotateApplicationSecretPayloadImplementors) + + 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("RotateApplicationSecretPayload") + case "application": + out.Values[i] = ec._RotateApplicationSecretPayload_application(ctx, field, obj) + case "accepted": + out.Values[i] = ec._RotateApplicationSecretPayload_accepted(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._RotateApplicationSecretPayload_errors(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 rotateTeamTokenPayloadImplementors = []string{"RotateTeamTokenPayload"} + +func (ec *executionContext) _RotateTeamTokenPayload(ctx context.Context, sel ast.SelectionSet, obj *model.RotateTeamTokenPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, rotateTeamTokenPayloadImplementors) + + 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("RotateTeamTokenPayload") + case "team": + out.Values[i] = ec._RotateTeamTokenPayload_team(ctx, field, obj) + case "accepted": + out.Values[i] = ec._RotateTeamTokenPayload_accepted(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._RotateTeamTokenPayload_errors(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 updateTeamPayloadImplementors = []string{"UpdateTeamPayload"} + +func (ec *executionContext) _UpdateTeamPayload(ctx context.Context, sel ast.SelectionSet, obj *model.UpdateTeamPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updateTeamPayloadImplementors) + + 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("UpdateTeamPayload") + case "team": + out.Values[i] = ec._UpdateTeamPayload_team(ctx, field, obj) + case "accepted": + out.Values[i] = ec._UpdateTeamPayload_accepted(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "errors": + out.Values[i] = ec._UpdateTeamPayload_errors(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "namespace": - out.Values[i] = ec._TeamMutationResult_namespace(ctx, field, obj) - case "resourceName": - out.Values[i] = ec._TeamMutationResult_resourceName(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -1433,7 +1927,7 @@ func (ec *executionContext) _TeamMutationResult(ctx context.Context, sel ast.Sel return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1451,18 +1945,18 @@ func (ec *executionContext) _TeamMutationResult(ctx context.Context, sel ast.Sel // region ***************************** type.gotpl ***************************** -func (ec *executionContext) marshalNApprovalMutationResult2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐApprovalMutationResult(ctx context.Context, sel ast.SelectionSet, v model.ApprovalMutationResult) graphql.Marshaler { - return ec._ApprovalMutationResult(ctx, sel, &v) +func (ec *executionContext) marshalNAddTeamMemberPayload2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAddTeamMemberPayload(ctx context.Context, sel ast.SelectionSet, v model.AddTeamMemberPayload) graphql.Marshaler { + return ec._AddTeamMemberPayload(ctx, sel, &v) } -func (ec *executionContext) marshalNApprovalMutationResult2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐApprovalMutationResult(ctx context.Context, sel ast.SelectionSet, v *model.ApprovalMutationResult) graphql.Marshaler { +func (ec *executionContext) marshalNAddTeamMemberPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAddTeamMemberPayload(ctx context.Context, sel ast.SelectionSet, v *model.AddTeamMemberPayload) 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._ApprovalMutationResult(ctx, sel, v) + return ec._AddTeamMemberPayload(ctx, sel, v) } func (ec *executionContext) unmarshalNCreateTeamInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐCreateTeamInput(ctx context.Context, v any) (model.CreateTeamInput, error) { @@ -1470,14 +1964,46 @@ func (ec *executionContext) unmarshalNCreateTeamInput2githubᚗcomᚋtelekomᚋc return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalNDecideApprovalInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecideApprovalInput(ctx context.Context, v any) (model.DecideApprovalInput, error) { - res, err := ec.unmarshalInputDecideApprovalInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) marshalNCreateTeamPayload2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐCreateTeamPayload(ctx context.Context, sel ast.SelectionSet, v model.CreateTeamPayload) graphql.Marshaler { + return ec._CreateTeamPayload(ctx, sel, &v) } -func (ec *executionContext) unmarshalNDecideApprovalRequestInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecideApprovalRequestInput(ctx context.Context, v any) (model.DecideApprovalRequestInput, error) { - res, err := ec.unmarshalInputDecideApprovalRequestInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) marshalNCreateTeamPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐCreateTeamPayload(ctx context.Context, sel ast.SelectionSet, v *model.CreateTeamPayload) 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._CreateTeamPayload(ctx, sel, v) +} + +func (ec *executionContext) marshalNDecideApprovalPayload2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecideApprovalPayload(ctx context.Context, sel ast.SelectionSet, v model.DecideApprovalPayload) graphql.Marshaler { + return ec._DecideApprovalPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDecideApprovalPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecideApprovalPayload(ctx context.Context, sel ast.SelectionSet, v *model.DecideApprovalPayload) 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._DecideApprovalPayload(ctx, sel, v) +} + +func (ec *executionContext) marshalNDecideApprovalRequestPayload2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecideApprovalRequestPayload(ctx context.Context, sel ast.SelectionSet, v model.DecideApprovalRequestPayload) graphql.Marshaler { + return ec._DecideApprovalRequestPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDecideApprovalRequestPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecideApprovalRequestPayload(ctx context.Context, sel ast.SelectionSet, v *model.DecideApprovalRequestPayload) 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._DecideApprovalRequestPayload(ctx, sel, v) } func (ec *executionContext) unmarshalNDecisionInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐDecisionInput(ctx context.Context, v any) (model.DecisionInput, error) { @@ -1485,6 +2011,16 @@ func (ec *executionContext) unmarshalNDecisionInput2githubᚗcomᚋtelekomᚋcon return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNErrorCode2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐErrorCode(ctx context.Context, v any) (model.ErrorCode, error) { + var res model.ErrorCode + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNErrorCode2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐErrorCode(ctx context.Context, sel ast.SelectionSet, v model.ErrorCode) graphql.Marshaler { + return v +} + func (ec *executionContext) unmarshalNMemberInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMemberInput(ctx context.Context, v any) (model.MemberInput, error) { res, err := ec.unmarshalInputMemberInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -1505,42 +2041,66 @@ func (ec *executionContext) unmarshalNMemberInput2ᚕgithubᚗcomᚋtelekomᚋco return res, nil } -func (ec *executionContext) unmarshalNRotateApplicationSecretInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateApplicationSecretInput(ctx context.Context, v any) (model.RotateApplicationSecretInput, error) { - res, err := ec.unmarshalInputRotateApplicationSecretInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) marshalNMutationError2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationError(ctx context.Context, sel ast.SelectionSet, v model.MutationError) graphql.Marshaler { + return ec._MutationError(ctx, sel, &v) } -func (ec *executionContext) marshalNRotateApplicationSecretResult2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateApplicationSecretResult(ctx context.Context, sel ast.SelectionSet, v model.RotateApplicationSecretResult) graphql.Marshaler { - return ec._RotateApplicationSecretResult(ctx, sel, &v) +func (ec *executionContext) marshalNMutationError2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationErrorᚄ(ctx context.Context, sel ast.SelectionSet, v []model.MutationError) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNMutationError2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMutationError(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNRemoveTeamMemberPayload2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRemoveTeamMemberPayload(ctx context.Context, sel ast.SelectionSet, v model.RemoveTeamMemberPayload) graphql.Marshaler { + return ec._RemoveTeamMemberPayload(ctx, sel, &v) } -func (ec *executionContext) marshalNRotateApplicationSecretResult2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateApplicationSecretResult(ctx context.Context, sel ast.SelectionSet, v *model.RotateApplicationSecretResult) graphql.Marshaler { +func (ec *executionContext) marshalNRemoveTeamMemberPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRemoveTeamMemberPayload(ctx context.Context, sel ast.SelectionSet, v *model.RemoveTeamMemberPayload) 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._RotateApplicationSecretResult(ctx, sel, v) + return ec._RemoveTeamMemberPayload(ctx, sel, v) } -func (ec *executionContext) unmarshalNRotateTeamTokenInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateTeamTokenInput(ctx context.Context, v any) (model.RotateTeamTokenInput, error) { - res, err := ec.unmarshalInputRotateTeamTokenInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) marshalNRotateApplicationSecretPayload2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateApplicationSecretPayload(ctx context.Context, sel ast.SelectionSet, v model.RotateApplicationSecretPayload) graphql.Marshaler { + return ec._RotateApplicationSecretPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNRotateApplicationSecretPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateApplicationSecretPayload(ctx context.Context, sel ast.SelectionSet, v *model.RotateApplicationSecretPayload) 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._RotateApplicationSecretPayload(ctx, sel, v) } -func (ec *executionContext) marshalNTeamMutationResult2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐTeamMutationResult(ctx context.Context, sel ast.SelectionSet, v model.TeamMutationResult) graphql.Marshaler { - return ec._TeamMutationResult(ctx, sel, &v) +func (ec *executionContext) marshalNRotateTeamTokenPayload2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateTeamTokenPayload(ctx context.Context, sel ast.SelectionSet, v model.RotateTeamTokenPayload) graphql.Marshaler { + return ec._RotateTeamTokenPayload(ctx, sel, &v) } -func (ec *executionContext) marshalNTeamMutationResult2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐTeamMutationResult(ctx context.Context, sel ast.SelectionSet, v *model.TeamMutationResult) graphql.Marshaler { +func (ec *executionContext) marshalNRotateTeamTokenPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐRotateTeamTokenPayload(ctx context.Context, sel ast.SelectionSet, v *model.RotateTeamTokenPayload) 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._TeamMutationResult(ctx, sel, v) + return ec._RotateTeamTokenPayload(ctx, sel, v) } func (ec *executionContext) unmarshalNUpdateTeamInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐUpdateTeamInput(ctx context.Context, v any) (model.UpdateTeamInput, error) { @@ -1548,22 +2108,18 @@ func (ec *executionContext) unmarshalNUpdateTeamInput2githubᚗcomᚋtelekomᚋc return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOMemberInput2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMemberInputᚄ(ctx context.Context, v any) ([]model.MemberInput, error) { +func (ec *executionContext) marshalNUpdateTeamPayload2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐUpdateTeamPayload(ctx context.Context, sel ast.SelectionSet, v model.UpdateTeamPayload) graphql.Marshaler { + return ec._UpdateTeamPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUpdateTeamPayload2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐUpdateTeamPayload(ctx context.Context, sel ast.SelectionSet, v *model.UpdateTeamPayload) graphql.Marshaler { if v == nil { - return nil, nil - } - var vSlice []any - vSlice = graphql.CoerceList(v) - var err error - res := make([]model.MemberInput, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNMemberInput2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐMemberInput(ctx, vSlice[i]) - if err != nil { - return nil, err + 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 res, nil + return ec._UpdateTeamPayload(ctx, sel, v) } // endregion ***************************** type.gotpl ***************************** diff --git a/controlplane-api/internal/resolvers/mutation.resolvers.go b/controlplane-api/internal/resolvers/mutation.resolvers.go index e12eadeca..baf0d0e86 100644 --- a/controlplane-api/internal/resolvers/mutation.resolvers.go +++ b/controlplane-api/internal/resolvers/mutation.resolvers.go @@ -6,88 +6,260 @@ package resolvers // This file will be automatically regenerated based on the schema, any resolver // implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.88 +// Code generated by github.com/99designs/gqlgen version v0.17.90 import ( "context" "fmt" + "github.com/telekom/controlplane/controlplane-api/ent" "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" ) // CreateTeam is the resolver for the createTeam field. -func (r *mutationResolver) CreateTeam(ctx context.Context, input model.CreateTeamInput) (*model.TeamMutationResult, error) { +func (r *mutationResolver) CreateTeam(ctx context.Context, input model.CreateTeamInput) (*model.CreateTeamPayload, error) { if r.services.Team == nil { - return nil, fmt.Errorf("mutations are not enabled: Kubernetes integration is disabled") + return &model.CreateTeamPayload{ + Errors: []model.MutationError{mutationsDisabledError()}, + }, nil } - return r.services.Team.CreateTeam(ctx, input) + + payload, err := r.services.Team.CreateTeam(ctx, input) + if err != nil { + return nil, fmt.Errorf("creating team: %w", err) + } + if payload == nil { + return nil, fmt.Errorf("creating team: service returned nil payload") + } + + return payload, nil } // UpdateTeam is the resolver for the updateTeam field. -func (r *mutationResolver) UpdateTeam(ctx context.Context, input model.UpdateTeamInput) (*model.TeamMutationResult, error) { +func (r *mutationResolver) UpdateTeam(ctx context.Context, input model.UpdateTeamInput) (*model.UpdateTeamPayload, error) { if r.services.Team == nil { - return nil, fmt.Errorf("mutations are not enabled: Kubernetes integration is disabled") + return &model.UpdateTeamPayload{ + Errors: []model.MutationError{mutationsDisabledError()}, + }, nil + } + + t, ref, err := r.resolveTeamRef(ctx, input.TeamID) + if err != nil { + if ent.IsNotFound(err) { + return &model.UpdateTeamPayload{ + Errors: []model.MutationError{notFoundMutationError("team not found")}, + }, nil + } + return nil, fmt.Errorf("resolving team reference: %w", err) + } + + payload, err := r.services.Team.UpdateTeam(ctx, ref, input) + if err != nil { + return nil, fmt.Errorf("updating team: %w", err) + } + if payload == nil { + return nil, fmt.Errorf("updating team: service returned nil payload") + } + if len(payload.Errors) == 0 { + payload.Team = t + } + + return payload, nil +} + +// AddTeamMember is the resolver for the addTeamMember field. +func (r *mutationResolver) AddTeamMember(ctx context.Context, teamID int, member model.MemberInput) (*model.AddTeamMemberPayload, error) { + if r.services.Team == nil { + return &model.AddTeamMemberPayload{ + Errors: []model.MutationError{mutationsDisabledError()}, + }, nil + } + + t, ref, err := r.resolveTeamRef(ctx, teamID) + if err != nil { + if ent.IsNotFound(err) { + return &model.AddTeamMemberPayload{ + Errors: []model.MutationError{notFoundMutationError("team not found")}, + }, nil + } + return nil, fmt.Errorf("resolving team reference: %w", err) } - return r.services.Team.UpdateTeam(ctx, input) + + payload, err := r.services.Team.AddTeamMember(ctx, ref, member) + if err != nil { + return nil, fmt.Errorf("adding team member: %w", err) + } + if payload == nil { + return nil, fmt.Errorf("adding team member: service returned nil payload") + } + if len(payload.Errors) == 0 { + payload.Team = t + } + + return payload, nil +} + +// RemoveTeamMember is the resolver for the removeTeamMember field. +func (r *mutationResolver) RemoveTeamMember(ctx context.Context, teamID int, memberEmail string) (*model.RemoveTeamMemberPayload, error) { + if r.services.Team == nil { + return &model.RemoveTeamMemberPayload{ + Errors: []model.MutationError{mutationsDisabledError()}, + }, nil + } + + t, ref, err := r.resolveTeamRef(ctx, teamID) + if err != nil { + if ent.IsNotFound(err) { + return &model.RemoveTeamMemberPayload{ + Errors: []model.MutationError{notFoundMutationError("team not found")}, + }, nil + } + return nil, fmt.Errorf("resolving team reference: %w", err) + } + + payload, err := r.services.Team.RemoveTeamMember(ctx, ref, memberEmail) + if err != nil { + return nil, fmt.Errorf("removing team member: %w", err) + } + if payload == nil { + return nil, fmt.Errorf("removing team member: service returned nil payload") + } + if len(payload.Errors) == 0 { + payload.Team = t + } + + return payload, nil } // RotateTeamToken is the resolver for the rotateTeamToken field. -func (r *mutationResolver) RotateTeamToken(ctx context.Context, input model.RotateTeamTokenInput) (*model.TeamMutationResult, error) { +func (r *mutationResolver) RotateTeamToken(ctx context.Context, teamID int) (*model.RotateTeamTokenPayload, error) { if r.services.Team == nil { - return nil, fmt.Errorf("mutations are not enabled: Kubernetes integration is disabled") + return &model.RotateTeamTokenPayload{ + Errors: []model.MutationError{mutationsDisabledError()}, + }, nil } - return r.services.Team.RotateTeamToken(ctx, input) + + t, ref, err := r.resolveTeamRef(ctx, teamID) + if err != nil { + if ent.IsNotFound(err) { + return &model.RotateTeamTokenPayload{ + Errors: []model.MutationError{notFoundMutationError("team not found")}, + }, nil + } + return nil, fmt.Errorf("resolving team reference: %w", err) + } + + payload, err := r.services.Team.RotateTeamToken(ctx, ref) + if err != nil { + return nil, fmt.Errorf("rotating team token: %w", err) + } + if payload == nil { + return nil, fmt.Errorf("rotating team token: service returned nil payload") + } + if len(payload.Errors) == 0 { + payload.Team = t + } + + return payload, nil } // RotateApplicationSecret is the resolver for the rotateApplicationSecret field. -func (r *mutationResolver) RotateApplicationSecret(ctx context.Context, input model.RotateApplicationSecretInput) (*model.RotateApplicationSecretResult, error) { +func (r *mutationResolver) RotateApplicationSecret(ctx context.Context, applicationID int) (*model.RotateApplicationSecretPayload, error) { if r.services.Application == nil { - return nil, fmt.Errorf("mutations are not enabled: Kubernetes integration is disabled") + return &model.RotateApplicationSecretPayload{ + Errors: []model.MutationError{mutationsDisabledError()}, + }, nil + } + + app, ref, err := r.resolveApplicationRef(ctx, applicationID) + if err != nil { + if ent.IsNotFound(err) { + return &model.RotateApplicationSecretPayload{ + Errors: []model.MutationError{notFoundMutationError("application not found")}, + }, nil + } + return nil, fmt.Errorf("resolving application reference: %w", err) + } + + payload, err := r.services.Application.RotateApplicationSecret(ctx, ref) + if err != nil { + return nil, fmt.Errorf("rotating application secret: %w", err) + } + if payload == nil { + return nil, fmt.Errorf("rotating application secret: service returned nil payload") } - return r.services.Application.RotateApplicationSecret(ctx, input) + if len(payload.Errors) == 0 { + payload.Application = app + } + + return payload, nil } // DecideApprovalRequest is the resolver for the decideApprovalRequest field. -func (r *mutationResolver) DecideApprovalRequest(ctx context.Context, input model.DecideApprovalRequestInput) (*model.ApprovalMutationResult, error) { +func (r *mutationResolver) DecideApprovalRequest(ctx context.Context, approvalRequestID int, input model.DecisionInput) (*model.DecideApprovalRequestPayload, error) { if r.services.Approval == nil { - return nil, fmt.Errorf("mutations are not enabled: Kubernetes integration is disabled") + return &model.DecideApprovalRequestPayload{ + Errors: []model.MutationError{mutationsDisabledError()}, + }, nil + } + + ar, ref, err := r.resolveApprovalRequestRef(ctx, approvalRequestID) + if err != nil { + if ent.IsNotFound(err) { + return &model.DecideApprovalRequestPayload{ + Errors: []model.MutationError{notFoundMutationError("approval request not found")}, + }, nil + } + return nil, fmt.Errorf("resolving approval request reference: %w", err) } - return r.services.Approval.DecideApprovalRequest(ctx, input) + + payload, err := r.services.Approval.DecideApprovalRequest(ctx, ref, input) + if err != nil { + return nil, fmt.Errorf("deciding approval request: %w", err) + } + if payload == nil { + return nil, fmt.Errorf("deciding approval request: service returned nil payload") + } + if len(payload.Errors) == 0 { + payload.ApprovalRequest = ar + } + + return payload, nil } // DecideApproval is the resolver for the decideApproval field. -func (r *mutationResolver) DecideApproval(ctx context.Context, input model.DecideApprovalInput) (*model.ApprovalMutationResult, error) { +func (r *mutationResolver) DecideApproval(ctx context.Context, approvalID int, input model.DecisionInput) (*model.DecideApprovalPayload, error) { if r.services.Approval == nil { - return nil, fmt.Errorf("mutations are not enabled: Kubernetes integration is disabled") + return &model.DecideApprovalPayload{ + Errors: []model.MutationError{mutationsDisabledError()}, + }, nil } - return r.services.Approval.DecideApproval(ctx, input) -} -// Action is the resolver for the action field. -func (r *decideApprovalInputResolver) Action(ctx context.Context, obj *model.DecideApprovalInput, data model.ApprovalAction) error { - obj.Action = string(data) - return nil -} + a, ref, err := r.resolveApprovalRef(ctx, approvalID) + if err != nil { + if ent.IsNotFound(err) { + return &model.DecideApprovalPayload{ + Errors: []model.MutationError{notFoundMutationError("approval not found")}, + }, nil + } + return nil, fmt.Errorf("resolving approval reference: %w", err) + } -// Action is the resolver for the action field. -func (r *decideApprovalRequestInputResolver) Action(ctx context.Context, obj *model.DecideApprovalRequestInput, data model.ApprovalAction) error { - obj.Action = string(data) - return nil + payload, err := r.services.Approval.DecideApproval(ctx, ref, input) + if err != nil { + return nil, fmt.Errorf("deciding approval: %w", err) + } + if payload == nil { + return nil, fmt.Errorf("deciding approval: service returned nil payload") + } + if len(payload.Errors) == 0 { + payload.Approval = a + } + + return payload, nil } // Mutation returns MutationResolver implementation. func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } -// DecideApprovalInput returns DecideApprovalInputResolver implementation. -func (r *Resolver) DecideApprovalInput() DecideApprovalInputResolver { - return &decideApprovalInputResolver{r} -} - -// DecideApprovalRequestInput returns DecideApprovalRequestInputResolver implementation. -func (r *Resolver) DecideApprovalRequestInput() DecideApprovalRequestInputResolver { - return &decideApprovalRequestInputResolver{r} -} - type mutationResolver struct{ *Resolver } -type decideApprovalInputResolver struct{ *Resolver } -type decideApprovalRequestInputResolver struct{ *Resolver } diff --git a/controlplane-api/internal/resolvers/mutation_helpers.go b/controlplane-api/internal/resolvers/mutation_helpers.go new file mode 100644 index 000000000..367786b83 --- /dev/null +++ b/controlplane-api/internal/resolvers/mutation_helpers.go @@ -0,0 +1,113 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package resolvers + +import ( + "context" + "fmt" + + "github.com/telekom/controlplane/controlplane-api/ent" + "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" + "github.com/telekom/controlplane/controlplane-api/internal/service" +) + +// mutationsDisabledError returns a MutationError indicating that mutations +// are disabled (the corresponding service is nil). +func mutationsDisabledError() model.MutationError { + return model.MutationError{ + Code: model.ErrorCodePreconditionFailed, + Message: "mutations are disabled", + } +} + +// notFoundMutationError returns a MutationError for a not-found resource. +func notFoundMutationError(msg string) model.MutationError { + return model.MutationError{ + Code: model.ErrorCodeNotFound, + Message: msg, + } +} + +// resolveTeamRef looks up a Team by its ent ID and builds a ResourceRef +// that the service layer needs for Kubernetes operations. +func (r *mutationResolver) resolveTeamRef(ctx context.Context, teamID int) (*ent.Team, service.ResourceRef, error) { + t, err := r.client.Team.Get(ctx, teamID) + if err != nil { + return nil, service.ResourceRef{}, fmt.Errorf("getting team: %w", err) + } + + group, err := t.QueryGroup().Only(ctx) + if err != nil { + return nil, service.ResourceRef{}, fmt.Errorf("getting team group: %w", err) + } + + ref := service.ResourceRef{ + Namespace: t.Namespace, + Name: t.Name, + Group: group.Name, + TeamName: t.Name, + } + + return t, ref, nil +} + +// resolveApplicationRef looks up an Application by its ent ID and builds a ResourceRef. +func (r *mutationResolver) resolveApplicationRef(ctx context.Context, applicationID int) (*ent.Application, service.ResourceRef, error) { + app, err := r.client.Application.Get(ctx, applicationID) + if err != nil { + return nil, service.ResourceRef{}, fmt.Errorf("getting application: %w", err) + } + + team, err := app.QueryOwnerTeam().Only(ctx) + if err != nil { + return nil, service.ResourceRef{}, fmt.Errorf("getting application owner team: %w", err) + } + + group, err := team.QueryGroup().Only(ctx) + if err != nil { + return nil, service.ResourceRef{}, fmt.Errorf("getting application owner group: %w", err) + } + + ref := service.ResourceRef{ + Namespace: app.Namespace, + Name: app.Name, + Group: group.Name, + TeamName: team.Name, + } + + return app, ref, nil +} + +// resolveApprovalRequestRef looks up an ApprovalRequest by its ent ID and builds a ResourceRef. +func (r *mutationResolver) resolveApprovalRequestRef(ctx context.Context, approvalRequestID int) (*ent.ApprovalRequest, service.ResourceRef, error) { + ar, err := r.client.ApprovalRequest.Get(ctx, approvalRequestID) + if err != nil { + return nil, service.ResourceRef{}, fmt.Errorf("getting approval request: %w", err) + } + + ref := service.ResourceRef{ + Namespace: ar.Namespace, + Name: ar.Name, + TeamName: ar.DeciderTeamName, + } + + return ar, ref, nil +} + +// resolveApprovalRef looks up an Approval by its ent ID and builds a ResourceRef. +func (r *mutationResolver) resolveApprovalRef(ctx context.Context, approvalID int) (*ent.Approval, service.ResourceRef, error) { + a, err := r.client.Approval.Get(ctx, approvalID) + if err != nil { + return nil, service.ResourceRef{}, fmt.Errorf("getting approval: %w", err) + } + + ref := service.ResourceRef{ + Namespace: a.Namespace, + Name: a.Name, + TeamName: a.DeciderTeamName, + } + + return a, ref, nil +} diff --git a/controlplane-api/internal/resolvers/prelude.generated.go b/controlplane-api/internal/resolvers/prelude.generated.go index 12d6b0aed..e2d1c7b3f 100644 --- a/controlplane-api/internal/resolvers/prelude.generated.go +++ b/controlplane-api/internal/resolvers/prelude.generated.go @@ -1,7 +1,6 @@ -// Copyright 2026 Deutsche Telekom IT GmbH +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. package resolvers @@ -9,7 +8,7 @@ package resolvers import ( "context" "errors" - "fmt" + "math" "strconv" "sync/atomic" @@ -27,12 +26,18 @@ import ( func (ec *executionContext) dir_defer_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "if", ec.unmarshalOBoolean2ᚖbool) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "if", + func(ctx context.Context, v any) (*bool, error) { + return ec.unmarshalOBoolean2ᚖbool(ctx, v) + }) if err != nil { return nil, err } args["if"] = arg0 - arg1, err := graphql.ProcessArgField(ctx, rawArgs, "label", ec.unmarshalOString2ᚖstring) + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "label", + func(ctx context.Context, v any) (*string, error) { + return ec.unmarshalOString2ᚖstring(ctx, v) + }) if err != nil { return nil, err } @@ -43,7 +48,10 @@ func (ec *executionContext) dir_defer_args(ctx context.Context, rawArgs map[stri func (ec *executionContext) field___Directive_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2ᚖbool) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", + func(ctx context.Context, v any) (*bool, error) { + return ec.unmarshalOBoolean2ᚖbool(ctx, v) + }) if err != nil { return nil, err } @@ -54,7 +62,10 @@ func (ec *executionContext) field___Directive_args_args(ctx context.Context, raw func (ec *executionContext) field___Field_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2ᚖbool) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", + func(ctx context.Context, v any) (*bool, error) { + return ec.unmarshalOBoolean2ᚖbool(ctx, v) + }) if err != nil { return nil, err } @@ -65,7 +76,10 @@ func (ec *executionContext) field___Field_args_args(ctx context.Context, rawArgs func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2bool) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", + func(ctx context.Context, v any) (bool, error) { + return ec.unmarshalOBoolean2bool(ctx, v) + }) if err != nil { return nil, err } @@ -76,7 +90,10 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} - arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2bool) + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", + func(ctx context.Context, v any) (bool, error) { + return ec.unmarshalOBoolean2bool(ctx, v) + }) if err != nil { return nil, err } @@ -97,28 +114,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext___Directive_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Directive_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Directive", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { @@ -126,28 +137,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext___Directive_description, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Directive_description(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Description(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Directive", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { @@ -155,28 +160,22 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext___Directive_isRepeatable, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Directive_isRepeatable(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.IsRepeatable, nil }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Directive", field, false, false, errors.New("field of type Boolean does not have child fields")) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { @@ -184,28 +183,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext___Directive_locations, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Directive_locations(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Locations, nil }, nil, - ec.marshalN__DirectiveLocation2ᚕstringᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __DirectiveLocation does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Directive", field, false, false, errors.New("field of type __DirectiveLocation does not have child fields")) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { @@ -213,17 +206,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext___Directive_args, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Directive_args(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Args, nil }, nil, - ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", @@ -231,21 +227,7 @@ func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, f IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - case "isDeprecated": - return ec.fieldContext___InputValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___InputValue_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + return ec.childFields___InputValue(ctx, field) }, } defer func() { @@ -267,28 +249,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___EnumValue_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__EnumValue", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { @@ -296,28 +272,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_description, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___EnumValue_description(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Description(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__EnumValue", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { @@ -325,28 +295,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_isDeprecated, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.IsDeprecated(), nil }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__EnumValue", field, true, false, errors.New("field of type Boolean does not have child fields")) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { @@ -354,28 +318,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_deprecationReason, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DeprecationReason(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__EnumValue", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { @@ -383,28 +341,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col ctx, ec.OperationContext, field, - ec.fieldContext___Field_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Field", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { @@ -412,28 +364,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap ctx, ec.OperationContext, field, - ec.fieldContext___Field_description, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_description(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Description(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Field", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { @@ -441,17 +387,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col ctx, ec.OperationContext, field, - ec.fieldContext___Field_args, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_args(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Args, nil }, nil, - ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", @@ -459,21 +408,7 @@ func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - case "isDeprecated": - return ec.fieldContext___InputValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___InputValue_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + return ec.childFields___InputValue(ctx, field) }, } defer func() { @@ -495,17 +430,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col ctx, ec.OperationContext, field, - ec.fieldContext___Field_type, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_type(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Type, nil }, nil, - ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", @@ -513,31 +451,7 @@ func (ec *executionContext) fieldContext___Field_type(_ context.Context, field g IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -548,28 +462,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext___Field_isDeprecated, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_isDeprecated(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.IsDeprecated(), nil }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Field", field, true, false, errors.New("field of type Boolean does not have child fields")) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { @@ -577,28 +485,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext___Field_deprecationReason, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Field_deprecationReason(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DeprecationReason(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Field", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { @@ -606,28 +508,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__InputValue", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { @@ -635,28 +531,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_description, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_description(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Description(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__InputValue", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { @@ -664,17 +554,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_type, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_type(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Type, nil }, nil, - ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", @@ -682,31 +575,7 @@ func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, fi IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -717,28 +586,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_defaultValue, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_defaultValue(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DefaultValue, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__InputValue", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___InputValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { @@ -746,28 +609,22 @@ func (ec *executionContext) ___InputValue_isDeprecated(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_isDeprecated, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.IsDeprecated(), nil }, nil, - ec.marshalNBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___InputValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__InputValue", field, true, false, errors.New("field of type Boolean does not have child fields")) } func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { @@ -775,28 +632,22 @@ func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_deprecationReason, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.DeprecationReason(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___InputValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__InputValue", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { @@ -804,28 +655,22 @@ func (ec *executionContext) ___Schema_description(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext___Schema_description, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_description(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Description(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Schema", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { @@ -833,17 +678,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext___Schema_types, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_types(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Types(), nil }, nil, - ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", @@ -851,31 +699,7 @@ func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -886,17 +710,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext___Schema_queryType, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_queryType(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.QueryType(), nil }, nil, - ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", @@ -904,31 +731,7 @@ func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, f IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -939,17 +742,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext___Schema_mutationType, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_mutationType(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.MutationType(), nil }, nil, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", @@ -957,31 +763,7 @@ func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -992,17 +774,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext___Schema_subscriptionType, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_subscriptionType(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.SubscriptionType(), nil }, nil, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", @@ -1010,31 +795,7 @@ func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Con IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -1045,17 +806,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap ctx, ec.OperationContext, field, - ec.fieldContext___Schema_directives, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Schema_directives(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Directives(), nil }, nil, - ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", @@ -1063,19 +827,7 @@ func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Directive_name(ctx, field) - case "description": - return ec.fieldContext___Directive_description(ctx, field) - case "isRepeatable": - return ec.fieldContext___Directive_isRepeatable(ctx, field) - case "locations": - return ec.fieldContext___Directive_locations(ctx, field) - case "args": - return ec.fieldContext___Directive_args(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + return ec.childFields___Directive(ctx, field) }, } return fc, nil @@ -1086,28 +838,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll ctx, ec.OperationContext, field, - ec.fieldContext___Type_kind, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_kind(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Kind(), nil }, nil, - ec.marshalN__TypeKind2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalN__TypeKind2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __TypeKind does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type __TypeKind does not have child fields")) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { @@ -1115,28 +861,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll ctx, ec.OperationContext, field, - ec.fieldContext___Type_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { @@ -1144,28 +884,22 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext___Type_description, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_description(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Description(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { @@ -1173,28 +907,22 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext___Type_specifiedByURL, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_specifiedByURL(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.SpecifiedByURL(), nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { @@ -1202,18 +930,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext___Type_fields, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_fields(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil }, nil, - ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", @@ -1221,21 +952,7 @@ func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, fiel IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Field_name(ctx, field) - case "description": - return ec.fieldContext___Field_description(ctx, field) - case "args": - return ec.fieldContext___Field_args(ctx, field) - case "type": - return ec.fieldContext___Field_type(ctx, field) - case "isDeprecated": - return ec.fieldContext___Field_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___Field_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + return ec.childFields___Field(ctx, field) }, } defer func() { @@ -1257,17 +974,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext___Type_interfaces, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_interfaces(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Interfaces(), nil }, nil, - ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", @@ -1275,31 +995,7 @@ func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, fi IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -1310,17 +1006,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext___Type_possibleTypes, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_possibleTypes(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.PossibleTypes(), nil }, nil, - ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", @@ -1328,31 +1027,7 @@ func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -1363,18 +1038,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq ctx, ec.OperationContext, field, - ec.fieldContext___Type_enumValues, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_enumValues(ctx, field) + }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil }, nil, - ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", @@ -1382,17 +1060,7 @@ func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___EnumValue_name(ctx, field) - case "description": - return ec.fieldContext___EnumValue_description(ctx, field) - case "isDeprecated": - return ec.fieldContext___EnumValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___EnumValue_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) + return ec.childFields___EnumValue(ctx, field) }, } defer func() { @@ -1414,17 +1082,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext___Type_inputFields, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_inputFields(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.InputFields(), nil }, nil, - ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", @@ -1432,21 +1103,7 @@ func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, f IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - case "isDeprecated": - return ec.fieldContext___InputValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___InputValue_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + return ec.childFields___InputValue(ctx, field) }, } return fc, nil @@ -1457,17 +1114,20 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext___Type_ofType, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_ofType(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.OfType(), nil }, nil, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + func(ctx context.Context, selections ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", @@ -1475,31 +1135,7 @@ func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "isOneOf": - return ec.fieldContext___Type_isOneOf(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return ec.childFields___Type(ctx, field) }, } return fc, nil @@ -1510,28 +1146,22 @@ func (ec *executionContext) ___Type_isOneOf(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext___Type_isOneOf, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext___Type_isOneOf(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.IsOneOf(), nil }, nil, - ec.marshalOBoolean2bool, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalOBoolean2bool(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("__Type", field, true, false, errors.New("field of type Boolean does not have child fields")) } // endregion **************************** field.gotpl ***************************** @@ -1588,7 +1218,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1636,7 +1266,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1694,7 +1324,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1749,7 +1379,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1804,7 +1434,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1863,7 +1493,7 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ diff --git a/controlplane-api/internal/resolvers/resolver.go b/controlplane-api/internal/resolvers/resolver.go index 48261cb71..204e35fd7 100644 --- a/controlplane-api/internal/resolvers/resolver.go +++ b/controlplane-api/internal/resolvers/resolver.go @@ -6,7 +6,9 @@ package resolvers import ( "github.com/99designs/gqlgen/graphql" + "github.com/telekom/controlplane/controlplane-api/ent" + "github.com/telekom/controlplane/controlplane-api/internal/secrets" "github.com/telekom/controlplane/controlplane-api/internal/service" ) @@ -14,20 +16,22 @@ import ( type Resolver struct { client *ent.Client services service.Services + secrets *secrets.Resolver } -// NewResolver creates a new root resolver with the given ent client and services. -func NewResolver(client *ent.Client, services ...service.Services) *Resolver { - r := &Resolver{client: client} - if len(services) > 0 { - r.services = services[0] +// NewResolver creates a new root resolver with the given ent client, services, +// and secret resolver. +func NewResolver(client *ent.Client, services service.Services, secretResolver *secrets.Resolver) *Resolver { + return &Resolver{ + client: client, + services: services, + secrets: secretResolver, } - return r } // NewSchema creates a graphql executable schema. -func NewSchema(client *ent.Client, services service.Services) graphql.ExecutableSchema { +func NewSchema(client *ent.Client, services service.Services, secretResolver *secrets.Resolver) graphql.ExecutableSchema { return NewExecutableSchema(Config{ - Resolvers: NewResolver(client, services), + Resolvers: NewResolver(client, services, secretResolver), }) } diff --git a/controlplane-api/internal/resolvers/root_.generated.go b/controlplane-api/internal/resolvers/root_.generated.go index 893a5c76b..1106c9db5 100644 --- a/controlplane-api/internal/resolvers/root_.generated.go +++ b/controlplane-api/internal/resolvers/root_.generated.go @@ -8,6 +8,7 @@ package resolvers import ( "bytes" "context" + "fmt" "sync/atomic" "entgo.io/contrib/entgql" @@ -36,16 +37,25 @@ type ResolverRoot interface { ApprovalRequest() ApprovalRequestResolver AvailableTransition() AvailableTransitionResolver Decision() DecisionResolver + EventExposure() EventExposureResolver + EventExposureInfo() EventExposureInfoResolver + EventSubscription() EventSubscriptionResolver + EventSubscriptionInfo() EventSubscriptionInfoResolver Mutation() MutationResolver Query() QueryResolver - DecideApprovalInput() DecideApprovalInputResolver - DecideApprovalRequestInput() DecideApprovalRequestInputResolver + Team() TeamResolver + Zone() ZoneResolver } type DirectiveRoot struct { } type ComplexityRoot struct { + AddTeamMemberPayload struct { + Errors func(childComplexity int) int + Team func(childComplexity int) int + } + ApiExposure struct { APIVersion func(childComplexity int) int Active func(childComplexity int) int @@ -128,21 +138,27 @@ type ComplexityRoot struct { } Application struct { - ClientID func(childComplexity int) int - ClientSecret func(childComplexity int) int - CreatedAt func(childComplexity int) int - Environment func(childComplexity int) int - ExposedApis func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiExposureOrder, where *ent.ApiExposureWhereInput) int - ID func(childComplexity int) int - IssuerURL func(childComplexity int) int - LastModifiedAt func(childComplexity int) int - Name func(childComplexity int) int - Namespace func(childComplexity int) int - OwnerTeam func(childComplexity int) int - StatusMessage func(childComplexity int) int - StatusPhase func(childComplexity int) int - SubscribedApis func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiSubscriptionOrder, where *ent.ApiSubscriptionWhereInput) int - Zone func(childComplexity int) int + ClientID func(childComplexity int) int + ClientSecret func(childComplexity int) int + CreatedAt func(childComplexity int) int + CurrentExpiresAt func(childComplexity int) int + Environment func(childComplexity int) int + ExposedApis func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiExposureOrder, where *ent.ApiExposureWhereInput) int + ExposedEvents func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventExposureOrder, where *ent.EventExposureWhereInput) int + ID func(childComplexity int) int + LastModifiedAt func(childComplexity int) int + Name func(childComplexity int) int + Namespace func(childComplexity int) int + OwnerTeam func(childComplexity int) int + RotatedClientSecret func(childComplexity int) int + RotatedExpiresAt func(childComplexity int) int + SecretRotationMessage func(childComplexity int) int + SecretRotationPhase func(childComplexity int) int + StatusMessage func(childComplexity int) int + StatusPhase func(childComplexity int) int + SubscribedApis func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiSubscriptionOrder, where *ent.ApiSubscriptionWhereInput) int + SubscribedEvents func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventSubscriptionOrder, where *ent.EventSubscriptionWhereInput) int + Zone func(childComplexity int) int } ApplicationConnection struct { @@ -157,7 +173,6 @@ type ComplexityRoot struct { } Approval struct { - APISubscription func(childComplexity int) int Action func(childComplexity int) int AvailableTransitions func(childComplexity int) int CreatedAt func(childComplexity int) int @@ -174,6 +189,7 @@ type ComplexityRoot struct { StatusMessage func(childComplexity int) int StatusPhase func(childComplexity int) int Strategy func(childComplexity int) int + Subscription func(childComplexity int) int } ApprovalConfig struct { @@ -192,16 +208,7 @@ type ComplexityRoot struct { Node func(childComplexity int) int } - ApprovalMutationResult struct { - Message func(childComplexity int) int - Namespace func(childComplexity int) int - NewState func(childComplexity int) int - ResourceName func(childComplexity int) int - Success func(childComplexity int) int - } - ApprovalRequest struct { - APISubscription func(childComplexity int) int Action func(childComplexity int) int Approval func(childComplexity int) int AvailableTransitions func(childComplexity int) int @@ -219,6 +226,7 @@ type ComplexityRoot struct { StatusMessage func(childComplexity int) int StatusPhase func(childComplexity int) int Strategy func(childComplexity int) int + Subscription func(childComplexity int) int } ApprovalRequestConnection struct { @@ -237,6 +245,24 @@ type ComplexityRoot struct { ToState func(childComplexity int) int } + CreateTeamPayload struct { + Accepted func(childComplexity int) int + Errors func(childComplexity int) int + Team func(childComplexity int) int + } + + DecideApprovalPayload struct { + Accepted func(childComplexity int) int + Approval func(childComplexity int) int + Errors func(childComplexity int) int + } + + DecideApprovalRequestPayload struct { + Accepted func(childComplexity int) int + ApprovalRequest func(childComplexity int) int + Errors func(childComplexity int) int + } + DeciderInfo struct { TeamEmail func(childComplexity int) int TeamName func(childComplexity int) int @@ -250,6 +276,82 @@ type ComplexityRoot struct { Timestamp func(childComplexity int) int } + EventExposure struct { + Active func(childComplexity int) int + ApprovalConfig func(childComplexity int) int + CreatedAt func(childComplexity int) int + Environment func(childComplexity int) int + EventType func(childComplexity int) int + ID func(childComplexity int) int + LastModifiedAt func(childComplexity int) int + Namespace func(childComplexity int) int + Owner func(childComplexity int) int + StatusMessage func(childComplexity int) int + StatusPhase func(childComplexity int) int + Subscriptions func(childComplexity int) int + Visibility func(childComplexity int) int + } + + EventExposureConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + TotalCount func(childComplexity int) int + } + + EventExposureEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + + EventExposureInfo struct { + Active func(childComplexity int) int + ApprovalConfig func(childComplexity int) int + EventType func(childComplexity int) int + ID func(childComplexity int) int + OwnerApplicationName func(childComplexity int) int + OwnerTeam func(childComplexity int) int + Visibility func(childComplexity int) int + } + + EventSubscription struct { + Approval func(childComplexity int) int + ApprovalRequests func(childComplexity int) int + CallbackURL func(childComplexity int) int + CreatedAt func(childComplexity int) int + DeliveryType func(childComplexity int) int + Environment func(childComplexity int) int + EventType func(childComplexity int) int + ID func(childComplexity int) int + LastModifiedAt func(childComplexity int) int + Name func(childComplexity int) int + Namespace func(childComplexity int) int + Owner func(childComplexity int) int + StatusMessage func(childComplexity int) int + StatusPhase func(childComplexity int) int + Target func(childComplexity int) int + } + + EventSubscriptionConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + TotalCount func(childComplexity int) int + } + + EventSubscriptionEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + + EventSubscriptionInfo struct { + DeliveryType func(childComplexity int) int + EventType func(childComplexity int) int + ID func(childComplexity int) int + OwnerApplicationName func(childComplexity int) int + OwnerTeam func(childComplexity int) int + StatusMessage func(childComplexity int) int + StatusPhase func(childComplexity int) int + } + Group struct { Description func(childComplexity int) int DisplayName func(childComplexity int) int @@ -269,14 +371,22 @@ type ComplexityRoot struct { } Mutation struct { + AddTeamMember func(childComplexity int, teamID int, member model.MemberInput) int CreateTeam func(childComplexity int, input model.CreateTeamInput) int - DecideApproval func(childComplexity int, input model.DecideApprovalInput) int - DecideApprovalRequest func(childComplexity int, input model.DecideApprovalRequestInput) int - RotateApplicationSecret func(childComplexity int, input model.RotateApplicationSecretInput) int - RotateTeamToken func(childComplexity int, input model.RotateTeamTokenInput) int + DecideApproval func(childComplexity int, approvalID int, input model.DecisionInput) int + DecideApprovalRequest func(childComplexity int, approvalRequestID int, input model.DecisionInput) int + RemoveTeamMember func(childComplexity int, teamID int, memberEmail string) int + RotateApplicationSecret func(childComplexity int, applicationID int) int + RotateTeamToken func(childComplexity int, teamID int) int UpdateTeam func(childComplexity int, input model.UpdateTeamInput) int } + MutationError struct { + Code func(childComplexity int) int + Field func(childComplexity int) int + Message func(childComplexity int) int + } + PageInfo struct { EndCursor func(childComplexity int) int HasNextPage func(childComplexity int) int @@ -285,15 +395,22 @@ type ComplexityRoot struct { } Query struct { - APIExposures func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiExposureOrder, where *ent.ApiExposureWhereInput) int - APISubscriptions func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiSubscriptionOrder, where *ent.ApiSubscriptionWhereInput) int - Applications func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ApplicationOrder, where *ent.ApplicationWhereInput) int - ApprovalRequests func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ApprovalRequestOrder, where *ent.ApprovalRequestWhereInput) int - Approvals func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ApprovalOrder, where *ent.ApprovalWhereInput) int - Node func(childComplexity int, id int) int - Nodes func(childComplexity int, ids []int) int - Teams func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.TeamOrder, where *ent.TeamWhereInput) int - Zones func(childComplexity int) int + APIExposures func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiExposureOrder, where *ent.ApiExposureWhereInput) int + APISubscriptions func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiSubscriptionOrder, where *ent.ApiSubscriptionWhereInput) int + Applications func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ApplicationOrder, where *ent.ApplicationWhereInput) int + ApprovalRequests func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ApprovalRequestOrder, where *ent.ApprovalRequestWhereInput) int + Approvals func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ApprovalOrder, where *ent.ApprovalWhereInput) int + EventExposures func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventExposureOrder, where *ent.EventExposureWhereInput) int + EventSubscriptions func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventSubscriptionOrder, where *ent.EventSubscriptionWhereInput) int + Node func(childComplexity int, id int) int + Nodes func(childComplexity int, ids []int) int + Teams func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.TeamOrder, where *ent.TeamWhereInput) int + Zones func(childComplexity int) int + } + + RemoveTeamMemberPayload struct { + Errors func(childComplexity int) int + Team func(childComplexity int) int } RequesterInfo struct { @@ -303,11 +420,16 @@ type ComplexityRoot struct { TeamName func(childComplexity int) int } - RotateApplicationSecretResult struct { - Message func(childComplexity int) int - Namespace func(childComplexity int) int - ResourceName func(childComplexity int) int - Success func(childComplexity int) int + RotateApplicationSecretPayload struct { + Accepted func(childComplexity int) int + Application func(childComplexity int) int + Errors func(childComplexity int) int + } + + RotateTeamTokenPayload struct { + Accepted func(childComplexity int) int + Errors func(childComplexity int) int + Team func(childComplexity int) int } Team struct { @@ -322,9 +444,9 @@ type ComplexityRoot struct { Members func(childComplexity int) int Name func(childComplexity int) int Namespace func(childComplexity int) int - RoverTokenRef func(childComplexity int) int StatusMessage func(childComplexity int) int StatusPhase func(childComplexity int) int + TeamToken func(childComplexity int) int } TeamConnection struct { @@ -345,11 +467,10 @@ type ComplexityRoot struct { Name func(childComplexity int) int } - TeamMutationResult struct { - Message func(childComplexity int) int - Namespace func(childComplexity int) int - ResourceName func(childComplexity int) int - Success func(childComplexity int) int + UpdateTeamPayload struct { + Accepted func(childComplexity int) int + Errors func(childComplexity int) int + Team func(childComplexity int) int } Upstream struct { @@ -362,7 +483,9 @@ type ComplexityRoot struct { Environment func(childComplexity int) int GatewayURL func(childComplexity int) int ID func(childComplexity int) int + IssuerURL func(childComplexity int) int Name func(childComplexity int) int + TokenURL func(childComplexity int) int Visibility func(childComplexity int) int } } @@ -381,6 +504,20 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin _ = ec switch typeName + "." + field { + case "AddTeamMemberPayload.errors": + if e.ComplexityRoot.AddTeamMemberPayload.Errors == nil { + break + } + + return e.ComplexityRoot.AddTeamMemberPayload.Errors(childComplexity), true + + case "AddTeamMemberPayload.team": + if e.ComplexityRoot.AddTeamMemberPayload.Team == nil { + break + } + + return e.ComplexityRoot.AddTeamMemberPayload.Team(childComplexity), true + case "ApiExposure.apiVersion": if e.ComplexityRoot.ApiExposure.APIVersion == nil { break @@ -801,6 +938,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Application.CreatedAt(childComplexity), true + case "Application.currentExpiresAt": + if e.ComplexityRoot.Application.CurrentExpiresAt == nil { + break + } + + return e.ComplexityRoot.Application.CurrentExpiresAt(childComplexity), true + case "Application.environment": if e.ComplexityRoot.Application.Environment == nil { break @@ -820,19 +964,24 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Application.ExposedApis(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.ApiExposureOrder), args["where"].(*ent.ApiExposureWhereInput)), true - case "Application.id": - if e.ComplexityRoot.Application.ID == nil { + case "Application.exposedEvents": + if e.ComplexityRoot.Application.ExposedEvents == nil { break } - return e.ComplexityRoot.Application.ID(childComplexity), true + args, err := ec.field_Application_exposedEvents_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Application.ExposedEvents(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.EventExposureOrder), args["where"].(*ent.EventExposureWhereInput)), true - case "Application.issuerURL": - if e.ComplexityRoot.Application.IssuerURL == nil { + case "Application.id": + if e.ComplexityRoot.Application.ID == nil { break } - return e.ComplexityRoot.Application.IssuerURL(childComplexity), true + return e.ComplexityRoot.Application.ID(childComplexity), true case "Application.lastModifiedAt": if e.ComplexityRoot.Application.LastModifiedAt == nil { @@ -862,6 +1011,34 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Application.OwnerTeam(childComplexity), true + case "Application.rotatedClientSecret": + if e.ComplexityRoot.Application.RotatedClientSecret == nil { + break + } + + return e.ComplexityRoot.Application.RotatedClientSecret(childComplexity), true + + case "Application.rotatedExpiresAt": + if e.ComplexityRoot.Application.RotatedExpiresAt == nil { + break + } + + return e.ComplexityRoot.Application.RotatedExpiresAt(childComplexity), true + + case "Application.secretRotationMessage": + if e.ComplexityRoot.Application.SecretRotationMessage == nil { + break + } + + return e.ComplexityRoot.Application.SecretRotationMessage(childComplexity), true + + case "Application.secretRotationPhase": + if e.ComplexityRoot.Application.SecretRotationPhase == nil { + break + } + + return e.ComplexityRoot.Application.SecretRotationPhase(childComplexity), true + case "Application.statusMessage": if e.ComplexityRoot.Application.StatusMessage == nil { break @@ -888,6 +1065,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Application.SubscribedApis(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.ApiSubscriptionOrder), args["where"].(*ent.ApiSubscriptionWhereInput)), true + case "Application.subscribedEvents": + if e.ComplexityRoot.Application.SubscribedEvents == nil { + break + } + + args, err := ec.field_Application_subscribedEvents_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Application.SubscribedEvents(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.EventSubscriptionOrder), args["where"].(*ent.EventSubscriptionWhereInput)), true + case "Application.zone": if e.ComplexityRoot.Application.Zone == nil { break @@ -930,13 +1119,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.ApplicationEdge.Node(childComplexity), true - case "Approval.apiSubscription": - if e.ComplexityRoot.Approval.APISubscription == nil { - break - } - - return e.ComplexityRoot.Approval.APISubscription(childComplexity), true - case "Approval.action": if e.ComplexityRoot.Approval.Action == nil { break @@ -1049,6 +1231,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Approval.Strategy(childComplexity), true + case "Approval.subscription": + if e.ComplexityRoot.Approval.Subscription == nil { + break + } + + return e.ComplexityRoot.Approval.Subscription(childComplexity), true + case "ApprovalConfig.strategy": if e.ComplexityRoot.ApprovalConfig.Strategy == nil { break @@ -1098,48 +1287,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.ApprovalEdge.Node(childComplexity), true - case "ApprovalMutationResult.message": - if e.ComplexityRoot.ApprovalMutationResult.Message == nil { - break - } - - return e.ComplexityRoot.ApprovalMutationResult.Message(childComplexity), true - - case "ApprovalMutationResult.namespace": - if e.ComplexityRoot.ApprovalMutationResult.Namespace == nil { - break - } - - return e.ComplexityRoot.ApprovalMutationResult.Namespace(childComplexity), true - - case "ApprovalMutationResult.newState": - if e.ComplexityRoot.ApprovalMutationResult.NewState == nil { - break - } - - return e.ComplexityRoot.ApprovalMutationResult.NewState(childComplexity), true - - case "ApprovalMutationResult.resourceName": - if e.ComplexityRoot.ApprovalMutationResult.ResourceName == nil { - break - } - - return e.ComplexityRoot.ApprovalMutationResult.ResourceName(childComplexity), true - - case "ApprovalMutationResult.success": - if e.ComplexityRoot.ApprovalMutationResult.Success == nil { - break - } - - return e.ComplexityRoot.ApprovalMutationResult.Success(childComplexity), true - - case "ApprovalRequest.apiSubscription": - if e.ComplexityRoot.ApprovalRequest.APISubscription == nil { - break - } - - return e.ComplexityRoot.ApprovalRequest.APISubscription(childComplexity), true - case "ApprovalRequest.action": if e.ComplexityRoot.ApprovalRequest.Action == nil { break @@ -1259,6 +1406,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.ApprovalRequest.Strategy(childComplexity), true + case "ApprovalRequest.subscription": + if e.ComplexityRoot.ApprovalRequest.Subscription == nil { + break + } + + return e.ComplexityRoot.ApprovalRequest.Subscription(childComplexity), true + case "ApprovalRequestConnection.edges": if e.ComplexityRoot.ApprovalRequestConnection.Edges == nil { break @@ -1308,6 +1462,69 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.AvailableTransition.ToState(childComplexity), true + case "CreateTeamPayload.accepted": + if e.ComplexityRoot.CreateTeamPayload.Accepted == nil { + break + } + + return e.ComplexityRoot.CreateTeamPayload.Accepted(childComplexity), true + + case "CreateTeamPayload.errors": + if e.ComplexityRoot.CreateTeamPayload.Errors == nil { + break + } + + return e.ComplexityRoot.CreateTeamPayload.Errors(childComplexity), true + + case "CreateTeamPayload.team": + if e.ComplexityRoot.CreateTeamPayload.Team == nil { + break + } + + return e.ComplexityRoot.CreateTeamPayload.Team(childComplexity), true + + case "DecideApprovalPayload.accepted": + if e.ComplexityRoot.DecideApprovalPayload.Accepted == nil { + break + } + + return e.ComplexityRoot.DecideApprovalPayload.Accepted(childComplexity), true + + case "DecideApprovalPayload.approval": + if e.ComplexityRoot.DecideApprovalPayload.Approval == nil { + break + } + + return e.ComplexityRoot.DecideApprovalPayload.Approval(childComplexity), true + + case "DecideApprovalPayload.errors": + if e.ComplexityRoot.DecideApprovalPayload.Errors == nil { + break + } + + return e.ComplexityRoot.DecideApprovalPayload.Errors(childComplexity), true + + case "DecideApprovalRequestPayload.accepted": + if e.ComplexityRoot.DecideApprovalRequestPayload.Accepted == nil { + break + } + + return e.ComplexityRoot.DecideApprovalRequestPayload.Accepted(childComplexity), true + + case "DecideApprovalRequestPayload.approvalRequest": + if e.ComplexityRoot.DecideApprovalRequestPayload.ApprovalRequest == nil { + break + } + + return e.ComplexityRoot.DecideApprovalRequestPayload.ApprovalRequest(childComplexity), true + + case "DecideApprovalRequestPayload.errors": + if e.ComplexityRoot.DecideApprovalRequestPayload.Errors == nil { + break + } + + return e.ComplexityRoot.DecideApprovalRequestPayload.Errors(childComplexity), true + case "DeciderInfo.teamEmail": if e.ComplexityRoot.DeciderInfo.TeamEmail == nil { break @@ -1357,732 +1574,1822 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Decision.Timestamp(childComplexity), true - case "Group.description": - if e.ComplexityRoot.Group.Description == nil { + case "EventExposure.active": + if e.ComplexityRoot.EventExposure.Active == nil { break } - return e.ComplexityRoot.Group.Description(childComplexity), true + return e.ComplexityRoot.EventExposure.Active(childComplexity), true - case "Group.displayName": - if e.ComplexityRoot.Group.DisplayName == nil { + case "EventExposure.approvalConfig": + if e.ComplexityRoot.EventExposure.ApprovalConfig == nil { break } - return e.ComplexityRoot.Group.DisplayName(childComplexity), true + return e.ComplexityRoot.EventExposure.ApprovalConfig(childComplexity), true - case "Group.environment": - if e.ComplexityRoot.Group.Environment == nil { + case "EventExposure.createdAt": + if e.ComplexityRoot.EventExposure.CreatedAt == nil { break } - return e.ComplexityRoot.Group.Environment(childComplexity), true + return e.ComplexityRoot.EventExposure.CreatedAt(childComplexity), true - case "Group.id": - if e.ComplexityRoot.Group.ID == nil { + case "EventExposure.environment": + if e.ComplexityRoot.EventExposure.Environment == nil { break } - return e.ComplexityRoot.Group.ID(childComplexity), true + return e.ComplexityRoot.EventExposure.Environment(childComplexity), true - case "Group.name": - if e.ComplexityRoot.Group.Name == nil { + case "EventExposure.eventType": + if e.ComplexityRoot.EventExposure.EventType == nil { break } - return e.ComplexityRoot.Group.Name(childComplexity), true + return e.ComplexityRoot.EventExposure.EventType(childComplexity), true - case "Group.namespace": - if e.ComplexityRoot.Group.Namespace == nil { + case "EventExposure.id": + if e.ComplexityRoot.EventExposure.ID == nil { break } - return e.ComplexityRoot.Group.Namespace(childComplexity), true + return e.ComplexityRoot.EventExposure.ID(childComplexity), true - case "Group.teams": - if e.ComplexityRoot.Group.Teams == nil { + case "EventExposure.lastModifiedAt": + if e.ComplexityRoot.EventExposure.LastModifiedAt == nil { break } - return e.ComplexityRoot.Group.Teams(childComplexity), true + return e.ComplexityRoot.EventExposure.LastModifiedAt(childComplexity), true - case "Member.email": - if e.ComplexityRoot.Member.Email == nil { + case "EventExposure.namespace": + if e.ComplexityRoot.EventExposure.Namespace == nil { break } - return e.ComplexityRoot.Member.Email(childComplexity), true + return e.ComplexityRoot.EventExposure.Namespace(childComplexity), true - case "Member.environment": - if e.ComplexityRoot.Member.Environment == nil { + case "EventExposure.owner": + if e.ComplexityRoot.EventExposure.Owner == nil { break } - return e.ComplexityRoot.Member.Environment(childComplexity), true + return e.ComplexityRoot.EventExposure.Owner(childComplexity), true - case "Member.id": - if e.ComplexityRoot.Member.ID == nil { + case "EventExposure.statusMessage": + if e.ComplexityRoot.EventExposure.StatusMessage == nil { break } - return e.ComplexityRoot.Member.ID(childComplexity), true + return e.ComplexityRoot.EventExposure.StatusMessage(childComplexity), true - case "Member.name": - if e.ComplexityRoot.Member.Name == nil { + case "EventExposure.statusPhase": + if e.ComplexityRoot.EventExposure.StatusPhase == nil { break } - return e.ComplexityRoot.Member.Name(childComplexity), true + return e.ComplexityRoot.EventExposure.StatusPhase(childComplexity), true - case "Member.team": - if e.ComplexityRoot.Member.Team == nil { + case "EventExposure.subscriptions": + if e.ComplexityRoot.EventExposure.Subscriptions == nil { break } - return e.ComplexityRoot.Member.Team(childComplexity), true + return e.ComplexityRoot.EventExposure.Subscriptions(childComplexity), true - case "Mutation.createTeam": - if e.ComplexityRoot.Mutation.CreateTeam == nil { + case "EventExposure.visibility": + if e.ComplexityRoot.EventExposure.Visibility == nil { break } - args, err := ec.field_Mutation_createTeam_args(ctx, rawArgs) - if err != nil { - return 0, false + return e.ComplexityRoot.EventExposure.Visibility(childComplexity), true + + case "EventExposureConnection.edges": + if e.ComplexityRoot.EventExposureConnection.Edges == nil { + break } - return e.ComplexityRoot.Mutation.CreateTeam(childComplexity, args["input"].(model.CreateTeamInput)), true + return e.ComplexityRoot.EventExposureConnection.Edges(childComplexity), true - case "Mutation.decideApproval": - if e.ComplexityRoot.Mutation.DecideApproval == nil { + case "EventExposureConnection.pageInfo": + if e.ComplexityRoot.EventExposureConnection.PageInfo == nil { break } - args, err := ec.field_Mutation_decideApproval_args(ctx, rawArgs) - if err != nil { - return 0, false + return e.ComplexityRoot.EventExposureConnection.PageInfo(childComplexity), true + + case "EventExposureConnection.totalCount": + if e.ComplexityRoot.EventExposureConnection.TotalCount == nil { + break } - return e.ComplexityRoot.Mutation.DecideApproval(childComplexity, args["input"].(model.DecideApprovalInput)), true + return e.ComplexityRoot.EventExposureConnection.TotalCount(childComplexity), true - case "Mutation.decideApprovalRequest": - if e.ComplexityRoot.Mutation.DecideApprovalRequest == nil { + case "EventExposureEdge.cursor": + if e.ComplexityRoot.EventExposureEdge.Cursor == nil { break } - args, err := ec.field_Mutation_decideApprovalRequest_args(ctx, rawArgs) - if err != nil { - return 0, false - } + return e.ComplexityRoot.EventExposureEdge.Cursor(childComplexity), true - return e.ComplexityRoot.Mutation.DecideApprovalRequest(childComplexity, args["input"].(model.DecideApprovalRequestInput)), true - - case "Mutation.rotateApplicationSecret": - if e.ComplexityRoot.Mutation.RotateApplicationSecret == nil { + case "EventExposureEdge.node": + if e.ComplexityRoot.EventExposureEdge.Node == nil { break } - args, err := ec.field_Mutation_rotateApplicationSecret_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Mutation.RotateApplicationSecret(childComplexity, args["input"].(model.RotateApplicationSecretInput)), true + return e.ComplexityRoot.EventExposureEdge.Node(childComplexity), true - case "Mutation.rotateTeamToken": - if e.ComplexityRoot.Mutation.RotateTeamToken == nil { + case "EventExposureInfo.active": + if e.ComplexityRoot.EventExposureInfo.Active == nil { break } - args, err := ec.field_Mutation_rotateTeamToken_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Mutation.RotateTeamToken(childComplexity, args["input"].(model.RotateTeamTokenInput)), true + return e.ComplexityRoot.EventExposureInfo.Active(childComplexity), true - case "Mutation.updateTeam": - if e.ComplexityRoot.Mutation.UpdateTeam == nil { + case "EventExposureInfo.approvalConfig": + if e.ComplexityRoot.EventExposureInfo.ApprovalConfig == nil { break } - args, err := ec.field_Mutation_updateTeam_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Mutation.UpdateTeam(childComplexity, args["input"].(model.UpdateTeamInput)), true + return e.ComplexityRoot.EventExposureInfo.ApprovalConfig(childComplexity), true - case "PageInfo.endCursor": - if e.ComplexityRoot.PageInfo.EndCursor == nil { + case "EventExposureInfo.eventType": + if e.ComplexityRoot.EventExposureInfo.EventType == nil { break } - return e.ComplexityRoot.PageInfo.EndCursor(childComplexity), true + return e.ComplexityRoot.EventExposureInfo.EventType(childComplexity), true - case "PageInfo.hasNextPage": - if e.ComplexityRoot.PageInfo.HasNextPage == nil { + case "EventExposureInfo.id": + if e.ComplexityRoot.EventExposureInfo.ID == nil { break } - return e.ComplexityRoot.PageInfo.HasNextPage(childComplexity), true + return e.ComplexityRoot.EventExposureInfo.ID(childComplexity), true - case "PageInfo.hasPreviousPage": - if e.ComplexityRoot.PageInfo.HasPreviousPage == nil { + case "EventExposureInfo.ownerApplicationName": + if e.ComplexityRoot.EventExposureInfo.OwnerApplicationName == nil { break } - return e.ComplexityRoot.PageInfo.HasPreviousPage(childComplexity), true + return e.ComplexityRoot.EventExposureInfo.OwnerApplicationName(childComplexity), true - case "PageInfo.startCursor": - if e.ComplexityRoot.PageInfo.StartCursor == nil { + case "EventExposureInfo.ownerTeam": + if e.ComplexityRoot.EventExposureInfo.OwnerTeam == nil { break } - return e.ComplexityRoot.PageInfo.StartCursor(childComplexity), true + return e.ComplexityRoot.EventExposureInfo.OwnerTeam(childComplexity), true - case "Query.apiExposures": - if e.ComplexityRoot.Query.APIExposures == nil { + case "EventExposureInfo.visibility": + if e.ComplexityRoot.EventExposureInfo.Visibility == nil { break } - args, err := ec.field_Query_apiExposures_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Query.APIExposures(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.ApiExposureOrder), args["where"].(*ent.ApiExposureWhereInput)), true + return e.ComplexityRoot.EventExposureInfo.Visibility(childComplexity), true - case "Query.apiSubscriptions": - if e.ComplexityRoot.Query.APISubscriptions == nil { + case "EventSubscription.approval": + if e.ComplexityRoot.EventSubscription.Approval == nil { break } - args, err := ec.field_Query_apiSubscriptions_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Query.APISubscriptions(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.ApiSubscriptionOrder), args["where"].(*ent.ApiSubscriptionWhereInput)), true + return e.ComplexityRoot.EventSubscription.Approval(childComplexity), true - case "Query.applications": - if e.ComplexityRoot.Query.Applications == nil { + case "EventSubscription.approvalRequests": + if e.ComplexityRoot.EventSubscription.ApprovalRequests == nil { break } - args, err := ec.field_Query_applications_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Query.Applications(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.ApplicationOrder), args["where"].(*ent.ApplicationWhereInput)), true + return e.ComplexityRoot.EventSubscription.ApprovalRequests(childComplexity), true - case "Query.approvalRequests": - if e.ComplexityRoot.Query.ApprovalRequests == nil { + case "EventSubscription.callbackURL": + if e.ComplexityRoot.EventSubscription.CallbackURL == nil { break } - args, err := ec.field_Query_approvalRequests_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Query.ApprovalRequests(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.ApprovalRequestOrder), args["where"].(*ent.ApprovalRequestWhereInput)), true + return e.ComplexityRoot.EventSubscription.CallbackURL(childComplexity), true - case "Query.approvals": - if e.ComplexityRoot.Query.Approvals == nil { + case "EventSubscription.createdAt": + if e.ComplexityRoot.EventSubscription.CreatedAt == nil { break } - args, err := ec.field_Query_approvals_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Query.Approvals(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.ApprovalOrder), args["where"].(*ent.ApprovalWhereInput)), true + return e.ComplexityRoot.EventSubscription.CreatedAt(childComplexity), true - case "Query.node": - if e.ComplexityRoot.Query.Node == nil { + case "EventSubscription.deliveryType": + if e.ComplexityRoot.EventSubscription.DeliveryType == nil { break } - args, err := ec.field_Query_node_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Query.Node(childComplexity, args["id"].(int)), true + return e.ComplexityRoot.EventSubscription.DeliveryType(childComplexity), true - case "Query.nodes": - if e.ComplexityRoot.Query.Nodes == nil { + case "EventSubscription.environment": + if e.ComplexityRoot.EventSubscription.Environment == nil { break } - args, err := ec.field_Query_nodes_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Query.Nodes(childComplexity, args["ids"].([]int)), true + return e.ComplexityRoot.EventSubscription.Environment(childComplexity), true - case "Query.teams": - if e.ComplexityRoot.Query.Teams == nil { + case "EventSubscription.eventType": + if e.ComplexityRoot.EventSubscription.EventType == nil { break } - args, err := ec.field_Query_teams_args(ctx, rawArgs) - if err != nil { - return 0, false - } - - return e.ComplexityRoot.Query.Teams(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.TeamOrder), args["where"].(*ent.TeamWhereInput)), true + return e.ComplexityRoot.EventSubscription.EventType(childComplexity), true - case "Query.zones": - if e.ComplexityRoot.Query.Zones == nil { + case "EventSubscription.id": + if e.ComplexityRoot.EventSubscription.ID == nil { break } - return e.ComplexityRoot.Query.Zones(childComplexity), true + return e.ComplexityRoot.EventSubscription.ID(childComplexity), true - case "RequesterInfo.applicationName": - if e.ComplexityRoot.RequesterInfo.ApplicationName == nil { + case "EventSubscription.lastModifiedAt": + if e.ComplexityRoot.EventSubscription.LastModifiedAt == nil { break } - return e.ComplexityRoot.RequesterInfo.ApplicationName(childComplexity), true + return e.ComplexityRoot.EventSubscription.LastModifiedAt(childComplexity), true - case "RequesterInfo.reason": - if e.ComplexityRoot.RequesterInfo.Reason == nil { + case "EventSubscription.name": + if e.ComplexityRoot.EventSubscription.Name == nil { break } - return e.ComplexityRoot.RequesterInfo.Reason(childComplexity), true + return e.ComplexityRoot.EventSubscription.Name(childComplexity), true - case "RequesterInfo.teamEmail": - if e.ComplexityRoot.RequesterInfo.TeamEmail == nil { + case "EventSubscription.namespace": + if e.ComplexityRoot.EventSubscription.Namespace == nil { break } - return e.ComplexityRoot.RequesterInfo.TeamEmail(childComplexity), true + return e.ComplexityRoot.EventSubscription.Namespace(childComplexity), true - case "RequesterInfo.teamName": - if e.ComplexityRoot.RequesterInfo.TeamName == nil { + case "EventSubscription.owner": + if e.ComplexityRoot.EventSubscription.Owner == nil { break } - return e.ComplexityRoot.RequesterInfo.TeamName(childComplexity), true + return e.ComplexityRoot.EventSubscription.Owner(childComplexity), true - case "RotateApplicationSecretResult.message": - if e.ComplexityRoot.RotateApplicationSecretResult.Message == nil { + case "EventSubscription.statusMessage": + if e.ComplexityRoot.EventSubscription.StatusMessage == nil { break } - return e.ComplexityRoot.RotateApplicationSecretResult.Message(childComplexity), true + return e.ComplexityRoot.EventSubscription.StatusMessage(childComplexity), true - case "RotateApplicationSecretResult.namespace": - if e.ComplexityRoot.RotateApplicationSecretResult.Namespace == nil { + case "EventSubscription.statusPhase": + if e.ComplexityRoot.EventSubscription.StatusPhase == nil { break } - return e.ComplexityRoot.RotateApplicationSecretResult.Namespace(childComplexity), true + return e.ComplexityRoot.EventSubscription.StatusPhase(childComplexity), true - case "RotateApplicationSecretResult.resourceName": - if e.ComplexityRoot.RotateApplicationSecretResult.ResourceName == nil { + case "EventSubscription.target": + if e.ComplexityRoot.EventSubscription.Target == nil { break } - return e.ComplexityRoot.RotateApplicationSecretResult.ResourceName(childComplexity), true + return e.ComplexityRoot.EventSubscription.Target(childComplexity), true - case "RotateApplicationSecretResult.success": - if e.ComplexityRoot.RotateApplicationSecretResult.Success == nil { + case "EventSubscriptionConnection.edges": + if e.ComplexityRoot.EventSubscriptionConnection.Edges == nil { break } - return e.ComplexityRoot.RotateApplicationSecretResult.Success(childComplexity), true + return e.ComplexityRoot.EventSubscriptionConnection.Edges(childComplexity), true - case "Team.applications": - if e.ComplexityRoot.Team.Applications == nil { + case "EventSubscriptionConnection.pageInfo": + if e.ComplexityRoot.EventSubscriptionConnection.PageInfo == nil { break } - args, err := ec.field_Team_applications_args(ctx, rawArgs) - if err != nil { - return 0, false - } + return e.ComplexityRoot.EventSubscriptionConnection.PageInfo(childComplexity), true - return e.ComplexityRoot.Team.Applications(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.ApplicationOrder), args["where"].(*ent.ApplicationWhereInput)), true - - case "Team.category": - if e.ComplexityRoot.Team.Category == nil { + case "EventSubscriptionConnection.totalCount": + if e.ComplexityRoot.EventSubscriptionConnection.TotalCount == nil { break } - return e.ComplexityRoot.Team.Category(childComplexity), true + return e.ComplexityRoot.EventSubscriptionConnection.TotalCount(childComplexity), true - case "Team.createdAt": - if e.ComplexityRoot.Team.CreatedAt == nil { + case "EventSubscriptionEdge.cursor": + if e.ComplexityRoot.EventSubscriptionEdge.Cursor == nil { break } - return e.ComplexityRoot.Team.CreatedAt(childComplexity), true + return e.ComplexityRoot.EventSubscriptionEdge.Cursor(childComplexity), true - case "Team.email": - if e.ComplexityRoot.Team.Email == nil { + case "EventSubscriptionEdge.node": + if e.ComplexityRoot.EventSubscriptionEdge.Node == nil { break } - return e.ComplexityRoot.Team.Email(childComplexity), true + return e.ComplexityRoot.EventSubscriptionEdge.Node(childComplexity), true - case "Team.environment": - if e.ComplexityRoot.Team.Environment == nil { + case "EventSubscriptionInfo.deliveryType": + if e.ComplexityRoot.EventSubscriptionInfo.DeliveryType == nil { break } - return e.ComplexityRoot.Team.Environment(childComplexity), true + return e.ComplexityRoot.EventSubscriptionInfo.DeliveryType(childComplexity), true - case "Team.group": - if e.ComplexityRoot.Team.Group == nil { + case "EventSubscriptionInfo.eventType": + if e.ComplexityRoot.EventSubscriptionInfo.EventType == nil { break } - return e.ComplexityRoot.Team.Group(childComplexity), true + return e.ComplexityRoot.EventSubscriptionInfo.EventType(childComplexity), true - case "Team.id": - if e.ComplexityRoot.Team.ID == nil { + case "EventSubscriptionInfo.id": + if e.ComplexityRoot.EventSubscriptionInfo.ID == nil { break } - return e.ComplexityRoot.Team.ID(childComplexity), true + return e.ComplexityRoot.EventSubscriptionInfo.ID(childComplexity), true - case "Team.lastModifiedAt": - if e.ComplexityRoot.Team.LastModifiedAt == nil { + case "EventSubscriptionInfo.ownerApplicationName": + if e.ComplexityRoot.EventSubscriptionInfo.OwnerApplicationName == nil { break } - return e.ComplexityRoot.Team.LastModifiedAt(childComplexity), true + return e.ComplexityRoot.EventSubscriptionInfo.OwnerApplicationName(childComplexity), true - case "Team.members": - if e.ComplexityRoot.Team.Members == nil { + case "EventSubscriptionInfo.ownerTeam": + if e.ComplexityRoot.EventSubscriptionInfo.OwnerTeam == nil { break } - return e.ComplexityRoot.Team.Members(childComplexity), true + return e.ComplexityRoot.EventSubscriptionInfo.OwnerTeam(childComplexity), true - case "Team.name": - if e.ComplexityRoot.Team.Name == nil { + case "EventSubscriptionInfo.statusMessage": + if e.ComplexityRoot.EventSubscriptionInfo.StatusMessage == nil { break } - return e.ComplexityRoot.Team.Name(childComplexity), true + return e.ComplexityRoot.EventSubscriptionInfo.StatusMessage(childComplexity), true - case "Team.namespace": - if e.ComplexityRoot.Team.Namespace == nil { + case "EventSubscriptionInfo.statusPhase": + if e.ComplexityRoot.EventSubscriptionInfo.StatusPhase == nil { break } - return e.ComplexityRoot.Team.Namespace(childComplexity), true + return e.ComplexityRoot.EventSubscriptionInfo.StatusPhase(childComplexity), true - case "Team.roverTokenRef": - if e.ComplexityRoot.Team.RoverTokenRef == nil { + case "Group.description": + if e.ComplexityRoot.Group.Description == nil { break } - return e.ComplexityRoot.Team.RoverTokenRef(childComplexity), true + return e.ComplexityRoot.Group.Description(childComplexity), true - case "Team.statusMessage": - if e.ComplexityRoot.Team.StatusMessage == nil { + case "Group.displayName": + if e.ComplexityRoot.Group.DisplayName == nil { break } - return e.ComplexityRoot.Team.StatusMessage(childComplexity), true + return e.ComplexityRoot.Group.DisplayName(childComplexity), true - case "Team.statusPhase": - if e.ComplexityRoot.Team.StatusPhase == nil { + case "Group.environment": + if e.ComplexityRoot.Group.Environment == nil { break } - return e.ComplexityRoot.Team.StatusPhase(childComplexity), true + return e.ComplexityRoot.Group.Environment(childComplexity), true - case "TeamConnection.edges": - if e.ComplexityRoot.TeamConnection.Edges == nil { + case "Group.id": + if e.ComplexityRoot.Group.ID == nil { break } - return e.ComplexityRoot.TeamConnection.Edges(childComplexity), true + return e.ComplexityRoot.Group.ID(childComplexity), true - case "TeamConnection.pageInfo": - if e.ComplexityRoot.TeamConnection.PageInfo == nil { + case "Group.name": + if e.ComplexityRoot.Group.Name == nil { break } - return e.ComplexityRoot.TeamConnection.PageInfo(childComplexity), true + return e.ComplexityRoot.Group.Name(childComplexity), true - case "TeamConnection.totalCount": - if e.ComplexityRoot.TeamConnection.TotalCount == nil { + case "Group.namespace": + if e.ComplexityRoot.Group.Namespace == nil { break } - return e.ComplexityRoot.TeamConnection.TotalCount(childComplexity), true + return e.ComplexityRoot.Group.Namespace(childComplexity), true - case "TeamEdge.cursor": - if e.ComplexityRoot.TeamEdge.Cursor == nil { + case "Group.teams": + if e.ComplexityRoot.Group.Teams == nil { break } - return e.ComplexityRoot.TeamEdge.Cursor(childComplexity), true + return e.ComplexityRoot.Group.Teams(childComplexity), true - case "TeamEdge.node": - if e.ComplexityRoot.TeamEdge.Node == nil { + case "Member.email": + if e.ComplexityRoot.Member.Email == nil { break } - return e.ComplexityRoot.TeamEdge.Node(childComplexity), true + return e.ComplexityRoot.Member.Email(childComplexity), true - case "TeamInfo.email": - if e.ComplexityRoot.TeamInfo.Email == nil { + case "Member.environment": + if e.ComplexityRoot.Member.Environment == nil { break } - return e.ComplexityRoot.TeamInfo.Email(childComplexity), true + return e.ComplexityRoot.Member.Environment(childComplexity), true - case "TeamInfo.groupName": - if e.ComplexityRoot.TeamInfo.GroupName == nil { + case "Member.id": + if e.ComplexityRoot.Member.ID == nil { break } - return e.ComplexityRoot.TeamInfo.GroupName(childComplexity), true + return e.ComplexityRoot.Member.ID(childComplexity), true - case "TeamInfo.id": - if e.ComplexityRoot.TeamInfo.ID == nil { + case "Member.name": + if e.ComplexityRoot.Member.Name == nil { break } - return e.ComplexityRoot.TeamInfo.ID(childComplexity), true + return e.ComplexityRoot.Member.Name(childComplexity), true - case "TeamInfo.name": - if e.ComplexityRoot.TeamInfo.Name == nil { + case "Member.team": + if e.ComplexityRoot.Member.Team == nil { break } - return e.ComplexityRoot.TeamInfo.Name(childComplexity), true + return e.ComplexityRoot.Member.Team(childComplexity), true - case "TeamMutationResult.message": - if e.ComplexityRoot.TeamMutationResult.Message == nil { + case "Mutation.addTeamMember": + if e.ComplexityRoot.Mutation.AddTeamMember == nil { break } - return e.ComplexityRoot.TeamMutationResult.Message(childComplexity), true - - case "TeamMutationResult.namespace": - if e.ComplexityRoot.TeamMutationResult.Namespace == nil { - break + args, err := ec.field_Mutation_addTeamMember_args(ctx, rawArgs) + if err != nil { + return 0, false } - return e.ComplexityRoot.TeamMutationResult.Namespace(childComplexity), true + return e.ComplexityRoot.Mutation.AddTeamMember(childComplexity, args["teamId"].(int), args["member"].(model.MemberInput)), true - case "TeamMutationResult.resourceName": - if e.ComplexityRoot.TeamMutationResult.ResourceName == nil { + case "Mutation.createTeam": + if e.ComplexityRoot.Mutation.CreateTeam == nil { break } - return e.ComplexityRoot.TeamMutationResult.ResourceName(childComplexity), true - - case "TeamMutationResult.success": - if e.ComplexityRoot.TeamMutationResult.Success == nil { - break + args, err := ec.field_Mutation_createTeam_args(ctx, rawArgs) + if err != nil { + return 0, false } - return e.ComplexityRoot.TeamMutationResult.Success(childComplexity), true + return e.ComplexityRoot.Mutation.CreateTeam(childComplexity, args["input"].(model.CreateTeamInput)), true - case "Upstream.url": - if e.ComplexityRoot.Upstream.URL == nil { + case "Mutation.decideApproval": + if e.ComplexityRoot.Mutation.DecideApproval == nil { break } - return e.ComplexityRoot.Upstream.URL(childComplexity), true - - case "Upstream.weight": - if e.ComplexityRoot.Upstream.Weight == nil { - break + args, err := ec.field_Mutation_decideApproval_args(ctx, rawArgs) + if err != nil { + return 0, false } - return e.ComplexityRoot.Upstream.Weight(childComplexity), true + return e.ComplexityRoot.Mutation.DecideApproval(childComplexity, args["approvalId"].(int), args["input"].(model.DecisionInput)), true - case "Zone.applications": - if e.ComplexityRoot.Zone.Applications == nil { + case "Mutation.decideApprovalRequest": + if e.ComplexityRoot.Mutation.DecideApprovalRequest == nil { break } - return e.ComplexityRoot.Zone.Applications(childComplexity), true - - case "Zone.environment": - if e.ComplexityRoot.Zone.Environment == nil { + args, err := ec.field_Mutation_decideApprovalRequest_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Mutation.DecideApprovalRequest(childComplexity, args["approvalRequestId"].(int), args["input"].(model.DecisionInput)), true + + case "Mutation.removeTeamMember": + if e.ComplexityRoot.Mutation.RemoveTeamMember == nil { break } - return e.ComplexityRoot.Zone.Environment(childComplexity), true + args, err := ec.field_Mutation_removeTeamMember_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "Zone.gatewayURL": - if e.ComplexityRoot.Zone.GatewayURL == nil { + return e.ComplexityRoot.Mutation.RemoveTeamMember(childComplexity, args["teamId"].(int), args["memberEmail"].(string)), true + + case "Mutation.rotateApplicationSecret": + if e.ComplexityRoot.Mutation.RotateApplicationSecret == nil { break } - return e.ComplexityRoot.Zone.GatewayURL(childComplexity), true + args, err := ec.field_Mutation_rotateApplicationSecret_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "Zone.id": - if e.ComplexityRoot.Zone.ID == nil { + return e.ComplexityRoot.Mutation.RotateApplicationSecret(childComplexity, args["applicationId"].(int)), true + + case "Mutation.rotateTeamToken": + if e.ComplexityRoot.Mutation.RotateTeamToken == nil { break } - return e.ComplexityRoot.Zone.ID(childComplexity), true + args, err := ec.field_Mutation_rotateTeamToken_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "Zone.name": - if e.ComplexityRoot.Zone.Name == nil { + return e.ComplexityRoot.Mutation.RotateTeamToken(childComplexity, args["teamId"].(int)), true + + case "Mutation.updateTeam": + if e.ComplexityRoot.Mutation.UpdateTeam == nil { break } - return e.ComplexityRoot.Zone.Name(childComplexity), true + args, err := ec.field_Mutation_updateTeam_args(ctx, rawArgs) + if err != nil { + return 0, false + } - case "Zone.visibility": - if e.ComplexityRoot.Zone.Visibility == nil { + return e.ComplexityRoot.Mutation.UpdateTeam(childComplexity, args["input"].(model.UpdateTeamInput)), true + + case "MutationError.code": + if e.ComplexityRoot.MutationError.Code == nil { break } - return e.ComplexityRoot.Zone.Visibility(childComplexity), true + return e.ComplexityRoot.MutationError.Code(childComplexity), true - } - return 0, false -} + case "MutationError.field": + if e.ComplexityRoot.MutationError.Field == nil { + break + } -func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - opCtx := graphql.GetOperationContext(ctx) - ec := newExecutionContext(opCtx, e, make(chan graphql.DeferredResult)) - inputUnmarshalMap := graphql.BuildUnmarshalerMap( - ec.unmarshalInputApiExposureOrder, - ec.unmarshalInputApiExposureWhereInput, - ec.unmarshalInputApiSubscriptionOrder, - ec.unmarshalInputApiSubscriptionWhereInput, - ec.unmarshalInputApplicationOrder, - ec.unmarshalInputApplicationWhereInput, - ec.unmarshalInputApprovalOrder, - ec.unmarshalInputApprovalRequestOrder, - ec.unmarshalInputApprovalRequestWhereInput, - ec.unmarshalInputApprovalWhereInput, - ec.unmarshalInputCreateTeamInput, - ec.unmarshalInputDecideApprovalInput, - ec.unmarshalInputDecideApprovalRequestInput, - ec.unmarshalInputDecisionInput, - ec.unmarshalInputGroupWhereInput, - ec.unmarshalInputMemberInput, - ec.unmarshalInputMemberWhereInput, - ec.unmarshalInputRotateApplicationSecretInput, - ec.unmarshalInputRotateTeamTokenInput, - ec.unmarshalInputTeamOrder, - ec.unmarshalInputTeamWhereInput, - ec.unmarshalInputUpdateTeamInput, - ec.unmarshalInputZoneWhereInput, - ) - first := true + return e.ComplexityRoot.MutationError.Field(childComplexity), true + + case "MutationError.message": + if e.ComplexityRoot.MutationError.Message == nil { + break + } + + return e.ComplexityRoot.MutationError.Message(childComplexity), true + + case "PageInfo.endCursor": + if e.ComplexityRoot.PageInfo.EndCursor == nil { + break + } + + return e.ComplexityRoot.PageInfo.EndCursor(childComplexity), true + + case "PageInfo.hasNextPage": + if e.ComplexityRoot.PageInfo.HasNextPage == nil { + break + } + + return e.ComplexityRoot.PageInfo.HasNextPage(childComplexity), true + + case "PageInfo.hasPreviousPage": + if e.ComplexityRoot.PageInfo.HasPreviousPage == nil { + break + } + + return e.ComplexityRoot.PageInfo.HasPreviousPage(childComplexity), true + + case "PageInfo.startCursor": + if e.ComplexityRoot.PageInfo.StartCursor == nil { + break + } + + return e.ComplexityRoot.PageInfo.StartCursor(childComplexity), true + + case "Query.apiExposures": + if e.ComplexityRoot.Query.APIExposures == nil { + break + } + + args, err := ec.field_Query_apiExposures_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.APIExposures(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.ApiExposureOrder), args["where"].(*ent.ApiExposureWhereInput)), true + + case "Query.apiSubscriptions": + if e.ComplexityRoot.Query.APISubscriptions == nil { + break + } + + args, err := ec.field_Query_apiSubscriptions_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.APISubscriptions(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.ApiSubscriptionOrder), args["where"].(*ent.ApiSubscriptionWhereInput)), true + + case "Query.applications": + if e.ComplexityRoot.Query.Applications == nil { + break + } + + args, err := ec.field_Query_applications_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.Applications(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.ApplicationOrder), args["where"].(*ent.ApplicationWhereInput)), true + + case "Query.approvalRequests": + if e.ComplexityRoot.Query.ApprovalRequests == nil { + break + } + + args, err := ec.field_Query_approvalRequests_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.ApprovalRequests(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.ApprovalRequestOrder), args["where"].(*ent.ApprovalRequestWhereInput)), true + + case "Query.approvals": + if e.ComplexityRoot.Query.Approvals == nil { + break + } + + args, err := ec.field_Query_approvals_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.Approvals(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.ApprovalOrder), args["where"].(*ent.ApprovalWhereInput)), true + + case "Query.eventExposures": + if e.ComplexityRoot.Query.EventExposures == nil { + break + } + + args, err := ec.field_Query_eventExposures_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.EventExposures(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.EventExposureOrder), args["where"].(*ent.EventExposureWhereInput)), true + + case "Query.eventSubscriptions": + if e.ComplexityRoot.Query.EventSubscriptions == nil { + break + } + + args, err := ec.field_Query_eventSubscriptions_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.EventSubscriptions(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.EventSubscriptionOrder), args["where"].(*ent.EventSubscriptionWhereInput)), true + + case "Query.node": + if e.ComplexityRoot.Query.Node == nil { + break + } + + args, err := ec.field_Query_node_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.Node(childComplexity, args["id"].(int)), true + + case "Query.nodes": + if e.ComplexityRoot.Query.Nodes == nil { + break + } + + args, err := ec.field_Query_nodes_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.Nodes(childComplexity, args["ids"].([]int)), true + + case "Query.teams": + if e.ComplexityRoot.Query.Teams == nil { + break + } + + args, err := ec.field_Query_teams_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.Teams(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.TeamOrder), args["where"].(*ent.TeamWhereInput)), true + + case "Query.zones": + if e.ComplexityRoot.Query.Zones == nil { + break + } + + return e.ComplexityRoot.Query.Zones(childComplexity), true + + case "RemoveTeamMemberPayload.errors": + if e.ComplexityRoot.RemoveTeamMemberPayload.Errors == nil { + break + } + + return e.ComplexityRoot.RemoveTeamMemberPayload.Errors(childComplexity), true + + case "RemoveTeamMemberPayload.team": + if e.ComplexityRoot.RemoveTeamMemberPayload.Team == nil { + break + } + + return e.ComplexityRoot.RemoveTeamMemberPayload.Team(childComplexity), true + + case "RequesterInfo.applicationName": + if e.ComplexityRoot.RequesterInfo.ApplicationName == nil { + break + } + + return e.ComplexityRoot.RequesterInfo.ApplicationName(childComplexity), true + + case "RequesterInfo.reason": + if e.ComplexityRoot.RequesterInfo.Reason == nil { + break + } + + return e.ComplexityRoot.RequesterInfo.Reason(childComplexity), true + + case "RequesterInfo.teamEmail": + if e.ComplexityRoot.RequesterInfo.TeamEmail == nil { + break + } + + return e.ComplexityRoot.RequesterInfo.TeamEmail(childComplexity), true + + case "RequesterInfo.teamName": + if e.ComplexityRoot.RequesterInfo.TeamName == nil { + break + } + + return e.ComplexityRoot.RequesterInfo.TeamName(childComplexity), true + + case "RotateApplicationSecretPayload.accepted": + if e.ComplexityRoot.RotateApplicationSecretPayload.Accepted == nil { + break + } + + return e.ComplexityRoot.RotateApplicationSecretPayload.Accepted(childComplexity), true + + case "RotateApplicationSecretPayload.application": + if e.ComplexityRoot.RotateApplicationSecretPayload.Application == nil { + break + } + + return e.ComplexityRoot.RotateApplicationSecretPayload.Application(childComplexity), true + + case "RotateApplicationSecretPayload.errors": + if e.ComplexityRoot.RotateApplicationSecretPayload.Errors == nil { + break + } + + return e.ComplexityRoot.RotateApplicationSecretPayload.Errors(childComplexity), true + + case "RotateTeamTokenPayload.accepted": + if e.ComplexityRoot.RotateTeamTokenPayload.Accepted == nil { + break + } + + return e.ComplexityRoot.RotateTeamTokenPayload.Accepted(childComplexity), true + + case "RotateTeamTokenPayload.errors": + if e.ComplexityRoot.RotateTeamTokenPayload.Errors == nil { + break + } + + return e.ComplexityRoot.RotateTeamTokenPayload.Errors(childComplexity), true + + case "RotateTeamTokenPayload.team": + if e.ComplexityRoot.RotateTeamTokenPayload.Team == nil { + break + } + + return e.ComplexityRoot.RotateTeamTokenPayload.Team(childComplexity), true + + case "Team.applications": + if e.ComplexityRoot.Team.Applications == nil { + break + } + + args, err := ec.field_Team_applications_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Team.Applications(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.ApplicationOrder), args["where"].(*ent.ApplicationWhereInput)), true + + case "Team.category": + if e.ComplexityRoot.Team.Category == nil { + break + } + + return e.ComplexityRoot.Team.Category(childComplexity), true + + case "Team.createdAt": + if e.ComplexityRoot.Team.CreatedAt == nil { + break + } + + return e.ComplexityRoot.Team.CreatedAt(childComplexity), true + + case "Team.email": + if e.ComplexityRoot.Team.Email == nil { + break + } + + return e.ComplexityRoot.Team.Email(childComplexity), true + + case "Team.environment": + if e.ComplexityRoot.Team.Environment == nil { + break + } + + return e.ComplexityRoot.Team.Environment(childComplexity), true + + case "Team.group": + if e.ComplexityRoot.Team.Group == nil { + break + } + + return e.ComplexityRoot.Team.Group(childComplexity), true + + case "Team.id": + if e.ComplexityRoot.Team.ID == nil { + break + } + + return e.ComplexityRoot.Team.ID(childComplexity), true + + case "Team.lastModifiedAt": + if e.ComplexityRoot.Team.LastModifiedAt == nil { + break + } + + return e.ComplexityRoot.Team.LastModifiedAt(childComplexity), true + + case "Team.members": + if e.ComplexityRoot.Team.Members == nil { + break + } + + return e.ComplexityRoot.Team.Members(childComplexity), true + + case "Team.name": + if e.ComplexityRoot.Team.Name == nil { + break + } + + return e.ComplexityRoot.Team.Name(childComplexity), true + + case "Team.namespace": + if e.ComplexityRoot.Team.Namespace == nil { + break + } + + return e.ComplexityRoot.Team.Namespace(childComplexity), true + + case "Team.statusMessage": + if e.ComplexityRoot.Team.StatusMessage == nil { + break + } + + return e.ComplexityRoot.Team.StatusMessage(childComplexity), true + + case "Team.statusPhase": + if e.ComplexityRoot.Team.StatusPhase == nil { + break + } + + return e.ComplexityRoot.Team.StatusPhase(childComplexity), true + + case "Team.teamToken": + if e.ComplexityRoot.Team.TeamToken == nil { + break + } + + return e.ComplexityRoot.Team.TeamToken(childComplexity), true + + case "TeamConnection.edges": + if e.ComplexityRoot.TeamConnection.Edges == nil { + break + } + + return e.ComplexityRoot.TeamConnection.Edges(childComplexity), true + + case "TeamConnection.pageInfo": + if e.ComplexityRoot.TeamConnection.PageInfo == nil { + break + } + + return e.ComplexityRoot.TeamConnection.PageInfo(childComplexity), true + + case "TeamConnection.totalCount": + if e.ComplexityRoot.TeamConnection.TotalCount == nil { + break + } + + return e.ComplexityRoot.TeamConnection.TotalCount(childComplexity), true + + case "TeamEdge.cursor": + if e.ComplexityRoot.TeamEdge.Cursor == nil { + break + } + + return e.ComplexityRoot.TeamEdge.Cursor(childComplexity), true + + case "TeamEdge.node": + if e.ComplexityRoot.TeamEdge.Node == nil { + break + } + + return e.ComplexityRoot.TeamEdge.Node(childComplexity), true + + case "TeamInfo.email": + if e.ComplexityRoot.TeamInfo.Email == nil { + break + } + + return e.ComplexityRoot.TeamInfo.Email(childComplexity), true + + case "TeamInfo.groupName": + if e.ComplexityRoot.TeamInfo.GroupName == nil { + break + } + + return e.ComplexityRoot.TeamInfo.GroupName(childComplexity), true + + case "TeamInfo.id": + if e.ComplexityRoot.TeamInfo.ID == nil { + break + } + + return e.ComplexityRoot.TeamInfo.ID(childComplexity), true + + case "TeamInfo.name": + if e.ComplexityRoot.TeamInfo.Name == nil { + break + } + + return e.ComplexityRoot.TeamInfo.Name(childComplexity), true + + case "UpdateTeamPayload.accepted": + if e.ComplexityRoot.UpdateTeamPayload.Accepted == nil { + break + } + + return e.ComplexityRoot.UpdateTeamPayload.Accepted(childComplexity), true + + case "UpdateTeamPayload.errors": + if e.ComplexityRoot.UpdateTeamPayload.Errors == nil { + break + } + + return e.ComplexityRoot.UpdateTeamPayload.Errors(childComplexity), true + + case "UpdateTeamPayload.team": + if e.ComplexityRoot.UpdateTeamPayload.Team == nil { + break + } + + return e.ComplexityRoot.UpdateTeamPayload.Team(childComplexity), true + + case "Upstream.url": + if e.ComplexityRoot.Upstream.URL == nil { + break + } + + return e.ComplexityRoot.Upstream.URL(childComplexity), true + + case "Upstream.weight": + if e.ComplexityRoot.Upstream.Weight == nil { + break + } + + return e.ComplexityRoot.Upstream.Weight(childComplexity), true + + case "Zone.applications": + if e.ComplexityRoot.Zone.Applications == nil { + break + } + + return e.ComplexityRoot.Zone.Applications(childComplexity), true + + case "Zone.environment": + if e.ComplexityRoot.Zone.Environment == nil { + break + } + + return e.ComplexityRoot.Zone.Environment(childComplexity), true + + case "Zone.gatewayURL": + if e.ComplexityRoot.Zone.GatewayURL == nil { + break + } + + return e.ComplexityRoot.Zone.GatewayURL(childComplexity), true + + case "Zone.id": + if e.ComplexityRoot.Zone.ID == nil { + break + } + + return e.ComplexityRoot.Zone.ID(childComplexity), true + + case "Zone.issuerURL": + if e.ComplexityRoot.Zone.IssuerURL == nil { + break + } + + return e.ComplexityRoot.Zone.IssuerURL(childComplexity), true + + case "Zone.name": + if e.ComplexityRoot.Zone.Name == nil { + break + } + + return e.ComplexityRoot.Zone.Name(childComplexity), true + + case "Zone.tokenURL": + if e.ComplexityRoot.Zone.TokenURL == nil { + break + } + + return e.ComplexityRoot.Zone.TokenURL(childComplexity), true + + case "Zone.visibility": + if e.ComplexityRoot.Zone.Visibility == nil { + break + } + + return e.ComplexityRoot.Zone.Visibility(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + opCtx := graphql.GetOperationContext(ctx) + ec := newExecutionContext(opCtx, e, make(chan graphql.DeferredResult)) + inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputApiExposureOrder, + ec.unmarshalInputApiExposureWhereInput, + ec.unmarshalInputApiSubscriptionOrder, + ec.unmarshalInputApiSubscriptionWhereInput, + ec.unmarshalInputApplicationOrder, + ec.unmarshalInputApplicationWhereInput, + ec.unmarshalInputApprovalOrder, + ec.unmarshalInputApprovalRequestOrder, + ec.unmarshalInputApprovalRequestWhereInput, + ec.unmarshalInputApprovalWhereInput, + ec.unmarshalInputCreateTeamInput, + ec.unmarshalInputDecisionInput, + ec.unmarshalInputEventExposureOrder, + ec.unmarshalInputEventExposureWhereInput, + ec.unmarshalInputEventSubscriptionOrder, + ec.unmarshalInputEventSubscriptionWhereInput, + ec.unmarshalInputGroupWhereInput, + ec.unmarshalInputMemberInput, + ec.unmarshalInputMemberWhereInput, + ec.unmarshalInputTeamOrder, + ec.unmarshalInputTeamWhereInput, + ec.unmarshalInputUpdateTeamInput, + ec.unmarshalInputZoneWhereInput, + ) + first := true + + switch opCtx.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + var response graphql.Response + var data graphql.Marshaler + if first { + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) + } else { + if atomic.LoadInt32(&ec.PendingDeferred) > 0 { + result := <-ec.DeferredResults + atomic.AddInt32(&ec.PendingDeferred, -1) + data = result.Result + response.Path = result.Path + response.Label = result.Label + response.Errors = result.Errors + } else { + return nil + } + } + var buf bytes.Buffer + data.MarshalGQL(&buf) + response.Data = buf.Bytes() + if atomic.LoadInt32(&ec.Deferred) > 0 { + hasNext := atomic.LoadInt32(&ec.PendingDeferred) > 0 + response.HasNext = &hasNext + } + + return &response + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.ExecutionContextState[ResolverRoot, DirectiveRoot, ComplexityRoot] +} + +func newExecutionContext( + opCtx *graphql.OperationContext, + execSchema *executableSchema, + deferredResults chan graphql.DeferredResult, +) *executionContext { + return &executionContext{ + ExecutionContextState: graphql.NewExecutionContextState[ResolverRoot, DirectiveRoot, ComplexityRoot]( + opCtx, + (*graphql.ExecutableSchemaState[ResolverRoot, DirectiveRoot, ComplexityRoot])(execSchema), + parsedSchema, + deferredResults, + ), + } +} + +var sources = []*ast.Source{ + {Name: "../../ent.graphql", Input: `directive @goField(forceResolver: Boolean, name: String, omittable: Boolean) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION +directive @goModel(model: String, models: [String!], forceGenerate: Boolean) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION +type ApiExposure implements Node { + id: ID! + createdAt: Time! + lastModifiedAt: Time! + statusPhase: ApiExposureStatusPhase + statusMessage: String + environment: String + namespace: String! + basePath: String! + visibility: ApiExposureVisibility! + active: Boolean + features: [ApiExposureFeature!]! + upstreams: [Upstream!]! + approvalConfig: ApprovalConfig! + apiVersion: String + owner: Application! +} +""" +A connection to a list of items. +""" +type ApiExposureConnection { + """ + A list of edges. + """ + edges: [ApiExposureEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +An edge in a connection. +""" +type ApiExposureEdge { + """ + The item at the end of the edge. + """ + node: ApiExposure + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} +""" +Ordering options for ApiExposure connections +""" +input ApiExposureOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order ApiExposures. + """ + field: ApiExposureOrderField! +} +""" +Properties by which ApiExposure connections can be ordered. +""" +enum ApiExposureOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +ApiExposureStatusPhase is enum for the field status_phase +""" +enum ApiExposureStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/apiexposure.StatusPhase") { + READY + PENDING + ERROR + UNKNOWN +} +""" +ApiExposureVisibility is enum for the field visibility +""" +enum ApiExposureVisibility @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/apiexposure.Visibility") { + WORLD + ZONE + ENTERPRISE +} +""" +ApiExposureWhereInput is used for filtering ApiExposure objects. +Input was generated by ent. +""" +input ApiExposureWhereInput { + not: ApiExposureWhereInput + and: [ApiExposureWhereInput!] + or: [ApiExposureWhereInput!] + """ + id field predicates + """ + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """ + created_at field predicates + """ + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """ + last_modified_at field predicates + """ + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """ + status_phase field predicates + """ + statusPhase: ApiExposureStatusPhase + statusPhaseNEQ: ApiExposureStatusPhase + statusPhaseIn: [ApiExposureStatusPhase!] + statusPhaseNotIn: [ApiExposureStatusPhase!] + statusPhaseIsNil: Boolean + statusPhaseNotNil: Boolean + """ + status_message field predicates + """ + statusMessage: String + statusMessageNEQ: String + statusMessageIn: [String!] + statusMessageNotIn: [String!] + statusMessageGT: String + statusMessageGTE: String + statusMessageLT: String + statusMessageLTE: String + statusMessageContains: String + statusMessageHasPrefix: String + statusMessageHasSuffix: String + statusMessageIsNil: Boolean + statusMessageNotNil: Boolean + statusMessageEqualFold: String + statusMessageContainsFold: String + """ + environment field predicates + """ + environment: String + environmentNEQ: String + environmentIn: [String!] + environmentNotIn: [String!] + environmentGT: String + environmentGTE: String + environmentLT: String + environmentLTE: String + environmentContains: String + environmentHasPrefix: String + environmentHasSuffix: String + environmentIsNil: Boolean + environmentNotNil: Boolean + environmentEqualFold: String + environmentContainsFold: String + """ + namespace field predicates + """ + namespace: String + namespaceNEQ: String + namespaceIn: [String!] + namespaceNotIn: [String!] + namespaceGT: String + namespaceGTE: String + namespaceLT: String + namespaceLTE: String + namespaceContains: String + namespaceHasPrefix: String + namespaceHasSuffix: String + namespaceEqualFold: String + namespaceContainsFold: String + """ + base_path field predicates + """ + basePath: String + basePathNEQ: String + basePathIn: [String!] + basePathNotIn: [String!] + basePathGT: String + basePathGTE: String + basePathLT: String + basePathLTE: String + basePathContains: String + basePathHasPrefix: String + basePathHasSuffix: String + basePathEqualFold: String + basePathContainsFold: String + """ + visibility field predicates + """ + visibility: ApiExposureVisibility + visibilityNEQ: ApiExposureVisibility + visibilityIn: [ApiExposureVisibility!] + visibilityNotIn: [ApiExposureVisibility!] + """ + active field predicates + """ + active: Boolean + activeNEQ: Boolean + activeIsNil: Boolean + activeNotNil: Boolean + """ + api_version field predicates + """ + apiVersion: String + apiVersionNEQ: String + apiVersionIn: [String!] + apiVersionNotIn: [String!] + apiVersionGT: String + apiVersionGTE: String + apiVersionLT: String + apiVersionLTE: String + apiVersionContains: String + apiVersionHasPrefix: String + apiVersionHasSuffix: String + apiVersionIsNil: Boolean + apiVersionNotNil: Boolean + apiVersionEqualFold: String + apiVersionContainsFold: String + """ + owner edge predicates + """ + hasOwner: Boolean + hasOwnerWith: [ApplicationWhereInput!] + """ + subscriptions edge predicates + """ + hasSubscriptions: Boolean + hasSubscriptionsWith: [ApiSubscriptionWhereInput!] +} +type ApiSubscription implements Node { + id: ID! + createdAt: Time! + lastModifiedAt: Time! + statusPhase: ApiSubscriptionStatusPhase + statusMessage: String + environment: String + namespace: String! + name: String! + basePath: String! + m2mAuthMethod: ApiSubscriptionM2mAuthMethod! + approvedScopes: [String!]! + owner: Application! + failoverZones: [Zone!] + approval: Approval + approvalRequests: [ApprovalRequest!] +} +""" +A connection to a list of items. +""" +type ApiSubscriptionConnection { + """ + A list of edges. + """ + edges: [ApiSubscriptionEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +An edge in a connection. +""" +type ApiSubscriptionEdge { + """ + The item at the end of the edge. + """ + node: ApiSubscription + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} +""" +ApiSubscriptionM2mAuthMethod is enum for the field m2m_auth_method +""" +enum ApiSubscriptionM2mAuthMethod @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/apisubscription.M2mAuthMethod") { + NONE + BASIC_AUTH + OAUTH2_CLIENT + SCOPES_ONLY +} +""" +Ordering options for ApiSubscription connections +""" +input ApiSubscriptionOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order ApiSubscriptions. + """ + field: ApiSubscriptionOrderField! +} +""" +Properties by which ApiSubscription connections can be ordered. +""" +enum ApiSubscriptionOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +ApiSubscriptionStatusPhase is enum for the field status_phase +""" +enum ApiSubscriptionStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/apisubscription.StatusPhase") { + READY + PENDING + ERROR + UNKNOWN +} +""" +ApiSubscriptionWhereInput is used for filtering ApiSubscription objects. +Input was generated by ent. +""" +input ApiSubscriptionWhereInput { + not: ApiSubscriptionWhereInput + and: [ApiSubscriptionWhereInput!] + or: [ApiSubscriptionWhereInput!] + """ + id field predicates + """ + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """ + created_at field predicates + """ + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """ + last_modified_at field predicates + """ + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """ + status_phase field predicates + """ + statusPhase: ApiSubscriptionStatusPhase + statusPhaseNEQ: ApiSubscriptionStatusPhase + statusPhaseIn: [ApiSubscriptionStatusPhase!] + statusPhaseNotIn: [ApiSubscriptionStatusPhase!] + statusPhaseIsNil: Boolean + statusPhaseNotNil: Boolean + """ + status_message field predicates + """ + statusMessage: String + statusMessageNEQ: String + statusMessageIn: [String!] + statusMessageNotIn: [String!] + statusMessageGT: String + statusMessageGTE: String + statusMessageLT: String + statusMessageLTE: String + statusMessageContains: String + statusMessageHasPrefix: String + statusMessageHasSuffix: String + statusMessageIsNil: Boolean + statusMessageNotNil: Boolean + statusMessageEqualFold: String + statusMessageContainsFold: String + """ + environment field predicates + """ + environment: String + environmentNEQ: String + environmentIn: [String!] + environmentNotIn: [String!] + environmentGT: String + environmentGTE: String + environmentLT: String + environmentLTE: String + environmentContains: String + environmentHasPrefix: String + environmentHasSuffix: String + environmentIsNil: Boolean + environmentNotNil: Boolean + environmentEqualFold: String + environmentContainsFold: String + """ + namespace field predicates + """ + namespace: String + namespaceNEQ: String + namespaceIn: [String!] + namespaceNotIn: [String!] + namespaceGT: String + namespaceGTE: String + namespaceLT: String + namespaceLTE: String + namespaceContains: String + namespaceHasPrefix: String + namespaceHasSuffix: String + namespaceEqualFold: String + namespaceContainsFold: String + """ + name field predicates + """ + name: String + nameNEQ: String + nameIn: [String!] + nameNotIn: [String!] + nameGT: String + nameGTE: String + nameLT: String + nameLTE: String + nameContains: String + nameHasPrefix: String + nameHasSuffix: String + nameEqualFold: String + nameContainsFold: String + """ + base_path field predicates + """ + basePath: String + basePathNEQ: String + basePathIn: [String!] + basePathNotIn: [String!] + basePathGT: String + basePathGTE: String + basePathLT: String + basePathLTE: String + basePathContains: String + basePathHasPrefix: String + basePathHasSuffix: String + basePathEqualFold: String + basePathContainsFold: String + """ + m2m_auth_method field predicates + """ + m2mAuthMethod: ApiSubscriptionM2mAuthMethod + m2mAuthMethodNEQ: ApiSubscriptionM2mAuthMethod + m2mAuthMethodIn: [ApiSubscriptionM2mAuthMethod!] + m2mAuthMethodNotIn: [ApiSubscriptionM2mAuthMethod!] + """ + owner edge predicates + """ + hasOwner: Boolean + hasOwnerWith: [ApplicationWhereInput!] + """ + target edge predicates + """ + hasTarget: Boolean + hasTargetWith: [ApiExposureWhereInput!] + """ + failover_zones edge predicates + """ + hasFailoverZones: Boolean + hasFailoverZonesWith: [ZoneWhereInput!] + """ + approval edge predicates + """ + hasApproval: Boolean + hasApprovalWith: [ApprovalWhereInput!] + """ + approval_requests edge predicates + """ + hasApprovalRequests: Boolean + hasApprovalRequestsWith: [ApprovalRequestWhereInput!] +} +type Application implements Node { + id: ID! + createdAt: Time! + lastModifiedAt: Time! + statusPhase: ApplicationStatusPhase + statusMessage: String + environment: String + namespace: String! + name: String! + clientID: String + clientSecret: String + rotatedClientSecret: String + rotatedExpiresAt: Time + currentExpiresAt: Time + secretRotationPhase: ApplicationSecretRotationPhase! + secretRotationMessage: String + zone: Zone! + exposedApis( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for ApiExposures returned from the connection. + """ + orderBy: ApiExposureOrder + + """ + Filtering options for ApiExposures returned from the connection. + """ + where: ApiExposureWhereInput + ): ApiExposureConnection! + subscribedApis( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for ApiSubscriptions returned from the connection. + """ + orderBy: ApiSubscriptionOrder + + """ + Filtering options for ApiSubscriptions returned from the connection. + """ + where: ApiSubscriptionWhereInput + ): ApiSubscriptionConnection! + exposedEvents( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor - switch opCtx.Operation.Operation { - case ast.Query: - return func(ctx context.Context) *graphql.Response { - var response graphql.Response - var data graphql.Marshaler - if first { - first = false - ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, opCtx.Operation.SelectionSet) - } else { - if atomic.LoadInt32(&ec.PendingDeferred) > 0 { - result := <-ec.DeferredResults - atomic.AddInt32(&ec.PendingDeferred, -1) - data = result.Result - response.Path = result.Path - response.Label = result.Label - response.Errors = result.Errors - } else { - return nil - } - } - var buf bytes.Buffer - data.MarshalGQL(&buf) - response.Data = buf.Bytes() - if atomic.LoadInt32(&ec.Deferred) > 0 { - hasNext := atomic.LoadInt32(&ec.PendingDeferred) > 0 - response.HasNext = &hasNext - } + """ + Returns the first _n_ elements from the list. + """ + first: Int - return &response - } - case ast.Mutation: - return func(ctx context.Context) *graphql.Response { - if !first { - return nil - } - first = false - ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor - return &graphql.Response{ - Data: buf.Bytes(), - } - } + """ + Returns the last _n_ elements from the list. + """ + last: Int - default: - return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) - } -} + """ + Ordering options for EventExposures returned from the connection. + """ + orderBy: EventExposureOrder -type executionContext struct { - *graphql.ExecutionContextState[ResolverRoot, DirectiveRoot, ComplexityRoot] -} + """ + Filtering options for EventExposures returned from the connection. + """ + where: EventExposureWhereInput + ): EventExposureConnection! + subscribedEvents( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor -func newExecutionContext( - opCtx *graphql.OperationContext, - execSchema *executableSchema, - deferredResults chan graphql.DeferredResult, -) executionContext { - return executionContext{ - ExecutionContextState: graphql.NewExecutionContextState[ResolverRoot, DirectiveRoot, ComplexityRoot]( - opCtx, - (*graphql.ExecutableSchemaState[ResolverRoot, DirectiveRoot, ComplexityRoot])(execSchema), - parsedSchema, - deferredResults, - ), - } -} + """ + Returns the first _n_ elements from the list. + """ + first: Int -var sources = []*ast.Source{ - {Name: "../../ent.graphql", Input: `directive @goField(forceResolver: Boolean, name: String, omittable: Boolean) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION -directive @goModel(model: String, models: [String!], forceGenerate: Boolean) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION -type ApiExposure implements Node { - id: ID! - createdAt: Time! - lastModifiedAt: Time! - statusPhase: ApiExposureStatusPhase - statusMessage: String - environment: String - namespace: String! - basePath: String! - visibility: ApiExposureVisibility! - active: Boolean - features: [ApiExposureFeature!]! - upstreams: [Upstream!]! - approvalConfig: ApprovalConfig! - apiVersion: String - owner: Application! + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for EventSubscriptions returned from the connection. + """ + orderBy: EventSubscriptionOrder + + """ + Filtering options for EventSubscriptions returned from the connection. + """ + where: EventSubscriptionWhereInput + ): EventSubscriptionConnection! } """ A connection to a list of items. """ -type ApiExposureConnection { +type ApplicationConnection { """ A list of edges. """ - edges: [ApiExposureEdge] + edges: [ApplicationEdge] """ Information to aid in pagination. """ @@ -2095,61 +3402,64 @@ type ApiExposureConnection { """ An edge in a connection. """ -type ApiExposureEdge { +type ApplicationEdge { """ The item at the end of the edge. """ - node: ApiExposure + node: Application """ A cursor for use in pagination. """ cursor: Cursor! } """ -Ordering options for ApiExposure connections +Ordering options for Application connections """ -input ApiExposureOrder { +input ApplicationOrder { """ The ordering direction. """ direction: OrderDirection! = ASC """ - The field by which to order ApiExposures. + The field by which to order Applications. """ - field: ApiExposureOrderField! + field: ApplicationOrderField! } """ -Properties by which ApiExposure connections can be ordered. +Properties by which Application connections can be ordered. """ -enum ApiExposureOrderField { +enum ApplicationOrderField { CREATED_AT LAST_MODIFIED_AT + NAME } """ -ApiExposureStatusPhase is enum for the field status_phase +ApplicationSecretRotationPhase is enum for the field secret_rotation_phase """ -enum ApiExposureStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/apiexposure.StatusPhase") { +enum ApplicationSecretRotationPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/application.SecretRotationPhase") { + DONE + ROTATING + GRACE_PERIOD_ACTIVE + GRACE_PERIOD_EXPIRING + FAILED +} +""" +ApplicationStatusPhase is enum for the field status_phase +""" +enum ApplicationStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/application.StatusPhase") { READY PENDING ERROR UNKNOWN } """ -ApiExposureVisibility is enum for the field visibility -""" -enum ApiExposureVisibility @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/apiexposure.Visibility") { - WORLD - ZONE - ENTERPRISE -} -""" -ApiExposureWhereInput is used for filtering ApiExposure objects. +ApplicationWhereInput is used for filtering Application objects. Input was generated by ent. """ -input ApiExposureWhereInput { - not: ApiExposureWhereInput - and: [ApiExposureWhereInput!] - or: [ApiExposureWhereInput!] +input ApplicationWhereInput { + not: ApplicationWhereInput + and: [ApplicationWhereInput!] + or: [ApplicationWhereInput!] """ id field predicates """ @@ -2186,10 +3496,10 @@ input ApiExposureWhereInput { """ status_phase field predicates """ - statusPhase: ApiExposureStatusPhase - statusPhaseNEQ: ApiExposureStatusPhase - statusPhaseIn: [ApiExposureStatusPhase!] - statusPhaseNotIn: [ApiExposureStatusPhase!] + statusPhase: ApplicationStatusPhase + statusPhaseNEQ: ApplicationStatusPhase + statusPhaseIn: [ApplicationStatusPhase!] + statusPhaseNotIn: [ApplicationStatusPhase!] statusPhaseIsNil: Boolean statusPhaseNotNil: Boolean """ @@ -2211,123 +3521,249 @@ input ApiExposureWhereInput { statusMessageEqualFold: String statusMessageContainsFold: String """ - environment field predicates + environment field predicates + """ + environment: String + environmentNEQ: String + environmentIn: [String!] + environmentNotIn: [String!] + environmentGT: String + environmentGTE: String + environmentLT: String + environmentLTE: String + environmentContains: String + environmentHasPrefix: String + environmentHasSuffix: String + environmentIsNil: Boolean + environmentNotNil: Boolean + environmentEqualFold: String + environmentContainsFold: String + """ + namespace field predicates + """ + namespace: String + namespaceNEQ: String + namespaceIn: [String!] + namespaceNotIn: [String!] + namespaceGT: String + namespaceGTE: String + namespaceLT: String + namespaceLTE: String + namespaceContains: String + namespaceHasPrefix: String + namespaceHasSuffix: String + namespaceEqualFold: String + namespaceContainsFold: String + """ + name field predicates + """ + name: String + nameNEQ: String + nameIn: [String!] + nameNotIn: [String!] + nameGT: String + nameGTE: String + nameLT: String + nameLTE: String + nameContains: String + nameHasPrefix: String + nameHasSuffix: String + nameEqualFold: String + nameContainsFold: String + """ + client_id field predicates + """ + clientID: String + clientIDNEQ: String + clientIDIn: [String!] + clientIDNotIn: [String!] + clientIDGT: String + clientIDGTE: String + clientIDLT: String + clientIDLTE: String + clientIDContains: String + clientIDHasPrefix: String + clientIDHasSuffix: String + clientIDIsNil: Boolean + clientIDNotNil: Boolean + clientIDEqualFold: String + clientIDContainsFold: String + """ + rotated_expires_at field predicates + """ + rotatedExpiresAt: Time + rotatedExpiresAtNEQ: Time + rotatedExpiresAtIn: [Time!] + rotatedExpiresAtNotIn: [Time!] + rotatedExpiresAtGT: Time + rotatedExpiresAtGTE: Time + rotatedExpiresAtLT: Time + rotatedExpiresAtLTE: Time + rotatedExpiresAtIsNil: Boolean + rotatedExpiresAtNotNil: Boolean + """ + current_expires_at field predicates + """ + currentExpiresAt: Time + currentExpiresAtNEQ: Time + currentExpiresAtIn: [Time!] + currentExpiresAtNotIn: [Time!] + currentExpiresAtGT: Time + currentExpiresAtGTE: Time + currentExpiresAtLT: Time + currentExpiresAtLTE: Time + currentExpiresAtIsNil: Boolean + currentExpiresAtNotNil: Boolean + """ + secret_rotation_phase field predicates + """ + secretRotationPhase: ApplicationSecretRotationPhase + secretRotationPhaseNEQ: ApplicationSecretRotationPhase + secretRotationPhaseIn: [ApplicationSecretRotationPhase!] + secretRotationPhaseNotIn: [ApplicationSecretRotationPhase!] + """ + secret_rotation_message field predicates + """ + secretRotationMessage: String + secretRotationMessageNEQ: String + secretRotationMessageIn: [String!] + secretRotationMessageNotIn: [String!] + secretRotationMessageGT: String + secretRotationMessageGTE: String + secretRotationMessageLT: String + secretRotationMessageLTE: String + secretRotationMessageContains: String + secretRotationMessageHasPrefix: String + secretRotationMessageHasSuffix: String + secretRotationMessageIsNil: Boolean + secretRotationMessageNotNil: Boolean + secretRotationMessageEqualFold: String + secretRotationMessageContainsFold: String + """ + zone edge predicates + """ + hasZone: Boolean + hasZoneWith: [ZoneWhereInput!] + """ + owner_team edge predicates + """ + hasOwnerTeam: Boolean + hasOwnerTeamWith: [TeamWhereInput!] + """ + exposed_apis edge predicates + """ + hasExposedApis: Boolean + hasExposedApisWith: [ApiExposureWhereInput!] + """ + subscribed_apis edge predicates + """ + hasSubscribedApis: Boolean + hasSubscribedApisWith: [ApiSubscriptionWhereInput!] """ + exposed_events edge predicates + """ + hasExposedEvents: Boolean + hasExposedEventsWith: [EventExposureWhereInput!] + """ + subscribed_events edge predicates + """ + hasSubscribedEvents: Boolean + hasSubscribedEventsWith: [EventSubscriptionWhereInput!] +} +type Approval implements Node { + id: ID! + createdAt: Time! + lastModifiedAt: Time! + statusPhase: ApprovalStatusPhase + statusMessage: String environment: String - environmentNEQ: String - environmentIn: [String!] - environmentNotIn: [String!] - environmentGT: String - environmentGTE: String - environmentLT: String - environmentLTE: String - environmentContains: String - environmentHasPrefix: String - environmentHasSuffix: String - environmentIsNil: Boolean - environmentNotNil: Boolean - environmentEqualFold: String - environmentContainsFold: String + namespace: String! + action: String! + strategy: ApprovalStrategy! + requester: RequesterInfo! + decider: DeciderInfo! + deciderTeamName: String! + decisions: [Decision!]! + availableTransitions: [AvailableTransition!] + name: String! + state: ApprovalState! +} +""" +A connection to a list of items. +""" +type ApprovalConnection { """ - namespace field predicates + A list of edges. """ - namespace: String - namespaceNEQ: String - namespaceIn: [String!] - namespaceNotIn: [String!] - namespaceGT: String - namespaceGTE: String - namespaceLT: String - namespaceLTE: String - namespaceContains: String - namespaceHasPrefix: String - namespaceHasSuffix: String - namespaceEqualFold: String - namespaceContainsFold: String + edges: [ApprovalEdge] """ - base_path field predicates + Information to aid in pagination. """ - basePath: String - basePathNEQ: String - basePathIn: [String!] - basePathNotIn: [String!] - basePathGT: String - basePathGTE: String - basePathLT: String - basePathLTE: String - basePathContains: String - basePathHasPrefix: String - basePathHasSuffix: String - basePathEqualFold: String - basePathContainsFold: String + pageInfo: PageInfo! """ - visibility field predicates + Identifies the total count of items in the connection. """ - visibility: ApiExposureVisibility - visibilityNEQ: ApiExposureVisibility - visibilityIn: [ApiExposureVisibility!] - visibilityNotIn: [ApiExposureVisibility!] + totalCount: Int! +} +""" +An edge in a connection. +""" +type ApprovalEdge { """ - active field predicates + The item at the end of the edge. """ - active: Boolean - activeNEQ: Boolean - activeIsNil: Boolean - activeNotNil: Boolean + node: Approval """ - api_version field predicates + A cursor for use in pagination. """ - apiVersion: String - apiVersionNEQ: String - apiVersionIn: [String!] - apiVersionNotIn: [String!] - apiVersionGT: String - apiVersionGTE: String - apiVersionLT: String - apiVersionLTE: String - apiVersionContains: String - apiVersionHasPrefix: String - apiVersionHasSuffix: String - apiVersionIsNil: Boolean - apiVersionNotNil: Boolean - apiVersionEqualFold: String - apiVersionContainsFold: String + cursor: Cursor! +} +""" +Ordering options for Approval connections +""" +input ApprovalOrder { """ - owner edge predicates + The ordering direction. """ - hasOwner: Boolean - hasOwnerWith: [ApplicationWhereInput!] + direction: OrderDirection! = ASC """ - subscriptions edge predicates + The field by which to order Approvals. """ - hasSubscriptions: Boolean - hasSubscriptionsWith: [ApiSubscriptionWhereInput!] + field: ApprovalOrderField! } -type ApiSubscription implements Node { +""" +Properties by which Approval connections can be ordered. +""" +enum ApprovalOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +type ApprovalRequest implements Node { id: ID! createdAt: Time! lastModifiedAt: Time! - statusPhase: ApiSubscriptionStatusPhase + statusPhase: ApprovalRequestStatusPhase statusMessage: String environment: String namespace: String! + action: String! + strategy: ApprovalRequestStrategy! + requester: RequesterInfo! + decider: DeciderInfo! + deciderTeamName: String! + decisions: [Decision!]! + availableTransitions: [AvailableTransition!] name: String! - basePath: String! - m2mAuthMethod: ApiSubscriptionM2mAuthMethod! - approvedScopes: [String!]! - owner: Application! - failoverZones: [Zone!] - approval: Approval - approvalRequests: [ApprovalRequest!] + state: ApprovalRequestState! } """ A connection to a list of items. """ -type ApiSubscriptionConnection { +type ApprovalRequestConnection { """ A list of edges. """ - edges: [ApiSubscriptionEdge] + edges: [ApprovalRequestEdge] """ Information to aid in pagination. """ @@ -2340,62 +3776,70 @@ type ApiSubscriptionConnection { """ An edge in a connection. """ -type ApiSubscriptionEdge { +type ApprovalRequestEdge { """ The item at the end of the edge. """ - node: ApiSubscription + node: ApprovalRequest """ A cursor for use in pagination. """ cursor: Cursor! } """ -ApiSubscriptionM2mAuthMethod is enum for the field m2m_auth_method -""" -enum ApiSubscriptionM2mAuthMethod @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/apisubscription.M2mAuthMethod") { - NONE - BASIC_AUTH - OAUTH2_CLIENT - SCOPES_ONLY -} -""" -Ordering options for ApiSubscription connections +Ordering options for ApprovalRequest connections """ -input ApiSubscriptionOrder { +input ApprovalRequestOrder { """ The ordering direction. """ direction: OrderDirection! = ASC """ - The field by which to order ApiSubscriptions. + The field by which to order ApprovalRequests. """ - field: ApiSubscriptionOrderField! + field: ApprovalRequestOrderField! } """ -Properties by which ApiSubscription connections can be ordered. +Properties by which ApprovalRequest connections can be ordered. """ -enum ApiSubscriptionOrderField { +enum ApprovalRequestOrderField { CREATED_AT LAST_MODIFIED_AT } """ -ApiSubscriptionStatusPhase is enum for the field status_phase +ApprovalRequestState is enum for the field state """ -enum ApiSubscriptionStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/apisubscription.StatusPhase") { +enum ApprovalRequestState @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest.State") { + PENDING + SEMIGRANTED + GRANTED + REJECTED +} +""" +ApprovalRequestStatusPhase is enum for the field status_phase +""" +enum ApprovalRequestStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest.StatusPhase") { READY PENDING ERROR UNKNOWN } """ -ApiSubscriptionWhereInput is used for filtering ApiSubscription objects. +ApprovalRequestStrategy is enum for the field strategy +""" +enum ApprovalRequestStrategy @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest.Strategy") { + AUTO + SIMPLE + FOUR_EYES +} +""" +ApprovalRequestWhereInput is used for filtering ApprovalRequest objects. Input was generated by ent. """ -input ApiSubscriptionWhereInput { - not: ApiSubscriptionWhereInput - and: [ApiSubscriptionWhereInput!] - or: [ApiSubscriptionWhereInput!] +input ApprovalRequestWhereInput { + not: ApprovalRequestWhereInput + and: [ApprovalRequestWhereInput!] + or: [ApprovalRequestWhereInput!] """ id field predicates """ @@ -2432,10 +3876,10 @@ input ApiSubscriptionWhereInput { """ status_phase field predicates """ - statusPhase: ApiSubscriptionStatusPhase - statusPhaseNEQ: ApiSubscriptionStatusPhase - statusPhaseIn: [ApiSubscriptionStatusPhase!] - statusPhaseNotIn: [ApiSubscriptionStatusPhase!] + statusPhase: ApprovalRequestStatusPhase + statusPhaseNEQ: ApprovalRequestStatusPhase + statusPhaseIn: [ApprovalRequestStatusPhase!] + statusPhaseNotIn: [ApprovalRequestStatusPhase!] statusPhaseIsNil: Boolean statusPhaseNotNil: Boolean """ @@ -2491,6 +3935,45 @@ input ApiSubscriptionWhereInput { namespaceEqualFold: String namespaceContainsFold: String """ + action field predicates + """ + action: String + actionNEQ: String + actionIn: [String!] + actionNotIn: [String!] + actionGT: String + actionGTE: String + actionLT: String + actionLTE: String + actionContains: String + actionHasPrefix: String + actionHasSuffix: String + actionEqualFold: String + actionContainsFold: String + """ + strategy field predicates + """ + strategy: ApprovalRequestStrategy + strategyNEQ: ApprovalRequestStrategy + strategyIn: [ApprovalRequestStrategy!] + strategyNotIn: [ApprovalRequestStrategy!] + """ + decider_team_name field predicates + """ + deciderTeamName: String + deciderTeamNameNEQ: String + deciderTeamNameIn: [String!] + deciderTeamNameNotIn: [String!] + deciderTeamNameGT: String + deciderTeamNameGTE: String + deciderTeamNameLT: String + deciderTeamNameLTE: String + deciderTeamNameContains: String + deciderTeamNameHasPrefix: String + deciderTeamNameHasSuffix: String + deciderTeamNameEqualFold: String + deciderTeamNameContainsFold: String + """ name field predicates """ name: String @@ -2507,198 +3990,59 @@ input ApiSubscriptionWhereInput { nameEqualFold: String nameContainsFold: String """ - base_path field predicates - """ - basePath: String - basePathNEQ: String - basePathIn: [String!] - basePathNotIn: [String!] - basePathGT: String - basePathGTE: String - basePathLT: String - basePathLTE: String - basePathContains: String - basePathHasPrefix: String - basePathHasSuffix: String - basePathEqualFold: String - basePathContainsFold: String - """ - m2m_auth_method field predicates - """ - m2mAuthMethod: ApiSubscriptionM2mAuthMethod - m2mAuthMethodNEQ: ApiSubscriptionM2mAuthMethod - m2mAuthMethodIn: [ApiSubscriptionM2mAuthMethod!] - m2mAuthMethodNotIn: [ApiSubscriptionM2mAuthMethod!] - """ - owner edge predicates - """ - hasOwner: Boolean - hasOwnerWith: [ApplicationWhereInput!] - """ - target edge predicates - """ - hasTarget: Boolean - hasTargetWith: [ApiExposureWhereInput!] - """ - failover_zones edge predicates - """ - hasFailoverZones: Boolean - hasFailoverZonesWith: [ZoneWhereInput!] - """ - approval edge predicates - """ - hasApproval: Boolean - hasApprovalWith: [ApprovalWhereInput!] - """ - approval_requests edge predicates - """ - hasApprovalRequests: Boolean - hasApprovalRequestsWith: [ApprovalRequestWhereInput!] -} -type Application implements Node { - id: ID! - createdAt: Time! - lastModifiedAt: Time! - statusPhase: ApplicationStatusPhase - statusMessage: String - environment: String - namespace: String! - name: String! - clientID: String - clientSecret: String - issuerURL: String - zone: Zone! - exposedApis( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: Cursor - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: Cursor - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for ApiExposures returned from the connection. - """ - orderBy: ApiExposureOrder - - """ - Filtering options for ApiExposures returned from the connection. - """ - where: ApiExposureWhereInput - ): ApiExposureConnection! - subscribedApis( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: Cursor - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: Cursor - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for ApiSubscriptions returned from the connection. - """ - orderBy: ApiSubscriptionOrder - - """ - Filtering options for ApiSubscriptions returned from the connection. - """ - where: ApiSubscriptionWhereInput - ): ApiSubscriptionConnection! -} -""" -A connection to a list of items. -""" -type ApplicationConnection { - """ - A list of edges. - """ - edges: [ApplicationEdge] - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} -""" -An edge in a connection. -""" -type ApplicationEdge { - """ - The item at the end of the edge. - """ - node: Application - """ - A cursor for use in pagination. + state field predicates """ - cursor: Cursor! -} -""" -Ordering options for Application connections -""" -input ApplicationOrder { + state: ApprovalRequestState + stateNEQ: ApprovalRequestState + stateIn: [ApprovalRequestState!] + stateNotIn: [ApprovalRequestState!] """ - The ordering direction. + api_subscription edge predicates """ - direction: OrderDirection! = ASC + hasAPISubscription: Boolean + hasAPISubscriptionWith: [ApiSubscriptionWhereInput!] """ - The field by which to order Applications. + event_subscription edge predicates """ - field: ApplicationOrderField! + hasEventSubscription: Boolean + hasEventSubscriptionWith: [EventSubscriptionWhereInput!] } """ -Properties by which Application connections can be ordered. +ApprovalState is enum for the field state """ -enum ApplicationOrderField { - CREATED_AT - LAST_MODIFIED_AT - NAME +enum ApprovalState @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approval.State") { + PENDING + SEMIGRANTED + GRANTED + REJECTED + SUSPENDED + EXPIRED } """ -ApplicationStatusPhase is enum for the field status_phase +ApprovalStatusPhase is enum for the field status_phase """ -enum ApplicationStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/application.StatusPhase") { +enum ApprovalStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approval.StatusPhase") { READY PENDING ERROR UNKNOWN } """ -ApplicationWhereInput is used for filtering Application objects. +ApprovalStrategy is enum for the field strategy +""" +enum ApprovalStrategy @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approval.Strategy") { + AUTO + SIMPLE + FOUR_EYES +} +""" +ApprovalWhereInput is used for filtering Approval objects. Input was generated by ent. """ -input ApplicationWhereInput { - not: ApplicationWhereInput - and: [ApplicationWhereInput!] - or: [ApplicationWhereInput!] +input ApprovalWhereInput { + not: ApprovalWhereInput + and: [ApprovalWhereInput!] + or: [ApprovalWhereInput!] """ id field predicates """ @@ -2735,10 +4079,10 @@ input ApplicationWhereInput { """ status_phase field predicates """ - statusPhase: ApplicationStatusPhase - statusPhaseNEQ: ApplicationStatusPhase - statusPhaseIn: [ApplicationStatusPhase!] - statusPhaseNotIn: [ApplicationStatusPhase!] + statusPhase: ApprovalStatusPhase + statusPhaseNEQ: ApprovalStatusPhase + statusPhaseIn: [ApprovalStatusPhase!] + statusPhaseNotIn: [ApprovalStatusPhase!] statusPhaseIsNil: Boolean statusPhaseNotNil: Boolean """ @@ -2778,21 +4122,60 @@ input ApplicationWhereInput { environmentEqualFold: String environmentContainsFold: String """ - namespace field predicates + namespace field predicates + """ + namespace: String + namespaceNEQ: String + namespaceIn: [String!] + namespaceNotIn: [String!] + namespaceGT: String + namespaceGTE: String + namespaceLT: String + namespaceLTE: String + namespaceContains: String + namespaceHasPrefix: String + namespaceHasSuffix: String + namespaceEqualFold: String + namespaceContainsFold: String + """ + action field predicates + """ + action: String + actionNEQ: String + actionIn: [String!] + actionNotIn: [String!] + actionGT: String + actionGTE: String + actionLT: String + actionLTE: String + actionContains: String + actionHasPrefix: String + actionHasSuffix: String + actionEqualFold: String + actionContainsFold: String + """ + strategy field predicates + """ + strategy: ApprovalStrategy + strategyNEQ: ApprovalStrategy + strategyIn: [ApprovalStrategy!] + strategyNotIn: [ApprovalStrategy!] + """ + decider_team_name field predicates """ - namespace: String - namespaceNEQ: String - namespaceIn: [String!] - namespaceNotIn: [String!] - namespaceGT: String - namespaceGTE: String - namespaceLT: String - namespaceLTE: String - namespaceContains: String - namespaceHasPrefix: String - namespaceHasSuffix: String - namespaceEqualFold: String - namespaceContainsFold: String + deciderTeamName: String + deciderTeamNameNEQ: String + deciderTeamNameIn: [String!] + deciderTeamNameNotIn: [String!] + deciderTeamNameGT: String + deciderTeamNameGTE: String + deciderTeamNameLT: String + deciderTeamNameLTE: String + deciderTeamNameContains: String + deciderTeamNameHasPrefix: String + deciderTeamNameHasSuffix: String + deciderTeamNameEqualFold: String + deciderTeamNameContainsFold: String """ name field predicates """ @@ -2810,174 +4193,50 @@ input ApplicationWhereInput { nameEqualFold: String nameContainsFold: String """ - client_id field predicates - """ - clientID: String - clientIDNEQ: String - clientIDIn: [String!] - clientIDNotIn: [String!] - clientIDGT: String - clientIDGTE: String - clientIDLT: String - clientIDLTE: String - clientIDContains: String - clientIDHasPrefix: String - clientIDHasSuffix: String - clientIDIsNil: Boolean - clientIDNotNil: Boolean - clientIDEqualFold: String - clientIDContainsFold: String - """ - client_secret field predicates - """ - clientSecret: String - clientSecretNEQ: String - clientSecretIn: [String!] - clientSecretNotIn: [String!] - clientSecretGT: String - clientSecretGTE: String - clientSecretLT: String - clientSecretLTE: String - clientSecretContains: String - clientSecretHasPrefix: String - clientSecretHasSuffix: String - clientSecretIsNil: Boolean - clientSecretNotNil: Boolean - clientSecretEqualFold: String - clientSecretContainsFold: String - """ - issuer_url field predicates - """ - issuerURL: String - issuerURLNEQ: String - issuerURLIn: [String!] - issuerURLNotIn: [String!] - issuerURLGT: String - issuerURLGTE: String - issuerURLLT: String - issuerURLLTE: String - issuerURLContains: String - issuerURLHasPrefix: String - issuerURLHasSuffix: String - issuerURLIsNil: Boolean - issuerURLNotNil: Boolean - issuerURLEqualFold: String - issuerURLContainsFold: String - """ - zone edge predicates - """ - hasZone: Boolean - hasZoneWith: [ZoneWhereInput!] - """ - owner_team edge predicates - """ - hasOwnerTeam: Boolean - hasOwnerTeamWith: [TeamWhereInput!] - """ - exposed_apis edge predicates - """ - hasExposedApis: Boolean - hasExposedApisWith: [ApiExposureWhereInput!] - """ - subscribed_apis edge predicates - """ - hasSubscribedApis: Boolean - hasSubscribedApisWith: [ApiSubscriptionWhereInput!] -} -type Approval implements Node { - id: ID! - createdAt: Time! - lastModifiedAt: Time! - statusPhase: ApprovalStatusPhase - statusMessage: String - environment: String - namespace: String! - action: String! - strategy: ApprovalStrategy! - requester: RequesterInfo! - decider: DeciderInfo! - deciderTeamName: String! - decisions: [Decision!]! - availableTransitions: [AvailableTransition!] - name: String! - state: ApprovalState! -} -""" -A connection to a list of items. -""" -type ApprovalConnection { - """ - A list of edges. - """ - edges: [ApprovalEdge] - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} -""" -An edge in a connection. -""" -type ApprovalEdge { - """ - The item at the end of the edge. - """ - node: Approval - """ - A cursor for use in pagination. + state field predicates """ - cursor: Cursor! -} -""" -Ordering options for Approval connections -""" -input ApprovalOrder { + state: ApprovalState + stateNEQ: ApprovalState + stateIn: [ApprovalState!] + stateNotIn: [ApprovalState!] """ - The ordering direction. + api_subscription edge predicates """ - direction: OrderDirection! = ASC + hasAPISubscription: Boolean + hasAPISubscriptionWith: [ApiSubscriptionWhereInput!] """ - The field by which to order Approvals. + event_subscription edge predicates """ - field: ApprovalOrderField! + hasEventSubscription: Boolean + hasEventSubscriptionWith: [EventSubscriptionWhereInput!] } """ -Properties by which Approval connections can be ordered. +Define a Relay Cursor type: +https://relay.dev/graphql/connections.htm#sec-Cursor """ -enum ApprovalOrderField { - CREATED_AT - LAST_MODIFIED_AT -} -type ApprovalRequest implements Node { +scalar Cursor +type EventExposure implements Node { id: ID! createdAt: Time! lastModifiedAt: Time! - statusPhase: ApprovalRequestStatusPhase + statusPhase: EventExposureStatusPhase statusMessage: String environment: String namespace: String! - action: String! - strategy: ApprovalRequestStrategy! - requester: RequesterInfo! - decider: DeciderInfo! - deciderTeamName: String! - decisions: [Decision!]! - availableTransitions: [AvailableTransition!] - name: String! - state: ApprovalRequestState! + eventType: String! + visibility: EventExposureVisibility! + active: Boolean + approvalConfig: ApprovalConfig! + owner: Application! } """ A connection to a list of items. """ -type ApprovalRequestConnection { +type EventExposureConnection { """ A list of edges. """ - edges: [ApprovalRequestEdge] + edges: [EventExposureEdge] """ Information to aid in pagination. """ @@ -2990,70 +4249,61 @@ type ApprovalRequestConnection { """ An edge in a connection. """ -type ApprovalRequestEdge { +type EventExposureEdge { """ The item at the end of the edge. """ - node: ApprovalRequest + node: EventExposure """ A cursor for use in pagination. """ cursor: Cursor! } """ -Ordering options for ApprovalRequest connections +Ordering options for EventExposure connections """ -input ApprovalRequestOrder { +input EventExposureOrder { """ The ordering direction. """ direction: OrderDirection! = ASC """ - The field by which to order ApprovalRequests. + The field by which to order EventExposures. """ - field: ApprovalRequestOrderField! + field: EventExposureOrderField! } """ -Properties by which ApprovalRequest connections can be ordered. +Properties by which EventExposure connections can be ordered. """ -enum ApprovalRequestOrderField { +enum EventExposureOrderField { CREATED_AT LAST_MODIFIED_AT } """ -ApprovalRequestState is enum for the field state -""" -enum ApprovalRequestState @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest.State") { - PENDING - SEMIGRANTED - GRANTED - REJECTED -} -""" -ApprovalRequestStatusPhase is enum for the field status_phase +EventExposureStatusPhase is enum for the field status_phase """ -enum ApprovalRequestStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest.StatusPhase") { +enum EventExposureStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/eventexposure.StatusPhase") { READY PENDING ERROR UNKNOWN } """ -ApprovalRequestStrategy is enum for the field strategy +EventExposureVisibility is enum for the field visibility """ -enum ApprovalRequestStrategy @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest.Strategy") { - AUTO - SIMPLE - FOUR_EYES +enum EventExposureVisibility @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/eventexposure.Visibility") { + WORLD + ZONE + ENTERPRISE } """ -ApprovalRequestWhereInput is used for filtering ApprovalRequest objects. +EventExposureWhereInput is used for filtering EventExposure objects. Input was generated by ent. """ -input ApprovalRequestWhereInput { - not: ApprovalRequestWhereInput - and: [ApprovalRequestWhereInput!] - or: [ApprovalRequestWhereInput!] +input EventExposureWhereInput { + not: EventExposureWhereInput + and: [EventExposureWhereInput!] + or: [EventExposureWhereInput!] """ id field predicates """ @@ -3090,10 +4340,10 @@ input ApprovalRequestWhereInput { """ status_phase field predicates """ - statusPhase: ApprovalRequestStatusPhase - statusPhaseNEQ: ApprovalRequestStatusPhase - statusPhaseIn: [ApprovalRequestStatusPhase!] - statusPhaseNotIn: [ApprovalRequestStatusPhase!] + statusPhase: EventExposureStatusPhase + statusPhaseNEQ: EventExposureStatusPhase + statusPhaseIn: [EventExposureStatusPhase!] + statusPhaseNotIn: [EventExposureStatusPhase!] statusPhaseIsNil: Boolean statusPhaseNotNil: Boolean """ @@ -3133,125 +4383,152 @@ input ApprovalRequestWhereInput { environmentEqualFold: String environmentContainsFold: String """ - namespace field predicates + namespace field predicates + """ + namespace: String + namespaceNEQ: String + namespaceIn: [String!] + namespaceNotIn: [String!] + namespaceGT: String + namespaceGTE: String + namespaceLT: String + namespaceLTE: String + namespaceContains: String + namespaceHasPrefix: String + namespaceHasSuffix: String + namespaceEqualFold: String + namespaceContainsFold: String + """ + event_type field predicates + """ + eventType: String + eventTypeNEQ: String + eventTypeIn: [String!] + eventTypeNotIn: [String!] + eventTypeGT: String + eventTypeGTE: String + eventTypeLT: String + eventTypeLTE: String + eventTypeContains: String + eventTypeHasPrefix: String + eventTypeHasSuffix: String + eventTypeEqualFold: String + eventTypeContainsFold: String + """ + visibility field predicates + """ + visibility: EventExposureVisibility + visibilityNEQ: EventExposureVisibility + visibilityIn: [EventExposureVisibility!] + visibilityNotIn: [EventExposureVisibility!] + """ + active field predicates + """ + active: Boolean + activeNEQ: Boolean + activeIsNil: Boolean + activeNotNil: Boolean + """ + owner edge predicates + """ + hasOwner: Boolean + hasOwnerWith: [ApplicationWhereInput!] + """ + subscriptions edge predicates + """ + hasSubscriptions: Boolean + hasSubscriptionsWith: [EventSubscriptionWhereInput!] +} +type EventSubscription implements Node { + id: ID! + createdAt: Time! + lastModifiedAt: Time! + statusPhase: EventSubscriptionStatusPhase + statusMessage: String + environment: String + namespace: String! + name: String! + eventType: String! + deliveryType: EventSubscriptionDeliveryType! + callbackURL: String + owner: Application! + approval: Approval + approvalRequests: [ApprovalRequest!] +} +""" +A connection to a list of items. +""" +type EventSubscriptionConnection { + """ + A list of edges. """ - namespace: String - namespaceNEQ: String - namespaceIn: [String!] - namespaceNotIn: [String!] - namespaceGT: String - namespaceGTE: String - namespaceLT: String - namespaceLTE: String - namespaceContains: String - namespaceHasPrefix: String - namespaceHasSuffix: String - namespaceEqualFold: String - namespaceContainsFold: String + edges: [EventSubscriptionEdge] """ - action field predicates + Information to aid in pagination. """ - action: String - actionNEQ: String - actionIn: [String!] - actionNotIn: [String!] - actionGT: String - actionGTE: String - actionLT: String - actionLTE: String - actionContains: String - actionHasPrefix: String - actionHasSuffix: String - actionEqualFold: String - actionContainsFold: String + pageInfo: PageInfo! """ - strategy field predicates + Identifies the total count of items in the connection. """ - strategy: ApprovalRequestStrategy - strategyNEQ: ApprovalRequestStrategy - strategyIn: [ApprovalRequestStrategy!] - strategyNotIn: [ApprovalRequestStrategy!] + totalCount: Int! +} +""" +EventSubscriptionDeliveryType is enum for the field delivery_type +""" +enum EventSubscriptionDeliveryType @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription.DeliveryType") { + CALLBACK + SERVER_SENT_EVENT +} +""" +An edge in a connection. +""" +type EventSubscriptionEdge { """ - decider_team_name field predicates + The item at the end of the edge. """ - deciderTeamName: String - deciderTeamNameNEQ: String - deciderTeamNameIn: [String!] - deciderTeamNameNotIn: [String!] - deciderTeamNameGT: String - deciderTeamNameGTE: String - deciderTeamNameLT: String - deciderTeamNameLTE: String - deciderTeamNameContains: String - deciderTeamNameHasPrefix: String - deciderTeamNameHasSuffix: String - deciderTeamNameEqualFold: String - deciderTeamNameContainsFold: String + node: EventSubscription """ - name field predicates + A cursor for use in pagination. """ - name: String - nameNEQ: String - nameIn: [String!] - nameNotIn: [String!] - nameGT: String - nameGTE: String - nameLT: String - nameLTE: String - nameContains: String - nameHasPrefix: String - nameHasSuffix: String - nameEqualFold: String - nameContainsFold: String + cursor: Cursor! +} +""" +Ordering options for EventSubscription connections +""" +input EventSubscriptionOrder { """ - state field predicates + The ordering direction. """ - state: ApprovalRequestState - stateNEQ: ApprovalRequestState - stateIn: [ApprovalRequestState!] - stateNotIn: [ApprovalRequestState!] + direction: OrderDirection! = ASC """ - api_subscription edge predicates + The field by which to order EventSubscriptions. """ - hasAPISubscription: Boolean - hasAPISubscriptionWith: [ApiSubscriptionWhereInput!] + field: EventSubscriptionOrderField! } """ -ApprovalState is enum for the field state +Properties by which EventSubscription connections can be ordered. """ -enum ApprovalState @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approval.State") { - PENDING - SEMIGRANTED - GRANTED - REJECTED - SUSPENDED - EXPIRED +enum EventSubscriptionOrderField { + CREATED_AT + LAST_MODIFIED_AT } """ -ApprovalStatusPhase is enum for the field status_phase +EventSubscriptionStatusPhase is enum for the field status_phase """ -enum ApprovalStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approval.StatusPhase") { +enum EventSubscriptionStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription.StatusPhase") { READY PENDING ERROR UNKNOWN } """ -ApprovalStrategy is enum for the field strategy -""" -enum ApprovalStrategy @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/approval.Strategy") { - AUTO - SIMPLE - FOUR_EYES -} -""" -ApprovalWhereInput is used for filtering Approval objects. +EventSubscriptionWhereInput is used for filtering EventSubscription objects. Input was generated by ent. """ -input ApprovalWhereInput { - not: ApprovalWhereInput - and: [ApprovalWhereInput!] - or: [ApprovalWhereInput!] +input EventSubscriptionWhereInput { + not: EventSubscriptionWhereInput + and: [EventSubscriptionWhereInput!] + or: [EventSubscriptionWhereInput!] """ id field predicates """ @@ -3288,10 +4565,10 @@ input ApprovalWhereInput { """ status_phase field predicates """ - statusPhase: ApprovalStatusPhase - statusPhaseNEQ: ApprovalStatusPhase - statusPhaseIn: [ApprovalStatusPhase!] - statusPhaseNotIn: [ApprovalStatusPhase!] + statusPhase: EventSubscriptionStatusPhase + statusPhaseNEQ: EventSubscriptionStatusPhase + statusPhaseIn: [EventSubscriptionStatusPhase!] + statusPhaseNotIn: [EventSubscriptionStatusPhase!] statusPhaseIsNil: Boolean statusPhaseNotNil: Boolean """ @@ -3347,45 +4624,6 @@ input ApprovalWhereInput { namespaceEqualFold: String namespaceContainsFold: String """ - action field predicates - """ - action: String - actionNEQ: String - actionIn: [String!] - actionNotIn: [String!] - actionGT: String - actionGTE: String - actionLT: String - actionLTE: String - actionContains: String - actionHasPrefix: String - actionHasSuffix: String - actionEqualFold: String - actionContainsFold: String - """ - strategy field predicates - """ - strategy: ApprovalStrategy - strategyNEQ: ApprovalStrategy - strategyIn: [ApprovalStrategy!] - strategyNotIn: [ApprovalStrategy!] - """ - decider_team_name field predicates - """ - deciderTeamName: String - deciderTeamNameNEQ: String - deciderTeamNameIn: [String!] - deciderTeamNameNotIn: [String!] - deciderTeamNameGT: String - deciderTeamNameGTE: String - deciderTeamNameLT: String - deciderTeamNameLTE: String - deciderTeamNameContains: String - deciderTeamNameHasPrefix: String - deciderTeamNameHasSuffix: String - deciderTeamNameEqualFold: String - deciderTeamNameContainsFold: String - """ name field predicates """ name: String @@ -3402,23 +4640,67 @@ input ApprovalWhereInput { nameEqualFold: String nameContainsFold: String """ - state field predicates + event_type field predicates + """ + eventType: String + eventTypeNEQ: String + eventTypeIn: [String!] + eventTypeNotIn: [String!] + eventTypeGT: String + eventTypeGTE: String + eventTypeLT: String + eventTypeLTE: String + eventTypeContains: String + eventTypeHasPrefix: String + eventTypeHasSuffix: String + eventTypeEqualFold: String + eventTypeContainsFold: String + """ + delivery_type field predicates + """ + deliveryType: EventSubscriptionDeliveryType + deliveryTypeNEQ: EventSubscriptionDeliveryType + deliveryTypeIn: [EventSubscriptionDeliveryType!] + deliveryTypeNotIn: [EventSubscriptionDeliveryType!] + """ + callback_url field predicates + """ + callbackURL: String + callbackURLNEQ: String + callbackURLIn: [String!] + callbackURLNotIn: [String!] + callbackURLGT: String + callbackURLGTE: String + callbackURLLT: String + callbackURLLTE: String + callbackURLContains: String + callbackURLHasPrefix: String + callbackURLHasSuffix: String + callbackURLIsNil: Boolean + callbackURLNotNil: Boolean + callbackURLEqualFold: String + callbackURLContainsFold: String """ - state: ApprovalState - stateNEQ: ApprovalState - stateIn: [ApprovalState!] - stateNotIn: [ApprovalState!] + owner edge predicates """ - api_subscription edge predicates + hasOwner: Boolean + hasOwnerWith: [ApplicationWhereInput!] """ - hasAPISubscription: Boolean - hasAPISubscriptionWith: [ApiSubscriptionWhereInput!] + target edge predicates + """ + hasTarget: Boolean + hasTargetWith: [EventExposureWhereInput!] + """ + approval edge predicates + """ + hasApproval: Boolean + hasApprovalWith: [ApprovalWhereInput!] + """ + approval_requests edge predicates + """ + hasApprovalRequests: Boolean + hasApprovalRequestsWith: [ApprovalRequestWhereInput!] } -""" -Define a Relay Cursor type: -https://relay.dev/graphql/connections.htm#sec-Cursor -""" -scalar Cursor type Group implements Node { id: ID! environment: String @@ -3836,6 +5118,68 @@ type Query { """ where: ApprovalRequestWhereInput ): ApprovalRequestConnection! + eventExposures( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for EventExposures returned from the connection. + """ + orderBy: EventExposureOrder + + """ + Filtering options for EventExposures returned from the connection. + """ + where: EventExposureWhereInput + ): EventExposureConnection! + eventSubscriptions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for EventSubscriptions returned from the connection. + """ + orderBy: EventSubscriptionOrder + + """ + Filtering options for EventSubscriptions returned from the connection. + """ + where: EventSubscriptionWhereInput + ): EventSubscriptionConnection! teams( """ Returns the elements in the list that come after the specified cursor. @@ -3880,7 +5224,7 @@ type Team implements Node { name: String! email: String! category: TeamCategory! - roverTokenRef: String + teamToken: String group: Group members: [Member!] applications( @@ -4124,23 +5468,23 @@ input TeamWhereInput { categoryIn: [TeamCategory!] categoryNotIn: [TeamCategory!] """ - rover_token_ref field predicates - """ - roverTokenRef: String - roverTokenRefNEQ: String - roverTokenRefIn: [String!] - roverTokenRefNotIn: [String!] - roverTokenRefGT: String - roverTokenRefGTE: String - roverTokenRefLT: String - roverTokenRefLTE: String - roverTokenRefContains: String - roverTokenRefHasPrefix: String - roverTokenRefHasSuffix: String - roverTokenRefIsNil: Boolean - roverTokenRefNotNil: Boolean - roverTokenRefEqualFold: String - roverTokenRefContainsFold: String + team_token field predicates + """ + teamToken: String + teamTokenNEQ: String + teamTokenIn: [String!] + teamTokenNotIn: [String!] + teamTokenGT: String + teamTokenGTE: String + teamTokenLT: String + teamTokenLTE: String + teamTokenContains: String + teamTokenHasPrefix: String + teamTokenHasSuffix: String + teamTokenIsNil: Boolean + teamTokenNotNil: Boolean + teamTokenEqualFold: String + teamTokenContainsFold: String """ group edge predicates """ @@ -4166,6 +5510,7 @@ type Zone implements Node { environment: String name: String! gatewayURL: String + issuerURL: String visibility: ZoneVisibility! applications: [Application!] } @@ -4248,6 +5593,24 @@ input ZoneWhereInput { gatewayURLEqualFold: String gatewayURLContainsFold: String """ + issuer_url field predicates + """ + issuerURL: String + issuerURLNEQ: String + issuerURLIn: [String!] + issuerURLNotIn: [String!] + issuerURLGT: String + issuerURLGTE: String + issuerURLLT: String + issuerURLLTE: String + issuerURLContains: String + issuerURLHasPrefix: String + issuerURLHasSuffix: String + issuerURLIsNil: Boolean + issuerURLNotNil: Boolean + issuerURLEqualFold: String + issuerURLContainsFold: String + """ visibility field predicates """ visibility: ZoneVisibility @@ -4265,141 +5628,134 @@ input ZoneWhereInput { # # SPDX-License-Identifier: Apache-2.0 +# ────────────────────────────────────────────────────────────────────────────── +# Shared types +# ────────────────────────────────────────────────────────────────────────────── + +type MutationError { + code: ErrorCode! + message: String! + field: String +} + +enum ErrorCode { + NOT_FOUND + FORBIDDEN + CONFLICT + VALIDATION_FAILED + PRECONDITION_FAILED +} + +input MemberInput { + name: String! + email: String! +} + +input DecisionInput { + action: ApprovalAction! + "Optional comment from the decider" + comment: String +} + +# ────────────────────────────────────────────────────────────────────────────── +# Team mutations +# ────────────────────────────────────────────────────────────────────────────── + input CreateTeamInput { - "Target environment (used for namespace derivation)" environment: String! - "Group this team belongs to" group: String! - "Team name" name: String! - "Team contact email" email: String! - "Team members (at least one required)" members: [MemberInput!]! } input UpdateTeamInput { - "Target environment" - environment: String! - "Group this team belongs to" - group: String! - "Team name (identifies which team to update)" - name: String! - "Updated team contact email" + teamId: ID! email: String - "Updated team members" - members: [MemberInput!] } -input MemberInput { - name: String! - email: String! +type CreateTeamPayload { + team: Team + accepted: Boolean! + errors: [MutationError!]! } -"Result of a team mutation. Reports acceptance status - the actual reconciliation happens asynchronously." -type TeamMutationResult { - "Whether the K8s API accepted the request" - success: Boolean! - "Human-readable message" - message: String! - "The namespace where the Team CRD was created/updated" - namespace: String - "The Team CRD resource name" - resourceName: String +type UpdateTeamPayload { + team: Team + accepted: Boolean! + errors: [MutationError!]! } -input RotateTeamTokenInput { - "Target environment" - environment: String! - "Group this team belongs to" - group: String! - "Team name" - name: String! +type AddTeamMemberPayload { + team: Team + errors: [MutationError!]! } -input RotateApplicationSecretInput { - "Target environment" - environment: String! - "Team that owns this application" - team: String! - "Application resource name" - name: String! +type RemoveTeamMemberPayload { + team: Team + errors: [MutationError!]! } -"Result of an application mutation. Reports acceptance status - the actual reconciliation happens asynchronously." -type RotateApplicationSecretResult { - "Whether the K8s API accepted the request" - success: Boolean! - "Human-readable message" - message: String! - "The namespace where the Application CRD was updated" - namespace: String - "The Application CRD resource name" - resourceName: String +type RotateTeamTokenPayload { + team: Team + accepted: Boolean! + errors: [MutationError!]! } -input DecideApprovalRequestInput { - "Target environment" - environment: String! - "Requester team that owns the namespace where the ApprovalRequest lives" - team: String! - "ApprovalRequest resource name" - name: String! - "Action to take" - action: ApprovalAction! - "Decision details" - decision: DecisionInput! -} +# ────────────────────────────────────────────────────────────────────────────── +# Application mutations +# ────────────────────────────────────────────────────────────────────────────── -input DecideApprovalInput { - "Target environment" - environment: String! - "Requester team that owns the namespace where the Approval lives" - team: String! - "Approval resource name" - name: String! - "Action to take (Allow, Deny, Suspend, Resume)" - action: ApprovalAction! - "Decision details" - decision: DecisionInput! +type RotateApplicationSecretPayload { + application: Application + accepted: Boolean! + errors: [MutationError!]! } -input DecisionInput { - "Name of the person making the decision" - name: String! - "Email of the person making the decision" - email: String! - "Optional comment" - comment: String +# ────────────────────────────────────────────────────────────────────────────── +# Approval mutations +# ────────────────────────────────────────────────────────────────────────────── + +type DecideApprovalRequestPayload { + approvalRequest: ApprovalRequest + accepted: Boolean! + errors: [MutationError!]! } -"Result of an approval mutation." -type ApprovalMutationResult { - "Whether the K8s API accepted the request" - success: Boolean! - "Human-readable message" - message: String! - "The new state after the transition" - newState: String - "The namespace of the resource" - namespace: String - "The resource name" - resourceName: String +type DecideApprovalPayload { + approval: Approval + accepted: Boolean! + errors: [MutationError!]! } +# ────────────────────────────────────────────────────────────────────────────── +# Mutation type +# ────────────────────────────────────────────────────────────────────────────── + type Mutation { "Create a new Team in Kubernetes" - createTeam(input: CreateTeamInput!): TeamMutationResult! - "Update an existing Team in Kubernetes" - updateTeam(input: UpdateTeamInput!): TeamMutationResult! - "Rotate the token for an existing Team. Triggers async secret regeneration via the operator." - rotateTeamToken(input: RotateTeamTokenInput!): TeamMutationResult! - "Rotate the client secret for an existing Application. Triggers async secret regeneration via the operator webhook." - rotateApplicationSecret(input: RotateApplicationSecretInput!): RotateApplicationSecretResult! + createTeam(input: CreateTeamInput!): CreateTeamPayload! + + "Update team metadata (email). Does not manage members." + updateTeam(input: UpdateTeamInput!): UpdateTeamPayload! + + "Add a member to a team. Takes effect immediately." + addTeamMember(teamId: ID!, member: MemberInput!): AddTeamMemberPayload! + + "Remove a member from a team by email. Takes effect immediately." + removeTeamMember(teamId: ID!, memberEmail: String!): RemoveTeamMemberPayload! + + "Rotate the token for a team. Triggers async secret regeneration." + rotateTeamToken(teamId: ID!): RotateTeamTokenPayload! + + "Rotate the client secret for an application. Triggers async secret regeneration." + rotateApplicationSecret(applicationId: ID!): RotateApplicationSecretPayload! + "Decide on an ApprovalRequest (approve or deny initial access)." - decideApprovalRequest(input: DecideApprovalRequestInput!): ApprovalMutationResult! + decideApprovalRequest(approvalRequestId: ID!, input: DecisionInput!): DecideApprovalRequestPayload! + "Decide on an existing Approval (suspend, resume, deny, or re-allow ongoing access)." - decideApproval(input: DecideApprovalInput!): ApprovalMutationResult! + decideApproval(approvalId: ID!, input: DecisionInput!): DecideApprovalPayload! } `, BuiltIn: false}, {Name: "../../schema.graphql", Input: `# Copyright 2025 Deutsche Telekom IT GmbH @@ -4507,6 +5863,32 @@ type ApiSubscriptionInfo { ownerTeam: TeamInfo! } +"Reduced event subscription for cross-tenant contexts (e.g., exposure subscribers)." +type EventSubscriptionInfo { + id: ID! + eventType: String! + deliveryType: EventSubscriptionDeliveryType! + statusPhase: EventSubscriptionStatusPhase + statusMessage: String + "Application name that owns this subscription" + ownerApplicationName: String! + "Owning team (reduced view)" + ownerTeam: TeamInfo! +} + +"Reduced event exposure for cross-tenant contexts (e.g., subscription target)." +type EventExposureInfo { + id: ID! + eventType: String! + visibility: EventExposureVisibility! + active: Boolean + approvalConfig: ApprovalConfig! + "Application name that owns this exposure" + ownerApplicationName: String! + "Owning team (reduced view)" + ownerTeam: TeamInfo! +} + # -- Cross-tenant edge overrides -- extend type Application { @@ -4514,6 +5896,11 @@ extend type Application { ownerTeam: TeamInfo! } +extend type Zone { + "Token endpoint URL derived from the issuer URL. Returns null if no issuer URL is set." + tokenURL: String @goField(forceResolver: true) +} + extend type ApiSubscription { "Target exposure (reduced view — cross-tenant boundary)" target: ApiExposureInfo! @goField(forceResolver: true) @@ -4524,18 +5911,973 @@ extend type ApiExposure { subscriptions: [ApiSubscriptionInfo!]! @goField(forceResolver: true) } +extend type EventSubscription { + "Target exposure (reduced view — cross-tenant boundary)" + target: EventExposureInfo! @goField(forceResolver: true) +} + +extend type EventExposure { + "Subscriptions to this exposure (reduced view — cross-tenant boundary)" + subscriptions: [EventSubscriptionInfo!]! @goField(forceResolver: true) +} + +"A subscription related to an approval — either an API or event subscription." +union SubscriptionInfo = ApiSubscriptionInfo | EventSubscriptionInfo + extend type Approval { "Related subscription (reduced view — cross-tenant boundary)" - apiSubscription: ApiSubscriptionInfo @goField(forceResolver: true) + subscription: SubscriptionInfo! @goField(forceResolver: true) } extend type ApprovalRequest { "Related subscription (reduced view — cross-tenant boundary)" - apiSubscription: ApiSubscriptionInfo @goField(forceResolver: true) - "The corresponding approval, if one exists (traverses via ApiSubscription)" + subscription: SubscriptionInfo! @goField(forceResolver: true) + "The corresponding approval, if one exists (traverses via the related subscription)" approval: Approval @goField(forceResolver: true) } `, BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// childFields_* functions provide shared child field context lookups. +// Each function is generated once per unique object type, deduplicating the +// switch statements that were previously inlined in every fieldContext_* function. + +func (ec *executionContext) childFields_AddTeamMemberPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "team": + return ec.fieldContext_AddTeamMemberPayload_team(ctx, field) + case "errors": + return ec.fieldContext_AddTeamMemberPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AddTeamMemberPayload", field.Name) +} + +func (ec *executionContext) childFields_ApiExposure(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ApiExposure_id(ctx, field) + case "createdAt": + return ec.fieldContext_ApiExposure_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_ApiExposure_lastModifiedAt(ctx, field) + case "statusPhase": + return ec.fieldContext_ApiExposure_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_ApiExposure_statusMessage(ctx, field) + case "environment": + return ec.fieldContext_ApiExposure_environment(ctx, field) + case "namespace": + return ec.fieldContext_ApiExposure_namespace(ctx, field) + case "basePath": + return ec.fieldContext_ApiExposure_basePath(ctx, field) + case "visibility": + return ec.fieldContext_ApiExposure_visibility(ctx, field) + case "active": + return ec.fieldContext_ApiExposure_active(ctx, field) + case "features": + return ec.fieldContext_ApiExposure_features(ctx, field) + case "upstreams": + return ec.fieldContext_ApiExposure_upstreams(ctx, field) + case "approvalConfig": + return ec.fieldContext_ApiExposure_approvalConfig(ctx, field) + case "apiVersion": + return ec.fieldContext_ApiExposure_apiVersion(ctx, field) + case "owner": + return ec.fieldContext_ApiExposure_owner(ctx, field) + case "subscriptions": + return ec.fieldContext_ApiExposure_subscriptions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiExposure", field.Name) +} + +func (ec *executionContext) childFields_ApiExposureConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_ApiExposureConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ApiExposureConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ApiExposureConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiExposureConnection", field.Name) +} + +func (ec *executionContext) childFields_ApiExposureEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_ApiExposureEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_ApiExposureEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiExposureEdge", field.Name) +} + +func (ec *executionContext) childFields_ApiExposureInfo(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ApiExposureInfo_id(ctx, field) + case "basePath": + return ec.fieldContext_ApiExposureInfo_basePath(ctx, field) + case "visibility": + return ec.fieldContext_ApiExposureInfo_visibility(ctx, field) + case "active": + return ec.fieldContext_ApiExposureInfo_active(ctx, field) + case "apiVersion": + return ec.fieldContext_ApiExposureInfo_apiVersion(ctx, field) + case "features": + return ec.fieldContext_ApiExposureInfo_features(ctx, field) + case "approvalConfig": + return ec.fieldContext_ApiExposureInfo_approvalConfig(ctx, field) + case "ownerApplicationName": + return ec.fieldContext_ApiExposureInfo_ownerApplicationName(ctx, field) + case "ownerTeam": + return ec.fieldContext_ApiExposureInfo_ownerTeam(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiExposureInfo", field.Name) +} + +func (ec *executionContext) childFields_ApiSubscription(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ApiSubscription_id(ctx, field) + case "createdAt": + return ec.fieldContext_ApiSubscription_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_ApiSubscription_lastModifiedAt(ctx, field) + case "statusPhase": + return ec.fieldContext_ApiSubscription_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_ApiSubscription_statusMessage(ctx, field) + case "environment": + return ec.fieldContext_ApiSubscription_environment(ctx, field) + case "namespace": + return ec.fieldContext_ApiSubscription_namespace(ctx, field) + case "name": + return ec.fieldContext_ApiSubscription_name(ctx, field) + case "basePath": + return ec.fieldContext_ApiSubscription_basePath(ctx, field) + case "m2mAuthMethod": + return ec.fieldContext_ApiSubscription_m2mAuthMethod(ctx, field) + case "approvedScopes": + return ec.fieldContext_ApiSubscription_approvedScopes(ctx, field) + case "owner": + return ec.fieldContext_ApiSubscription_owner(ctx, field) + case "failoverZones": + return ec.fieldContext_ApiSubscription_failoverZones(ctx, field) + case "approval": + return ec.fieldContext_ApiSubscription_approval(ctx, field) + case "approvalRequests": + return ec.fieldContext_ApiSubscription_approvalRequests(ctx, field) + case "target": + return ec.fieldContext_ApiSubscription_target(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiSubscription", field.Name) +} + +func (ec *executionContext) childFields_ApiSubscriptionConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_ApiSubscriptionConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ApiSubscriptionConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ApiSubscriptionConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiSubscriptionConnection", field.Name) +} + +func (ec *executionContext) childFields_ApiSubscriptionEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_ApiSubscriptionEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_ApiSubscriptionEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiSubscriptionEdge", field.Name) +} + +func (ec *executionContext) childFields_ApiSubscriptionInfo(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ApiSubscriptionInfo_id(ctx, field) + case "basePath": + return ec.fieldContext_ApiSubscriptionInfo_basePath(ctx, field) + case "statusPhase": + return ec.fieldContext_ApiSubscriptionInfo_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_ApiSubscriptionInfo_statusMessage(ctx, field) + case "ownerApplicationName": + return ec.fieldContext_ApiSubscriptionInfo_ownerApplicationName(ctx, field) + case "ownerTeam": + return ec.fieldContext_ApiSubscriptionInfo_ownerTeam(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiSubscriptionInfo", field.Name) +} + +func (ec *executionContext) childFields_Application(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Application_id(ctx, field) + case "createdAt": + return ec.fieldContext_Application_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Application_lastModifiedAt(ctx, field) + case "statusPhase": + return ec.fieldContext_Application_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_Application_statusMessage(ctx, field) + case "environment": + return ec.fieldContext_Application_environment(ctx, field) + case "namespace": + return ec.fieldContext_Application_namespace(ctx, field) + case "name": + return ec.fieldContext_Application_name(ctx, field) + case "clientID": + return ec.fieldContext_Application_clientID(ctx, field) + case "clientSecret": + return ec.fieldContext_Application_clientSecret(ctx, field) + case "rotatedClientSecret": + return ec.fieldContext_Application_rotatedClientSecret(ctx, field) + case "rotatedExpiresAt": + return ec.fieldContext_Application_rotatedExpiresAt(ctx, field) + case "currentExpiresAt": + return ec.fieldContext_Application_currentExpiresAt(ctx, field) + case "secretRotationPhase": + return ec.fieldContext_Application_secretRotationPhase(ctx, field) + case "secretRotationMessage": + return ec.fieldContext_Application_secretRotationMessage(ctx, field) + case "zone": + return ec.fieldContext_Application_zone(ctx, field) + case "exposedApis": + return ec.fieldContext_Application_exposedApis(ctx, field) + case "subscribedApis": + return ec.fieldContext_Application_subscribedApis(ctx, field) + case "exposedEvents": + return ec.fieldContext_Application_exposedEvents(ctx, field) + case "subscribedEvents": + return ec.fieldContext_Application_subscribedEvents(ctx, field) + case "ownerTeam": + return ec.fieldContext_Application_ownerTeam(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Application", field.Name) +} + +func (ec *executionContext) childFields_ApplicationConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_ApplicationConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ApplicationConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ApplicationConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApplicationConnection", field.Name) +} + +func (ec *executionContext) childFields_ApplicationEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_ApplicationEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_ApplicationEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApplicationEdge", field.Name) +} + +func (ec *executionContext) childFields_Approval(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Approval_id(ctx, field) + case "createdAt": + return ec.fieldContext_Approval_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Approval_lastModifiedAt(ctx, field) + case "statusPhase": + return ec.fieldContext_Approval_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_Approval_statusMessage(ctx, field) + case "environment": + return ec.fieldContext_Approval_environment(ctx, field) + case "namespace": + return ec.fieldContext_Approval_namespace(ctx, field) + case "action": + return ec.fieldContext_Approval_action(ctx, field) + case "strategy": + return ec.fieldContext_Approval_strategy(ctx, field) + case "requester": + return ec.fieldContext_Approval_requester(ctx, field) + case "decider": + return ec.fieldContext_Approval_decider(ctx, field) + case "deciderTeamName": + return ec.fieldContext_Approval_deciderTeamName(ctx, field) + case "decisions": + return ec.fieldContext_Approval_decisions(ctx, field) + case "availableTransitions": + return ec.fieldContext_Approval_availableTransitions(ctx, field) + case "name": + return ec.fieldContext_Approval_name(ctx, field) + case "state": + return ec.fieldContext_Approval_state(ctx, field) + case "subscription": + return ec.fieldContext_Approval_subscription(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Approval", field.Name) +} + +func (ec *executionContext) childFields_ApprovalConfig(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "strategy": + return ec.fieldContext_ApprovalConfig_strategy(ctx, field) + case "trustedTeams": + return ec.fieldContext_ApprovalConfig_trustedTeams(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApprovalConfig", field.Name) +} + +func (ec *executionContext) childFields_ApprovalConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_ApprovalConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ApprovalConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ApprovalConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApprovalConnection", field.Name) +} + +func (ec *executionContext) childFields_ApprovalEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_ApprovalEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_ApprovalEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApprovalEdge", field.Name) +} + +func (ec *executionContext) childFields_ApprovalRequest(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ApprovalRequest_id(ctx, field) + case "createdAt": + return ec.fieldContext_ApprovalRequest_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_ApprovalRequest_lastModifiedAt(ctx, field) + case "statusPhase": + return ec.fieldContext_ApprovalRequest_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_ApprovalRequest_statusMessage(ctx, field) + case "environment": + return ec.fieldContext_ApprovalRequest_environment(ctx, field) + case "namespace": + return ec.fieldContext_ApprovalRequest_namespace(ctx, field) + case "action": + return ec.fieldContext_ApprovalRequest_action(ctx, field) + case "strategy": + return ec.fieldContext_ApprovalRequest_strategy(ctx, field) + case "requester": + return ec.fieldContext_ApprovalRequest_requester(ctx, field) + case "decider": + return ec.fieldContext_ApprovalRequest_decider(ctx, field) + case "deciderTeamName": + return ec.fieldContext_ApprovalRequest_deciderTeamName(ctx, field) + case "decisions": + return ec.fieldContext_ApprovalRequest_decisions(ctx, field) + case "availableTransitions": + return ec.fieldContext_ApprovalRequest_availableTransitions(ctx, field) + case "name": + return ec.fieldContext_ApprovalRequest_name(ctx, field) + case "state": + return ec.fieldContext_ApprovalRequest_state(ctx, field) + case "subscription": + return ec.fieldContext_ApprovalRequest_subscription(ctx, field) + case "approval": + return ec.fieldContext_ApprovalRequest_approval(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApprovalRequest", field.Name) +} + +func (ec *executionContext) childFields_ApprovalRequestConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_ApprovalRequestConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ApprovalRequestConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ApprovalRequestConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApprovalRequestConnection", field.Name) +} + +func (ec *executionContext) childFields_ApprovalRequestEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_ApprovalRequestEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_ApprovalRequestEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApprovalRequestEdge", field.Name) +} + +func (ec *executionContext) childFields_AvailableTransition(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "action": + return ec.fieldContext_AvailableTransition_action(ctx, field) + case "toState": + return ec.fieldContext_AvailableTransition_toState(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AvailableTransition", field.Name) +} + +func (ec *executionContext) childFields_CreateTeamPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "team": + return ec.fieldContext_CreateTeamPayload_team(ctx, field) + case "accepted": + return ec.fieldContext_CreateTeamPayload_accepted(ctx, field) + case "errors": + return ec.fieldContext_CreateTeamPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateTeamPayload", field.Name) +} + +func (ec *executionContext) childFields_DecideApprovalPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "approval": + return ec.fieldContext_DecideApprovalPayload_approval(ctx, field) + case "accepted": + return ec.fieldContext_DecideApprovalPayload_accepted(ctx, field) + case "errors": + return ec.fieldContext_DecideApprovalPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DecideApprovalPayload", field.Name) +} + +func (ec *executionContext) childFields_DecideApprovalRequestPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "approvalRequest": + return ec.fieldContext_DecideApprovalRequestPayload_approvalRequest(ctx, field) + case "accepted": + return ec.fieldContext_DecideApprovalRequestPayload_accepted(ctx, field) + case "errors": + return ec.fieldContext_DecideApprovalRequestPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DecideApprovalRequestPayload", field.Name) +} + +func (ec *executionContext) childFields_DeciderInfo(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "teamName": + return ec.fieldContext_DeciderInfo_teamName(ctx, field) + case "teamEmail": + return ec.fieldContext_DeciderInfo_teamEmail(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeciderInfo", field.Name) +} + +func (ec *executionContext) childFields_Decision(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Decision_name(ctx, field) + case "email": + return ec.fieldContext_Decision_email(ctx, field) + case "comment": + return ec.fieldContext_Decision_comment(ctx, field) + case "timestamp": + return ec.fieldContext_Decision_timestamp(ctx, field) + case "resultingState": + return ec.fieldContext_Decision_resultingState(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Decision", field.Name) +} + +func (ec *executionContext) childFields_EventExposure(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_EventExposure_id(ctx, field) + case "createdAt": + return ec.fieldContext_EventExposure_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_EventExposure_lastModifiedAt(ctx, field) + case "statusPhase": + return ec.fieldContext_EventExposure_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_EventExposure_statusMessage(ctx, field) + case "environment": + return ec.fieldContext_EventExposure_environment(ctx, field) + case "namespace": + return ec.fieldContext_EventExposure_namespace(ctx, field) + case "eventType": + return ec.fieldContext_EventExposure_eventType(ctx, field) + case "visibility": + return ec.fieldContext_EventExposure_visibility(ctx, field) + case "active": + return ec.fieldContext_EventExposure_active(ctx, field) + case "approvalConfig": + return ec.fieldContext_EventExposure_approvalConfig(ctx, field) + case "owner": + return ec.fieldContext_EventExposure_owner(ctx, field) + case "subscriptions": + return ec.fieldContext_EventExposure_subscriptions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventExposure", field.Name) +} + +func (ec *executionContext) childFields_EventExposureConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_EventExposureConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_EventExposureConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_EventExposureConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventExposureConnection", field.Name) +} + +func (ec *executionContext) childFields_EventExposureEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_EventExposureEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_EventExposureEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventExposureEdge", field.Name) +} + +func (ec *executionContext) childFields_EventExposureInfo(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_EventExposureInfo_id(ctx, field) + case "eventType": + return ec.fieldContext_EventExposureInfo_eventType(ctx, field) + case "visibility": + return ec.fieldContext_EventExposureInfo_visibility(ctx, field) + case "active": + return ec.fieldContext_EventExposureInfo_active(ctx, field) + case "approvalConfig": + return ec.fieldContext_EventExposureInfo_approvalConfig(ctx, field) + case "ownerApplicationName": + return ec.fieldContext_EventExposureInfo_ownerApplicationName(ctx, field) + case "ownerTeam": + return ec.fieldContext_EventExposureInfo_ownerTeam(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventExposureInfo", field.Name) +} + +func (ec *executionContext) childFields_EventSubscription(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_EventSubscription_id(ctx, field) + case "createdAt": + return ec.fieldContext_EventSubscription_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_EventSubscription_lastModifiedAt(ctx, field) + case "statusPhase": + return ec.fieldContext_EventSubscription_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_EventSubscription_statusMessage(ctx, field) + case "environment": + return ec.fieldContext_EventSubscription_environment(ctx, field) + case "namespace": + return ec.fieldContext_EventSubscription_namespace(ctx, field) + case "name": + return ec.fieldContext_EventSubscription_name(ctx, field) + case "eventType": + return ec.fieldContext_EventSubscription_eventType(ctx, field) + case "deliveryType": + return ec.fieldContext_EventSubscription_deliveryType(ctx, field) + case "callbackURL": + return ec.fieldContext_EventSubscription_callbackURL(ctx, field) + case "owner": + return ec.fieldContext_EventSubscription_owner(ctx, field) + case "approval": + return ec.fieldContext_EventSubscription_approval(ctx, field) + case "approvalRequests": + return ec.fieldContext_EventSubscription_approvalRequests(ctx, field) + case "target": + return ec.fieldContext_EventSubscription_target(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventSubscription", field.Name) +} + +func (ec *executionContext) childFields_EventSubscriptionConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_EventSubscriptionConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_EventSubscriptionConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_EventSubscriptionConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventSubscriptionConnection", field.Name) +} + +func (ec *executionContext) childFields_EventSubscriptionEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_EventSubscriptionEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_EventSubscriptionEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventSubscriptionEdge", field.Name) +} + +func (ec *executionContext) childFields_EventSubscriptionInfo(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_EventSubscriptionInfo_id(ctx, field) + case "eventType": + return ec.fieldContext_EventSubscriptionInfo_eventType(ctx, field) + case "deliveryType": + return ec.fieldContext_EventSubscriptionInfo_deliveryType(ctx, field) + case "statusPhase": + return ec.fieldContext_EventSubscriptionInfo_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_EventSubscriptionInfo_statusMessage(ctx, field) + case "ownerApplicationName": + return ec.fieldContext_EventSubscriptionInfo_ownerApplicationName(ctx, field) + case "ownerTeam": + return ec.fieldContext_EventSubscriptionInfo_ownerTeam(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventSubscriptionInfo", field.Name) +} + +func (ec *executionContext) childFields_Group(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Group_id(ctx, field) + case "environment": + return ec.fieldContext_Group_environment(ctx, field) + case "namespace": + return ec.fieldContext_Group_namespace(ctx, field) + case "name": + return ec.fieldContext_Group_name(ctx, field) + case "displayName": + return ec.fieldContext_Group_displayName(ctx, field) + case "description": + return ec.fieldContext_Group_description(ctx, field) + case "teams": + return ec.fieldContext_Group_teams(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Group", field.Name) +} + +func (ec *executionContext) childFields_Member(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Member_id(ctx, field) + case "environment": + return ec.fieldContext_Member_environment(ctx, field) + case "name": + return ec.fieldContext_Member_name(ctx, field) + case "email": + return ec.fieldContext_Member_email(ctx, field) + case "team": + return ec.fieldContext_Member_team(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Member", field.Name) +} + +func (ec *executionContext) childFields_MutationError(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "code": + return ec.fieldContext_MutationError_code(ctx, field) + case "message": + return ec.fieldContext_MutationError_message(ctx, field) + case "field": + return ec.fieldContext_MutationError_field(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type MutationError", field.Name) +} + +func (ec *executionContext) childFields_PageInfo(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) +} + +func (ec *executionContext) childFields_RemoveTeamMemberPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "team": + return ec.fieldContext_RemoveTeamMemberPayload_team(ctx, field) + case "errors": + return ec.fieldContext_RemoveTeamMemberPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RemoveTeamMemberPayload", field.Name) +} + +func (ec *executionContext) childFields_RequesterInfo(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "teamName": + return ec.fieldContext_RequesterInfo_teamName(ctx, field) + case "teamEmail": + return ec.fieldContext_RequesterInfo_teamEmail(ctx, field) + case "reason": + return ec.fieldContext_RequesterInfo_reason(ctx, field) + case "applicationName": + return ec.fieldContext_RequesterInfo_applicationName(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RequesterInfo", field.Name) +} + +func (ec *executionContext) childFields_RotateApplicationSecretPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "application": + return ec.fieldContext_RotateApplicationSecretPayload_application(ctx, field) + case "accepted": + return ec.fieldContext_RotateApplicationSecretPayload_accepted(ctx, field) + case "errors": + return ec.fieldContext_RotateApplicationSecretPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RotateApplicationSecretPayload", field.Name) +} + +func (ec *executionContext) childFields_RotateTeamTokenPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "team": + return ec.fieldContext_RotateTeamTokenPayload_team(ctx, field) + case "accepted": + return ec.fieldContext_RotateTeamTokenPayload_accepted(ctx, field) + case "errors": + return ec.fieldContext_RotateTeamTokenPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RotateTeamTokenPayload", field.Name) +} + +func (ec *executionContext) childFields_Team(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "createdAt": + return ec.fieldContext_Team_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Team_lastModifiedAt(ctx, field) + case "statusPhase": + return ec.fieldContext_Team_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_Team_statusMessage(ctx, field) + case "environment": + return ec.fieldContext_Team_environment(ctx, field) + case "namespace": + return ec.fieldContext_Team_namespace(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "email": + return ec.fieldContext_Team_email(ctx, field) + case "category": + return ec.fieldContext_Team_category(ctx, field) + case "teamToken": + return ec.fieldContext_Team_teamToken(ctx, field) + case "group": + return ec.fieldContext_Team_group(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "applications": + return ec.fieldContext_Team_applications(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) +} + +func (ec *executionContext) childFields_TeamConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_TeamConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_TeamConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_TeamConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamConnection", field.Name) +} + +func (ec *executionContext) childFields_TeamEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_TeamEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_TeamEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamEdge", field.Name) +} + +func (ec *executionContext) childFields_TeamInfo(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamInfo_id(ctx, field) + case "name": + return ec.fieldContext_TeamInfo_name(ctx, field) + case "groupName": + return ec.fieldContext_TeamInfo_groupName(ctx, field) + case "email": + return ec.fieldContext_TeamInfo_email(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamInfo", field.Name) +} + +func (ec *executionContext) childFields_UpdateTeamPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "team": + return ec.fieldContext_UpdateTeamPayload_team(ctx, field) + case "accepted": + return ec.fieldContext_UpdateTeamPayload_accepted(ctx, field) + case "errors": + return ec.fieldContext_UpdateTeamPayload_errors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateTeamPayload", field.Name) +} + +func (ec *executionContext) childFields_Upstream(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "url": + return ec.fieldContext_Upstream_url(ctx, field) + case "weight": + return ec.fieldContext_Upstream_weight(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Upstream", field.Name) +} + +func (ec *executionContext) childFields_Zone(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Zone_id(ctx, field) + case "environment": + return ec.fieldContext_Zone_environment(ctx, field) + case "name": + return ec.fieldContext_Zone_name(ctx, field) + case "gatewayURL": + return ec.fieldContext_Zone_gatewayURL(ctx, field) + case "issuerURL": + return ec.fieldContext_Zone_issuerURL(ctx, field) + case "visibility": + return ec.fieldContext_Zone_visibility(ctx, field) + case "applications": + return ec.fieldContext_Zone_applications(ctx, field) + case "tokenURL": + return ec.fieldContext_Zone_tokenURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Zone", field.Name) +} + +func (ec *executionContext) childFields___Directive(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) +} + +func (ec *executionContext) childFields___EnumValue(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___EnumValue_name(ctx, field) + case "description": + return ec.fieldContext___EnumValue_description(ctx, field) + case "isDeprecated": + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) +} + +func (ec *executionContext) childFields___Field(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Field_name(ctx, field) + case "description": + return ec.fieldContext___Field_description(ctx, field) + case "args": + return ec.fieldContext___Field_args(ctx, field) + case "type": + return ec.fieldContext___Field_type(ctx, field) + case "isDeprecated": + return ec.fieldContext___Field_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___Field_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) +} + +func (ec *executionContext) childFields___InputValue(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) +} + +func (ec *executionContext) childFields___Schema(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) +} + +func (ec *executionContext) childFields___Type(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) +} diff --git a/controlplane-api/internal/resolvers/schema.generated.go b/controlplane-api/internal/resolvers/schema.generated.go index 0af0e0761..38d00e3d2 100644 --- a/controlplane-api/internal/resolvers/schema.generated.go +++ b/controlplane-api/internal/resolvers/schema.generated.go @@ -1,7 +1,6 @@ -// Copyright 2026 Deutsche Telekom IT GmbH +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. package resolvers @@ -10,6 +9,7 @@ import ( "context" "errors" "fmt" + "math" "strconv" "sync/atomic" @@ -17,6 +17,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approval" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" model1 "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" "github.com/telekom/controlplane/controlplane-api/pkg/model" "github.com/vektah/gqlparser/v2/ast" @@ -42,6 +44,13 @@ type AvailableTransitionResolver interface { type DecisionResolver interface { ResultingState(ctx context.Context, obj *model.Decision) (*approval.State, error) } +type EventExposureInfoResolver interface { + Visibility(ctx context.Context, obj *model.EventExposureInfo) (eventexposure.Visibility, error) +} +type EventSubscriptionInfoResolver interface { + DeliveryType(ctx context.Context, obj *model.EventSubscriptionInfo) (eventsubscription.DeliveryType, error) + StatusPhase(ctx context.Context, obj *model.EventSubscriptionInfo) (*eventsubscription.StatusPhase, error) +} // endregion ************************** generated!.gotpl ************************** @@ -60,28 +69,22 @@ func (ec *executionContext) _ApiExposureInfo_id(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureInfo_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureInfo_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposureInfo_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposureInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposureInfo", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _ApiExposureInfo_basePath(ctx context.Context, field graphql.CollectedField, obj *model.ApiExposureInfo) (ret graphql.Marshaler) { @@ -89,28 +92,22 @@ func (ec *executionContext) _ApiExposureInfo_basePath(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureInfo_basePath, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureInfo_basePath(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.BasePath, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposureInfo_basePath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposureInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposureInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiExposureInfo_visibility(ctx context.Context, field graphql.CollectedField, obj *model.ApiExposureInfo) (ret graphql.Marshaler) { @@ -118,28 +115,22 @@ func (ec *executionContext) _ApiExposureInfo_visibility(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureInfo_visibility, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureInfo_visibility(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.ApiExposureInfo().Visibility(ctx, obj) }, nil, - ec.marshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility, + func(ctx context.Context, selections ast.SelectionSet, v apiexposure.Visibility) graphql.Marshaler { + return ec.marshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposureInfo_visibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposureInfo", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApiExposureVisibility does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposureInfo", field, true, true, errors.New("field of type ApiExposureVisibility does not have child fields")) } func (ec *executionContext) _ApiExposureInfo_active(ctx context.Context, field graphql.CollectedField, obj *model.ApiExposureInfo) (ret graphql.Marshaler) { @@ -147,28 +138,22 @@ func (ec *executionContext) _ApiExposureInfo_active(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureInfo_active, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureInfo_active(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Active, nil }, nil, - ec.marshalOBoolean2ᚖbool, + func(ctx context.Context, selections ast.SelectionSet, v *bool) graphql.Marshaler { + return ec.marshalOBoolean2ᚖbool(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiExposureInfo_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposureInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposureInfo", field, false, false, errors.New("field of type Boolean does not have child fields")) } func (ec *executionContext) _ApiExposureInfo_apiVersion(ctx context.Context, field graphql.CollectedField, obj *model.ApiExposureInfo) (ret graphql.Marshaler) { @@ -176,28 +161,22 @@ func (ec *executionContext) _ApiExposureInfo_apiVersion(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureInfo_apiVersion, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureInfo_apiVersion(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ApiVersion, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiExposureInfo_apiVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposureInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposureInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiExposureInfo_features(ctx context.Context, field graphql.CollectedField, obj *model.ApiExposureInfo) (ret graphql.Marshaler) { @@ -205,28 +184,22 @@ func (ec *executionContext) _ApiExposureInfo_features(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureInfo_features, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureInfo_features(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.ApiExposureInfo().Features(ctx, obj) }, nil, - ec.marshalNApiExposureFeature2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAPIExposureFeatureᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []model1.APIExposureFeature) graphql.Marshaler { + return ec.marshalNApiExposureFeature2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAPIExposureFeatureᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposureInfo_features(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposureInfo", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApiExposureFeature does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposureInfo", field, true, true, errors.New("field of type ApiExposureFeature does not have child fields")) } func (ec *executionContext) _ApiExposureInfo_approvalConfig(ctx context.Context, field graphql.CollectedField, obj *model.ApiExposureInfo) (ret graphql.Marshaler) { @@ -234,17 +207,20 @@ func (ec *executionContext) _ApiExposureInfo_approvalConfig(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureInfo_approvalConfig, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureInfo_approvalConfig(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ApprovalConfig, nil }, nil, - ec.marshalNApprovalConfig2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApprovalConfig, + func(ctx context.Context, selections ast.SelectionSet, v model.ApprovalConfig) graphql.Marshaler { + return ec.marshalNApprovalConfig2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApprovalConfig(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposureInfo_approvalConfig(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiExposureInfo", @@ -252,13 +228,7 @@ func (ec *executionContext) fieldContext_ApiExposureInfo_approvalConfig(_ contex IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "strategy": - return ec.fieldContext_ApprovalConfig_strategy(ctx, field) - case "trustedTeams": - return ec.fieldContext_ApprovalConfig_trustedTeams(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ApprovalConfig", field.Name) + return ec.childFields_ApprovalConfig(ctx, field) }, } return fc, nil @@ -269,28 +239,22 @@ func (ec *executionContext) _ApiExposureInfo_ownerApplicationName(ctx context.Co ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureInfo_ownerApplicationName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureInfo_ownerApplicationName(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.OwnerApplicationName, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposureInfo_ownerApplicationName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiExposureInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiExposureInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiExposureInfo_ownerTeam(ctx context.Context, field graphql.CollectedField, obj *model.ApiExposureInfo) (ret graphql.Marshaler) { @@ -298,17 +262,20 @@ func (ec *executionContext) _ApiExposureInfo_ownerTeam(ctx context.Context, fiel ctx, ec.OperationContext, field, - ec.fieldContext_ApiExposureInfo_ownerTeam, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiExposureInfo_ownerTeam(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.OwnerTeam, nil }, nil, - ec.marshalNTeamInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐTeamInfo, + func(ctx context.Context, selections ast.SelectionSet, v *model.TeamInfo) graphql.Marshaler { + return ec.marshalNTeamInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐTeamInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiExposureInfo_ownerTeam(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiExposureInfo", @@ -316,17 +283,7 @@ func (ec *executionContext) fieldContext_ApiExposureInfo_ownerTeam(_ context.Con IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_TeamInfo_id(ctx, field) - case "name": - return ec.fieldContext_TeamInfo_name(ctx, field) - case "groupName": - return ec.fieldContext_TeamInfo_groupName(ctx, field) - case "email": - return ec.fieldContext_TeamInfo_email(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TeamInfo", field.Name) + return ec.childFields_TeamInfo(ctx, field) }, } return fc, nil @@ -337,28 +294,22 @@ func (ec *executionContext) _ApiSubscriptionInfo_id(ctx context.Context, field g ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionInfo_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionInfo_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionInfo_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscriptionInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscriptionInfo", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _ApiSubscriptionInfo_basePath(ctx context.Context, field graphql.CollectedField, obj *model.ApiSubscriptionInfo) (ret graphql.Marshaler) { @@ -366,28 +317,22 @@ func (ec *executionContext) _ApiSubscriptionInfo_basePath(ctx context.Context, f ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionInfo_basePath, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionInfo_basePath(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.BasePath, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionInfo_basePath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscriptionInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscriptionInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiSubscriptionInfo_statusPhase(ctx context.Context, field graphql.CollectedField, obj *model.ApiSubscriptionInfo) (ret graphql.Marshaler) { @@ -395,28 +340,22 @@ func (ec *executionContext) _ApiSubscriptionInfo_statusPhase(ctx context.Context ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionInfo_statusPhase, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionInfo_statusPhase(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.ApiSubscriptionInfo().StatusPhase(ctx, obj) }, nil, - ec.marshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase, + func(ctx context.Context, selections ast.SelectionSet, v *apisubscription.StatusPhase) graphql.Marshaler { + return ec.marshalOApiSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐStatusPhase(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionInfo_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscriptionInfo", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApiSubscriptionStatusPhase does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscriptionInfo", field, true, true, errors.New("field of type ApiSubscriptionStatusPhase does not have child fields")) } func (ec *executionContext) _ApiSubscriptionInfo_statusMessage(ctx context.Context, field graphql.CollectedField, obj *model.ApiSubscriptionInfo) (ret graphql.Marshaler) { @@ -424,28 +363,22 @@ func (ec *executionContext) _ApiSubscriptionInfo_statusMessage(ctx context.Conte ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionInfo_statusMessage, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionInfo_statusMessage(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionInfo_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscriptionInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscriptionInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiSubscriptionInfo_ownerApplicationName(ctx context.Context, field graphql.CollectedField, obj *model.ApiSubscriptionInfo) (ret graphql.Marshaler) { @@ -453,28 +386,22 @@ func (ec *executionContext) _ApiSubscriptionInfo_ownerApplicationName(ctx contex ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionInfo_ownerApplicationName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionInfo_ownerApplicationName(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.OwnerApplicationName, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionInfo_ownerApplicationName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApiSubscriptionInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApiSubscriptionInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ApiSubscriptionInfo_ownerTeam(ctx context.Context, field graphql.CollectedField, obj *model.ApiSubscriptionInfo) (ret graphql.Marshaler) { @@ -482,17 +409,20 @@ func (ec *executionContext) _ApiSubscriptionInfo_ownerTeam(ctx context.Context, ctx, ec.OperationContext, field, - ec.fieldContext_ApiSubscriptionInfo_ownerTeam, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiSubscriptionInfo_ownerTeam(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.OwnerTeam, nil }, nil, - ec.marshalNTeamInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐTeamInfo, + func(ctx context.Context, selections ast.SelectionSet, v *model.TeamInfo) graphql.Marshaler { + return ec.marshalNTeamInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐTeamInfo(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApiSubscriptionInfo_ownerTeam(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ApiSubscriptionInfo", @@ -500,17 +430,7 @@ func (ec *executionContext) fieldContext_ApiSubscriptionInfo_ownerTeam(_ context IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_TeamInfo_id(ctx, field) - case "name": - return ec.fieldContext_TeamInfo_name(ctx, field) - case "groupName": - return ec.fieldContext_TeamInfo_groupName(ctx, field) - case "email": - return ec.fieldContext_TeamInfo_email(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TeamInfo", field.Name) + return ec.childFields_TeamInfo(ctx, field) }, } return fc, nil @@ -521,28 +441,22 @@ func (ec *executionContext) _ApprovalConfig_strategy(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalConfig_strategy, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalConfig_strategy(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.ApprovalConfig().Strategy(ctx, obj) }, nil, - ec.marshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy, + func(ctx context.Context, selections ast.SelectionSet, v approval.Strategy) graphql.Marshaler { + return ec.marshalNApprovalStrategy2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategy(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalConfig_strategy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalConfig", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApprovalStrategy does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalConfig", field, true, true, errors.New("field of type ApprovalStrategy does not have child fields")) } func (ec *executionContext) _ApprovalConfig_trustedTeams(ctx context.Context, field graphql.CollectedField, obj *model.ApprovalConfig) (ret graphql.Marshaler) { @@ -550,28 +464,22 @@ func (ec *executionContext) _ApprovalConfig_trustedTeams(ctx context.Context, fi ctx, ec.OperationContext, field, - ec.fieldContext_ApprovalConfig_trustedTeams, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApprovalConfig_trustedTeams(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.TrustedTeams, nil }, nil, - ec.marshalNString2ᚕstringᚄ, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalNString2ᚕstringᚄ(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_ApprovalConfig_trustedTeams(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApprovalConfig", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("ApprovalConfig", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _AvailableTransition_action(ctx context.Context, field graphql.CollectedField, obj *model.AvailableTransition) (ret graphql.Marshaler) { @@ -579,28 +487,22 @@ func (ec *executionContext) _AvailableTransition_action(ctx context.Context, fie ctx, ec.OperationContext, field, - ec.fieldContext_AvailableTransition_action, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AvailableTransition_action(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.AvailableTransition().Action(ctx, obj) }, nil, - ec.marshalNApprovalAction2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐApprovalAction, + func(ctx context.Context, selections ast.SelectionSet, v model1.ApprovalAction) graphql.Marshaler { + return ec.marshalNApprovalAction2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐApprovalAction(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_AvailableTransition_action(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "AvailableTransition", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApprovalAction does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("AvailableTransition", field, true, true, errors.New("field of type ApprovalAction does not have child fields")) } func (ec *executionContext) _AvailableTransition_toState(ctx context.Context, field graphql.CollectedField, obj *model.AvailableTransition) (ret graphql.Marshaler) { @@ -608,28 +510,22 @@ func (ec *executionContext) _AvailableTransition_toState(ctx context.Context, fi ctx, ec.OperationContext, field, - ec.fieldContext_AvailableTransition_toState, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AvailableTransition_toState(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.AvailableTransition().ToState(ctx, obj) }, nil, - ec.marshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState, + func(ctx context.Context, selections ast.SelectionSet, v approval.State) graphql.Marshaler { + return ec.marshalNApprovalState2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_AvailableTransition_toState(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "AvailableTransition", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApprovalState does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("AvailableTransition", field, true, true, errors.New("field of type ApprovalState does not have child fields")) } func (ec *executionContext) _DeciderInfo_teamName(ctx context.Context, field graphql.CollectedField, obj *model.DeciderInfo) (ret graphql.Marshaler) { @@ -637,28 +533,22 @@ func (ec *executionContext) _DeciderInfo_teamName(ctx context.Context, field gra ctx, ec.OperationContext, field, - ec.fieldContext_DeciderInfo_teamName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeciderInfo_teamName(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.TeamName, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_DeciderInfo_teamName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "DeciderInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("DeciderInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _DeciderInfo_teamEmail(ctx context.Context, field graphql.CollectedField, obj *model.DeciderInfo) (ret graphql.Marshaler) { @@ -666,28 +556,22 @@ func (ec *executionContext) _DeciderInfo_teamEmail(ctx context.Context, field gr ctx, ec.OperationContext, field, - ec.fieldContext_DeciderInfo_teamEmail, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeciderInfo_teamEmail(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.TeamEmail, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_DeciderInfo_teamEmail(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "DeciderInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("DeciderInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Decision_name(ctx context.Context, field graphql.CollectedField, obj *model.Decision) (ret graphql.Marshaler) { @@ -695,28 +579,22 @@ func (ec *executionContext) _Decision_name(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_Decision_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Decision_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Decision_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Decision", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Decision", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Decision_email(ctx context.Context, field graphql.CollectedField, obj *model.Decision) (ret graphql.Marshaler) { @@ -724,28 +602,22 @@ func (ec *executionContext) _Decision_email(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext_Decision_email, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Decision_email(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Email, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Decision_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Decision", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Decision", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Decision_comment(ctx context.Context, field graphql.CollectedField, obj *model.Decision) (ret graphql.Marshaler) { @@ -753,28 +625,22 @@ func (ec *executionContext) _Decision_comment(ctx context.Context, field graphql ctx, ec.OperationContext, field, - ec.fieldContext_Decision_comment, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Decision_comment(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Comment, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Decision_comment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Decision", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Decision", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Decision_timestamp(ctx context.Context, field graphql.CollectedField, obj *model.Decision) (ret graphql.Marshaler) { @@ -782,28 +648,22 @@ func (ec *executionContext) _Decision_timestamp(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_Decision_timestamp, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Decision_timestamp(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Timestamp, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Decision_timestamp(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Decision", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Decision", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Decision_resultingState(ctx context.Context, field graphql.CollectedField, obj *model.Decision) (ret graphql.Marshaler) { @@ -811,144 +671,463 @@ func (ec *executionContext) _Decision_resultingState(ctx context.Context, field ctx, ec.OperationContext, field, - ec.fieldContext_Decision_resultingState, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Decision_resultingState(ctx, field) + }, func(ctx context.Context) (any, error) { return ec.Resolvers.Decision().ResultingState(ctx, obj) }, nil, - ec.marshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState, + func(ctx context.Context, selections ast.SelectionSet, v *approval.State) graphql.Marshaler { + return ec.marshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐState(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_Decision_resultingState(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Decision", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ApprovalState does not have child fields") + return graphql.NewScalarFieldContext("Decision", field, true, true, errors.New("field of type ApprovalState does not have child fields")) +} + +func (ec *executionContext) _EventExposureInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.EventExposureInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureInfo_id(ctx, field) }, - } - return fc, nil + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_EventExposureInfo_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposureInfo", field, false, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _RequesterInfo_teamName(ctx context.Context, field graphql.CollectedField, obj *model.RequesterInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposureInfo_eventType(ctx context.Context, field graphql.CollectedField, obj *model.EventExposureInfo) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RequesterInfo_teamName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureInfo_eventType(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.TeamName, nil + return obj.EventType, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } +func (ec *executionContext) fieldContext_EventExposureInfo_eventType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposureInfo", field, false, false, errors.New("field of type String does not have child fields")) +} -func (ec *executionContext) fieldContext_RequesterInfo_teamName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _EventExposureInfo_visibility(ctx context.Context, field graphql.CollectedField, obj *model.EventExposureInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureInfo_visibility(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.EventExposureInfo().Visibility(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v eventexposure.Visibility) graphql.Marshaler { + return ec.marshalNEventExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐVisibility(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_EventExposureInfo_visibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposureInfo", field, true, true, errors.New("field of type EventExposureVisibility does not have child fields")) +} + +func (ec *executionContext) _EventExposureInfo_active(ctx context.Context, field graphql.CollectedField, obj *model.EventExposureInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureInfo_active(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Active, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *bool) graphql.Marshaler { + return ec.marshalOBoolean2ᚖbool(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_EventExposureInfo_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposureInfo", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) _EventExposureInfo_approvalConfig(ctx context.Context, field graphql.CollectedField, obj *model.EventExposureInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureInfo_approvalConfig(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ApprovalConfig, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v model.ApprovalConfig) graphql.Marshaler { + return ec.marshalNApprovalConfig2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApprovalConfig(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_EventExposureInfo_approvalConfig(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RequesterInfo", + Object: "EventExposureInfo", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_ApprovalConfig(ctx, field) }, } return fc, nil } -func (ec *executionContext) _RequesterInfo_teamEmail(ctx context.Context, field graphql.CollectedField, obj *model.RequesterInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposureInfo_ownerApplicationName(ctx context.Context, field graphql.CollectedField, obj *model.EventExposureInfo) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RequesterInfo_teamEmail, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureInfo_ownerApplicationName(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.TeamEmail, nil + return obj.OwnerApplicationName, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } +func (ec *executionContext) fieldContext_EventExposureInfo_ownerApplicationName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventExposureInfo", field, false, false, errors.New("field of type String does not have child fields")) +} -func (ec *executionContext) fieldContext_RequesterInfo_teamEmail(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _EventExposureInfo_ownerTeam(ctx context.Context, field graphql.CollectedField, obj *model.EventExposureInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventExposureInfo_ownerTeam(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.OwnerTeam, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model.TeamInfo) graphql.Marshaler { + return ec.marshalNTeamInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐTeamInfo(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_EventExposureInfo_ownerTeam(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RequesterInfo", + Object: "EventExposureInfo", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_TeamInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _RequesterInfo_reason(ctx context.Context, field graphql.CollectedField, obj *model.RequesterInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _EventSubscriptionInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.EventSubscriptionInfo) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RequesterInfo_reason, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionInfo_id(ctx, field) + }, func(ctx context.Context) (any, error) { - return obj.Reason, nil + return obj.ID, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_EventSubscriptionInfo_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscriptionInfo", field, false, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _EventSubscriptionInfo_eventType(ctx context.Context, field graphql.CollectedField, obj *model.EventSubscriptionInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionInfo_eventType(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.EventType, 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_EventSubscriptionInfo_eventType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscriptionInfo", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _EventSubscriptionInfo_deliveryType(ctx context.Context, field graphql.CollectedField, obj *model.EventSubscriptionInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionInfo_deliveryType(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.EventSubscriptionInfo().DeliveryType(ctx, obj) }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v eventsubscription.DeliveryType) graphql.Marshaler { + return ec.marshalNEventSubscriptionDeliveryType2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_EventSubscriptionInfo_deliveryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscriptionInfo", field, true, true, errors.New("field of type EventSubscriptionDeliveryType does not have child fields")) +} + +func (ec *executionContext) _EventSubscriptionInfo_statusPhase(ctx context.Context, field graphql.CollectedField, obj *model.EventSubscriptionInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionInfo_statusPhase(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.EventSubscriptionInfo().StatusPhase(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *eventsubscription.StatusPhase) graphql.Marshaler { + return ec.marshalOEventSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx, selections, v) + }, true, false, ) } +func (ec *executionContext) fieldContext_EventSubscriptionInfo_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscriptionInfo", field, true, true, errors.New("field of type EventSubscriptionStatusPhase does not have child fields")) +} -func (ec *executionContext) fieldContext_RequesterInfo_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) _EventSubscriptionInfo_statusMessage(ctx context.Context, field graphql.CollectedField, obj *model.EventSubscriptionInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionInfo_statusMessage(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.StatusMessage, 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_EventSubscriptionInfo_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscriptionInfo", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _EventSubscriptionInfo_ownerApplicationName(ctx context.Context, field graphql.CollectedField, obj *model.EventSubscriptionInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionInfo_ownerApplicationName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.OwnerApplicationName, 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_EventSubscriptionInfo_ownerApplicationName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventSubscriptionInfo", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _EventSubscriptionInfo_ownerTeam(ctx context.Context, field graphql.CollectedField, obj *model.EventSubscriptionInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_EventSubscriptionInfo_ownerTeam(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.OwnerTeam, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *model.TeamInfo) graphql.Marshaler { + return ec.marshalNTeamInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐTeamInfo(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_EventSubscriptionInfo_ownerTeam(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RequesterInfo", + Object: "EventSubscriptionInfo", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return ec.childFields_TeamInfo(ctx, field) }, } return fc, nil } +func (ec *executionContext) _RequesterInfo_teamName(ctx context.Context, field graphql.CollectedField, obj *model.RequesterInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RequesterInfo_teamName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TeamName, 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_RequesterInfo_teamName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("RequesterInfo", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _RequesterInfo_teamEmail(ctx context.Context, field graphql.CollectedField, obj *model.RequesterInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RequesterInfo_teamEmail(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TeamEmail, 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_RequesterInfo_teamEmail(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("RequesterInfo", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _RequesterInfo_reason(ctx context.Context, field graphql.CollectedField, obj *model.RequesterInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RequesterInfo_reason(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Reason, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_RequesterInfo_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("RequesterInfo", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _RequesterInfo_applicationName(ctx context.Context, field graphql.CollectedField, obj *model.RequesterInfo) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_RequesterInfo_applicationName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_RequesterInfo_applicationName(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ApplicationName, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_RequesterInfo_applicationName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "RequesterInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("RequesterInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _TeamInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.TeamInfo) (ret graphql.Marshaler) { @@ -956,28 +1135,22 @@ func (ec *executionContext) _TeamInfo_id(ctx context.Context, field graphql.Coll ctx, ec.OperationContext, field, - ec.fieldContext_TeamInfo_id, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_TeamInfo_id(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.ID, nil }, nil, - ec.marshalNID2int, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_TeamInfo_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "TeamInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("TeamInfo", field, false, false, errors.New("field of type ID does not have child fields")) } func (ec *executionContext) _TeamInfo_name(ctx context.Context, field graphql.CollectedField, obj *model.TeamInfo) (ret graphql.Marshaler) { @@ -985,28 +1158,22 @@ func (ec *executionContext) _TeamInfo_name(ctx context.Context, field graphql.Co ctx, ec.OperationContext, field, - ec.fieldContext_TeamInfo_name, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_TeamInfo_name(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Name, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_TeamInfo_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "TeamInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("TeamInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _TeamInfo_groupName(ctx context.Context, field graphql.CollectedField, obj *model.TeamInfo) (ret graphql.Marshaler) { @@ -1014,28 +1181,22 @@ func (ec *executionContext) _TeamInfo_groupName(ctx context.Context, field graph ctx, ec.OperationContext, field, - ec.fieldContext_TeamInfo_groupName, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_TeamInfo_groupName(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.GroupName, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_TeamInfo_groupName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "TeamInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("TeamInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _TeamInfo_email(ctx context.Context, field graphql.CollectedField, obj *model.TeamInfo) (ret graphql.Marshaler) { @@ -1043,28 +1204,22 @@ func (ec *executionContext) _TeamInfo_email(ctx context.Context, field graphql.C ctx, ec.OperationContext, field, - ec.fieldContext_TeamInfo_email, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_TeamInfo_email(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Email, nil }, nil, - ec.marshalOString2ᚖstring, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, true, false, ) } - func (ec *executionContext) fieldContext_TeamInfo_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "TeamInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("TeamInfo", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Upstream_url(ctx context.Context, field graphql.CollectedField, obj *model.Upstream) (ret graphql.Marshaler) { @@ -1072,28 +1227,22 @@ func (ec *executionContext) _Upstream_url(ctx context.Context, field graphql.Col ctx, ec.OperationContext, field, - ec.fieldContext_Upstream_url, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Upstream_url(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.URL, nil }, nil, - ec.marshalNString2string, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, true, true, ) } - func (ec *executionContext) fieldContext_Upstream_url(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Upstream", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return graphql.NewScalarFieldContext("Upstream", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _Upstream_weight(ctx context.Context, field graphql.CollectedField, obj *model.Upstream) (ret graphql.Marshaler) { @@ -1101,28 +1250,22 @@ func (ec *executionContext) _Upstream_weight(ctx context.Context, field graphql. ctx, ec.OperationContext, field, - ec.fieldContext_Upstream_weight, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Upstream_weight(ctx, field) + }, func(ctx context.Context) (any, error) { return obj.Weight, nil }, nil, - ec.marshalNInt2int, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_Upstream_weight(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Upstream", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Upstream_weight(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Upstream", field, false, false, errors.New("field of type Int does not have child fields")) } // endregion **************************** field.gotpl ***************************** @@ -1133,6 +1276,33 @@ func (ec *executionContext) fieldContext_Upstream_weight(_ context.Context, fiel // region ************************** interface.gotpl *************************** +func (ec *executionContext) _SubscriptionInfo(ctx context.Context, sel ast.SelectionSet, obj model1.SubscriptionInfo) graphql.Marshaler { + switch obj := (obj).(type) { + case nil: + return graphql.Null + case model.EventSubscriptionInfo: + return ec._EventSubscriptionInfo(ctx, sel, &obj) + case *model.EventSubscriptionInfo: + if obj == nil { + return graphql.Null + } + return ec._EventSubscriptionInfo(ctx, sel, obj) + case model.ApiSubscriptionInfo: + return ec._ApiSubscriptionInfo(ctx, sel, &obj) + case *model.ApiSubscriptionInfo: + if obj == nil { + return graphql.Null + } + return ec._ApiSubscriptionInfo(ctx, sel, obj) + default: + if typedObj, ok := obj.(graphql.Marshaler); ok { + return typedObj + } else { + panic(fmt.Errorf("unexpected type %T; non-generated variants of SubscriptionInfo must implement graphql.Marshaler", obj)) + } + } +} + // endregion ************************** interface.gotpl *************************** // region **************************** object.gotpl **************************** @@ -1258,7 +1428,7 @@ func (ec *executionContext) _ApiExposureInfo(ctx context.Context, sel ast.Select return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1272,7 +1442,7 @@ func (ec *executionContext) _ApiExposureInfo(ctx context.Context, sel ast.Select return out } -var apiSubscriptionInfoImplementors = []string{"ApiSubscriptionInfo"} +var apiSubscriptionInfoImplementors = []string{"ApiSubscriptionInfo", "SubscriptionInfo"} func (ec *executionContext) _ApiSubscriptionInfo(ctx context.Context, sel ast.SelectionSet, obj *model.ApiSubscriptionInfo) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, apiSubscriptionInfoImplementors) @@ -1347,7 +1517,7 @@ func (ec *executionContext) _ApiSubscriptionInfo(ctx context.Context, sel ast.Se return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1422,7 +1592,7 @@ func (ec *executionContext) _ApprovalConfig(ctx context.Context, sel ast.Selecti return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1528,7 +1698,7 @@ func (ec *executionContext) _AvailableTransition(ctx context.Context, sel ast.Se return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1569,7 +1739,7 @@ func (ec *executionContext) _DeciderInfo(ctx context.Context, sel ast.SelectionS return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1647,7 +1817,229 @@ func (ec *executionContext) _Decision(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + 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 eventExposureInfoImplementors = []string{"EventExposureInfo"} + +func (ec *executionContext) _EventExposureInfo(ctx context.Context, sel ast.SelectionSet, obj *model.EventExposureInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventExposureInfoImplementors) + + 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("EventExposureInfo") + case "id": + out.Values[i] = ec._EventExposureInfo_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "eventType": + out.Values[i] = ec._EventExposureInfo_eventType(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "visibility": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._EventExposureInfo_visibility(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "active": + out.Values[i] = ec._EventExposureInfo_active(ctx, field, obj) + case "approvalConfig": + out.Values[i] = ec._EventExposureInfo_approvalConfig(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "ownerApplicationName": + out.Values[i] = ec._EventExposureInfo_ownerApplicationName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "ownerTeam": + out.Values[i] = ec._EventExposureInfo_ownerTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + 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 eventSubscriptionInfoImplementors = []string{"EventSubscriptionInfo", "SubscriptionInfo"} + +func (ec *executionContext) _EventSubscriptionInfo(ctx context.Context, sel ast.SelectionSet, obj *model.EventSubscriptionInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventSubscriptionInfoImplementors) + + 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("EventSubscriptionInfo") + case "id": + out.Values[i] = ec._EventSubscriptionInfo_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "eventType": + out.Values[i] = ec._EventSubscriptionInfo_eventType(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "deliveryType": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._EventSubscriptionInfo_deliveryType(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "statusPhase": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._EventSubscriptionInfo_statusPhase(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "statusMessage": + out.Values[i] = ec._EventSubscriptionInfo_statusMessage(ctx, field, obj) + case "ownerApplicationName": + out.Values[i] = ec._EventSubscriptionInfo_ownerApplicationName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "ownerTeam": + out.Values[i] = ec._EventSubscriptionInfo_ownerTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + 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{ @@ -1695,7 +2087,7 @@ func (ec *executionContext) _RequesterInfo(ctx context.Context, sel ast.Selectio return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1746,7 +2138,7 @@ func (ec *executionContext) _TeamInfo(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1790,7 +2182,7 @@ func (ec *executionContext) _Upstream(ctx context.Context, sel ast.SelectionSet, return graphql.Null } - atomic.AddInt32(&ec.Deferred, int32(len(deferred))) + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) for label, dfs := range deferred { ec.ProcessDeferredGroup(graphql.DeferredGroup{ @@ -1931,10 +2323,60 @@ func (ec *executionContext) marshalNDecision2ᚕgithubᚗcomᚋtelekomᚋcontrol return ret } +func (ec *executionContext) marshalNEventExposureInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventExposureInfo(ctx context.Context, sel ast.SelectionSet, v model.EventExposureInfo) graphql.Marshaler { + return ec._EventExposureInfo(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEventExposureInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventExposureInfo(ctx context.Context, sel ast.SelectionSet, v *model.EventExposureInfo) 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._EventExposureInfo(ctx, sel, v) +} + +func (ec *executionContext) marshalNEventSubscriptionInfo2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventSubscriptionInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.EventSubscriptionInfo) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNEventSubscriptionInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventSubscriptionInfo(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNEventSubscriptionInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventSubscriptionInfo(ctx context.Context, sel ast.SelectionSet, v *model.EventSubscriptionInfo) 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._EventSubscriptionInfo(ctx, sel, v) +} + func (ec *executionContext) marshalNRequesterInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐRequesterInfo(ctx context.Context, sel ast.SelectionSet, v model.RequesterInfo) graphql.Marshaler { return ec._RequesterInfo(ctx, sel, &v) } +func (ec *executionContext) marshalNSubscriptionInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐSubscriptionInfo(ctx context.Context, sel ast.SelectionSet, v model1.SubscriptionInfo) 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._SubscriptionInfo(ctx, sel, v) +} + func (ec *executionContext) marshalNTeamInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐTeamInfo(ctx context.Context, sel ast.SelectionSet, v model.TeamInfo) graphql.Marshaler { return ec._TeamInfo(ctx, sel, &v) } @@ -1969,13 +2411,6 @@ func (ec *executionContext) marshalNUpstream2ᚕgithubᚗcomᚋtelekomᚋcontrol return ret } -func (ec *executionContext) marshalOApiSubscriptionInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiSubscriptionInfo(ctx context.Context, sel ast.SelectionSet, v *model.ApiSubscriptionInfo) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._ApiSubscriptionInfo(ctx, sel, v) -} - func (ec *executionContext) marshalOAvailableTransition2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐAvailableTransitionᚄ(ctx context.Context, sel ast.SelectionSet, v []model.AvailableTransition) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/controlplane-api/internal/resolvers/schema.resolvers.go b/controlplane-api/internal/resolvers/schema.resolvers.go index 88db5d296..7b638fad0 100644 --- a/controlplane-api/internal/resolvers/schema.resolvers.go +++ b/controlplane-api/internal/resolvers/schema.resolvers.go @@ -1,21 +1,23 @@ -// Copyright 2026 Deutsche Telekom IT GmbH +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH // // SPDX-License-Identifier: Apache-2.0 - package resolvers // This file will be automatically regenerated based on the schema, any resolver // implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.88 +// Code generated by github.com/99designs/gqlgen version v0.17.90 import ( "context" + "fmt" "github.com/telekom/controlplane/controlplane-api/ent" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approval" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" gqlmodel "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" "github.com/telekom/controlplane/controlplane-api/internal/viewer" "github.com/telekom/controlplane/controlplane-api/pkg/model" @@ -24,6 +26,8 @@ import ( // Subscriptions is the resolver for the subscriptions field. // Returns reduced ApiSubscriptionInfo types for cross-tenant safety. func (r *apiExposureResolver) Subscriptions(ctx context.Context, obj *ent.ApiExposure) ([]*model.ApiSubscriptionInfo, error) { + // SystemContext: Subscriptions belong to other tenants; privacy rules would + // block the cross-tenant traversal. We return a reduced Info type to limit exposure. sysCtx := viewer.SystemContext(ctx) subs, err := obj.QuerySubscriptions(). WithOwner(func(q *ent.ApplicationQuery) { @@ -33,13 +37,20 @@ func (r *apiExposureResolver) Subscriptions(ctx context.Context, obj *ent.ApiExp }). All(sysCtx) if err != nil { - return nil, err + return nil, fmt.Errorf("loading subscriptions for api exposure %d: %w", obj.ID, err) } + result := make([]*model.ApiSubscriptionInfo, len(subs)) for i, sub := range subs { app := sub.Edges.Owner team := app.Edges.OwnerTeam - group, _ := team.Edges.GroupOrErr() + group, groupErr := team.Edges.GroupOrErr() + if groupErr != nil { + if !ent.IsNotFound(groupErr) && !ent.IsNotLoaded(groupErr) { + return nil, fmt.Errorf("loading group edge for team %d: %w", team.ID, groupErr) + } + group = nil + } result[i] = mapApiSubscriptionInfo(sub, app, team, group) } return result, nil @@ -62,6 +73,8 @@ func (r *apiExposureInfoResolver) Features(ctx context.Context, obj *model.ApiEx // Target is the resolver for the target field. // Returns reduced ApiExposureInfo type for cross-tenant safety. func (r *apiSubscriptionResolver) Target(ctx context.Context, obj *ent.ApiSubscription) (*model.ApiExposureInfo, error) { + // SystemContext: The target exposure belongs to another tenant; privacy rules + // would block this traversal. We return a reduced Info type to limit exposure. sysCtx := viewer.SystemContext(ctx) exposure, err := obj.Edges.TargetOrErr() @@ -69,21 +82,10 @@ func (r *apiSubscriptionResolver) Target(ctx context.Context, obj *ent.ApiSubscr exposure, err = obj.QueryTarget().Only(sysCtx) } if err != nil { - return nil, err - } - - app, err := exposure.QueryOwner().Only(sysCtx) - if err != nil { - return nil, err - } - - team, err := app.QueryOwnerTeam().Only(sysCtx) - if err != nil { - return nil, err + return nil, fmt.Errorf("loading target for api subscription %d: %w", obj.ID, err) } - group, _ := team.QueryGroup().Only(sysCtx) - return mapApiExposureInfo(exposure, app, team, group), nil + return loadApiExposureInfo(sysCtx, exposure) } // StatusPhase is the resolver for the statusPhase field. @@ -97,53 +99,64 @@ func (r *apiSubscriptionInfoResolver) StatusPhase(ctx context.Context, obj *mode // OwnerTeam is the resolver for the ownerTeam field. func (r *applicationResolver) OwnerTeam(ctx context.Context, obj *ent.Application) (*model.TeamInfo, error) { + // SystemContext: The owning team may belong to a different tenant than the + // querying viewer. We return a reduced TeamInfo type to limit exposure. sysCtx := viewer.SystemContext(ctx) team, err := obj.Edges.OwnerTeamOrErr() if ent.IsNotLoaded(err) { team, err = obj.QueryOwnerTeam().Only(sysCtx) } if err != nil { - return nil, err + return nil, fmt.Errorf("loading owner team for application %d: %w", obj.ID, err) } group, err := team.Edges.GroupOrErr() if ent.IsNotLoaded(err) { group, err = team.QueryGroup().Only(sysCtx) } - if err != nil { + if err != nil && !ent.IsNotFound(err) { + return nil, fmt.Errorf("loading group for team %d: %w", team.ID, err) + } + if ent.IsNotFound(err) { group = nil } return mapTeamInfo(team, group), nil } -// APISubscription is the resolver for the apiSubscription field. -// Returns reduced ApiSubscriptionInfo type for cross-tenant safety. -func (r *approvalResolver) APISubscription(ctx context.Context, obj *ent.Approval) (*model.ApiSubscriptionInfo, error) { +// Subscription is the resolver for the subscription field. +// Returns the related subscription as a SubscriptionInfo union (ApiSubscriptionInfo or EventSubscriptionInfo). +func (r *approvalResolver) Subscription(ctx context.Context, obj *ent.Approval) (gqlmodel.SubscriptionInfo, error) { + // SystemContext: The subscription belongs to the requesting tenant, but the + // traversal path (approval → subscription → owner) crosses privacy boundaries. + // We return reduced Info types to limit exposure. sysCtx := viewer.SystemContext(ctx) - sub, err := obj.Edges.APISubscriptionOrErr() + // Try API subscription first. + apiSub, err := obj.Edges.APISubscriptionOrErr() if ent.IsNotLoaded(err) { - sub, err = obj.QueryAPISubscription().Only(sysCtx) + apiSub, err = obj.QueryAPISubscription().Only(sysCtx) } - if err != nil { - if ent.IsNotFound(err) { - return nil, nil - } - return nil, err + if err != nil && !ent.IsNotFound(err) { + return nil, fmt.Errorf("loading api subscription for approval %d: %w", obj.ID, err) + } + if apiSub != nil { + return loadApiSubscriptionInfo(sysCtx, apiSub) } - app, err := sub.QueryOwner().Only(sysCtx) - if err != nil { - return nil, err + // Fall back to event subscription. + eventSub, err := obj.Edges.EventSubscriptionOrErr() + if ent.IsNotLoaded(err) { + eventSub, err = obj.QueryEventSubscription().Only(sysCtx) } - team, err := app.QueryOwnerTeam().Only(sysCtx) - if err != nil { - return nil, err + if err != nil && !ent.IsNotFound(err) { + return nil, fmt.Errorf("loading event subscription for approval %d: %w", obj.ID, err) + } + if eventSub != nil { + return loadEventSubscriptionInfo(sysCtx, eventSub) } - group, _ := team.QueryGroup().Only(sysCtx) - return mapApiSubscriptionInfo(sub, app, team, group), nil + return nil, fmt.Errorf("approval %d has no related subscription", obj.ID) } // Strategy is the resolver for the strategy field. @@ -151,56 +164,82 @@ func (r *approvalConfigResolver) Strategy(ctx context.Context, obj *model.Approv return approval.Strategy(obj.Strategy), nil } -// APISubscription is the resolver for the apiSubscription field. -// Returns reduced ApiSubscriptionInfo type for cross-tenant safety. -func (r *approvalRequestResolver) APISubscription(ctx context.Context, obj *ent.ApprovalRequest) (*model.ApiSubscriptionInfo, error) { +// Subscription is the resolver for the subscription field. +// Returns the related subscription as a SubscriptionInfo union (ApiSubscriptionInfo or EventSubscriptionInfo). +func (r *approvalRequestResolver) Subscription(ctx context.Context, obj *ent.ApprovalRequest) (gqlmodel.SubscriptionInfo, error) { + // SystemContext: Same rationale as approvalResolver.Subscription — the traversal + // path crosses privacy boundaries; reduced Info types limit exposure. sysCtx := viewer.SystemContext(ctx) - sub, err := obj.Edges.APISubscriptionOrErr() + // Try API subscription first. + apiSub, err := obj.Edges.APISubscriptionOrErr() if ent.IsNotLoaded(err) { - sub, err = obj.QueryAPISubscription().Only(sysCtx) + apiSub, err = obj.QueryAPISubscription().Only(sysCtx) } - if err != nil { - if ent.IsNotFound(err) { - return nil, nil - } - return nil, err + if err != nil && !ent.IsNotFound(err) { + return nil, fmt.Errorf("loading api subscription for approval request %d: %w", obj.ID, err) + } + if apiSub != nil { + return loadApiSubscriptionInfo(sysCtx, apiSub) } - app, err := sub.QueryOwner().Only(sysCtx) - if err != nil { - return nil, err + // Fall back to event subscription. + eventSub, err := obj.Edges.EventSubscriptionOrErr() + if ent.IsNotLoaded(err) { + eventSub, err = obj.QueryEventSubscription().Only(sysCtx) } - team, err := app.QueryOwnerTeam().Only(sysCtx) - if err != nil { - return nil, err + if err != nil && !ent.IsNotFound(err) { + return nil, fmt.Errorf("loading event subscription for approval request %d: %w", obj.ID, err) } - group, _ := team.QueryGroup().Only(sysCtx) - return mapApiSubscriptionInfo(sub, app, team, group), nil + if eventSub != nil { + return loadEventSubscriptionInfo(sysCtx, eventSub) + } + + return nil, fmt.Errorf("approval request %d has no related subscription", obj.ID) } // Approval is the resolver for the approval field. -// Traverses ApprovalRequest → ApiSubscription → Approval. +// Traverses ApprovalRequest → ApiSubscription/EventSubscription → Approval. // Returns nil if no Approval exists yet (request not decided). func (r *approvalRequestResolver) Approval(ctx context.Context, obj *ent.ApprovalRequest) (*ent.Approval, error) { - sub, err := obj.Edges.APISubscriptionOrErr() + // Try API subscription path first. + apiSub, err := obj.Edges.APISubscriptionOrErr() + if ent.IsNotLoaded(err) { + apiSub, err = obj.QueryAPISubscription().Only(ctx) + } + if err != nil && !ent.IsNotFound(err) { + return nil, fmt.Errorf("loading api subscription for approval request %d: %w", obj.ID, err) + } + if apiSub != nil { + appr, err := apiSub.QueryApproval().Only(ctx) + if err != nil { + if ent.IsNotFound(err) { + return nil, nil + } + return nil, fmt.Errorf("loading approval for api subscription %d: %w", apiSub.ID, err) + } + return appr, nil + } + + // Fall back to event subscription path. + eventSub, err := obj.Edges.EventSubscriptionOrErr() if ent.IsNotLoaded(err) { - sub, err = obj.QueryAPISubscription().Only(ctx) + eventSub, err = obj.QueryEventSubscription().Only(ctx) } if err != nil { if ent.IsNotFound(err) { return nil, nil } - return nil, err + return nil, fmt.Errorf("loading event subscription for approval request %d: %w", obj.ID, err) } - appr, err := sub.QueryApproval().Only(ctx) + appr, err := eventSub.QueryApproval().Only(ctx) if err != nil { if ent.IsNotFound(err) { return nil, nil } - return nil, err + return nil, fmt.Errorf("loading approval for event subscription %d: %w", eventSub.ID, err) } return appr, nil } @@ -224,6 +263,86 @@ func (r *decisionResolver) ResultingState(ctx context.Context, obj *model.Decisi return &s, nil } +// Subscriptions is the resolver for the subscriptions field. +// Returns reduced EventSubscriptionInfo types for cross-tenant safety. +func (r *eventExposureResolver) Subscriptions(ctx context.Context, obj *ent.EventExposure) ([]*model.EventSubscriptionInfo, error) { + // SystemContext: Subscriptions belong to other tenants; privacy rules would + // block the cross-tenant traversal. We return a reduced Info type to limit exposure. + sysCtx := viewer.SystemContext(ctx) + subs, err := obj.QuerySubscriptions(). + WithOwner(func(q *ent.ApplicationQuery) { + q.WithOwnerTeam(func(q *ent.TeamQuery) { + q.WithGroup() + }) + }). + All(sysCtx) + if err != nil { + return nil, fmt.Errorf("loading subscriptions for event exposure %d: %w", obj.ID, err) + } + + result := make([]*model.EventSubscriptionInfo, len(subs)) + for i, sub := range subs { + app := sub.Edges.Owner + team := app.Edges.OwnerTeam + group, groupErr := team.Edges.GroupOrErr() + if groupErr != nil { + if !ent.IsNotFound(groupErr) && !ent.IsNotLoaded(groupErr) { + return nil, fmt.Errorf("loading group edge for team %d: %w", team.ID, groupErr) + } + group = nil + } + result[i] = mapEventSubscriptionInfo(sub, app, team, group) + } + return result, nil +} + +// Visibility is the resolver for the visibility field. +func (r *eventExposureInfoResolver) Visibility(ctx context.Context, obj *model.EventExposureInfo) (eventexposure.Visibility, error) { + return eventexposure.Visibility(obj.Visibility), nil +} + +// Target is the resolver for the target field. +// Returns reduced EventExposureInfo type for cross-tenant safety. +func (r *eventSubscriptionResolver) Target(ctx context.Context, obj *ent.EventSubscription) (*model.EventExposureInfo, error) { + // SystemContext: The target exposure belongs to another tenant; privacy rules + // would block this traversal. We return a reduced Info type to limit exposure. + sysCtx := viewer.SystemContext(ctx) + + exposure, err := obj.Edges.TargetOrErr() + if ent.IsNotLoaded(err) { + exposure, err = obj.QueryTarget().Only(sysCtx) + } + if err != nil { + return nil, fmt.Errorf("loading target for event subscription %d: %w", obj.ID, err) + } + + return loadEventExposureInfo(sysCtx, exposure) +} + +// DeliveryType is the resolver for the deliveryType field. +func (r *eventSubscriptionInfoResolver) DeliveryType(ctx context.Context, obj *model.EventSubscriptionInfo) (eventsubscription.DeliveryType, error) { + return eventsubscription.DeliveryType(obj.DeliveryType), nil +} + +// StatusPhase is the resolver for the statusPhase field. +func (r *eventSubscriptionInfoResolver) StatusPhase(ctx context.Context, obj *model.EventSubscriptionInfo) (*eventsubscription.StatusPhase, error) { + if obj.StatusPhase == nil { + return nil, nil + } + s := eventsubscription.StatusPhase(*obj.StatusPhase) + return &s, nil +} + +// TokenURL is the resolver for the tokenUrl field. +func (r *zoneResolver) TokenURL(ctx context.Context, obj *ent.Zone) (*string, error) { + if obj.IssuerURL == nil { + return nil, nil + } + + tokenURL := *obj.IssuerURL + "/protocol/openid-connect/token" + return &tokenURL, nil +} + // ApiExposureInfo returns ApiExposureInfoResolver implementation. func (r *Resolver) ApiExposureInfo() ApiExposureInfoResolver { return &apiExposureInfoResolver{r} } @@ -243,8 +362,20 @@ func (r *Resolver) AvailableTransition() AvailableTransitionResolver { // Decision returns DecisionResolver implementation. func (r *Resolver) Decision() DecisionResolver { return &decisionResolver{r} } +// EventExposureInfo returns EventExposureInfoResolver implementation. +func (r *Resolver) EventExposureInfo() EventExposureInfoResolver { + return &eventExposureInfoResolver{r} +} + +// EventSubscriptionInfo returns EventSubscriptionInfoResolver implementation. +func (r *Resolver) EventSubscriptionInfo() EventSubscriptionInfoResolver { + return &eventSubscriptionInfoResolver{r} +} + type apiExposureInfoResolver struct{ *Resolver } type apiSubscriptionInfoResolver struct{ *Resolver } type approvalConfigResolver struct{ *Resolver } type availableTransitionResolver struct{ *Resolver } type decisionResolver struct{ *Resolver } +type eventExposureInfoResolver struct{ *Resolver } +type eventSubscriptionInfoResolver struct{ *Resolver } diff --git a/controlplane-api/internal/resolvers/schema_resolvers_test.go b/controlplane-api/internal/resolvers/schema_resolvers_test.go index d77a6dfcd..dbe1af5b8 100644 --- a/controlplane-api/internal/resolvers/schema_resolvers_test.go +++ b/controlplane-api/internal/resolvers/schema_resolvers_test.go @@ -7,16 +7,17 @@ package resolvers_test import ( "context" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "github.com/telekom/controlplane/controlplane-api/ent" "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/internal/resolvers" gqlmodel "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" + "github.com/telekom/controlplane/controlplane-api/internal/service" "github.com/telekom/controlplane/controlplane-api/internal/testutil" "github.com/telekom/controlplane/controlplane-api/internal/viewer" "github.com/telekom/controlplane/controlplane-api/pkg/model" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) var _ = Describe("OwnerTeam resolver", func() { @@ -27,7 +28,7 @@ var _ = Describe("OwnerTeam resolver", func() { BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client) + r = resolvers.NewResolver(client, service.Services{}, nil) }) AfterEach(func() { @@ -145,7 +146,7 @@ var _ = Describe("OwnerTeam resolver", func() { var _ = Describe("ApprovalConfig.Strategy resolver", func() { It("should convert string to approval.Strategy", func() { - r := resolvers.NewResolver(nil) + r := resolvers.NewResolver(nil, service.Services{}, nil) s, err := r.ApprovalConfig().Strategy(context.Background(), &model.ApprovalConfig{Strategy: "FOUR_EYES"}) Expect(err).NotTo(HaveOccurred()) Expect(s).To(Equal(approval.StrategyFourEyes)) @@ -281,7 +282,7 @@ var _ = Describe("ApprovalConfig.TrustedTeams", func() { }) var _ = Describe("AvailableTransition resolvers", func() { - r := resolvers.NewResolver(nil) + r := resolvers.NewResolver(nil, service.Services{}, nil) It("should convert Action string to ApprovalAction", func() { action, err := r.AvailableTransition().Action(context.Background(), &model.AvailableTransition{Action: "ALLOW"}) @@ -297,7 +298,7 @@ var _ = Describe("AvailableTransition resolvers", func() { }) var _ = Describe("Decision.ResultingState resolver", func() { - r := resolvers.NewResolver(nil) + r := resolvers.NewResolver(nil, service.Services{}, nil) It("should return the state when ResultingState is set", func() { granted := "GRANTED" diff --git a/controlplane-api/internal/rule/rule_test.go b/controlplane-api/internal/rule/rule_test.go index b93dd5387..ae769d2b4 100644 --- a/controlplane-api/internal/rule/rule_test.go +++ b/controlplane-api/internal/rule/rule_test.go @@ -8,11 +8,12 @@ import ( "context" "entgo.io/ent/privacy" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/telekom/controlplane/controlplane-api/internal/rule" "github.com/telekom/controlplane/controlplane-api/internal/viewer" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) var _ = Describe("DenyIfNoViewer", func() { diff --git a/controlplane-api/internal/secrets/resolver.go b/controlplane-api/internal/secrets/resolver.go new file mode 100644 index 000000000..5566d88dc --- /dev/null +++ b/controlplane-api/internal/secrets/resolver.go @@ -0,0 +1,69 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package secrets + +import ( + "context" + "fmt" + + "github.com/go-logr/logr" + + "github.com/telekom/controlplane/common-server/pkg/server/middleware/security" + secretsapi "github.com/telekom/controlplane/secret-manager/api" +) + +const obfuscatedValue = "**********" + +// Resolver resolves secret references ($) to their plaintext values +// just-in-time. It checks the caller's access level and returns obfuscated +// values for callers without read-write access. +type Resolver struct { + api secretsapi.SecretsApi +} + +// NewResolver creates a Resolver backed by the given SecretsApi. +func NewResolver(api secretsapi.SecretsApi) *Resolver { + return &Resolver{api: api} +} + +// Resolve checks whether value is a secret-manager reference ($<...>) and +// resolves it. If the caller's BusinessContext has AccessType "obfuscated", +// the value is masked instead. Non-reference values are returned unchanged. +// +// Security invariants: +// - Obfuscated callers never see plaintext secrets. +// - Resolved secret values are never logged. +// - Access to secret fields is audit-logged at V(0). +func (r *Resolver) Resolve(ctx context.Context, value *string, fieldName string) (*string, error) { + if value == nil { + return nil, nil + } + + ref, isRef := secretsapi.FromRef(*value) + if !isRef { + // Not a secret reference — return as-is (backwards compatibility + // for values that haven't been migrated to secret-manager yet). + return value, nil + } + + log := logr.FromContextOrDiscard(ctx) + + // Obfuscated callers must never receive plaintext secrets. + if security.IsObfuscated(ctx) { + log.V(1).Info("Secret field requested by obfuscated caller, masking", "field", fieldName) + masked := obfuscatedValue + return &masked, nil + } + + log.Info("Resolving secret field", "field", fieldName) + + resolved, err := r.api.Get(ctx, ref) + if err != nil { + log.Error(err, "Failed to resolve secret from secret-manager", "field", fieldName) + return nil, fmt.Errorf("failed to resolve secret %s", fieldName) + } + + return &resolved, nil +} diff --git a/controlplane-api/internal/secrets/resolver_test.go b/controlplane-api/internal/secrets/resolver_test.go new file mode 100644 index 000000000..5e08ad0f7 --- /dev/null +++ b/controlplane-api/internal/secrets/resolver_test.go @@ -0,0 +1,108 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package secrets_test + +import ( + "context" + "fmt" + + "github.com/stretchr/testify/mock" + + "github.com/telekom/controlplane/common-server/pkg/server/middleware/security" + "github.com/telekom/controlplane/controlplane-api/internal/secrets" + "github.com/telekom/controlplane/secret-manager/api/fake" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("Resolver", func() { + var ( + ctx context.Context + secretManager *fake.MockSecretManager + resolver *secrets.Resolver + ) + + BeforeEach(func() { + ctx = context.Background() + secretManager = fake.NewMockSecretManager(GinkgoT()) + resolver = secrets.NewResolver(secretManager) + }) + + Context("when value is nil", func() { + It("should return nil", func() { + result, err := resolver.Resolve(ctx, nil, "clientSecret") + Expect(err).NotTo(HaveOccurred()) + Expect(result).To(BeNil()) + }) + }) + + Context("when value is not a secret reference", func() { + It("should return the value unchanged", func() { + plaintext := "plain-value" + result, err := resolver.Resolve(ctx, &plaintext, "clientSecret") + Expect(err).NotTo(HaveOccurred()) + Expect(result).To(Equal(&plaintext)) + }) + }) + + Context("when value is a secret reference", func() { + It("should resolve the secret from the secret manager", func() { + ref := "$" + secretManager.EXPECT(). + Get(mock.Anything, "env/team/app/secret/abc123"). + Return("resolved-secret-value", nil) + + result, err := resolver.Resolve(ctx, &ref, "clientSecret") + Expect(err).NotTo(HaveOccurred()) + Expect(*result).To(Equal("resolved-secret-value")) + }) + + It("should return a sanitized error and not leak upstream details", func() { + ref := "$" + secretManager.EXPECT(). + Get(mock.Anything, "env/team/app/secret/abc123"). + Return("", fmt.Errorf("unexpected http error (401): {\"detail\":\"Invalid token\"}")) + + result, err := resolver.Resolve(ctx, &ref, "clientSecret") + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(Equal("failed to resolve secret clientSecret")) + Expect(err.Error()).NotTo(ContainSubstring("401")) + Expect(err.Error()).NotTo(ContainSubstring("Invalid token")) + Expect(result).To(BeNil()) + }) + }) + + Context("when the caller has obfuscated access", func() { + BeforeEach(func() { + ctx = security.ToContext(ctx, &security.BusinessContext{ + AccessType: security.AccessTypeObfuscated, + }) + }) + + It("should return a masked value instead of resolving", func() { + ref := "$" + + result, err := resolver.Resolve(ctx, &ref, "clientSecret") + Expect(err).NotTo(HaveOccurred()) + Expect(*result).To(Equal("**********")) + }) + + It("should not call the secret manager", func() { + ref := "$" + // No mock expectations set — any call would fail the test + + _, err := resolver.Resolve(ctx, &ref, "clientSecret") + Expect(err).NotTo(HaveOccurred()) + }) + + It("should return non-ref values unchanged even when obfuscated", func() { + plain := "not-a-ref" + result, err := resolver.Resolve(ctx, &plain, "clientSecret") + Expect(err).NotTo(HaveOccurred()) + Expect(*result).To(Equal("not-a-ref")) + }) + }) +}) diff --git a/controlplane-api/internal/secrets/suite_test.go b/controlplane-api/internal/secrets/suite_test.go new file mode 100644 index 000000000..e807442ed --- /dev/null +++ b/controlplane-api/internal/secrets/suite_test.go @@ -0,0 +1,17 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package secrets_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestSecrets(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Secrets Suite") +} diff --git a/controlplane-api/internal/service/application_k8s_test.go b/controlplane-api/internal/service/application_k8s_test.go index 9df5fd32f..7b4ecc617 100644 --- a/controlplane-api/internal/service/application_k8s_test.go +++ b/controlplane-api/internal/service/application_k8s_test.go @@ -5,16 +5,17 @@ package service_test import ( - "context" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" applicationv1 "github.com/telekom/controlplane/application/api/v1" + cc "github.com/telekom/controlplane/common/pkg/client" "github.com/telekom/controlplane/common/pkg/config" "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" "github.com/telekom/controlplane/controlplane-api/internal/service" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/controller-runtime/pkg/client" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) var _ = Describe("ApplicationK8sService", func() { @@ -23,12 +24,12 @@ var _ = Describe("ApplicationK8sService", func() { k8sClient client.Client ) - seedApp := &applicationv1.Application{ + app := &applicationv1.Application{ ObjectMeta: metav1.ObjectMeta{ Name: "my-app", Namespace: "dev--team-alpha", Labels: map[string]string{ - config.EnvironmentLabelKey: "dev", + config.EnvironmentLabelKey: "poc", }, }, Spec: applicationv1.ApplicationSpec{ @@ -38,74 +39,45 @@ var _ = Describe("ApplicationK8sService", func() { }, } - rotateInput := model.RotateApplicationSecretInput{ - Environment: "dev", - Team: "team-alpha", - Name: "my-app", - } - BeforeEach(func() { - k8sClient = newFakeClient(seedApp.DeepCopy()) - svc = service.NewApplicationK8sService(k8sClient) + k8sClient = newFakeClient(app.DeepCopy()) + svc = service.NewApplicationK8sService(cc.NewScopedClient(k8sClient, "poc")) }) Describe("RotateApplicationSecret", func() { - Describe("Authorization", func() { - It("should allow admin to rotate any application secret", func() { - result, err := svc.RotateApplicationSecret(adminCtx(), rotateInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should allow team viewer owning the application", func() { - result, err := svc.RotateApplicationSecret(teamCtx("team-alpha"), rotateInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should deny team viewer not owning the application", func() { - _, err := svc.RotateApplicationSecret(teamCtx("team-beta"), rotateInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("forbidden")) - }) - - It("should deny when no viewer is present", func() { - _, err := svc.RotateApplicationSecret(noViewerCtx(), rotateInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("unauthorized")) - }) + It("should set the secret to rotate keyword", func() { + ref := service.ResourceRef{ + Namespace: "dev--team-alpha", + Name: "my-app", + TeamName: "team-alpha", + } + payload, err := svc.RotateApplicationSecret(adminCtx(), ref) + Expect(err).ToNot(HaveOccurred()) + Expect(payload.Accepted).To(BeTrue()) + Expect(payload.Errors).To(BeEmpty()) }) - Describe("Success", func() { - It("should set Spec.Secret to 'rotate' and return correct result", func() { - result, err := svc.RotateApplicationSecret(adminCtx(), rotateInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - Expect(result.Message).To(Equal("application secret rotation initiated")) - Expect(*result.Namespace).To(Equal("dev--team-alpha")) - Expect(*result.ResourceName).To(Equal("my-app")) - - // Verify Spec.Secret was set on the CRD - app := &applicationv1.Application{} - err = k8sClient.Get(context.Background(), client.ObjectKey{ - Namespace: "dev--team-alpha", - Name: "my-app", - }, app) - Expect(err).NotTo(HaveOccurred()) - Expect(app.Spec.Secret).To(Equal("rotate")) - }) + It("should return error when application not found", func() { + ref := service.ResourceRef{ + Namespace: "dev--team-alpha", + Name: "nonexistent", + TeamName: "team-alpha", + } + payload, err := svc.RotateApplicationSecret(adminCtx(), ref) + Expect(err).ToNot(HaveOccurred()) + Expect(payload.Errors).ToNot(BeEmpty()) }) - Describe("Not found", func() { - It("should return error when application does not exist", func() { - _, err := svc.RotateApplicationSecret(adminCtx(), model.RotateApplicationSecretInput{ - Environment: "dev", - Team: "team-alpha", - Name: "nonexistent-app", - }) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("not found")) - }) + It("should return forbidden when not authorized", func() { + ref := service.ResourceRef{ + Namespace: "dev--team-alpha", + Name: "my-app", + TeamName: "other-team", + } + payload, err := svc.RotateApplicationSecret(teamCtx("team-alpha"), ref) + Expect(err).ToNot(HaveOccurred()) + Expect(payload.Errors).ToNot(BeEmpty()) + Expect(payload.Errors[0].Code).To(Equal(model.ErrorCodeForbidden)) }) }) }) diff --git a/controlplane-api/internal/service/approval_k8s_test.go b/controlplane-api/internal/service/approval_k8s_test.go index e6fedc7f5..8bac0e105 100644 --- a/controlplane-api/internal/service/approval_k8s_test.go +++ b/controlplane-api/internal/service/approval_k8s_test.go @@ -7,42 +7,34 @@ package service_test import ( "context" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + approvalv1 "github.com/telekom/controlplane/approval/api/v1" + cc "github.com/telekom/controlplane/common/pkg/client" "github.com/telekom/controlplane/common/pkg/config" "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" "github.com/telekom/controlplane/controlplane-api/internal/service" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/telekom/controlplane/controlplane-api/internal/viewer" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) var _ = Describe("ApprovalK8sService", func() { - var ( - svc service.ApprovalService - k8sClient client.Client - ) + var svc service.ApprovalService - seedApprovalRequest := &approvalv1.ApprovalRequest{ + approvalReq := &approvalv1.ApprovalRequest{ ObjectMeta: metav1.ObjectMeta{ - Name: "my-sub--abc123", - Namespace: "dev--requester-team", + Name: "ar-1", + Namespace: "dev--team-alpha", Labels: map[string]string{ - config.EnvironmentLabelKey: "dev", + config.EnvironmentLabelKey: "poc", }, }, Spec: approvalv1.ApprovalRequestSpec{ - Action: "subscribe", - Requester: approvalv1.Requester{ - TeamName: "requester-team", - TeamEmail: "requester@example.com", - }, - Decider: approvalv1.Decider{ - TeamName: "decider-team", - TeamEmail: "decider@example.com", - }, - Strategy: approvalv1.ApprovalStrategySimple, State: approvalv1.ApprovalStatePending, + Strategy: approvalv1.ApprovalStrategySimple, + Decider: approvalv1.Decider{TeamName: "team-beta"}, }, Status: approvalv1.ApprovalRequestStatus{ AvailableTransitions: approvalv1.AvailableTransitions{ @@ -52,237 +44,100 @@ var _ = Describe("ApprovalK8sService", func() { }, } - seedApproval := &approvalv1.Approval{ + approval := &approvalv1.Approval{ ObjectMeta: metav1.ObjectMeta{ - Name: "apisubscription--my-sub", - Namespace: "dev--requester-team", + Name: "appr-1", + Namespace: "dev--team-alpha", Labels: map[string]string{ - config.EnvironmentLabelKey: "dev", + config.EnvironmentLabelKey: "poc", }, }, Spec: approvalv1.ApprovalSpec{ - Action: "subscribe", - Requester: approvalv1.Requester{ - TeamName: "requester-team", - TeamEmail: "requester@example.com", - }, - Decider: approvalv1.Decider{ - TeamName: "decider-team", - TeamEmail: "decider@example.com", - }, - Strategy: approvalv1.ApprovalStrategySimple, State: approvalv1.ApprovalStateGranted, + Strategy: approvalv1.ApprovalStrategySimple, + Decider: approvalv1.Decider{TeamName: "team-beta"}, }, Status: approvalv1.ApprovalStatus{ AvailableTransitions: approvalv1.AvailableTransitions{ - {Action: approvalv1.ApprovalActionDeny, To: approvalv1.ApprovalStateRejected}, {Action: approvalv1.ApprovalActionSuspend, To: approvalv1.ApprovalStateSuspended}, }, }, } - decisionInput := model.DecisionInput{ - Name: "Alice Decider", - Email: "alice@decider.com", - Comment: strPtr("Looks good"), - } + BeforeEach(func() { + k8sClient := newFakeClient(approvalReq.DeepCopy(), approval.DeepCopy()) + svc = service.NewApprovalK8sService(cc.NewScopedClient(k8sClient, "poc")) + }) Describe("DecideApprovalRequest", func() { - decideInput := model.DecideApprovalRequestInput{ - Environment: "dev", - Team: "requester-team", - Name: "my-sub--abc123", - Action: "ALLOW", - Decision: decisionInput, - } - - BeforeEach(func() { - k8sClient = newFakeClient(seedApprovalRequest.DeepCopy()) - svc = service.NewApprovalK8sService(k8sClient) + It("should allow deciding an approval request", func() { + ref := service.ResourceRef{ + Namespace: "dev--team-alpha", + Name: "ar-1", + TeamName: "team-beta", + } + input := model.DecisionInput{ + Action: model.ApprovalActionAllow, + Comment: strPtr("Looks good"), + } + payload, err := svc.DecideApprovalRequest(adminCtx(), ref, input) + Expect(err).ToNot(HaveOccurred()) + Expect(payload.Accepted).To(BeTrue()) + Expect(payload.Errors).To(BeEmpty()) }) - Describe("Authorization", func() { - It("should allow admin to decide on any approval request", func() { - result, err := svc.DecideApprovalRequest(adminCtx(), decideInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should allow decider team to decide", func() { - result, err := svc.DecideApprovalRequest(teamCtx("decider-team"), decideInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should deny non-decider team", func() { - _, err := svc.DecideApprovalRequest(teamCtx("other-team"), decideInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("forbidden")) - }) - - It("should deny when no viewer is present", func() { - _, err := svc.DecideApprovalRequest(noViewerCtx(), decideInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("unauthorized")) - }) + It("should stamp user identity from viewer onto the decision", func() { + ctx := viewer.NewContext(context.Background(), &viewer.Viewer{ + Admin: true, + UserName: "Jane Doe", + UserEmail: "jane@example.com", + }) + ref := service.ResourceRef{ + Namespace: "dev--team-alpha", + Name: "ar-1", + TeamName: "team-beta", + } + input := model.DecisionInput{ + Action: model.ApprovalActionAllow, + Comment: strPtr("LGTM"), + } + payload, err := svc.DecideApprovalRequest(ctx, ref, input) + Expect(err).ToNot(HaveOccurred()) + Expect(payload.Accepted).To(BeTrue()) + Expect(payload.Errors).To(BeEmpty()) }) - Describe("Success", func() { - It("should update state and append decision", func() { - result, err := svc.DecideApprovalRequest(adminCtx(), decideInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - Expect(result.Message).To(Equal("approval request decision applied")) - Expect(*result.NewState).To(Equal("Granted")) - Expect(*result.Namespace).To(Equal("dev--requester-team")) - Expect(*result.ResourceName).To(Equal("my-sub--abc123")) - - // Verify the CRD was updated - ar := &approvalv1.ApprovalRequest{} - err = k8sClient.Get(context.Background(), client.ObjectKey{ - Namespace: "dev--requester-team", - Name: "my-sub--abc123", - }, ar) - Expect(err).NotTo(HaveOccurred()) - Expect(ar.Spec.State).To(Equal(approvalv1.ApprovalStateGranted)) - Expect(ar.Spec.Decisions).To(HaveLen(1)) - Expect(ar.Spec.Decisions[0].Name).To(Equal("Alice Decider")) - Expect(ar.Spec.Decisions[0].Email).To(Equal("alice@decider.com")) - Expect(ar.Spec.Decisions[0].Comment).To(Equal("Looks good")) - Expect(ar.Spec.Decisions[0].ResultingState).To(Equal(approvalv1.ApprovalStateGranted)) - Expect(ar.Spec.Decisions[0].Timestamp).NotTo(BeNil()) - }) - - It("should deny an approval request", func() { - denyInput := decideInput - denyInput.Action = "DENY" - result, err := svc.DecideApprovalRequest(adminCtx(), denyInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - Expect(*result.NewState).To(Equal("Rejected")) - }) - }) - - Describe("Unavailable action", func() { - It("should return error for action not in available transitions", func() { - suspendInput := decideInput - suspendInput.Action = "SUSPEND" - _, err := svc.DecideApprovalRequest(adminCtx(), suspendInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("not available")) - }) - }) - - Describe("Not found", func() { - It("should return error when approval request does not exist", func() { - _, err := svc.DecideApprovalRequest(adminCtx(), model.DecideApprovalRequestInput{ - Environment: "dev", - Team: "requester-team", - Name: "nonexistent", - Action: "ALLOW", - Decision: decisionInput, - }) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("not found")) - }) + It("should return error for unavailable transition", func() { + ref := service.ResourceRef{ + Namespace: "dev--team-alpha", + Name: "ar-1", + TeamName: "team-beta", + } + input := model.DecisionInput{ + Action: model.ApprovalActionSuspend, + } + payload, err := svc.DecideApprovalRequest(adminCtx(), ref, input) + Expect(err).ToNot(HaveOccurred()) + Expect(payload.Errors).ToNot(BeEmpty()) + Expect(payload.Errors[0].Code).To(Equal(model.ErrorCodePreconditionFailed)) }) }) Describe("DecideApproval", func() { - decideInput := model.DecideApprovalInput{ - Environment: "dev", - Team: "requester-team", - Name: "apisubscription--my-sub", - Action: "SUSPEND", - Decision: decisionInput, - } - - BeforeEach(func() { - k8sClient = newFakeClient(seedApproval.DeepCopy()) - svc = service.NewApprovalK8sService(k8sClient) - }) - - Describe("Authorization", func() { - It("should allow admin to decide on any approval", func() { - result, err := svc.DecideApproval(adminCtx(), decideInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should allow decider team to decide", func() { - result, err := svc.DecideApproval(teamCtx("decider-team"), decideInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should deny non-decider team", func() { - _, err := svc.DecideApproval(teamCtx("other-team"), decideInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("forbidden")) - }) - - It("should deny when no viewer is present", func() { - _, err := svc.DecideApproval(noViewerCtx(), decideInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("unauthorized")) - }) - }) - - Describe("Success", func() { - It("should suspend an approval and append decision", func() { - result, err := svc.DecideApproval(adminCtx(), decideInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - Expect(result.Message).To(Equal("approval decision applied")) - Expect(*result.NewState).To(Equal("Suspended")) - Expect(*result.Namespace).To(Equal("dev--requester-team")) - Expect(*result.ResourceName).To(Equal("apisubscription--my-sub")) - - // Verify the CRD was updated - approval := &approvalv1.Approval{} - err = k8sClient.Get(context.Background(), client.ObjectKey{ - Namespace: "dev--requester-team", - Name: "apisubscription--my-sub", - }, approval) - Expect(err).NotTo(HaveOccurred()) - Expect(approval.Spec.State).To(Equal(approvalv1.ApprovalStateSuspended)) - Expect(approval.Spec.Decisions).To(HaveLen(1)) - Expect(approval.Spec.Decisions[0].Name).To(Equal("Alice Decider")) - Expect(approval.Spec.Decisions[0].ResultingState).To(Equal(approvalv1.ApprovalStateSuspended)) - }) - - It("should deny an approval", func() { - denyInput := decideInput - denyInput.Action = "DENY" - result, err := svc.DecideApproval(adminCtx(), denyInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - Expect(*result.NewState).To(Equal("Rejected")) - }) - }) - - Describe("Unavailable action", func() { - It("should return error for action not in available transitions", func() { - resumeInput := decideInput - resumeInput.Action = "RESUME" - _, err := svc.DecideApproval(adminCtx(), resumeInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("not available")) - }) - }) - - Describe("Not found", func() { - It("should return error when approval does not exist", func() { - _, err := svc.DecideApproval(adminCtx(), model.DecideApprovalInput{ - Environment: "dev", - Team: "requester-team", - Name: "nonexistent", - Action: "SUSPEND", - Decision: decisionInput, - }) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("not found")) - }) + It("should allow deciding an approval", func() { + ref := service.ResourceRef{ + Namespace: "dev--team-alpha", + Name: "appr-1", + TeamName: "team-beta", + } + input := model.DecisionInput{ + Action: model.ApprovalActionSuspend, + Comment: strPtr("Suspending"), + } + payload, err := svc.DecideApproval(adminCtx(), ref, input) + Expect(err).ToNot(HaveOccurred()) + Expect(payload.Accepted).To(BeTrue()) + Expect(payload.Errors).To(BeEmpty()) }) }) }) diff --git a/controlplane-api/internal/service/build_decision_test.go b/controlplane-api/internal/service/build_decision_test.go new file mode 100644 index 000000000..1e4e3bce6 --- /dev/null +++ b/controlplane-api/internal/service/build_decision_test.go @@ -0,0 +1,60 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package service + +import ( + "context" + "testing" + + approvalv1 "github.com/telekom/controlplane/approval/api/v1" + "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" + "github.com/telekom/controlplane/controlplane-api/internal/viewer" +) + +func TestBuildDecision_StampsUserIdentity(t *testing.T) { + ctx := viewer.NewContext(context.Background(), &viewer.Viewer{ + Admin: true, + UserName: "Jane Doe", + UserEmail: "jane@example.com", + }) + comment := "LGTM" + input := model.DecisionInput{ + Action: model.ApprovalActionAllow, + Comment: &comment, + } + + d := buildDecision(ctx, input, approvalv1.ApprovalStateGranted) + + if d.Name != "Jane Doe" { + t.Errorf("expected Name %q, got %q", "Jane Doe", d.Name) + } + if d.Email != "jane@example.com" { + t.Errorf("expected Email %q, got %q", "jane@example.com", d.Email) + } + if d.Comment != "LGTM" { + t.Errorf("expected Comment %q, got %q", "LGTM", d.Comment) + } + if d.ResultingState != approvalv1.ApprovalStateGranted { + t.Errorf("expected ResultingState %q, got %q", approvalv1.ApprovalStateGranted, d.ResultingState) + } + if d.Timestamp == nil { + t.Error("expected Timestamp to be set") + } +} + +func TestBuildDecision_NoViewer(t *testing.T) { + input := model.DecisionInput{ + Action: model.ApprovalActionAllow, + } + + d := buildDecision(context.Background(), input, approvalv1.ApprovalStateGranted) + + if d.Name != "" { + t.Errorf("expected empty Name, got %q", d.Name) + } + if d.Email != "" { + t.Errorf("expected empty Email, got %q", d.Email) + } +} diff --git a/controlplane-api/internal/service/helpers.go b/controlplane-api/internal/service/helpers.go index b98a58d0a..b800b973e 100644 --- a/controlplane-api/internal/service/helpers.go +++ b/controlplane-api/internal/service/helpers.go @@ -9,8 +9,6 @@ import ( "fmt" "github.com/telekom/controlplane/controlplane-api/internal/viewer" - "github.com/vektah/gqlparser/v2/gqlerror" - apierrors "k8s.io/apimachinery/pkg/api/errors" ) // authorizeCreateTeam checks that the viewer is allowed to create a team in the given group. @@ -79,43 +77,3 @@ func authorizeApprovalAction(ctx context.Context, deciderTeam string) error { } return fmt.Errorf("forbidden: insufficient permissions — only the decider team %q can decide on this approval", deciderTeam) } - -// mapK8sError converts a Kubernetes API error to a GraphQL error with an appropriate error code. -func mapK8sError(err error) *gqlerror.Error { - if err == nil { - return nil - } - - switch { - case apierrors.IsNotFound(err): - return &gqlerror.Error{ - Message: "resource not found", - Extensions: map[string]interface{}{"code": "NOT_FOUND"}, - } - case apierrors.IsAlreadyExists(err): - return &gqlerror.Error{ - Message: "resource already exists", - Extensions: map[string]interface{}{"code": "ALREADY_EXISTS"}, - } - case apierrors.IsConflict(err): - return &gqlerror.Error{ - Message: "conflict: resource was modified concurrently", - Extensions: map[string]interface{}{"code": "CONFLICT"}, - } - case apierrors.IsForbidden(err): - return &gqlerror.Error{ - Message: "forbidden by Kubernetes RBAC", - Extensions: map[string]interface{}{"code": "FORBIDDEN"}, - } - case apierrors.IsInvalid(err): - return &gqlerror.Error{ - Message: fmt.Sprintf("validation failed: %s", err), - Extensions: map[string]interface{}{"code": "VALIDATION_ERROR"}, - } - default: - return &gqlerror.Error{ - Message: fmt.Sprintf("internal error: %s", err), - Extensions: map[string]interface{}{"code": "INTERNAL"}, - } - } -} diff --git a/controlplane-api/internal/service/services.go b/controlplane-api/internal/service/services.go index e5e200e14..e315accc3 100644 --- a/controlplane-api/internal/service/services.go +++ b/controlplane-api/internal/service/services.go @@ -10,6 +10,19 @@ import ( "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" ) +// ResourceRef identifies a Kubernetes resource by namespace and name, +// along with authorization context (group and team name). +type ResourceRef struct { + // Namespace is the Kubernetes namespace of the resource. + Namespace string + // Name is the Kubernetes resource name. + Name string + // Group is the owning group name (used for authorization). + Group string + // TeamName is the owning team name (used for authorization). + TeamName string +} + // Services groups all mutation services. type Services struct { Team TeamService @@ -19,18 +32,20 @@ type Services struct { // TeamService defines operations for managing Team resources. type TeamService interface { - CreateTeam(ctx context.Context, input model.CreateTeamInput) (*model.TeamMutationResult, error) - UpdateTeam(ctx context.Context, input model.UpdateTeamInput) (*model.TeamMutationResult, error) - RotateTeamToken(ctx context.Context, input model.RotateTeamTokenInput) (*model.TeamMutationResult, error) + CreateTeam(ctx context.Context, input model.CreateTeamInput) (*model.CreateTeamPayload, error) + UpdateTeam(ctx context.Context, ref ResourceRef, input model.UpdateTeamInput) (*model.UpdateTeamPayload, error) + AddTeamMember(ctx context.Context, ref ResourceRef, member model.MemberInput) (*model.AddTeamMemberPayload, error) + RemoveTeamMember(ctx context.Context, ref ResourceRef, memberEmail string) (*model.RemoveTeamMemberPayload, error) + RotateTeamToken(ctx context.Context, ref ResourceRef) (*model.RotateTeamTokenPayload, error) } // ApplicationService defines operations for managing Application resources. type ApplicationService interface { - RotateApplicationSecret(ctx context.Context, input model.RotateApplicationSecretInput) (*model.RotateApplicationSecretResult, error) + RotateApplicationSecret(ctx context.Context, ref ResourceRef) (*model.RotateApplicationSecretPayload, error) } // ApprovalService defines operations for managing Approval and ApprovalRequest resources. type ApprovalService interface { - DecideApprovalRequest(ctx context.Context, input model.DecideApprovalRequestInput) (*model.ApprovalMutationResult, error) - DecideApproval(ctx context.Context, input model.DecideApprovalInput) (*model.ApprovalMutationResult, error) + DecideApprovalRequest(ctx context.Context, ref ResourceRef, input model.DecisionInput) (*model.DecideApprovalRequestPayload, error) + DecideApproval(ctx context.Context, ref ResourceRef, input model.DecisionInput) (*model.DecideApprovalPayload, error) } diff --git a/controlplane-api/internal/service/services_k8s.go b/controlplane-api/internal/service/services_k8s.go index 498d37f89..55e7c7b3b 100644 --- a/controlplane-api/internal/service/services_k8s.go +++ b/controlplane-api/internal/service/services_k8s.go @@ -6,39 +6,50 @@ package service import ( "context" + "errors" "fmt" "strings" + "github.com/go-logr/logr" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + k8stypes "k8s.io/apimachinery/pkg/types" + applicationv1 "github.com/telekom/controlplane/application/api/v1" approvalv1 "github.com/telekom/controlplane/approval/api/v1" cc "github.com/telekom/controlplane/common/pkg/client" "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" + "github.com/telekom/controlplane/controlplane-api/internal/viewer" organizationv1 "github.com/telekom/controlplane/organization/api/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/controller-runtime/pkg/client" ) +// rotateKeyword is the keyword that triggers secret rotation via the webhook. +const rotateKeyword = "rotate" + // ----- Team ----- type teamK8sService struct { - client client.Client + client cc.ScopedClient } // NewTeamK8sService creates a TeamService backed by Kubernetes. -func NewTeamK8sService(c client.Client) TeamService { +func NewTeamK8sService(c cc.ScopedClient) TeamService { return &teamK8sService{client: c} } -func (s *teamK8sService) CreateTeam(ctx context.Context, input model.CreateTeamInput) (*model.TeamMutationResult, error) { +func (s *teamK8sService) CreateTeam(ctx context.Context, input model.CreateTeamInput) (*model.CreateTeamPayload, error) { + log := logr.FromContextOrDiscard(ctx).WithValues("operation", "CreateTeam", "group", input.Group, "team", input.Name) + if err := authorizeCreateTeam(ctx, input.Group); err != nil { - return nil, err + log.V(1).Info("Authorization denied", "reason", err.Error()) + return &model.CreateTeamPayload{ + Errors: []model.MutationError{forbiddenError(err.Error())}, + }, nil } resourceName := organizationv1.TeamResourceName(input.Group, input.Name) namespace := input.Environment - scopedClient := cc.NewScopedClient(s.client, input.Environment) - team := &organizationv1.Team{ ObjectMeta: metav1.ObjectMeta{ Name: resourceName, @@ -46,7 +57,7 @@ func (s *teamK8sService) CreateTeam(ctx context.Context, input model.CreateTeamI }, } - _, err := scopedClient.CreateOrUpdate(ctx, team, func() error { + _, err := s.client.CreateOrUpdate(ctx, team, func() error { team.Spec = organizationv1.TeamSpec{ Name: input.Name, Group: input.Group, @@ -57,81 +68,169 @@ func (s *teamK8sService) CreateTeam(ctx context.Context, input model.CreateTeamI return nil }) if err != nil { - return nil, mapK8sError(err) + log.Error(err, "Failed to create or update team resource", "resourceName", resourceName, "namespace", namespace) + return &model.CreateTeamPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil } - return &model.TeamMutationResult{ - Success: true, - Message: "team created successfully", - Namespace: &namespace, - ResourceName: &resourceName, + log.V(0).Info("Created team", "resourceName", resourceName, "namespace", namespace) + return &model.CreateTeamPayload{ + Accepted: true, + Errors: []model.MutationError{}, }, nil } -func (s *teamK8sService) UpdateTeam(ctx context.Context, input model.UpdateTeamInput) (*model.TeamMutationResult, error) { - if err := authorizeUpdateTeam(ctx, input.Group, input.Name); err != nil { - return nil, err - } - - resourceName := organizationv1.TeamResourceName(input.Group, input.Name) - namespace := input.Environment +func (s *teamK8sService) UpdateTeam(ctx context.Context, ref ResourceRef, input model.UpdateTeamInput) (*model.UpdateTeamPayload, error) { + log := logr.FromContextOrDiscard(ctx).WithValues("operation", "UpdateTeam", "resourceName", ref.Name, "namespace", ref.Namespace) - scopedClient := cc.NewScopedClient(s.client, input.Environment) + if err := authorizeUpdateTeam(ctx, ref.Group, ref.TeamName); err != nil { + log.V(1).Info("Authorization denied", "reason", err.Error()) + return &model.UpdateTeamPayload{ + Errors: []model.MutationError{forbiddenError(err.Error())}, + }, nil + } team := &organizationv1.Team{} - if err := scopedClient.Get(ctx, client.ObjectKey{Namespace: namespace, Name: resourceName}, team); err != nil { - return nil, mapK8sError(err) + if err := s.client.Get(ctx, k8stypes.NamespacedName{Name: ref.Name, Namespace: ref.Namespace}, team); err != nil { + log.V(1).Info("Failed to get team resource", "error", err) + return &model.UpdateTeamPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil } - _, err := scopedClient.CreateOrUpdate(ctx, team, func() error { + _, err := s.client.CreateOrUpdate(ctx, team, func() error { if input.Email != nil { team.Spec.Email = *input.Email } - if input.Members != nil { - team.Spec.Members = toK8sMembers(input.Members) - } return nil }) if err != nil { - return nil, mapK8sError(err) + log.Error(err, "Failed to update team resource") + return &model.UpdateTeamPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil } - return &model.TeamMutationResult{ - Success: true, - Message: "team updated successfully", - Namespace: &namespace, - ResourceName: &resourceName, + log.V(0).Info("Updated team") + return &model.UpdateTeamPayload{ + Accepted: true, + Errors: []model.MutationError{}, }, nil } -func (s *teamK8sService) RotateTeamToken(ctx context.Context, input model.RotateTeamTokenInput) (*model.TeamMutationResult, error) { - if err := authorizeUpdateTeam(ctx, input.Group, input.Name); err != nil { - return nil, err +func (s *teamK8sService) AddTeamMember(ctx context.Context, ref ResourceRef, member model.MemberInput) (*model.AddTeamMemberPayload, error) { + log := logr.FromContextOrDiscard(ctx).WithValues("operation", "AddTeamMember", "resourceName", ref.Name, "namespace", ref.Namespace, "memberEmail", member.Email) + + if err := authorizeUpdateTeam(ctx, ref.Group, ref.TeamName); err != nil { + log.V(1).Info("Authorization denied", "reason", err.Error()) + return &model.AddTeamMemberPayload{ + Errors: []model.MutationError{forbiddenError(err.Error())}, + }, nil } - resourceName := organizationv1.TeamResourceName(input.Group, input.Name) - namespace := input.Environment + team := &organizationv1.Team{} + if err := s.client.Get(ctx, k8stypes.NamespacedName{Name: ref.Name, Namespace: ref.Namespace}, team); err != nil { + log.V(1).Info("Failed to get team resource", "error", err) + return &model.AddTeamMemberPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil + } + + _, err := s.client.CreateOrUpdate(ctx, team, func() error { + team.Spec.Members = append(team.Spec.Members, organizationv1.Member{ + Name: member.Name, + Email: member.Email, + }) + return nil + }) + if err != nil { + log.Error(err, "Failed to add team member") + return &model.AddTeamMemberPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil + } + + log.V(0).Info("Added team member") + return &model.AddTeamMemberPayload{ + Errors: []model.MutationError{}, + }, nil +} + +func (s *teamK8sService) RemoveTeamMember(ctx context.Context, ref ResourceRef, memberEmail string) (*model.RemoveTeamMemberPayload, error) { + log := logr.FromContextOrDiscard(ctx).WithValues("operation", "RemoveTeamMember", "resourceName", ref.Name, "namespace", ref.Namespace, "memberEmail", memberEmail) - scopedClient := cc.NewScopedClient(s.client, input.Environment) + if err := authorizeUpdateTeam(ctx, ref.Group, ref.TeamName); err != nil { + log.V(1).Info("Authorization denied", "reason", err.Error()) + return &model.RemoveTeamMemberPayload{ + Errors: []model.MutationError{forbiddenError(err.Error())}, + }, nil + } team := &organizationv1.Team{} - if err := scopedClient.Get(ctx, client.ObjectKey{Namespace: namespace, Name: resourceName}, team); err != nil { - return nil, mapK8sError(err) + if err := s.client.Get(ctx, k8stypes.NamespacedName{Name: ref.Name, Namespace: ref.Namespace}, team); err != nil { + log.V(1).Info("Failed to get team resource", "error", err) + return &model.RemoveTeamMemberPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil } - _, err := scopedClient.CreateOrUpdate(ctx, team, func() error { - team.Spec.Secret = "rotate" + _, err := s.client.CreateOrUpdate(ctx, team, func() error { + filtered := make([]organizationv1.Member, 0, len(team.Spec.Members)) + for _, m := range team.Spec.Members { + if m.Email != memberEmail { + filtered = append(filtered, m) + } + } + team.Spec.Members = filtered return nil }) if err != nil { - return nil, mapK8sError(err) + log.Error(err, "Failed to remove team member") + return &model.RemoveTeamMemberPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil } - return &model.TeamMutationResult{ - Success: true, - Message: "team token rotation initiated", - Namespace: &namespace, - ResourceName: &resourceName, + log.V(0).Info("Removed team member") + return &model.RemoveTeamMemberPayload{ + Errors: []model.MutationError{}, + }, nil +} + +func (s *teamK8sService) RotateTeamToken(ctx context.Context, ref ResourceRef) (*model.RotateTeamTokenPayload, error) { + log := logr.FromContextOrDiscard(ctx).WithValues("operation", "RotateTeamToken", "resourceName", ref.Name, "namespace", ref.Namespace) + + if err := authorizeUpdateTeam(ctx, ref.Group, ref.TeamName); err != nil { + log.V(1).Info("Authorization denied", "reason", err.Error()) + return &model.RotateTeamTokenPayload{ + Errors: []model.MutationError{forbiddenError(err.Error())}, + }, nil + } + + team := &organizationv1.Team{} + if err := s.client.Get(ctx, k8stypes.NamespacedName{Name: ref.Name, Namespace: ref.Namespace}, team); err != nil { + log.V(1).Info("Failed to get team resource", "error", err) + return &model.RotateTeamTokenPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil + } + + _, err := s.client.CreateOrUpdate(ctx, team, func() error { + team.Spec.Secret = rotateKeyword + return nil + }) + if err != nil { + log.Error(err, "Failed to trigger team token rotation") + return &model.RotateTeamTokenPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil + } + + log.V(0).Info("Triggered team token rotation") + return &model.RotateTeamTokenPayload{ + Accepted: true, + Errors: []model.MutationError{}, }, nil } @@ -149,60 +248,64 @@ func toK8sMembers(members []model.MemberInput) []organizationv1.Member { // ----- Application ----- type applicationK8sService struct { - client client.Client + client cc.ScopedClient } // NewApplicationK8sService creates an ApplicationService backed by Kubernetes. -func NewApplicationK8sService(c client.Client) ApplicationService { +func NewApplicationK8sService(c cc.ScopedClient) ApplicationService { return &applicationK8sService{client: c} } -func (s *applicationK8sService) RotateApplicationSecret(ctx context.Context, input model.RotateApplicationSecretInput) (*model.RotateApplicationSecretResult, error) { - if err := authorizeApplicationAction(ctx, input.Team); err != nil { - return nil, err - } - - namespace := organizationv1.TeamNamespace(input.Environment, input.Team) - resourceName := input.Name +func (s *applicationK8sService) RotateApplicationSecret(ctx context.Context, ref ResourceRef) (*model.RotateApplicationSecretPayload, error) { + log := logr.FromContextOrDiscard(ctx).WithValues("operation", "RotateApplicationSecret", "resourceName", ref.Name, "namespace", ref.Namespace) - scopedClient := cc.NewScopedClient(s.client, input.Environment) + if err := authorizeApplicationAction(ctx, ref.TeamName); err != nil { + log.V(1).Info("Authorization denied", "reason", err.Error()) + return &model.RotateApplicationSecretPayload{ + Errors: []model.MutationError{forbiddenError(err.Error())}, + }, nil + } app := &applicationv1.Application{} - err := scopedClient.Get(ctx, client.ObjectKey{Namespace: namespace, Name: resourceName}, app) - if err != nil { - return nil, mapK8sError(err) + if err := s.client.Get(ctx, k8stypes.NamespacedName{Name: ref.Name, Namespace: ref.Namespace}, app); err != nil { + log.V(1).Info("Failed to get application resource", "error", err) + return &model.RotateApplicationSecretPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil } - _, err = scopedClient.CreateOrUpdate(ctx, app, func() error { - app.Spec.Secret = "rotate" + _, err := s.client.CreateOrUpdate(ctx, app, func() error { + app.Spec.Secret = rotateKeyword return nil }) if err != nil { - return nil, mapK8sError(err) + log.Error(err, "Failed to trigger application secret rotation") + return &model.RotateApplicationSecretPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil } - return &model.RotateApplicationSecretResult{ - Success: true, - Message: "application secret rotation initiated", - Namespace: &namespace, - ResourceName: &resourceName, + log.V(0).Info("Triggered application secret rotation") + return &model.RotateApplicationSecretPayload{ + Accepted: true, + Errors: []model.MutationError{}, }, nil } // ----- Approval ----- type approvalK8sService struct { - client client.Client + client cc.ScopedClient } // NewApprovalK8sService creates an ApprovalService backed by Kubernetes. -func NewApprovalK8sService(c client.Client) ApprovalService { +func NewApprovalK8sService(c cc.ScopedClient) ApprovalService { return &approvalK8sService{client: c} } -// mapActionToApprovalAction maps a GraphQL action string (uppercase) to the CRD ApprovalAction (title-case). -func mapActionToApprovalAction(action string) (approvalv1.ApprovalAction, error) { - switch strings.ToUpper(action) { +// mapActionToApprovalAction maps a GraphQL ApprovalAction to the CRD ApprovalAction. +func mapActionToApprovalAction(action model.ApprovalAction) (approvalv1.ApprovalAction, error) { + switch strings.ToUpper(string(action)) { case "ALLOW": return approvalv1.ApprovalActionAllow, nil case "DENY": @@ -226,107 +329,239 @@ func findTargetState(transitions approvalv1.AvailableTransitions, action approva return "", fmt.Errorf("action %q is not available for the current state", action) } -// buildDecision creates a CRD Decision from the GraphQL input and the resulting state. -func buildDecision(input model.DecisionInput, resultingState approvalv1.ApprovalState) approvalv1.Decision { +// buildDecision creates a CRD Decision from the authenticated viewer context and the resulting state. +func buildDecision(ctx context.Context, input model.DecisionInput, resultingState approvalv1.ApprovalState) approvalv1.Decision { now := metav1.Now() + v := viewer.FromContext(ctx) + d := approvalv1.Decision{ - Name: input.Name, Timestamp: &now, ResultingState: resultingState, } - d.Email = input.Email + if v != nil { + d.Name = v.UserName + d.Email = v.UserEmail + } if input.Comment != nil { d.Comment = *input.Comment } return d } -func (s *approvalK8sService) DecideApprovalRequest(ctx context.Context, input model.DecideApprovalRequestInput) (*model.ApprovalMutationResult, error) { - namespace := organizationv1.TeamNamespace(input.Environment, input.Team) - resourceName := input.Name - - scopedClient := cc.NewScopedClient(s.client, input.Environment) +func (s *approvalK8sService) DecideApprovalRequest(ctx context.Context, ref ResourceRef, input model.DecisionInput) (*model.DecideApprovalRequestPayload, error) { + log := logr.FromContextOrDiscard(ctx).WithValues("operation", "DecideApprovalRequest", "resourceName", ref.Name, "namespace", ref.Namespace, "action", input.Action) - ar := &approvalv1.ApprovalRequest{} - err := scopedClient.Get(ctx, client.ObjectKey{Namespace: namespace, Name: resourceName}, ar) - if err != nil { - return nil, mapK8sError(err) + if err := authorizeApprovalAction(ctx, ref.TeamName); err != nil { + log.V(1).Info("Authorization denied", "reason", err.Error()) + return &model.DecideApprovalRequestPayload{ + Errors: []model.MutationError{forbiddenError(err.Error())}, + }, nil } - if err := authorizeApprovalAction(ctx, ar.Spec.Decider.TeamName); err != nil { - return nil, err + ar := &approvalv1.ApprovalRequest{} + if err := s.client.Get(ctx, k8stypes.NamespacedName{Name: ref.Name, Namespace: ref.Namespace}, ar); err != nil { + log.V(1).Info("Failed to get approval request resource", "error", err) + return &model.DecideApprovalRequestPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil } - crdAction, err := mapActionToApprovalAction(input.Action) + action, err := mapActionToApprovalAction(input.Action) if err != nil { - return nil, err + log.V(1).Info("Invalid approval action", "error", err) + return &model.DecideApprovalRequestPayload{ + Errors: []model.MutationError{{Code: model.ErrorCodeValidationFailed, Message: err.Error()}}, + }, nil } - targetState, err := findTargetState(ar.Status.AvailableTransitions, crdAction) + targetState, err := findTargetState(ar.Status.AvailableTransitions, action) if err != nil { - return nil, err + log.V(1).Info("Transition not available", "currentState", ar.Spec.State, "requestedAction", action) + return &model.DecideApprovalRequestPayload{ + Errors: []model.MutationError{{Code: model.ErrorCodePreconditionFailed, Message: err.Error()}}, + }, nil } - _, err = scopedClient.CreateOrUpdate(ctx, ar, func() error { - ar.Spec.Decisions = append(ar.Spec.Decisions, buildDecision(input.Decision, targetState)) + decision := buildDecision(ctx, input, targetState) + + _, updateErr := s.client.CreateOrUpdate(ctx, ar, func() error { ar.Spec.State = targetState + ar.Spec.Decisions = append(ar.Spec.Decisions, decision) return nil }) - if err != nil { - return nil, mapK8sError(err) + if updateErr != nil { + log.Error(updateErr, "Failed to update approval request", "targetState", targetState) + return &model.DecideApprovalRequestPayload{ + Errors: []model.MutationError{k8sToMutationError(updateErr)}, + }, nil } - newState := string(targetState) - return &model.ApprovalMutationResult{ - Success: true, - Message: "approval request decision applied", - NewState: &newState, - Namespace: &namespace, - ResourceName: &resourceName, + log.V(0).Info("Decided approval request", "targetState", targetState, "decidedByName", decision.Name, "decidedByEmail", decision.Email) + return &model.DecideApprovalRequestPayload{ + Accepted: true, + Errors: []model.MutationError{}, }, nil } -func (s *approvalK8sService) DecideApproval(ctx context.Context, input model.DecideApprovalInput) (*model.ApprovalMutationResult, error) { - namespace := organizationv1.TeamNamespace(input.Environment, input.Team) - resourceName := input.Name - - scopedClient := cc.NewScopedClient(s.client, input.Environment) +func (s *approvalK8sService) DecideApproval(ctx context.Context, ref ResourceRef, input model.DecisionInput) (*model.DecideApprovalPayload, error) { + log := logr.FromContextOrDiscard(ctx).WithValues("operation", "DecideApproval", "resourceName", ref.Name, "namespace", ref.Namespace, "action", input.Action) - approval := &approvalv1.Approval{} - err := scopedClient.Get(ctx, client.ObjectKey{Namespace: namespace, Name: resourceName}, approval) - if err != nil { - return nil, mapK8sError(err) + if err := authorizeApprovalAction(ctx, ref.TeamName); err != nil { + log.V(1).Info("Authorization denied", "reason", err.Error()) + return &model.DecideApprovalPayload{ + Errors: []model.MutationError{forbiddenError(err.Error())}, + }, nil } - if err := authorizeApprovalAction(ctx, approval.Spec.Decider.TeamName); err != nil { - return nil, err + approval := &approvalv1.Approval{} + if err := s.client.Get(ctx, k8stypes.NamespacedName{Name: ref.Name, Namespace: ref.Namespace}, approval); err != nil { + log.V(1).Info("Failed to get approval resource", "error", err) + return &model.DecideApprovalPayload{ + Errors: []model.MutationError{k8sToMutationError(err)}, + }, nil } - crdAction, err := mapActionToApprovalAction(input.Action) + action, err := mapActionToApprovalAction(input.Action) if err != nil { - return nil, err + log.V(1).Info("Invalid approval action", "error", err) + return &model.DecideApprovalPayload{ + Errors: []model.MutationError{{Code: model.ErrorCodeValidationFailed, Message: err.Error()}}, + }, nil } - targetState, err := findTargetState(approval.Status.AvailableTransitions, crdAction) + targetState, err := findTargetState(approval.Status.AvailableTransitions, action) if err != nil { - return nil, err + log.V(1).Info("Transition not available", "currentState", approval.Spec.State, "requestedAction", action) + return &model.DecideApprovalPayload{ + Errors: []model.MutationError{{Code: model.ErrorCodePreconditionFailed, Message: err.Error()}}, + }, nil } - _, err = scopedClient.CreateOrUpdate(ctx, approval, func() error { - approval.Spec.Decisions = append(approval.Spec.Decisions, buildDecision(input.Decision, targetState)) + decision := buildDecision(ctx, input, targetState) + + _, updateErr := s.client.CreateOrUpdate(ctx, approval, func() error { approval.Spec.State = targetState + approval.Spec.Decisions = append(approval.Spec.Decisions, decision) return nil }) - if err != nil { - return nil, mapK8sError(err) + if updateErr != nil { + log.Error(updateErr, "Failed to update approval", "targetState", targetState) + return &model.DecideApprovalPayload{ + Errors: []model.MutationError{k8sToMutationError(updateErr)}, + }, nil } - newState := string(targetState) - return &model.ApprovalMutationResult{ - Success: true, - Message: "approval decision applied", - NewState: &newState, - Namespace: &namespace, - ResourceName: &resourceName, + log.V(0).Info("Decided approval", "targetState", targetState, "decidedByName", decision.Name, "decidedByEmail", decision.Email) + return &model.DecideApprovalPayload{ + Accepted: true, + Errors: []model.MutationError{}, }, nil } + +// ────────────────────────────────────────────────────────────────────────────── +// Helpers +// ────────────────────────────────────────────────────────────────────────────── + +// forbiddenError creates a MutationError with FORBIDDEN code. +func forbiddenError(msg string) model.MutationError { + return model.MutationError{ + Code: model.ErrorCodeForbidden, + Message: msg, + } +} + +// k8sToMutationError converts a Kubernetes API error to a MutationError with +// an appropriate error code based on the error type. +// It unwraps wrapped errors (e.g. from pkg/errors) to find the underlying +// StatusError for proper classification. +func k8sToMutationError(err error) model.MutationError { + if err == nil { + return model.MutationError{} + } + + // Unwrap to find the underlying StatusError, since the scoped client + // wraps K8s errors with pkg/errors.Wrapf which may not be transparent + // to apierrors type checks. + apiErr := unwrapStatusError(err) + if apiErr == nil { + return model.MutationError{ + Code: model.ErrorCodePreconditionFailed, + Message: "internal error while processing request", + } + } + + switch { + case apierrors.IsNotFound(apiErr): + return model.MutationError{ + Code: model.ErrorCodeNotFound, + Message: "resource not found", + } + case apierrors.IsConflict(apiErr): + return model.MutationError{ + Code: model.ErrorCodeConflict, + Message: "resource was modified concurrently, please retry", + } + case apierrors.IsForbidden(apiErr): + return model.MutationError{ + Code: model.ErrorCodeForbidden, + Message: "operation forbidden by cluster policy", + } + case apierrors.IsInvalid(apiErr): + return model.MutationError{ + Code: model.ErrorCodeValidationFailed, + Message: fmt.Sprintf("resource validation failed: %s", extractCauses(apiErr)), + } + case apierrors.IsAlreadyExists(apiErr): + return model.MutationError{ + Code: model.ErrorCodeConflict, + Message: "resource already exists", + } + default: + return model.MutationError{ + Code: model.ErrorCodePreconditionFailed, + Message: "internal error while processing request", + } + } +} + +// unwrapStatusError traverses the error chain to find a *apierrors.StatusError. +// It handles both standard Unwrap() chains and pkg/errors Cause() chains. +func unwrapStatusError(err error) *apierrors.StatusError { + for e := err; e != nil; { + var statusErr *apierrors.StatusError + if ok := errors.As(e, &statusErr); ok { + return statusErr + } + // Support pkg/errors Cause() interface + type causer interface { + Cause() error + } + if c, ok := e.(causer); ok { + e = c.Cause() + } else { + break + } + } + return nil +} + +// extractCauses extracts validation failure causes from a StatusError, providing +// user-friendly messages without exposing internal K8s implementation details. +func extractCauses(statusErr *apierrors.StatusError) string { + if statusErr == nil { + return "validation failed" + } + if statusErr.ErrStatus.Details == nil || len(statusErr.ErrStatus.Details.Causes) == 0 { + return "validation failed" + } + + messages := make([]string, 0, len(statusErr.ErrStatus.Details.Causes)) + for _, cause := range statusErr.ErrStatus.Details.Causes { + if cause.Field != "" { + messages = append(messages, fmt.Sprintf("%s: %s", cause.Field, cause.Message)) + } else { + messages = append(messages, cause.Message) + } + } + return strings.Join(messages, "; ") +} diff --git a/controlplane-api/internal/service/team_k8s_test.go b/controlplane-api/internal/service/team_k8s_test.go index cb1f9cbef..67219391e 100644 --- a/controlplane-api/internal/service/team_k8s_test.go +++ b/controlplane-api/internal/service/team_k8s_test.go @@ -7,19 +7,22 @@ package service_test import ( "context" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/fake" + applicationv1 "github.com/telekom/controlplane/application/api/v1" approvalv1 "github.com/telekom/controlplane/approval/api/v1" + cc "github.com/telekom/controlplane/common/pkg/client" "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" "github.com/telekom/controlplane/controlplane-api/internal/service" "github.com/telekom/controlplane/controlplane-api/internal/viewer" organizationv1 "github.com/telekom/controlplane/organization/api/v1" - "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - clientgoscheme "k8s.io/client-go/kubernetes/scheme" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/client/fake" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) func newTestScheme() *runtime.Scheme { @@ -67,16 +70,9 @@ var _ = Describe("TeamK8sService", func() { }, } - updateInput := model.UpdateTeamInput{ - Environment: "dev", - Group: "group-a", - Name: "team-alpha", - Email: strPtr("newemail@example.com"), - } - BeforeEach(func() { k8sClient = newFakeClient() - svc = service.NewTeamK8sService(k8sClient) + svc = service.NewTeamK8sService(cc.NewScopedClient(k8sClient, "poc")) }) Describe("CreateTeam", func() { @@ -84,42 +80,47 @@ var _ = Describe("TeamK8sService", func() { It("should allow admin to create any team", func() { result, err := svc.CreateTeam(adminCtx(), createInput) Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) + Expect(result.Accepted).To(BeTrue()) + Expect(result.Errors).To(BeEmpty()) }) It("should allow group viewer to create team in their group", func() { result, err := svc.CreateTeam(groupCtx("group-a"), createInput) Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) + Expect(result.Accepted).To(BeTrue()) + Expect(result.Errors).To(BeEmpty()) }) It("should deny group viewer creating team in a different group", func() { - _, err := svc.CreateTeam(groupCtx("group-b"), createInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("forbidden")) + result, err := svc.CreateTeam(groupCtx("group-b"), createInput) + Expect(err).NotTo(HaveOccurred()) + Expect(result.Accepted).To(BeFalse()) + Expect(result.Errors).To(HaveLen(1)) + Expect(result.Errors[0].Code).To(Equal(model.ErrorCodeForbidden)) }) It("should deny team viewer from creating a team", func() { - _, err := svc.CreateTeam(teamCtx("team-alpha"), createInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("forbidden")) + result, err := svc.CreateTeam(teamCtx("team-alpha"), createInput) + Expect(err).NotTo(HaveOccurred()) + Expect(result.Accepted).To(BeFalse()) + Expect(result.Errors).To(HaveLen(1)) + Expect(result.Errors[0].Code).To(Equal(model.ErrorCodeForbidden)) }) It("should deny when no viewer is present", func() { - _, err := svc.CreateTeam(noViewerCtx(), createInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("unauthorized")) + result, err := svc.CreateTeam(noViewerCtx(), createInput) + Expect(err).NotTo(HaveOccurred()) + Expect(result.Accepted).To(BeFalse()) + Expect(result.Errors).NotTo(BeEmpty()) }) }) Describe("Success", func() { - It("should create a team and return correct result", func() { + It("should create a team and return accepted", func() { result, err := svc.CreateTeam(adminCtx(), createInput) Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - Expect(result.Message).To(Equal("team created successfully")) - Expect(*result.Namespace).To(Equal("dev")) - Expect(*result.ResourceName).To(Equal("group-a--team-alpha")) + Expect(result.Accepted).To(BeTrue()) + Expect(result.Errors).To(BeEmpty()) // Verify the CRD was created in K8s team := &organizationv1.Team{} @@ -138,190 +139,9 @@ var _ = Describe("TeamK8sService", func() { }) }) - Describe("UpdateTeam", func() { - BeforeEach(func() { - // Seed a team first - _, err := svc.CreateTeam(adminCtx(), createInput) - Expect(err).NotTo(HaveOccurred()) - }) - - Describe("Authorization", func() { - It("should allow admin to update any team", func() { - result, err := svc.UpdateTeam(adminCtx(), updateInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should allow group viewer to update team in their group", func() { - result, err := svc.UpdateTeam(groupCtx("group-a"), updateInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should deny group viewer updating team in a different group", func() { - _, err := svc.UpdateTeam(groupCtx("group-b"), updateInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("forbidden")) - }) - - It("should allow team viewer to update their own team", func() { - result, err := svc.UpdateTeam(teamCtx("team-alpha"), updateInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should deny team viewer updating a different team", func() { - _, err := svc.UpdateTeam(teamCtx("team-beta"), updateInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("forbidden")) - }) - - It("should deny when no viewer is present", func() { - _, err := svc.UpdateTeam(noViewerCtx(), updateInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("unauthorized")) - }) - }) - - Describe("Partial update", func() { - It("should only update provided fields", func() { - newEmail := "updated@example.com" - result, err := svc.UpdateTeam(adminCtx(), model.UpdateTeamInput{ - Environment: "dev", - Group: "group-a", - Name: "team-alpha", - Email: &newEmail, - }) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - - // Verify only email changed - team := &organizationv1.Team{} - err = k8sClient.Get(context.Background(), client.ObjectKey{ - Namespace: "dev", - Name: "group-a--team-alpha", - }, team) - Expect(err).NotTo(HaveOccurred()) - Expect(team.Spec.Email).To(Equal("updated@example.com")) - // Members should be unchanged from create - Expect(team.Spec.Members).To(HaveLen(1)) - Expect(team.Spec.Members[0].Name).To(Equal("Alice")) - }) - }) - - Describe("Not found", func() { - It("should return NOT_FOUND when the team does not exist", func() { - _, err := svc.UpdateTeam(adminCtx(), model.UpdateTeamInput{ - Environment: "dev", - Group: "group-a", - Name: "team-missing", - Email: strPtr("x@example.com"), - }) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("not found")) - - // Verify no team was created - team := &organizationv1.Team{} - err = k8sClient.Get(context.Background(), client.ObjectKey{ - Namespace: "dev", - Name: "group-a--team-missing", - }, team) - Expect(err).To(HaveOccurred()) - }) - }) - }) - - Describe("RotateTeamToken", func() { - rotateInput := model.RotateTeamTokenInput{ - Environment: "dev", - Group: "group-a", - Name: "team-alpha", - } - - BeforeEach(func() { - // Seed a team first - _, err := svc.CreateTeam(adminCtx(), createInput) - Expect(err).NotTo(HaveOccurred()) - }) - - Describe("Authorization", func() { - It("should allow admin to rotate any team token", func() { - result, err := svc.RotateTeamToken(adminCtx(), rotateInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should allow group viewer to rotate token for team in their group", func() { - result, err := svc.RotateTeamToken(groupCtx("group-a"), rotateInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should deny group viewer rotating token for team in a different group", func() { - _, err := svc.RotateTeamToken(groupCtx("group-b"), rotateInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("forbidden")) - }) - - It("should allow team viewer to rotate their own team token", func() { - result, err := svc.RotateTeamToken(teamCtx("team-alpha"), rotateInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - }) - - It("should deny team viewer rotating a different team's token", func() { - _, err := svc.RotateTeamToken(teamCtx("team-beta"), rotateInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("forbidden")) - }) - - It("should deny when no viewer is present", func() { - _, err := svc.RotateTeamToken(noViewerCtx(), rotateInput) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("unauthorized")) - }) - }) - - Describe("Success", func() { - It("should set Spec.Secret to 'rotate' and return correct result", func() { - result, err := svc.RotateTeamToken(adminCtx(), rotateInput) - Expect(err).NotTo(HaveOccurred()) - Expect(result.Success).To(BeTrue()) - Expect(result.Message).To(Equal("team token rotation initiated")) - Expect(*result.Namespace).To(Equal("dev")) - Expect(*result.ResourceName).To(Equal("group-a--team-alpha")) - - // Verify Spec.Secret was set on the CRD - team := &organizationv1.Team{} - err = k8sClient.Get(context.Background(), client.ObjectKey{ - Namespace: "dev", - Name: "group-a--team-alpha", - }, team) - Expect(err).NotTo(HaveOccurred()) - Expect(team.Spec.Secret).To(Equal("rotate")) - }) - }) - - Describe("Not found", func() { - It("should return NOT_FOUND when the team does not exist", func() { - _, err := svc.RotateTeamToken(adminCtx(), model.RotateTeamTokenInput{ - Environment: "dev", - Group: "group-a", - Name: "team-missing", - }) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("not found")) - - // Verify no team was created - team := &organizationv1.Team{} - err = k8sClient.Get(context.Background(), client.ObjectKey{ - Namespace: "dev", - Name: "group-a--team-missing", - }, team) - Expect(err).To(HaveOccurred()) - }) - }) - }) + // NOTE: UpdateTeam, AddTeamMember, RemoveTeamMember, and RotateTeamToken + // now take Node IDs and are not yet implemented in the K8s service layer. + // Tests for these will be added once ID resolution is wired through the resolver. }) func strPtr(s string) *string { diff --git a/controlplane-api/internal/testutil/seed.go b/controlplane-api/internal/testutil/seed.go index 13cb2b778..78eadeded 100644 --- a/controlplane-api/internal/testutil/seed.go +++ b/controlplane-api/internal/testutil/seed.go @@ -32,6 +32,9 @@ type SeedData struct { MemberAlpha *ent.Member MemberBeta *ent.Member + + EventExposureAlpha *ent.EventExposure + EventSubscription *ent.EventSubscription } // SeedStandard creates a standard set of test data covering all entity types. @@ -100,6 +103,22 @@ func SeedStandard(client *ent.Client) *SeedData { SetAPISubscription(s.Subscription). Save(ctx)) + // Event Exposures + s.EventExposureAlpha = must(client.EventExposure.Create(). + SetNamespace("default"). + SetEventType("order.created"). + SetOwner(s.AppAlpha). + Save(ctx)) + + // Event Subscriptions: app-beta subscribes to event-exposure-alpha (cross-team) + s.EventSubscription = must(client.EventSubscription.Create(). + SetNamespace("default"). + SetName("eventsub-order-created"). + SetEventType("order.created"). + SetOwner(s.AppBeta). + SetTarget(s.EventExposureAlpha). + Save(ctx)) + return s } diff --git a/controlplane-api/internal/viewer/viewer.go b/controlplane-api/internal/viewer/viewer.go index f54c83893..a0370e88b 100644 --- a/controlplane-api/internal/viewer/viewer.go +++ b/controlplane-api/internal/viewer/viewer.go @@ -12,11 +12,35 @@ import ( type viewerKey struct{} +type forwardedUserKey struct{} + +// ForwardedUser holds the user identity extracted from X-Forwarded-User-* headers. +type ForwardedUser struct { + Name string + Email string + IsAdmin bool // Derived from X-Forwarded-User-Is-Admin header + Roles []string // App roles from X-Forwarded-User-Roles header + Groups []string // Group IDs from X-Forwarded-User-Groups header +} + +// NewForwardedUserContext stores forwarded user identity in the context. +func NewForwardedUserContext(ctx context.Context, u ForwardedUser) context.Context { + return context.WithValue(ctx, forwardedUserKey{}, u) +} + +// ForwardedUserFromContext returns the forwarded user identity, if present. +func ForwardedUserFromContext(ctx context.Context) (ForwardedUser, bool) { + u, ok := ctx.Value(forwardedUserKey{}).(ForwardedUser) + return u, ok +} + // Viewer represents the authenticated user and their accessible teams. type Viewer struct { - Teams []string - Group string // Group name from BusinessContext (set for group-level viewers) - Admin bool + Teams []string + Group string // Group name from BusinessContext (set for group-level viewers) + Admin bool + UserName string // Display name from X-Forwarded-User-Name header + UserEmail string // Email from X-Forwarded-User-Email header } // NewContext returns a new context with the viewer attached. @@ -43,7 +67,23 @@ func (v *Viewer) HasTeam(teamName string) bool { return false } -// SystemContext returns a context that bypasses all privacy rules. +// SystemContext returns a context that bypasses all Ent privacy rules, +// granting unrestricted database access. This is the equivalent of a +// superuser context and must be used with extreme care. +// +// Acceptable uses: +// - Viewer middleware bootstrapping (looking up teams/groups for the +// authenticated user before a Viewer exists in context) +// - Internal system operations with no associated user request +// +// DO NOT use SystemContext for: +// - Resolving user-initiated GraphQL queries or mutations +// - Any operation where the caller already has a Viewer in context +// - Fetching data that should respect team/org boundaries +// +// If you're adding a new callsite, consider whether the operation truly +// needs to bypass privacy rules or if it should run under the caller's +// Viewer context instead. func SystemContext(ctx context.Context) context.Context { return privacy.DecisionContext(ctx, privacy.Allow) } diff --git a/controlplane-api/internal/viewer/viewer_test.go b/controlplane-api/internal/viewer/viewer_test.go index 384896378..c605b530a 100644 --- a/controlplane-api/internal/viewer/viewer_test.go +++ b/controlplane-api/internal/viewer/viewer_test.go @@ -8,10 +8,11 @@ import ( "context" "entgo.io/ent/privacy" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/telekom/controlplane/controlplane-api/internal/viewer" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) var _ = Describe("NewContext / FromContext", func() { @@ -57,3 +58,35 @@ var _ = Describe("SystemContext", func() { Expect(decision).ToNot(HaveOccurred()) }) }) + +var _ = Describe("ForwardedUser context", func() { + It("should round-trip forwarded user through context", func() { + fu := viewer.ForwardedUser{Name: "Jane Doe", Email: "jane@example.com"} + ctx := viewer.NewForwardedUserContext(context.Background(), fu) + got, ok := viewer.ForwardedUserFromContext(ctx) + Expect(ok).To(BeTrue()) + Expect(got.Name).To(Equal("Jane Doe")) + Expect(got.Email).To(Equal("jane@example.com")) + }) + + It("should round-trip all extended fields", func() { + fu := viewer.ForwardedUser{ + Name: "Jane Doe", + Email: "jane@example.com", + IsAdmin: true, + Roles: []string{"editor", "viewer"}, + Groups: []string{"group-1", "group-2"}, + } + ctx := viewer.NewForwardedUserContext(context.Background(), fu) + got, ok := viewer.ForwardedUserFromContext(ctx) + Expect(ok).To(BeTrue()) + Expect(got.IsAdmin).To(BeTrue()) + Expect(got.Roles).To(ConsistOf("editor", "viewer")) + Expect(got.Groups).To(ConsistOf("group-1", "group-2")) + }) + + It("should return false when no forwarded user is in context", func() { + _, ok := viewer.ForwardedUserFromContext(context.Background()) + Expect(ok).To(BeFalse()) + }) +}) diff --git a/controlplane-api/mutation.graphql b/controlplane-api/mutation.graphql index 7c0b9d54d..767bccc9f 100644 --- a/controlplane-api/mutation.graphql +++ b/controlplane-api/mutation.graphql @@ -2,139 +2,132 @@ # # SPDX-License-Identifier: Apache-2.0 +# ────────────────────────────────────────────────────────────────────────────── +# Shared types +# ────────────────────────────────────────────────────────────────────────────── + +type MutationError { + code: ErrorCode! + message: String! + field: String +} + +enum ErrorCode { + NOT_FOUND + FORBIDDEN + CONFLICT + VALIDATION_FAILED + PRECONDITION_FAILED +} + +input MemberInput { + name: String! + email: String! +} + +input DecisionInput { + action: ApprovalAction! + "Optional comment from the decider" + comment: String +} + +# ────────────────────────────────────────────────────────────────────────────── +# Team mutations +# ────────────────────────────────────────────────────────────────────────────── + input CreateTeamInput { - "Target environment (used for namespace derivation)" environment: String! - "Group this team belongs to" group: String! - "Team name" name: String! - "Team contact email" email: String! - "Team members (at least one required)" members: [MemberInput!]! } input UpdateTeamInput { - "Target environment" - environment: String! - "Group this team belongs to" - group: String! - "Team name (identifies which team to update)" - name: String! - "Updated team contact email" + teamId: ID! email: String - "Updated team members" - members: [MemberInput!] } -input MemberInput { - name: String! - email: String! +type CreateTeamPayload { + team: Team + accepted: Boolean! + errors: [MutationError!]! } -"Result of a team mutation. Reports acceptance status - the actual reconciliation happens asynchronously." -type TeamMutationResult { - "Whether the K8s API accepted the request" - success: Boolean! - "Human-readable message" - message: String! - "The namespace where the Team CRD was created/updated" - namespace: String - "The Team CRD resource name" - resourceName: String +type UpdateTeamPayload { + team: Team + accepted: Boolean! + errors: [MutationError!]! } -input RotateTeamTokenInput { - "Target environment" - environment: String! - "Group this team belongs to" - group: String! - "Team name" - name: String! +type AddTeamMemberPayload { + team: Team + errors: [MutationError!]! } -input RotateApplicationSecretInput { - "Target environment" - environment: String! - "Team that owns this application" - team: String! - "Application resource name" - name: String! +type RemoveTeamMemberPayload { + team: Team + errors: [MutationError!]! } -"Result of an application mutation. Reports acceptance status - the actual reconciliation happens asynchronously." -type RotateApplicationSecretResult { - "Whether the K8s API accepted the request" - success: Boolean! - "Human-readable message" - message: String! - "The namespace where the Application CRD was updated" - namespace: String - "The Application CRD resource name" - resourceName: String +type RotateTeamTokenPayload { + team: Team + accepted: Boolean! + errors: [MutationError!]! } -input DecideApprovalRequestInput { - "Target environment" - environment: String! - "Requester team that owns the namespace where the ApprovalRequest lives" - team: String! - "ApprovalRequest resource name" - name: String! - "Action to take" - action: ApprovalAction! - "Decision details" - decision: DecisionInput! -} +# ────────────────────────────────────────────────────────────────────────────── +# Application mutations +# ────────────────────────────────────────────────────────────────────────────── -input DecideApprovalInput { - "Target environment" - environment: String! - "Requester team that owns the namespace where the Approval lives" - team: String! - "Approval resource name" - name: String! - "Action to take (Allow, Deny, Suspend, Resume)" - action: ApprovalAction! - "Decision details" - decision: DecisionInput! +type RotateApplicationSecretPayload { + application: Application + accepted: Boolean! + errors: [MutationError!]! } -input DecisionInput { - "Name of the person making the decision" - name: String! - "Email of the person making the decision" - email: String! - "Optional comment" - comment: String +# ────────────────────────────────────────────────────────────────────────────── +# Approval mutations +# ────────────────────────────────────────────────────────────────────────────── + +type DecideApprovalRequestPayload { + approvalRequest: ApprovalRequest + accepted: Boolean! + errors: [MutationError!]! } -"Result of an approval mutation." -type ApprovalMutationResult { - "Whether the K8s API accepted the request" - success: Boolean! - "Human-readable message" - message: String! - "The new state after the transition" - newState: String - "The namespace of the resource" - namespace: String - "The resource name" - resourceName: String +type DecideApprovalPayload { + approval: Approval + accepted: Boolean! + errors: [MutationError!]! } +# ────────────────────────────────────────────────────────────────────────────── +# Mutation type +# ────────────────────────────────────────────────────────────────────────────── + type Mutation { "Create a new Team in Kubernetes" - createTeam(input: CreateTeamInput!): TeamMutationResult! - "Update an existing Team in Kubernetes" - updateTeam(input: UpdateTeamInput!): TeamMutationResult! - "Rotate the token for an existing Team. Triggers async secret regeneration via the operator." - rotateTeamToken(input: RotateTeamTokenInput!): TeamMutationResult! - "Rotate the client secret for an existing Application. Triggers async secret regeneration via the operator webhook." - rotateApplicationSecret(input: RotateApplicationSecretInput!): RotateApplicationSecretResult! + createTeam(input: CreateTeamInput!): CreateTeamPayload! + + "Update team metadata (email). Does not manage members." + updateTeam(input: UpdateTeamInput!): UpdateTeamPayload! + + "Add a member to a team. Takes effect immediately." + addTeamMember(teamId: ID!, member: MemberInput!): AddTeamMemberPayload! + + "Remove a member from a team by email. Takes effect immediately." + removeTeamMember(teamId: ID!, memberEmail: String!): RemoveTeamMemberPayload! + + "Rotate the token for a team. Triggers async secret regeneration." + rotateTeamToken(teamId: ID!): RotateTeamTokenPayload! + + "Rotate the client secret for an application. Triggers async secret regeneration." + rotateApplicationSecret(applicationId: ID!): RotateApplicationSecretPayload! + "Decide on an ApprovalRequest (approve or deny initial access)." - decideApprovalRequest(input: DecideApprovalRequestInput!): ApprovalMutationResult! + decideApprovalRequest(approvalRequestId: ID!, input: DecisionInput!): DecideApprovalRequestPayload! + "Decide on an existing Approval (suspend, resume, deny, or re-allow ongoing access)." - decideApproval(input: DecideApprovalInput!): ApprovalMutationResult! + decideApproval(approvalId: ID!, input: DecisionInput!): DecideApprovalPayload! } diff --git a/controlplane-api/pkg/model/info_types.go b/controlplane-api/pkg/model/info_types.go index 3227fd5d0..148e7f224 100644 --- a/controlplane-api/pkg/model/info_types.go +++ b/controlplane-api/pkg/model/info_types.go @@ -28,3 +28,31 @@ type ApiSubscriptionInfo struct { OwnerApplicationName string `json:"ownerApplicationName"` OwnerTeam *TeamInfo `json:"ownerTeam"` } + +func (ApiSubscriptionInfo) IsSubscriptionInfo() {} + +// EventSubscriptionInfo provides a reduced cross-tenant safe view of an event subscription. +// No navigable edges — traversal terminates here. +type EventSubscriptionInfo struct { + ID int `json:"id"` + EventType string `json:"eventType"` + DeliveryType string `json:"deliveryType"` + StatusPhase *string `json:"statusPhase,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` + OwnerApplicationName string `json:"ownerApplicationName"` + OwnerTeam *TeamInfo `json:"ownerTeam"` +} + +func (EventSubscriptionInfo) IsSubscriptionInfo() {} + +// EventExposureInfo provides a reduced cross-tenant safe view of an event exposure. +// No navigable edges — traversal terminates here. +type EventExposureInfo struct { + ID int `json:"id"` + EventType string `json:"eventType"` + Visibility string `json:"visibility"` + Active *bool `json:"active,omitempty"` + ApprovalConfig ApprovalConfig `json:"approvalConfig"` + OwnerApplicationName string `json:"ownerApplicationName"` + OwnerTeam *TeamInfo `json:"ownerTeam"` +} diff --git a/controlplane-api/schema.graphql b/controlplane-api/schema.graphql index cbda6412e..cd476267d 100644 --- a/controlplane-api/schema.graphql +++ b/controlplane-api/schema.graphql @@ -103,6 +103,32 @@ type ApiSubscriptionInfo { ownerTeam: TeamInfo! } +"Reduced event subscription for cross-tenant contexts (e.g., exposure subscribers)." +type EventSubscriptionInfo { + id: ID! + eventType: String! + deliveryType: EventSubscriptionDeliveryType! + statusPhase: EventSubscriptionStatusPhase + statusMessage: String + "Application name that owns this subscription" + ownerApplicationName: String! + "Owning team (reduced view)" + ownerTeam: TeamInfo! +} + +"Reduced event exposure for cross-tenant contexts (e.g., subscription target)." +type EventExposureInfo { + id: ID! + eventType: String! + visibility: EventExposureVisibility! + active: Boolean + approvalConfig: ApprovalConfig! + "Application name that owns this exposure" + ownerApplicationName: String! + "Owning team (reduced view)" + ownerTeam: TeamInfo! +} + # -- Cross-tenant edge overrides -- extend type Application { @@ -110,6 +136,11 @@ extend type Application { ownerTeam: TeamInfo! } +extend type Zone { + "Token endpoint URL derived from the issuer URL. Returns null if no issuer URL is set." + tokenURL: String @goField(forceResolver: true) +} + extend type ApiSubscription { "Target exposure (reduced view — cross-tenant boundary)" target: ApiExposureInfo! @goField(forceResolver: true) @@ -120,15 +151,28 @@ extend type ApiExposure { subscriptions: [ApiSubscriptionInfo!]! @goField(forceResolver: true) } +extend type EventSubscription { + "Target exposure (reduced view — cross-tenant boundary)" + target: EventExposureInfo! @goField(forceResolver: true) +} + +extend type EventExposure { + "Subscriptions to this exposure (reduced view — cross-tenant boundary)" + subscriptions: [EventSubscriptionInfo!]! @goField(forceResolver: true) +} + +"A subscription related to an approval — either an API or event subscription." +union SubscriptionInfo = ApiSubscriptionInfo | EventSubscriptionInfo + extend type Approval { "Related subscription (reduced view — cross-tenant boundary)" - apiSubscription: ApiSubscriptionInfo @goField(forceResolver: true) + subscription: SubscriptionInfo! @goField(forceResolver: true) } extend type ApprovalRequest { "Related subscription (reduced view — cross-tenant boundary)" - apiSubscription: ApiSubscriptionInfo @goField(forceResolver: true) - "The corresponding approval, if one exists (traverses via ApiSubscription)" + subscription: SubscriptionInfo! @goField(forceResolver: true) + "The corresponding approval, if one exists (traverses via the related subscription)" approval: Approval @goField(forceResolver: true) } diff --git a/projector/go.mod b/projector/go.mod index e88a796c9..5cc0118b4 100644 --- a/projector/go.mod +++ b/projector/go.mod @@ -33,6 +33,7 @@ require ( github.com/telekom/controlplane/approval/api v0.0.0 github.com/telekom/controlplane/common v0.0.0 github.com/telekom/controlplane/controlplane-api v0.0.0 + github.com/telekom/controlplane/event/api v0.0.0 github.com/telekom/controlplane/organization/api v0.0.0 ) diff --git a/projector/internal/bootstrap/bootstrap.go b/projector/internal/bootstrap/bootstrap.go index d351be1d2..41e6c6ea7 100644 --- a/projector/internal/bootstrap/bootstrap.go +++ b/projector/internal/bootstrap/bootstrap.go @@ -29,9 +29,11 @@ import ( apiv1 "github.com/telekom/controlplane/api/api/v1" appv1 "github.com/telekom/controlplane/application/api/v1" approvalv1 "github.com/telekom/controlplane/approval/api/v1" + cconfig "github.com/telekom/controlplane/common/pkg/config" "github.com/telekom/controlplane/controlplane-api/ent" "github.com/telekom/controlplane/controlplane-api/ent/migrate" _ "github.com/telekom/controlplane/controlplane-api/ent/runtime" + eventv1 "github.com/telekom/controlplane/event/api/v1" orgv1 "github.com/telekom/controlplane/organization/api/v1" "github.com/telekom/controlplane/projector/internal/config" @@ -40,6 +42,8 @@ import ( "github.com/telekom/controlplane/projector/internal/domain/application" "github.com/telekom/controlplane/projector/internal/domain/approval" "github.com/telekom/controlplane/projector/internal/domain/approvalrequest" + "github.com/telekom/controlplane/projector/internal/domain/eventexposure" + "github.com/telekom/controlplane/projector/internal/domain/eventsubscription" "github.com/telekom/controlplane/projector/internal/domain/group" "github.com/telekom/controlplane/projector/internal/domain/team" "github.com/telekom/controlplane/projector/internal/domain/zone" @@ -52,15 +56,6 @@ var ( setupLog = ctrl.Log.WithName("setup") ) -func init() { - // Register all CR schemes used by the projector modules. - _ = adminv1.AddToScheme(scheme) - _ = apiv1.AddToScheme(scheme) - _ = appv1.AddToScheme(scheme) - _ = approvalv1.AddToScheme(scheme) - _ = orgv1.AddToScheme(scheme) -} - // modules is the ordered list of resource modules to register. var modules = []module.Module{ zone.Module, @@ -73,6 +68,20 @@ var modules = []module.Module{ approvalrequest.Module, } +func init() { + // Register all CR schemes used by the projector modules. + _ = adminv1.AddToScheme(scheme) + _ = apiv1.AddToScheme(scheme) + _ = appv1.AddToScheme(scheme) + _ = approvalv1.AddToScheme(scheme) + _ = orgv1.AddToScheme(scheme) + + if cconfig.FeaturePubSub.IsEnabled() { + _ = eventv1.AddToScheme(scheme) + modules = append(modules, eventexposure.Module, eventsubscription.Module) + } +} + // Run is the projector entry point. It sets up the database, caches, // controller manager, registers all modules, and starts the manager. func Run() error { diff --git a/projector/internal/domain/application/repository.go b/projector/internal/domain/application/repository.go index f28ef420d..484f0e7aa 100644 --- a/projector/internal/domain/application/repository.go +++ b/projector/internal/domain/application/repository.go @@ -53,9 +53,9 @@ func NewRepository(client *ent.Client, cache *infrastructure.EdgeCache, deps App // Resolves Team FK and Zone FK (both required) via deps, then upserts on // the composite unique constraint (name, owner_team). // -// ClientID, ClientSecret and IssuerURL are nillable — set only when non-nil. +// ClientID and ClientSecret are nillable — set only when non-nil. // On conflict update: always sets StatusPhase, StatusMessage; conditionally -// sets/clears ClientID, ClientSecret and IssuerURL. +// sets/clears ClientID and ClientSecret. func (r *Repository) Upsert(ctx context.Context, data *ApplicationData) error { start := time.Now() defer func() { @@ -85,7 +85,8 @@ func (r *Repository) Upsert(ctx context.Context, data *ApplicationData) error { SetEnvironment(data.Meta.Environment). SetNamespace(data.Meta.Namespace). SetOwnerTeamID(teamID). - SetZoneID(zoneID) + SetZoneID(zoneID). + SetSecretRotationPhase(application.SecretRotationPhase(data.SecretRotationPhase)) if data.ClientID != nil { create.SetClientID(*data.ClientID) @@ -93,8 +94,17 @@ func (r *Repository) Upsert(ctx context.Context, data *ApplicationData) error { if data.ClientSecret != nil { create.SetClientSecret(*data.ClientSecret) } - if data.IssuerURL != nil { - create.SetIssuerURL(*data.IssuerURL) + if data.RotatedClientSecret != nil { + create.SetRotatedClientSecret(*data.RotatedClientSecret) + } + if data.RotatedExpiresAt != nil { + create.SetRotatedExpiresAt(*data.RotatedExpiresAt) + } + if data.CurrentExpiresAt != nil { + create.SetCurrentExpiresAt(*data.CurrentExpiresAt) + } + if data.SecretRotationMessage != nil { + create.SetSecretRotationMessage(*data.SecretRotationMessage) } appID, upsertErr := create. @@ -104,16 +114,32 @@ func (r *Repository) Upsert(ctx context.Context, data *ApplicationData) error { u.SetStatusMessage(data.StatusMessage) u.SetEnvironment(data.Meta.Environment) u.SetNamespace(data.Meta.Namespace) + u.SetSecretRotationPhase(application.SecretRotationPhase(data.SecretRotationPhase)) if data.ClientID != nil { u.SetClientID(*data.ClientID) } if data.ClientSecret != nil { u.SetClientSecret(*data.ClientSecret) } - if data.IssuerURL != nil { - u.SetIssuerURL(*data.IssuerURL) + if data.RotatedClientSecret != nil { + u.SetRotatedClientSecret(*data.RotatedClientSecret) + } else { + u.ClearRotatedClientSecret() + } + if data.RotatedExpiresAt != nil { + u.SetRotatedExpiresAt(*data.RotatedExpiresAt) + } else { + u.ClearRotatedExpiresAt() + } + if data.CurrentExpiresAt != nil { + u.SetCurrentExpiresAt(*data.CurrentExpiresAt) + } else { + u.ClearCurrentExpiresAt() + } + if data.SecretRotationMessage != nil { + u.SetSecretRotationMessage(*data.SecretRotationMessage) } else { - u.ClearIssuerURL() + u.ClearSecretRotationMessage() } }). ID(ctx) diff --git a/projector/internal/domain/application/repository_test.go b/projector/internal/domain/application/repository_test.go index 6fc63bb0d..c914d0bc5 100644 --- a/projector/internal/domain/application/repository_test.go +++ b/projector/internal/domain/application/repository_test.go @@ -103,14 +103,14 @@ var _ = Describe("Application Repository", func() { Describe("Upsert", func() { It("should create an application with valid deps", func() { data := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "my-app", nil), - StatusPhase: "READY", - StatusMessage: "ok", - Name: "my-app", - ClientID: strPtr("client-123"), - IssuerURL: nil, - TeamName: "platform--narvi", - ZoneName: "caas", + Meta: shared.NewMetadata("prod--platform--narvi", "my-app", nil), + StatusPhase: "READY", + StatusMessage: "ok", + Name: "my-app", + ClientID: strPtr("client-123"), + TeamName: "platform--narvi", + ZoneName: "caas", + SecretRotationPhase: "DONE", } Expect(repo.Upsert(ctx, data)).To(Succeed()) @@ -119,7 +119,6 @@ var _ = Describe("Application Repository", func() { Expect(app.Name).To(Equal("my-app")) Expect(app.ClientID).ToNot(BeNil()) Expect(*app.ClientID).To(Equal("client-123")) - Expect(app.IssuerURL).To(BeNil()) // Verify FK edges. ownerTeam, err := app.QueryOwnerTeam().Only(ctx) @@ -133,12 +132,13 @@ var _ = Describe("Application Repository", func() { It("should return ErrDependencyMissing when team is missing", func() { data := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--unknown--team-a", "fail-app", nil), - StatusPhase: "UNKNOWN", - StatusMessage: "", - Name: "fail-app", - TeamName: "unknown--team-a", - ZoneName: "caas", + Meta: shared.NewMetadata("prod--unknown--team-a", "fail-app", nil), + StatusPhase: "UNKNOWN", + StatusMessage: "", + Name: "fail-app", + TeamName: "unknown--team-a", + ZoneName: "caas", + SecretRotationPhase: "DONE", } err := repo.Upsert(ctx, data) Expect(err).To(HaveOccurred()) @@ -148,12 +148,13 @@ var _ = Describe("Application Repository", func() { It("should return ErrDependencyMissing when zone is missing", func() { data := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "fail-app", nil), - StatusPhase: "UNKNOWN", - StatusMessage: "", - Name: "fail-app", - TeamName: "platform--narvi", - ZoneName: "missing-zone", + Meta: shared.NewMetadata("prod--platform--narvi", "fail-app", nil), + StatusPhase: "UNKNOWN", + StatusMessage: "", + Name: "fail-app", + TeamName: "platform--narvi", + ZoneName: "missing-zone", + SecretRotationPhase: "DONE", } err := repo.Upsert(ctx, data) Expect(err).To(HaveOccurred()) @@ -171,12 +172,13 @@ var _ = Describe("Application Repository", func() { failRepo := application.NewRepository(client, cache, failDeps) data := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "fail-app", nil), - StatusPhase: "UNKNOWN", - StatusMessage: "", - Name: "fail-app", - TeamName: "platform--narvi", - ZoneName: "caas", + Meta: shared.NewMetadata("prod--platform--narvi", "fail-app", nil), + StatusPhase: "UNKNOWN", + StatusMessage: "", + Name: "fail-app", + TeamName: "platform--narvi", + ZoneName: "caas", + SecretRotationPhase: "DONE", } err := failRepo.Upsert(ctx, data) Expect(err).To(HaveOccurred()) @@ -194,12 +196,13 @@ var _ = Describe("Application Repository", func() { failRepo := application.NewRepository(client, cache, failDeps) data := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "fail-app", nil), - StatusPhase: "UNKNOWN", - StatusMessage: "", - Name: "fail-app", - TeamName: "platform--narvi", - ZoneName: "caas", + Meta: shared.NewMetadata("prod--platform--narvi", "fail-app", nil), + StatusPhase: "UNKNOWN", + StatusMessage: "", + Name: "fail-app", + TeamName: "platform--narvi", + ZoneName: "caas", + SecretRotationPhase: "DONE", } err := failRepo.Upsert(ctx, data) Expect(err).To(HaveOccurred()) @@ -209,14 +212,14 @@ var _ = Describe("Application Repository", func() { It("should update existing application on conflict", func() { data := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "upd-app", nil), - StatusPhase: "PENDING", - StatusMessage: "v1", - Name: "upd-app", - ClientID: nil, - IssuerURL: nil, - TeamName: "platform--narvi", - ZoneName: "caas", + Meta: shared.NewMetadata("prod--platform--narvi", "upd-app", nil), + StatusPhase: "PENDING", + StatusMessage: "v1", + Name: "upd-app", + ClientID: nil, + TeamName: "platform--narvi", + ZoneName: "caas", + SecretRotationPhase: "DONE", } Expect(repo.Upsert(ctx, data)).To(Succeed()) @@ -236,41 +239,15 @@ var _ = Describe("Application Repository", func() { Expect(*app.ClientID).To(Equal("client-456")) }) - It("should clear IssuerURL when updated to nil", func() { - data := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "issuer-app", nil), - StatusPhase: "READY", - StatusMessage: "ok", - Name: "issuer-app", - IssuerURL: strPtr("https://issuer.example.com"), - TeamName: "platform--narvi", - ZoneName: "caas", - } - Expect(repo.Upsert(ctx, data)).To(Succeed()) - - // Verify IssuerURL was set. - app, err := client.Application.Query().Where(entapp.NameEQ("issuer-app")).Only(ctx) - Expect(err).NotTo(HaveOccurred()) - Expect(app.IssuerURL).ToNot(BeNil()) - Expect(*app.IssuerURL).To(Equal("https://issuer.example.com")) - - // Update with IssuerURL cleared. - data.IssuerURL = nil - Expect(repo.Upsert(ctx, data)).To(Succeed()) - - app, err = client.Application.Query().Where(entapp.NameEQ("issuer-app")).Only(ctx) - Expect(err).NotTo(HaveOccurred()) - Expect(app.IssuerURL).To(BeNil()) - }) - It("should populate the edge cache after upsert", func() { data := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "cached-app", nil), - StatusPhase: "READY", - StatusMessage: "", - Name: "cached-app", - TeamName: "platform--narvi", - ZoneName: "caas", + Meta: shared.NewMetadata("prod--platform--narvi", "cached-app", nil), + StatusPhase: "READY", + StatusMessage: "", + Name: "cached-app", + TeamName: "platform--narvi", + ZoneName: "caas", + SecretRotationPhase: "DONE", } Expect(repo.Upsert(ctx, data)).To(Succeed()) cache.Wait() @@ -285,12 +262,13 @@ var _ = Describe("Application Repository", func() { It("should delete application and cascade to children", func() { // Create an application first. data := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "del-app", nil), - StatusPhase: "READY", - StatusMessage: "", - Name: "del-app", - TeamName: "platform--narvi", - ZoneName: "caas", + Meta: shared.NewMetadata("prod--platform--narvi", "del-app", nil), + StatusPhase: "READY", + StatusMessage: "", + Name: "del-app", + TeamName: "platform--narvi", + ZoneName: "caas", + SecretRotationPhase: "DONE", } Expect(repo.Upsert(ctx, data)).To(Succeed()) @@ -325,12 +303,13 @@ var _ = Describe("Application Repository", func() { It("should evict from edge cache after delete", func() { data := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "evict-app", nil), - StatusPhase: "READY", - StatusMessage: "", - Name: "evict-app", - TeamName: "platform--narvi", - ZoneName: "caas", + Meta: shared.NewMetadata("prod--platform--narvi", "evict-app", nil), + StatusPhase: "READY", + StatusMessage: "", + Name: "evict-app", + TeamName: "platform--narvi", + ZoneName: "caas", + SecretRotationPhase: "DONE", } Expect(repo.Upsert(ctx, data)).To(Succeed()) cache.Wait() @@ -348,20 +327,22 @@ var _ = Describe("Application Repository", func() { It("should only delete the targeted application", func() { data1 := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "app-1", nil), - StatusPhase: "READY", - StatusMessage: "", - Name: "app-1", - TeamName: "platform--narvi", - ZoneName: "caas", + Meta: shared.NewMetadata("prod--platform--narvi", "app-1", nil), + StatusPhase: "READY", + StatusMessage: "", + Name: "app-1", + TeamName: "platform--narvi", + ZoneName: "caas", + SecretRotationPhase: "DONE", } data2 := &application.ApplicationData{ - Meta: shared.NewMetadata("prod--platform--narvi", "app-2", nil), - StatusPhase: "READY", - StatusMessage: "", - Name: "app-2", - TeamName: "platform--narvi", - ZoneName: "caas", + Meta: shared.NewMetadata("prod--platform--narvi", "app-2", nil), + StatusPhase: "READY", + StatusMessage: "", + Name: "app-2", + TeamName: "platform--narvi", + ZoneName: "caas", + SecretRotationPhase: "DONE", } Expect(repo.Upsert(ctx, data1)).To(Succeed()) Expect(repo.Upsert(ctx, data2)).To(Succeed()) diff --git a/projector/internal/domain/application/translator.go b/projector/internal/domain/application/translator.go index aba85e525..00c3963bc 100644 --- a/projector/internal/domain/application/translator.go +++ b/projector/internal/domain/application/translator.go @@ -6,13 +6,32 @@ package application import ( "context" + "time" appv1 "github.com/telekom/controlplane/application/api/v1" "github.com/telekom/controlplane/projector/internal/domain/shared" "github.com/telekom/controlplane/projector/internal/runtime" + "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/types" ) +// Secret rotation phase constants. +const ( + RotationPhaseDone = "DONE" + RotationPhaseRotating = "ROTATING" + RotationPhaseGracePeriodActive = "GRACE_PERIOD_ACTIVE" + RotationPhaseGracePeriodExpiring = "GRACE_PERIOD_EXPIRING" + RotationPhaseFailed = "FAILED" + + // gracePeriodExpiringThreshold is the fraction of the total grace period + // below which the phase switches from GRACE_PERIOD_ACTIVE to + // GRACE_PERIOD_EXPIRING (20%). + gracePeriodExpiringThreshold = 0.2 + + // secretRotationConditionType is the condition type on the Application CR. + secretRotationConditionType = "SecretRotation" +) + // Translator maps an Application CR to an ApplicationData DTO and derives // identity keys. // @@ -31,7 +50,7 @@ func (t *Translator) ShouldSkip(_ *appv1.Application) (bool, string) { // Translate converts an Application CR into an ApplicationData DTO. // ClientID is nil when Status.ClientId is empty (populated asynchronously by -// the identity controller). IssuerURL is always nil — the CR never carries it. +// the identity controller). func (t *Translator) Translate(_ context.Context, obj *appv1.Application) (*ApplicationData, error) { phase, message := shared.StatusFromConditions(obj.Status.Conditions) @@ -45,6 +64,26 @@ func (t *Translator) Translate(_ context.Context, obj *appv1.Application) (*Appl clientSecret = &obj.Spec.Secret } + // Secret rotation fields + rotationPhase, rotationMessage := deriveRotationState(obj) + + var rotatedClientSecret *string + if obj.Status.RotatedClientSecret != "" { + rotatedClientSecret = &obj.Status.RotatedClientSecret + } + + var rotatedExpiresAt *time.Time + if obj.Status.RotatedExpiresAt != nil { + t := obj.Status.RotatedExpiresAt.Time + rotatedExpiresAt = &t + } + + var currentExpiresAt *time.Time + if obj.Status.CurrentExpiresAt != nil { + t := obj.Status.CurrentExpiresAt.Time + currentExpiresAt = &t + } + return &ApplicationData{ Meta: shared.NewMetadata(obj.Namespace, obj.Name, obj.Labels), StatusPhase: phase, @@ -52,12 +91,76 @@ func (t *Translator) Translate(_ context.Context, obj *appv1.Application) (*Appl Name: obj.Name, ClientID: clientID, ClientSecret: clientSecret, - IssuerURL: nil, TeamName: obj.Spec.Team, ZoneName: obj.Spec.Zone.Name, + + RotatedClientSecret: rotatedClientSecret, + RotatedExpiresAt: rotatedExpiresAt, + CurrentExpiresAt: currentExpiresAt, + SecretRotationPhase: rotationPhase, + SecretRotationMessage: rotationMessage, }, nil } +// deriveRotationState maps the SecretRotation condition to an FSM phase. +// +// Rules: +// 1. Condition absent → DONE +// 2. Reason "InProgress" → ROTATING +// 3. Reason "Success" + RotatedClientSecret non-empty → GRACE_PERIOD_ACTIVE or GRACE_PERIOD_EXPIRING +// 4. Reason "Success" + RotatedClientSecret empty → DONE +// 5. Reason "Failed" or "Error" → FAILED +// 6. Unknown reason → ROTATING (safe fallback) +func deriveRotationState(obj *appv1.Application) (phase string, message *string) { + return deriveRotationStateAt(obj, time.Now()) +} + +// deriveRotationStateAt is the time-parameterised implementation of +// deriveRotationState, allowing deterministic testing. +func deriveRotationStateAt(obj *appv1.Application, now time.Time) (phase string, message *string) { + cond := meta.FindStatusCondition(obj.Status.Conditions, secretRotationConditionType) + if cond == nil { + return RotationPhaseDone, nil + } + + var msg *string + if cond.Message != "" { + msg = &cond.Message + } + + switch cond.Reason { + case "InProgress": + return RotationPhaseRotating, msg + case "Success": + if obj.Status.RotatedExpiresAt != nil && obj.Status.RotatedExpiresAt.Time.After(now) { + return gracePeriodPhase(cond.LastTransitionTime.Time, obj.Status.RotatedExpiresAt.Time, now), msg + } + return RotationPhaseDone, nil + case "Failed", "Error": + return RotationPhaseFailed, msg + default: + return RotationPhaseRotating, msg + } +} + +// gracePeriodPhase returns GRACE_PERIOD_EXPIRING when less than 20% of the +// total grace period remains, otherwise GRACE_PERIOD_ACTIVE. +// +// Precondition: rotatedExpiresAt is non-nil and in the future relative to now. +// The function is still defensive against edge cases (zero-length period, etc.). +func gracePeriodPhase(gracePeriodStart time.Time, expiresAt time.Time, now time.Time) string { + total := expiresAt.Sub(gracePeriodStart) + if total <= 0 { + return RotationPhaseGracePeriodExpiring + } + + remaining := expiresAt.Sub(now) + if float64(remaining)/float64(total) < gracePeriodExpiringThreshold { + return RotationPhaseGracePeriodExpiring + } + return RotationPhaseGracePeriodActive +} + // KeyFromObject derives the composite identity key from a live Application. func (t *Translator) KeyFromObject(obj *appv1.Application) ApplicationKey { return ApplicationKey{ diff --git a/projector/internal/domain/application/translator_test.go b/projector/internal/domain/application/translator_test.go index ef6b17ea6..a8e5fe337 100644 --- a/projector/internal/domain/application/translator_test.go +++ b/projector/internal/domain/application/translator_test.go @@ -6,6 +6,7 @@ package application_test import ( "context" + "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -63,7 +64,6 @@ var _ = Describe("Application Translator", func() { Expect(data.StatusMessage).To(Equal("all good")) Expect(data.ClientID).ToNot(BeNil()) Expect(*data.ClientID).To(Equal("client-123")) - Expect(data.IssuerURL).To(BeNil()) Expect(data.Meta.Environment).To(Equal("prod")) }) @@ -85,7 +85,6 @@ var _ = Describe("Application Translator", func() { data, err := t.Translate(context.Background(), obj) Expect(err).NotTo(HaveOccurred()) Expect(data.ClientID).To(BeNil()) - Expect(data.IssuerURL).To(BeNil()) }) It("should derive UNKNOWN status when no conditions are set", func() { @@ -161,4 +160,211 @@ var _ = Describe("Application Translator", func() { Expect(key.TeamName).To(Equal("simple-ns")) }) }) + + Describe("Secret Rotation State", func() { + baseApp := func() *appv1.Application { + return &appv1.Application{ + ObjectMeta: metav1.ObjectMeta{ + Name: "my-app", + Namespace: "prod--platform--narvi", + }, + Spec: appv1.ApplicationSpec{ + Team: "platform--narvi", + Zone: commontypes.ObjectRef{Name: "caas"}, + }, + } + } + + It("should return DONE when no SecretRotation condition exists", func() { + obj := baseApp() + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.SecretRotationPhase).To(Equal("DONE")) + Expect(data.SecretRotationMessage).To(BeNil()) + Expect(data.RotatedClientSecret).To(BeNil()) + Expect(data.RotatedExpiresAt).To(BeNil()) + Expect(data.CurrentExpiresAt).To(BeNil()) + }) + + It("should return ROTATING when condition reason is InProgress", func() { + obj := baseApp() + obj.Status.Conditions = []metav1.Condition{ + { + Type: "SecretRotation", + Status: metav1.ConditionFalse, + Reason: "InProgress", + Message: "waiting for identity", + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.SecretRotationPhase).To(Equal("ROTATING")) + Expect(data.SecretRotationMessage).ToNot(BeNil()) + Expect(*data.SecretRotationMessage).To(Equal("waiting for identity")) + }) + + It("should return GRACE_PERIOD_ACTIVE when plenty of grace period remains", func() { + // Grace period started 10 min ago, expires in 50 min → 83% remaining + gracePeriodStart := time.Now().Add(-10 * time.Minute) + expiresAt := metav1.NewTime(time.Now().Add(50 * time.Minute)) + currentExpiresAt := metav1.NewTime(time.Now().Add(72 * time.Hour)) + obj := baseApp() + obj.Status.Conditions = []metav1.Condition{ + { + Type: "SecretRotation", + Status: metav1.ConditionTrue, + Reason: "Success", + Message: "rotation completed", + LastTransitionTime: metav1.NewTime(gracePeriodStart), + }, + } + obj.Status.RotatedClientSecret = "secret-manager://old-secret-ref" + obj.Status.RotatedExpiresAt = &expiresAt + obj.Status.CurrentExpiresAt = ¤tExpiresAt + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.SecretRotationPhase).To(Equal("GRACE_PERIOD_ACTIVE")) + Expect(data.SecretRotationMessage).ToNot(BeNil()) + Expect(*data.SecretRotationMessage).To(Equal("rotation completed")) + Expect(data.RotatedClientSecret).ToNot(BeNil()) + Expect(*data.RotatedClientSecret).To(Equal("secret-manager://old-secret-ref")) + Expect(data.RotatedExpiresAt).ToNot(BeNil()) + Expect(data.CurrentExpiresAt).ToNot(BeNil()) + }) + + It("should return GRACE_PERIOD_EXPIRING when less than 20% of grace period remains", func() { + // Grace period started 100 min ago, expires in 10 min → 9% remaining + now := time.Now() + gracePeriodStart := now.Add(-100 * time.Minute) + expiresAt := metav1.NewTime(now.Add(10 * time.Minute)) + obj := baseApp() + obj.Status.Conditions = []metav1.Condition{ + { + Type: "SecretRotation", + Status: metav1.ConditionTrue, + Reason: "Success", + Message: "rotation completed", + LastTransitionTime: metav1.NewTime(gracePeriodStart), + }, + } + obj.Status.RotatedClientSecret = "secret-manager://old-secret-ref" + obj.Status.RotatedExpiresAt = &expiresAt + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.SecretRotationPhase).To(Equal("GRACE_PERIOD_EXPIRING")) + }) + + It("should return DONE when expiry has passed", func() { + now := time.Now() + gracePeriodStart := now.Add(-2 * time.Hour) + expiresAt := metav1.NewTime(now.Add(-5 * time.Minute)) + obj := baseApp() + obj.Status.Conditions = []metav1.Condition{ + { + Type: "SecretRotation", + Status: metav1.ConditionTrue, + Reason: "Success", + LastTransitionTime: metav1.NewTime(gracePeriodStart), + }, + } + obj.Status.RotatedClientSecret = "secret-manager://old-secret-ref" + obj.Status.RotatedExpiresAt = &expiresAt + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.SecretRotationPhase).To(Equal("DONE")) + }) + + It("should return GRACE_PERIOD_ACTIVE when RotatedExpiresAt is nil but condition is Success with rotated secret", func() { + obj := baseApp() + obj.Status.Conditions = []metav1.Condition{ + { + Type: "SecretRotation", + Status: metav1.ConditionTrue, + Reason: "Success", + }, + } + obj.Status.RotatedClientSecret = "secret-manager://old-secret-ref" + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + // RotatedExpiresAt is nil → grace period not trackable, falls through to DONE + Expect(data.SecretRotationPhase).To(Equal("DONE")) + }) + + It("should return DONE when condition is Success but grace period has expired", func() { + now := time.Now() + expiresAt := metav1.NewTime(now.Add(-1 * time.Hour)) + obj := baseApp() + obj.Status.Conditions = []metav1.Condition{ + { + Type: "SecretRotation", + Status: metav1.ConditionTrue, + Reason: "Success", + LastTransitionTime: metav1.NewTime(now.Add(-3 * time.Hour)), + }, + } + obj.Status.RotatedClientSecret = "secret-manager://old-secret-ref" + obj.Status.RotatedExpiresAt = &expiresAt + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.SecretRotationPhase).To(Equal("DONE")) + Expect(data.SecretRotationMessage).To(BeNil()) + }) + + It("should return DONE when condition is Success and rotated secret is empty", func() { + obj := baseApp() + obj.Status.Conditions = []metav1.Condition{ + { + Type: "SecretRotation", + Status: metav1.ConditionTrue, + Reason: "Success", + }, + } + obj.Status.RotatedClientSecret = "" + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.SecretRotationPhase).To(Equal("DONE")) + Expect(data.SecretRotationMessage).To(BeNil()) + }) + + It("should return FAILED when condition reason is Failed", func() { + obj := baseApp() + obj.Status.Conditions = []metav1.Condition{ + { + Type: "SecretRotation", + Status: metav1.ConditionFalse, + Reason: "Failed", + Message: "keycloak unavailable", + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.SecretRotationPhase).To(Equal("FAILED")) + Expect(*data.SecretRotationMessage).To(Equal("keycloak unavailable")) + }) + + It("should return ROTATING for unknown condition reason (fallback)", func() { + obj := baseApp() + obj.Status.Conditions = []metav1.Condition{ + { + Type: "SecretRotation", + Status: metav1.ConditionFalse, + Reason: "SomeFutureReason", + Message: "something new", + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.SecretRotationPhase).To(Equal("ROTATING")) + Expect(*data.SecretRotationMessage).To(Equal("something new")) + }) + }) }) diff --git a/projector/internal/domain/application/types.go b/projector/internal/domain/application/types.go index 01414be06..011902440 100644 --- a/projector/internal/domain/application/types.go +++ b/projector/internal/domain/application/types.go @@ -7,7 +7,11 @@ // on both Team and Zone. package application -import "github.com/telekom/controlplane/projector/internal/domain/shared" +import ( + "time" + + "github.com/telekom/controlplane/projector/internal/domain/shared" +) // ApplicationKey is the composite identity key for Application entities. // Application names are only unique per team (composite unique index on @@ -25,7 +29,13 @@ type ApplicationData struct { Name string ClientID *string // optional/nillable — nil when Status.ClientId is empty ClientSecret *string // optional/nillable — nil when Spec.Secret is empty - IssuerURL *string // optional/nillable — always nil (CR does not carry it) TeamName string // resolved to owner_team FK ZoneName string // resolved to zone FK + + // Secret rotation fields + RotatedClientSecret *string // secret-manager reference to previous secret + RotatedExpiresAt *time.Time // when the rotated (old) secret stops being valid + CurrentExpiresAt *time.Time // when the current secret will auto-expire + SecretRotationPhase string // FSM state: DONE, ROTATING, GRACE_PERIOD_ACTIVE, GRACE_PERIOD_EXPIRING, FAILED + SecretRotationMessage *string // human-readable message (nil when DONE) } diff --git a/projector/internal/domain/approval/deps.go b/projector/internal/domain/approval/deps.go index 2b27e2004..382e176fd 100644 --- a/projector/internal/domain/approval/deps.go +++ b/projector/internal/domain/approval/deps.go @@ -10,10 +10,19 @@ import "context" // Approval repository. // // - FindAPISubscriptionByMeta: resolves the parent ApiSubscription FK -// (required) by k8s namespace + name. If the ApiSubscription is missing, -// the upsert fails with ErrDependencyMissing and the reconciler requeues. +// by k8s namespace + name. +// - FindEventSubscriptionByMeta: resolves the parent EventSubscription FK +// by k8s namespace + name. +// - EvictAPISubscription: evicts a stale cached ApiSubscription ID. +// - EvictEventSubscription: evicts a stale cached EventSubscription ID. +// +// The repository uses one or the other depending on the target kind +// (ApiSubscription vs EventSubscription). // // Satisfied by *infrastructure.IDResolver at wiring time. type ApprovalDeps interface { FindAPISubscriptionByMeta(ctx context.Context, namespace, name string) (int, error) + FindEventSubscriptionByMeta(ctx context.Context, namespace, name string) (int, error) + EvictAPISubscription(namespace, name string) + EvictEventSubscription(namespace, name string) } diff --git a/projector/internal/domain/approval/repository.go b/projector/internal/domain/approval/repository.go index 2c1ea7a7b..04c17b72d 100644 --- a/projector/internal/domain/approval/repository.go +++ b/projector/internal/domain/approval/repository.go @@ -24,9 +24,10 @@ const entityType = "approval" // Repository performs typed persistence operations for Approval entities. // It implements runtime.Repository[ApprovalKey, *ApprovalData]. // -// Approval has a required FK dependency on ApiSubscription. The FK column -// (api_subscription_approval) is an edge column, not a schema field, so -// ent's UpdateNewValues() on conflict will NOT update it. After the initial +// Approval has a required FK dependency on either ApiSubscription or +// EventSubscription, determined by the TargetKind field in ApprovalData. +// The FK column is an edge column, not a schema field, so ent's +// UpdateNewValues() on conflict will NOT update it. After the initial // INSERT sets the FK correctly, subsequent upserts (ON CONFLICT UPDATE) // explicitly update the FK via UpdateOneID to handle potential subscription // re-targeting. A single cache entry keyed by namespace:name is maintained. @@ -49,12 +50,41 @@ func NewRepository(client *ent.Client, cache *infrastructure.EdgeCache, deps App } } +// resolveSubscriptionID resolves the parent subscription FK based on the +// target kind (ApiSubscription or EventSubscription). +func (r *Repository) resolveSubscriptionID(ctx context.Context, data *ApprovalData) (int, error) { + switch data.TargetKind { + case TargetKindEventSubscription: + id, err := r.deps.FindEventSubscriptionByMeta(ctx, data.SubscriptionNamespace, data.SubscriptionName) + if err != nil { + if errors.Is(err, infrastructure.ErrEntityNotFound) { + return 0, runtime.WrapDependencyMissing("event_subscription", + data.SubscriptionNamespace+"/"+data.SubscriptionName) + } + return 0, fmt.Errorf("find event_subscription %s/%s: %w", + data.SubscriptionNamespace, data.SubscriptionName, err) + } + return id, nil + default: // TargetKindAPISubscription + id, err := r.deps.FindAPISubscriptionByMeta(ctx, data.SubscriptionNamespace, data.SubscriptionName) + if err != nil { + if errors.Is(err, infrastructure.ErrEntityNotFound) { + return 0, runtime.WrapDependencyMissing("api_subscription", + data.SubscriptionNamespace+"/"+data.SubscriptionName) + } + return 0, fmt.Errorf("find api_subscription %s/%s: %w", + data.SubscriptionNamespace, data.SubscriptionName, err) + } + return id, nil + } +} + // Upsert creates or updates an Approval entity in the database. // // Steps: -// 1. Resolve parent ApiSubscription FK (required) via cache-based meta-key -// lookup. Returns ErrDependencyMissing if the subscription has not been -// synced yet. +// 1. Resolve parent subscription FK (required) via cache-based meta-key +// lookup, branching on TargetKind. Returns ErrDependencyMissing if the +// subscription has not been synced yet. // 2. Create with ON CONFLICT (namespace, name) + UpdateNewValues(). // 3. Explicitly update the subscription FK via UpdateOneID, because ent's // edge-based FK columns are not included in the ON CONFLICT UPDATE SET @@ -66,14 +96,9 @@ func (r *Repository) Upsert(ctx context.Context, data *ApprovalData) error { metrics.DBOperationDuration.WithLabelValues(entityType, metrics.OperationUpsert).Observe(time.Since(start).Seconds()) }() - subID, err := r.deps.FindAPISubscriptionByMeta(ctx, data.SubscriptionNamespace, data.SubscriptionName) + subID, err := r.resolveSubscriptionID(ctx, data) if err != nil { - if errors.Is(err, infrastructure.ErrEntityNotFound) { - return runtime.WrapDependencyMissing("api_subscription", - data.SubscriptionNamespace+"/"+data.SubscriptionName) - } - return fmt.Errorf("find api_subscription %s/%s: %w", - data.SubscriptionNamespace, data.SubscriptionName, err) + return err } create := r.client.Approval.Create(). @@ -89,27 +114,47 @@ func (r *Repository) Upsert(ctx context.Context, data *ApprovalData) error { SetDecider(data.Decider). SetDeciderTeamName(data.Decider.TeamName). SetDecisions(data.Decisions). - SetAvailableTransitions(data.AvailableTransitions). - SetAPISubscriptionID(subID) + SetAvailableTransitions(data.AvailableTransitions) + + // Set the correct subscription FK based on target kind. + if data.TargetKind == TargetKindEventSubscription { + create = create.SetEventSubscriptionID(subID) + } else { + create = create.SetAPISubscriptionID(subID) + } approvalID, upsertErr := create. OnConflictColumns(entapproval.FieldNamespace, entapproval.FieldName). UpdateNewValues(). ID(ctx) if upsertErr != nil { + if infrastructure.IsFKViolation(upsertErr) { + r.evictSubscriptionCache(data) + return runtime.WrapDependencyMissing("api_subscription", + data.SubscriptionNamespace+"/"+data.SubscriptionName) + } return fmt.Errorf("upsert approval %s/%s (sub %s/%s): %w", data.Meta.Namespace, data.Meta.Name, data.SubscriptionNamespace, data.SubscriptionName, upsertErr) } // Explicitly update the subscription FK. The edge-based FK column - // (api_subscription_approval) is not included in UpdateNewValues() - // ON CONFLICT SET clauses because ent treats it as an edge, not a field. - // On the initial INSERT the FK is set correctly via the edge spec, but - // on subsequent upserts the old value would be preserved without this. - if err := r.client.Approval.UpdateOneID(approvalID). - SetAPISubscriptionID(subID). - Exec(ctx); err != nil { + // is not included in UpdateNewValues() ON CONFLICT SET clauses because + // ent treats it as an edge, not a field. On the initial INSERT the FK + // is set correctly via the edge spec, but on subsequent upserts the old + // value would be preserved without this. + update := r.client.Approval.UpdateOneID(approvalID) + if data.TargetKind == TargetKindEventSubscription { + update = update.SetEventSubscriptionID(subID).ClearAPISubscription() + } else { + update = update.SetAPISubscriptionID(subID).ClearEventSubscription() + } + if err := update.Exec(ctx); err != nil { + if infrastructure.IsFKViolation(err) { + r.evictSubscriptionCache(data) + return runtime.WrapDependencyMissing("api_subscription", + data.SubscriptionNamespace+"/"+data.SubscriptionName) + } return fmt.Errorf("update subscription FK for approval %d (%s/%s): %w", approvalID, data.Meta.Namespace, data.Meta.Name, err) } @@ -119,6 +164,16 @@ func (r *Repository) Upsert(ctx context.Context, data *ApprovalData) error { return nil } +// evictSubscriptionCache removes the stale cached subscription ID so the +// next reconcile attempt performs a fresh DB lookup. +func (r *Repository) evictSubscriptionCache(data *ApprovalData) { + if data.TargetKind == TargetKindEventSubscription { + r.deps.EvictEventSubscription(data.SubscriptionNamespace, data.SubscriptionName) + } else { + r.deps.EvictAPISubscription(data.SubscriptionNamespace, data.SubscriptionName) + } +} + // Delete removes an Approval entity from the database by its Kubernetes // object identity (namespace + name). Also cleans the cache entry if the // entity was found. diff --git a/projector/internal/domain/approval/repository_test.go b/projector/internal/domain/approval/repository_test.go index 48705eefe..a6cffc8c2 100644 --- a/projector/internal/domain/approval/repository_test.go +++ b/projector/internal/domain/approval/repository_test.go @@ -18,6 +18,7 @@ import ( entapiexposure "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" entapproval "github.com/telekom/controlplane/controlplane-api/ent/approval" "github.com/telekom/controlplane/controlplane-api/ent/enttest" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" _ "github.com/telekom/controlplane/controlplane-api/ent/runtime" "github.com/telekom/controlplane/controlplane-api/ent/zone" "github.com/telekom/controlplane/controlplane-api/pkg/model" @@ -30,8 +31,11 @@ import ( // mockApprovalDeps implements approval.ApprovalDeps for testing. type mockApprovalDeps struct { - subIDs map[string]int // key: "namespace:name" - subErr error // if non-nil, FindAPISubscriptionByMeta always returns this error + subIDs map[string]int // key: "namespace:name" + subErr error // if non-nil, FindAPISubscriptionByMeta always returns this error + eventSubIDs map[string]int // key: "namespace:name" + eventSubErr error // if non-nil, FindEventSubscriptionByMeta always returns this error + evicted []string // tracks eviction calls as "namespace:name" } func (m *mockApprovalDeps) FindAPISubscriptionByMeta(_ context.Context, namespace, name string) (int, error) { @@ -45,6 +49,25 @@ func (m *mockApprovalDeps) FindAPISubscriptionByMeta(_ context.Context, namespac return 0, fmt.Errorf("api_subscription %s/%s: %w", namespace, name, infrastructure.ErrEntityNotFound) } +func (m *mockApprovalDeps) FindEventSubscriptionByMeta(_ context.Context, namespace, name string) (int, error) { + if m.eventSubErr != nil { + return 0, m.eventSubErr + } + key := namespace + ":" + name + if id, ok := m.eventSubIDs[key]; ok { + return id, nil + } + return 0, fmt.Errorf("event_subscription %s/%s: %w", namespace, name, infrastructure.ErrEntityNotFound) +} + +func (m *mockApprovalDeps) EvictAPISubscription(namespace, name string) { + m.evicted = append(m.evicted, namespace+":"+name) +} + +func (m *mockApprovalDeps) EvictEventSubscription(namespace, name string) { + m.evicted = append(m.evicted, namespace+":"+name) +} + var _ = Describe("Approval Repository", func() { var ( client *ent.Client @@ -113,7 +136,8 @@ var _ = Describe("Approval Repository", func() { subID = sub.ID deps = &mockApprovalDeps{ - subIDs: map[string]int{"prod--platform--narvi:my-sub": subID}, + subIDs: map[string]int{"prod--platform--narvi:my-sub": subID}, + eventSubIDs: map[string]int{}, } repo = approval.NewRepository(client, cache, deps) @@ -145,6 +169,7 @@ var _ = Describe("Approval Repository", func() { }, Decisions: []model.Decision{}, AvailableTransitions: []model.AvailableTransition{}, + TargetKind: "ApiSubscription", SubscriptionNamespace: "prod--platform--narvi", SubscriptionName: "my-sub", } @@ -176,9 +201,56 @@ var _ = Describe("Approval Repository", func() { Expect(a.Edges.APISubscription.ID).To(Equal(subID)) }) + It("should create a new approval with event subscription FK", func() { + // Seed an EventSubscription. + z, err := client.Zone.Query().Where(zone.NameEQ("caas")).Only(ctx) + Expect(err).NotTo(HaveOccurred()) + t, err := client.Team.Query().Only(ctx) + Expect(err).NotTo(HaveOccurred()) + subscriberApp, err := client.Application.Create(). + SetName("event-consumer"). + SetNamespace("platform--narvi"). + SetOwnerTeamID(t.ID). + SetZoneID(z.ID). + Save(ctx) + Expect(err).NotTo(HaveOccurred()) + + eventSub, err := client.EventSubscription.Create(). + SetEventType("user.created"). + SetNamespace("platform--narvi"). + SetName("my-event-sub"). + SetDeliveryType(eventsubscription.DeliveryTypeCallback). + SetOwnerID(subscriberApp.ID). + Save(ctx) + Expect(err).NotTo(HaveOccurred()) + + deps.eventSubIDs["prod--platform--narvi:my-event-sub"] = eventSub.ID + + data := baseData() + data.Meta.Name = "eventsubscription--my-event-sub" + data.TargetKind = "EventSubscription" + data.SubscriptionNamespace = "prod--platform--narvi" + data.SubscriptionName = "my-event-sub" + + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + // Verify the approval was created with event subscription FK. + a, err := client.Approval.Query(). + Where( + entapproval.NamespaceEQ("prod--platform--narvi"), + entapproval.NameEQ("eventsubscription--my-event-sub"), + ). + WithEventSubscription(). + Only(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(a.Edges.EventSubscription).NotTo(BeNil()) + Expect(a.Edges.EventSubscription.ID).To(Equal(eventSub.ID)) + }) + It("should return ErrDependencyMissing when subscription is not cached", func() { missingDeps := &mockApprovalDeps{ - subIDs: map[string]int{}, // empty — no subscription found + subIDs: map[string]int{}, // empty — no subscription found + eventSubIDs: map[string]int{}, } repo = approval.NewRepository(client, cache, missingDeps) @@ -188,15 +260,42 @@ var _ = Describe("Approval Repository", func() { Expect(errors.Is(err, runtime.ErrDependencyMissing)).To(BeTrue()) }) + It("should return ErrDependencyMissing when event subscription is not cached", func() { + data := baseData() + data.TargetKind = "EventSubscription" + data.SubscriptionName = "missing-event-sub" + err := repo.Upsert(ctx, data) + Expect(err).To(HaveOccurred()) + Expect(errors.Is(err, runtime.ErrDependencyMissing)).To(BeTrue()) + }) + It("should propagate non-ErrEntityNotFound errors from FindAPISubscriptionByMeta", func() { dbErr := errors.New("connection refused") failDeps := &mockApprovalDeps{ - subIDs: map[string]int{}, - subErr: dbErr, + subIDs: map[string]int{}, + subErr: dbErr, + eventSubIDs: map[string]int{}, + } + failRepo := approval.NewRepository(client, cache, failDeps) + + data := baseData() + err := failRepo.Upsert(ctx, data) + Expect(err).To(HaveOccurred()) + Expect(runtime.IsDependencyMissing(err)).To(BeFalse()) + Expect(errors.Is(err, dbErr)).To(BeTrue()) + }) + + It("should propagate non-ErrEntityNotFound errors from FindEventSubscriptionByMeta", func() { + dbErr := errors.New("connection refused") + failDeps := &mockApprovalDeps{ + subIDs: map[string]int{}, + eventSubIDs: map[string]int{}, + eventSubErr: dbErr, } failRepo := approval.NewRepository(client, cache, failDeps) data := baseData() + data.TargetKind = "EventSubscription" err := failRepo.Upsert(ctx, data) Expect(err).To(HaveOccurred()) Expect(runtime.IsDependencyMissing(err)).To(BeFalse()) diff --git a/projector/internal/domain/approval/translator.go b/projector/internal/domain/approval/translator.go index fbc703337..5584b477d 100644 --- a/projector/internal/domain/approval/translator.go +++ b/projector/internal/domain/approval/translator.go @@ -9,6 +9,7 @@ import ( "strings" approvalv1 "github.com/telekom/controlplane/approval/api/v1" + cconfig "github.com/telekom/controlplane/common/pkg/config" "github.com/telekom/controlplane/controlplane-api/pkg/model" "github.com/telekom/controlplane/projector/internal/domain/shared" "github.com/telekom/controlplane/projector/internal/runtime" @@ -19,7 +20,7 @@ import ( // keys. // // ShouldSkip filters out CRs that lack the required fields for FK resolution: -// empty spec.target.Name, empty spec.action, or spec.target.Kind != "ApiSubscription". +// empty spec.target.Name, empty spec.action, or unsupported spec.target.Kind. // // KeyFromDelete uses lastKnown when available. When lastKnown is nil, returns // ErrDeleteKeyLost because the subscription namespace/name cannot be derived @@ -29,8 +30,13 @@ type Translator struct{} // compile-time interface check. var _ runtime.Translator[*approvalv1.Approval, *ApprovalData, ApprovalKey] = (*Translator)(nil) +// isSupportedTargetKind returns true if the target kind is one we can resolve. +func isSupportedTargetKind(kind string) bool { + return kind == TargetKindAPISubscription || kind == TargetKindEventSubscription +} + // ShouldSkip returns true if the Approval CR lacks the required fields for -// sync (missing target name, empty action, or non-ApiSubscription target kind). +// sync (missing target name, empty action, or unsupported target kind). func (t *Translator) ShouldSkip(obj *approvalv1.Approval) (bool, string) { if obj.Spec.Target.Name == "" { return true, "spec.target.name is empty" @@ -38,9 +44,11 @@ func (t *Translator) ShouldSkip(obj *approvalv1.Approval) (bool, string) { if obj.Spec.Action == "" { return true, "spec.action is empty" } - // TODO: This filter should be removed in the future when other target kinds are supported. - if obj.Spec.Target.TypeMeta.Kind != "ApiSubscription" { - return true, "spec.target.kind is not ApiSubscription" + if !isSupportedTargetKind(obj.Spec.Target.TypeMeta.Kind) { + return true, "spec.target.kind is not ApiSubscription or EventSubscription" + } + if !cconfig.FeaturePubSub.IsEnabled() && obj.Spec.Target.TypeMeta.Kind == TargetKindEventSubscription { + return true, "pubsub feature is disabled" } if obj.Spec.Decider.TeamName == "" { @@ -59,7 +67,7 @@ func (t *Translator) ShouldSkip(obj *approvalv1.Approval) (bool, string) { // computed by the approval-operator's FSM. // // The subscription reference is derived from spec.target, which carries the -// k8s namespace and name of the ApiSubscription CR being approved. If the +// k8s namespace and name of the target subscription CR being approved. If the // target namespace is empty, it falls back to the Approval CR's own namespace // (same-namespace reference). func (t *Translator) Translate(_ context.Context, obj *approvalv1.Approval) (*ApprovalData, error) { @@ -81,6 +89,7 @@ func (t *Translator) Translate(_ context.Context, obj *approvalv1.Approval) (*Ap Decider: mapDecider(obj.Spec.Decider), Decisions: mapDecisions(obj.Spec.Decisions), AvailableTransitions: mapAvailableTransitions(obj.Status.AvailableTransitions), + TargetKind: obj.Spec.Target.TypeMeta.Kind, SubscriptionNamespace: targetNamespace, SubscriptionName: obj.Spec.Target.Name, }, nil diff --git a/projector/internal/domain/approval/translator_test.go b/projector/internal/domain/approval/translator_test.go index 80ee45ff8..6c22fc758 100644 --- a/projector/internal/domain/approval/translator_test.go +++ b/projector/internal/domain/approval/translator_test.go @@ -11,6 +11,7 @@ import ( . "github.com/onsi/gomega" approvalv1 "github.com/telekom/controlplane/approval/api/v1" + cconfig "github.com/telekom/controlplane/common/pkg/config" ctypes "github.com/telekom/controlplane/common/pkg/types" "github.com/telekom/controlplane/controlplane-api/pkg/model" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -53,7 +54,7 @@ var _ = Describe("Approval Translator", func() { Expect(reason).To(ContainSubstring("action")) }) - It("should skip when target kind is not ApiSubscription", func() { + It("should skip when target kind is unsupported", func() { obj := &approvalv1.Approval{ Spec: approvalv1.ApprovalSpec{ Action: "subscribe", @@ -65,10 +66,64 @@ var _ = Describe("Approval Translator", func() { } skip, reason := t.ShouldSkip(obj) Expect(skip).To(BeTrue()) - Expect(reason).To(ContainSubstring("ApiSubscription")) + Expect(reason).To(ContainSubstring("ApiSubscription or EventSubscription")) }) - It("should not skip a valid Approval CR", func() { + It("should not skip a valid Approval CR targeting ApiSubscription", func() { + obj := &approvalv1.Approval{ + Spec: approvalv1.ApprovalSpec{ + Action: "subscribe", + Target: ctypes.TypedObjectRef{ + TypeMeta: metav1.TypeMeta{Kind: "ApiSubscription"}, + ObjectRef: ctypes.ObjectRef{Name: "my-sub"}, + }, + Decider: approvalv1.Decider{TeamName: "some-team"}, + }, + } + skip, reason := t.ShouldSkip(obj) + Expect(skip).To(BeFalse()) + Expect(reason).To(BeEmpty()) + }) + + It("should not skip a valid Approval CR targeting EventSubscription", func() { + cconfig.SetFeatureEnabled(cconfig.FeaturePubSub, true) + defer cconfig.SetFeatureEnabled(cconfig.FeaturePubSub, false) + + obj := &approvalv1.Approval{ + Spec: approvalv1.ApprovalSpec{ + Action: "subscribe", + Target: ctypes.TypedObjectRef{ + TypeMeta: metav1.TypeMeta{Kind: "EventSubscription"}, + ObjectRef: ctypes.ObjectRef{Name: "my-event-sub"}, + }, + Decider: approvalv1.Decider{TeamName: "some-team"}, + }, + } + skip, reason := t.ShouldSkip(obj) + Expect(skip).To(BeFalse()) + Expect(reason).To(BeEmpty()) + }) + It("should skip EventSubscription target when pubsub feature is disabled", func() { + cconfig.SetFeatureEnabled(cconfig.FeaturePubSub, false) + + obj := &approvalv1.Approval{ + Spec: approvalv1.ApprovalSpec{ + Action: "subscribe", + Target: ctypes.TypedObjectRef{ + TypeMeta: metav1.TypeMeta{Kind: "EventSubscription"}, + ObjectRef: ctypes.ObjectRef{Name: "my-event-sub"}, + }, + Decider: approvalv1.Decider{TeamName: "some-team"}, + }, + } + skip, reason := t.ShouldSkip(obj) + Expect(skip).To(BeTrue()) + Expect(reason).To(ContainSubstring("pubsub feature is disabled")) + }) + + It("should not skip ApiSubscription target when pubsub feature is disabled", func() { + cconfig.SetFeatureEnabled(cconfig.FeaturePubSub, false) + obj := &approvalv1.Approval{ Spec: approvalv1.ApprovalSpec{ Action: "subscribe", @@ -86,7 +141,7 @@ var _ = Describe("Approval Translator", func() { }) Describe("Translate", func() { - It("should populate all fields from the CR", func() { + It("should populate all fields from the CR targeting ApiSubscription", func() { reason := "need access" obj := &approvalv1.Approval{ ObjectMeta: metav1.ObjectMeta{ @@ -148,6 +203,7 @@ var _ = Describe("Approval Translator", func() { Expect(data.State).To(Equal("GRANTED")) Expect(data.Action).To(Equal("subscribe")) Expect(data.Strategy).To(Equal("FOUR_EYES")) + Expect(data.TargetKind).To(Equal("ApiSubscription")) Expect(data.Requester.TeamName).To(Equal("narvi")) Expect(data.Requester.TeamEmail).To(Equal("narvi@example.com")) Expect(*data.Requester.Reason).To(Equal("need access")) @@ -165,6 +221,38 @@ var _ = Describe("Approval Translator", func() { Expect(data.SubscriptionName).To(Equal("my-sub")) }) + It("should set TargetKind to EventSubscription when target kind is EventSubscription", func() { + obj := &approvalv1.Approval{ + ObjectMeta: metav1.ObjectMeta{ + Name: "eventsubscription--my-event-sub", + Namespace: "prod--platform--narvi", + Labels: map[string]string{ + "cp.ei.telekom.de/environment": "prod", + }, + }, + Spec: approvalv1.ApprovalSpec{ + Action: "subscribe", + Strategy: approvalv1.ApprovalStrategySimple, + State: approvalv1.ApprovalStatePending, + Target: ctypes.TypedObjectRef{ + TypeMeta: metav1.TypeMeta{Kind: "EventSubscription"}, + ObjectRef: ctypes.ObjectRef{ + Namespace: "prod--platform--narvi", + Name: "my-event-sub", + }, + }, + Requester: approvalv1.Requester{TeamName: "narvi"}, + Decider: approvalv1.Decider{TeamName: "provider"}, + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.TargetKind).To(Equal("EventSubscription")) + Expect(data.SubscriptionNamespace).To(Equal("prod--platform--narvi")) + Expect(data.SubscriptionName).To(Equal("my-event-sub")) + }) + It("should fall back to own namespace when target namespace is empty", func() { obj := &approvalv1.Approval{ ObjectMeta: metav1.ObjectMeta{ diff --git a/projector/internal/domain/approval/types.go b/projector/internal/domain/approval/types.go index 995e7acb2..c44e605a6 100644 --- a/projector/internal/domain/approval/types.go +++ b/projector/internal/domain/approval/types.go @@ -4,8 +4,9 @@ // Package approval implements the Approval resource module for the projector // operator. Approval is a Level 4 entity with a required FK dependency -// on ApiSubscription. It uses namespace+name as the unique conflict key and -// resolves the subscription FK via cache-based meta-key lookup. +// on ApiSubscription or EventSubscription (determined by TargetKind). It uses +// namespace+name as the unique conflict key and resolves the subscription FK +// via cache-based meta-key lookup. package approval import ( @@ -13,6 +14,12 @@ import ( "github.com/telekom/controlplane/projector/internal/domain/shared" ) +// TargetKind constants for FK resolution. +const ( + TargetKindAPISubscription = "ApiSubscription" + TargetKindEventSubscription = "EventSubscription" +) + // ApprovalKey is the composite identity key for Approval entities. // Namespace + Name form the unique index and are sufficient for both // upsert conflict detection and delete identification. @@ -37,7 +44,10 @@ type ApprovalData struct { Decider model.DeciderInfo Decisions []model.Decision AvailableTransitions []model.AvailableTransition - // ApiSubscription reference via spec.target (k8s namespace + name). + // TargetKind indicates whether the approval targets an ApiSubscription + // or EventSubscription. Used by the repository to resolve the correct FK. + TargetKind string // "ApiSubscription" or "EventSubscription" + // Subscription reference via spec.target (k8s namespace + name). SubscriptionNamespace string SubscriptionName string } diff --git a/projector/internal/domain/approvalrequest/deps.go b/projector/internal/domain/approvalrequest/deps.go index 66f29675f..06d08a71f 100644 --- a/projector/internal/domain/approvalrequest/deps.go +++ b/projector/internal/domain/approvalrequest/deps.go @@ -10,10 +10,19 @@ import "context" // ApprovalRequest repository. // // - FindAPISubscriptionByMeta: resolves the parent ApiSubscription FK -// (required) by k8s namespace + name. If the ApiSubscription is missing, -// the upsert fails with ErrDependencyMissing and the reconciler requeues. +// by k8s namespace + name. +// - FindEventSubscriptionByMeta: resolves the parent EventSubscription FK +// by k8s namespace + name. +// - EvictAPISubscription: evicts a stale cached ApiSubscription ID. +// - EvictEventSubscription: evicts a stale cached EventSubscription ID. +// +// The repository uses one or the other depending on the target kind +// (ApiSubscription vs EventSubscription). // // Satisfied by *infrastructure.IDResolver at wiring time. type ApprovalRequestDeps interface { FindAPISubscriptionByMeta(ctx context.Context, namespace, name string) (int, error) + FindEventSubscriptionByMeta(ctx context.Context, namespace, name string) (int, error) + EvictAPISubscription(namespace, name string) + EvictEventSubscription(namespace, name string) } diff --git a/projector/internal/domain/approvalrequest/repository.go b/projector/internal/domain/approvalrequest/repository.go index de8209f13..86f89b3b8 100644 --- a/projector/internal/domain/approvalrequest/repository.go +++ b/projector/internal/domain/approvalrequest/repository.go @@ -25,12 +25,12 @@ const entityType = "approvalrequest" // Repository performs typed persistence operations for ApprovalRequest // entities. It implements runtime.Repository[ApprovalRequestKey, *ApprovalRequestData]. // -// ApprovalRequest has a required FK dependency on ApiSubscription (M2O). The -// FK column (api_subscription_approval_requests) is an edge column, not a -// schema field, so ent's UpdateNewValues() on conflict will NOT update it. -// After the initial INSERT sets the FK correctly, subsequent upserts (ON -// CONFLICT UPDATE) explicitly update the FK via UpdateOneID to handle -// potential subscription re-targeting. A single cache entry keyed by +// ApprovalRequest has a required FK dependency on either ApiSubscription or +// EventSubscription (determined by TargetKind). The FK column is an edge +// column, not a schema field, so ent's UpdateNewValues() on conflict will NOT +// update it. After the initial INSERT sets the FK correctly, subsequent +// upserts (ON CONFLICT UPDATE) explicitly update the FK via UpdateOneID to +// handle potential subscription re-targeting. A single cache entry keyed by // namespace:name is maintained. type Repository struct { client *ent.Client @@ -51,12 +51,41 @@ func NewRepository(client *ent.Client, cache *infrastructure.EdgeCache, deps App } } +// resolveSubscriptionID resolves the parent subscription FK based on the +// target kind (ApiSubscription or EventSubscription). +func (r *Repository) resolveSubscriptionID(ctx context.Context, data *ApprovalRequestData) (int, error) { + switch data.TargetKind { + case TargetKindEventSubscription: + id, err := r.deps.FindEventSubscriptionByMeta(ctx, data.SubscriptionNamespace, data.SubscriptionName) + if err != nil { + if errors.Is(err, infrastructure.ErrEntityNotFound) { + return 0, runtime.WrapDependencyMissing("event_subscription", + data.SubscriptionNamespace+"/"+data.SubscriptionName) + } + return 0, fmt.Errorf("find event_subscription %s/%s: %w", + data.SubscriptionNamespace, data.SubscriptionName, err) + } + return id, nil + default: // TargetKindAPISubscription + id, err := r.deps.FindAPISubscriptionByMeta(ctx, data.SubscriptionNamespace, data.SubscriptionName) + if err != nil { + if errors.Is(err, infrastructure.ErrEntityNotFound) { + return 0, runtime.WrapDependencyMissing("api_subscription", + data.SubscriptionNamespace+"/"+data.SubscriptionName) + } + return 0, fmt.Errorf("find api_subscription %s/%s: %w", + data.SubscriptionNamespace, data.SubscriptionName, err) + } + return id, nil + } +} + // Upsert creates or updates an ApprovalRequest entity in the database. // // Steps: -// 1. Resolve parent ApiSubscription FK (required) via cache-based meta-key -// lookup. Returns ErrDependencyMissing if the subscription has not been -// synced yet. +// 1. Resolve parent subscription FK (required) via cache-based meta-key +// lookup, branching on TargetKind. Returns ErrDependencyMissing if the +// subscription has not been synced yet. // 2. Create with ON CONFLICT (namespace, name) + UpdateNewValues(). // 3. Explicitly update the subscription FK via UpdateOneID, because ent's // edge-based FK columns are not included in the ON CONFLICT UPDATE SET @@ -68,14 +97,9 @@ func (r *Repository) Upsert(ctx context.Context, data *ApprovalRequestData) erro metrics.DBOperationDuration.WithLabelValues(entityType, metrics.OperationUpsert).Observe(time.Since(start).Seconds()) }() - subID, err := r.deps.FindAPISubscriptionByMeta(ctx, data.SubscriptionNamespace, data.SubscriptionName) + subID, err := r.resolveSubscriptionID(ctx, data) if err != nil { - if errors.Is(err, infrastructure.ErrEntityNotFound) { - return runtime.WrapDependencyMissing("api_subscription", - data.SubscriptionNamespace+"/"+data.SubscriptionName) - } - return fmt.Errorf("find api_subscription %s/%s: %w", - data.SubscriptionNamespace, data.SubscriptionName, err) + return err } create := r.client.ApprovalRequest.Create(). @@ -91,28 +115,47 @@ func (r *Repository) Upsert(ctx context.Context, data *ApprovalRequestData) erro SetDecider(data.Decider). SetDeciderTeamName(data.Decider.TeamName). SetDecisions(data.Decisions). - SetAvailableTransitions(data.AvailableTransitions). - SetAPISubscriptionID(subID) + SetAvailableTransitions(data.AvailableTransitions) + + // Set the correct subscription FK based on target kind. + if data.TargetKind == TargetKindEventSubscription { + create = create.SetEventSubscriptionID(subID) + } else { + create = create.SetAPISubscriptionID(subID) + } arID, upsertErr := create. OnConflictColumns(entapprovalrequest.FieldNamespace, entapprovalrequest.FieldName). UpdateNewValues(). ID(ctx) if upsertErr != nil { + if infrastructure.IsFKViolation(upsertErr) { + r.evictSubscriptionCache(data) + return runtime.WrapDependencyMissing("api_subscription", + data.SubscriptionNamespace+"/"+data.SubscriptionName) + } return fmt.Errorf("upsert approval_request %s/%s (sub %s/%s): %w", data.Meta.Namespace, data.Meta.Name, data.SubscriptionNamespace, data.SubscriptionName, upsertErr) } // Explicitly update the subscription FK. The edge-based FK column - // (api_subscription_approval_requests) is not included in - // UpdateNewValues() ON CONFLICT SET clauses because ent treats it as an - // edge, not a field. On the initial INSERT the FK is set correctly via - // the edge spec, but on subsequent upserts the old value would be - // preserved without this. - if err := r.client.ApprovalRequest.UpdateOneID(arID). - SetAPISubscriptionID(subID). - Exec(ctx); err != nil { + // is not included in UpdateNewValues() ON CONFLICT SET clauses because + // ent treats it as an edge, not a field. On the initial INSERT the FK + // is set correctly via the edge spec, but on subsequent upserts the old + // value would be preserved without this. + update := r.client.ApprovalRequest.UpdateOneID(arID) + if data.TargetKind == TargetKindEventSubscription { + update = update.SetEventSubscriptionID(subID).ClearAPISubscription() + } else { + update = update.SetAPISubscriptionID(subID).ClearEventSubscription() + } + if err := update.Exec(ctx); err != nil { + if infrastructure.IsFKViolation(err) { + r.evictSubscriptionCache(data) + return runtime.WrapDependencyMissing("api_subscription", + data.SubscriptionNamespace+"/"+data.SubscriptionName) + } return fmt.Errorf("update subscription FK for approval_request %d (%s/%s): %w", arID, data.Meta.Namespace, data.Meta.Name, err) } @@ -122,6 +165,16 @@ func (r *Repository) Upsert(ctx context.Context, data *ApprovalRequestData) erro return nil } +// evictSubscriptionCache removes the stale cached subscription ID so the +// next reconcile attempt performs a fresh DB lookup. +func (r *Repository) evictSubscriptionCache(data *ApprovalRequestData) { + if data.TargetKind == TargetKindEventSubscription { + r.deps.EvictEventSubscription(data.SubscriptionNamespace, data.SubscriptionName) + } else { + r.deps.EvictAPISubscription(data.SubscriptionNamespace, data.SubscriptionName) + } +} + // Delete removes an ApprovalRequest entity from the database by its // Kubernetes object identity (namespace + name). Also cleans the cache entry // if the entity was found. diff --git a/projector/internal/domain/approvalrequest/repository_test.go b/projector/internal/domain/approvalrequest/repository_test.go index 12c9b0bae..2efa80028 100644 --- a/projector/internal/domain/approvalrequest/repository_test.go +++ b/projector/internal/domain/approvalrequest/repository_test.go @@ -18,6 +18,7 @@ import ( entapiexposure "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" entapprovalrequest "github.com/telekom/controlplane/controlplane-api/ent/approvalrequest" "github.com/telekom/controlplane/controlplane-api/ent/enttest" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" _ "github.com/telekom/controlplane/controlplane-api/ent/runtime" "github.com/telekom/controlplane/controlplane-api/ent/zone" "github.com/telekom/controlplane/controlplane-api/pkg/model" @@ -31,8 +32,11 @@ import ( // mockApprovalRequestDeps implements approvalrequest.ApprovalRequestDeps for // testing. type mockApprovalRequestDeps struct { - subIDs map[string]int // key: "namespace:name" - subErr error // if non-nil, FindAPISubscriptionByMeta always returns this error + subIDs map[string]int // key: "namespace:name" + subErr error // if non-nil, FindAPISubscriptionByMeta always returns this error + eventSubIDs map[string]int // key: "namespace:name" + eventSubErr error // if non-nil, FindEventSubscriptionByMeta always returns this error + evicted []string // tracks eviction calls as "namespace:name" } func (m *mockApprovalRequestDeps) FindAPISubscriptionByMeta(_ context.Context, namespace, name string) (int, error) { @@ -46,6 +50,25 @@ func (m *mockApprovalRequestDeps) FindAPISubscriptionByMeta(_ context.Context, n return 0, fmt.Errorf("api_subscription %s/%s: %w", namespace, name, infrastructure.ErrEntityNotFound) } +func (m *mockApprovalRequestDeps) FindEventSubscriptionByMeta(_ context.Context, namespace, name string) (int, error) { + if m.eventSubErr != nil { + return 0, m.eventSubErr + } + key := namespace + ":" + name + if id, ok := m.eventSubIDs[key]; ok { + return id, nil + } + return 0, fmt.Errorf("event_subscription %s/%s: %w", namespace, name, infrastructure.ErrEntityNotFound) +} + +func (m *mockApprovalRequestDeps) EvictAPISubscription(namespace, name string) { + m.evicted = append(m.evicted, namespace+":"+name) +} + +func (m *mockApprovalRequestDeps) EvictEventSubscription(namespace, name string) { + m.evicted = append(m.evicted, namespace+":"+name) +} + var _ = Describe("ApprovalRequest Repository", func() { var ( client *ent.Client @@ -114,7 +137,8 @@ var _ = Describe("ApprovalRequest Repository", func() { subID = sub.ID deps = &mockApprovalRequestDeps{ - subIDs: map[string]int{"prod--platform--narvi:my-sub": subID}, + subIDs: map[string]int{"prod--platform--narvi:my-sub": subID}, + eventSubIDs: map[string]int{}, } repo = approvalrequest.NewRepository(client, cache, deps) @@ -146,6 +170,7 @@ var _ = Describe("ApprovalRequest Repository", func() { }, Decisions: []model.Decision{}, AvailableTransitions: []model.AvailableTransition{}, + TargetKind: "ApiSubscription", SubscriptionNamespace: "prod--platform--narvi", SubscriptionName: "my-sub", } @@ -177,9 +202,56 @@ var _ = Describe("ApprovalRequest Repository", func() { Expect(ar.Edges.APISubscription.ID).To(Equal(subID)) }) + It("should create a new approval request with event subscription FK", func() { + // Seed an EventSubscription. + z, err := client.Zone.Query().Where(zone.NameEQ("caas")).Only(ctx) + Expect(err).NotTo(HaveOccurred()) + t, err := client.Team.Query().Only(ctx) + Expect(err).NotTo(HaveOccurred()) + subscriberApp, err := client.Application.Create(). + SetName("event-consumer"). + SetNamespace("platform--narvi"). + SetOwnerTeamID(t.ID). + SetZoneID(z.ID). + Save(ctx) + Expect(err).NotTo(HaveOccurred()) + + eventSub, err := client.EventSubscription.Create(). + SetEventType("user.created"). + SetNamespace("platform--narvi"). + SetName("my-event-sub"). + SetDeliveryType(eventsubscription.DeliveryTypeCallback). + SetOwnerID(subscriberApp.ID). + Save(ctx) + Expect(err).NotTo(HaveOccurred()) + + deps.eventSubIDs["prod--platform--narvi:my-event-sub"] = eventSub.ID + + data := baseData() + data.Meta.Name = "eventsubscription--my-event-sub--abc123" + data.TargetKind = "EventSubscription" + data.SubscriptionNamespace = "prod--platform--narvi" + data.SubscriptionName = "my-event-sub" + + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + // Verify the approval request was created with event subscription FK. + ar, err := client.ApprovalRequest.Query(). + Where( + entapprovalrequest.NamespaceEQ("prod--platform--narvi"), + entapprovalrequest.NameEQ("eventsubscription--my-event-sub--abc123"), + ). + WithEventSubscription(). + Only(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(ar.Edges.EventSubscription).NotTo(BeNil()) + Expect(ar.Edges.EventSubscription.ID).To(Equal(eventSub.ID)) + }) + It("should return ErrDependencyMissing when subscription is not cached", func() { missingDeps := &mockApprovalRequestDeps{ - subIDs: map[string]int{}, // empty -- no subscription found + subIDs: map[string]int{}, // empty -- no subscription found + eventSubIDs: map[string]int{}, } repo = approvalrequest.NewRepository(client, cache, missingDeps) @@ -189,15 +261,42 @@ var _ = Describe("ApprovalRequest Repository", func() { Expect(errors.Is(err, runtime.ErrDependencyMissing)).To(BeTrue()) }) + It("should return ErrDependencyMissing when event subscription is not cached", func() { + data := baseData() + data.TargetKind = "EventSubscription" + data.SubscriptionName = "missing-event-sub" + err := repo.Upsert(ctx, data) + Expect(err).To(HaveOccurred()) + Expect(errors.Is(err, runtime.ErrDependencyMissing)).To(BeTrue()) + }) + It("should propagate non-ErrEntityNotFound errors from FindAPISubscriptionByMeta", func() { dbErr := errors.New("connection refused") failDeps := &mockApprovalRequestDeps{ - subIDs: map[string]int{}, - subErr: dbErr, + subIDs: map[string]int{}, + subErr: dbErr, + eventSubIDs: map[string]int{}, + } + failRepo := approvalrequest.NewRepository(client, cache, failDeps) + + data := baseData() + err := failRepo.Upsert(ctx, data) + Expect(err).To(HaveOccurred()) + Expect(runtime.IsDependencyMissing(err)).To(BeFalse()) + Expect(errors.Is(err, dbErr)).To(BeTrue()) + }) + + It("should propagate non-ErrEntityNotFound errors from FindEventSubscriptionByMeta", func() { + dbErr := errors.New("connection refused") + failDeps := &mockApprovalRequestDeps{ + subIDs: map[string]int{}, + eventSubIDs: map[string]int{}, + eventSubErr: dbErr, } failRepo := approvalrequest.NewRepository(client, cache, failDeps) data := baseData() + data.TargetKind = "EventSubscription" err := failRepo.Upsert(ctx, data) Expect(err).To(HaveOccurred()) Expect(runtime.IsDependencyMissing(err)).To(BeFalse()) diff --git a/projector/internal/domain/approvalrequest/translator.go b/projector/internal/domain/approvalrequest/translator.go index e3864295d..99c8e65eb 100644 --- a/projector/internal/domain/approvalrequest/translator.go +++ b/projector/internal/domain/approvalrequest/translator.go @@ -9,6 +9,7 @@ import ( "strings" approvalv1 "github.com/telekom/controlplane/approval/api/v1" + cconfig "github.com/telekom/controlplane/common/pkg/config" "github.com/telekom/controlplane/controlplane-api/pkg/model" "github.com/telekom/controlplane/projector/internal/domain/shared" "github.com/telekom/controlplane/projector/internal/runtime" @@ -19,7 +20,7 @@ import ( // derives identity keys. // // ShouldSkip filters out CRs that lack the required fields for FK resolution: -// empty spec.target.Name, empty spec.action, or spec.target.Kind != "ApiSubscription". +// empty spec.target.Name, empty spec.action, or unsupported spec.target.Kind. // // KeyFromDelete uses lastKnown when available. When lastKnown is nil, returns // a key with only Namespace+Name (sufficient for DB delete by unique index) @@ -29,9 +30,13 @@ type Translator struct{} // compile-time interface check. var _ runtime.Translator[*approvalv1.ApprovalRequest, *ApprovalRequestData, ApprovalRequestKey] = (*Translator)(nil) +// isSupportedTargetKind returns true if the target kind is one we can resolve. +func isSupportedTargetKind(kind string) bool { + return kind == TargetKindAPISubscription || kind == TargetKindEventSubscription +} + // ShouldSkip returns true if the ApprovalRequest CR lacks the required fields -// for sync (missing target name, empty action, or non-ApiSubscription target -// kind). +// for sync (missing target name, empty action, or unsupported target kind). func (t *Translator) ShouldSkip(obj *approvalv1.ApprovalRequest) (bool, string) { if obj.Spec.Target.Name == "" { return true, "spec.target.name is empty" @@ -39,9 +44,11 @@ func (t *Translator) ShouldSkip(obj *approvalv1.ApprovalRequest) (bool, string) if obj.Spec.Action == "" { return true, "spec.action is empty" } - // TODO: This filter should be removed in the future when other target kinds are supported. - if obj.Spec.Target.TypeMeta.Kind != "ApiSubscription" { - return true, "spec.target.kind is not ApiSubscription" + if !isSupportedTargetKind(obj.Spec.Target.TypeMeta.Kind) { + return true, "spec.target.kind is not ApiSubscription or EventSubscription" + } + if !cconfig.FeaturePubSub.IsEnabled() && obj.Spec.Target.TypeMeta.Kind == TargetKindEventSubscription { + return true, "pubsub feature is disabled" } if obj.Spec.Decider.TeamName == "" { @@ -60,7 +67,7 @@ func (t *Translator) ShouldSkip(obj *approvalv1.ApprovalRequest) (bool, string) // computed by the approval-operator's FSM. // // The subscription reference is derived from spec.target, which carries the -// k8s namespace and name of the ApiSubscription CR being approved. If the +// k8s namespace and name of the target subscription CR being approved. If the // target namespace is empty, it falls back to the ApprovalRequest CR's own // namespace (same-namespace reference). func (t *Translator) Translate(_ context.Context, obj *approvalv1.ApprovalRequest) (*ApprovalRequestData, error) { @@ -82,6 +89,7 @@ func (t *Translator) Translate(_ context.Context, obj *approvalv1.ApprovalReques Decider: mapDecider(obj.Spec.Decider), Decisions: mapDecisions(obj.Spec.Decisions), AvailableTransitions: mapAvailableTransitions(obj.Status.AvailableTransitions), + TargetKind: obj.Spec.Target.TypeMeta.Kind, SubscriptionNamespace: targetNamespace, SubscriptionName: obj.Spec.Target.Name, }, nil diff --git a/projector/internal/domain/approvalrequest/translator_test.go b/projector/internal/domain/approvalrequest/translator_test.go index abf6f88f1..52aa4a4f1 100644 --- a/projector/internal/domain/approvalrequest/translator_test.go +++ b/projector/internal/domain/approvalrequest/translator_test.go @@ -11,6 +11,7 @@ import ( . "github.com/onsi/gomega" approvalv1 "github.com/telekom/controlplane/approval/api/v1" + cconfig "github.com/telekom/controlplane/common/pkg/config" ctypes "github.com/telekom/controlplane/common/pkg/types" "github.com/telekom/controlplane/controlplane-api/pkg/model" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -53,7 +54,7 @@ var _ = Describe("ApprovalRequest Translator", func() { Expect(reason).To(ContainSubstring("action")) }) - It("should skip when target kind is not ApiSubscription", func() { + It("should skip when target kind is unsupported", func() { obj := &approvalv1.ApprovalRequest{ Spec: approvalv1.ApprovalRequestSpec{ Action: "subscribe", @@ -65,10 +66,64 @@ var _ = Describe("ApprovalRequest Translator", func() { } skip, reason := t.ShouldSkip(obj) Expect(skip).To(BeTrue()) - Expect(reason).To(ContainSubstring("ApiSubscription")) + Expect(reason).To(ContainSubstring("ApiSubscription or EventSubscription")) }) - It("should not skip a valid ApprovalRequest CR", func() { + It("should not skip a valid ApprovalRequest CR targeting ApiSubscription", func() { + obj := &approvalv1.ApprovalRequest{ + Spec: approvalv1.ApprovalRequestSpec{ + Action: "subscribe", + Target: ctypes.TypedObjectRef{ + TypeMeta: metav1.TypeMeta{Kind: "ApiSubscription"}, + ObjectRef: ctypes.ObjectRef{Name: "my-sub"}, + }, + Decider: approvalv1.Decider{TeamName: "some-team"}, + }, + } + skip, reason := t.ShouldSkip(obj) + Expect(skip).To(BeFalse()) + Expect(reason).To(BeEmpty()) + }) + + It("should not skip a valid ApprovalRequest CR targeting EventSubscription", func() { + cconfig.SetFeatureEnabled(cconfig.FeaturePubSub, true) + defer cconfig.SetFeatureEnabled(cconfig.FeaturePubSub, false) + + obj := &approvalv1.ApprovalRequest{ + Spec: approvalv1.ApprovalRequestSpec{ + Action: "subscribe", + Target: ctypes.TypedObjectRef{ + TypeMeta: metav1.TypeMeta{Kind: "EventSubscription"}, + ObjectRef: ctypes.ObjectRef{Name: "my-event-sub"}, + }, + Decider: approvalv1.Decider{TeamName: "some-team"}, + }, + } + skip, reason := t.ShouldSkip(obj) + Expect(skip).To(BeFalse()) + Expect(reason).To(BeEmpty()) + }) + It("should skip EventSubscription target when pubsub feature is disabled", func() { + cconfig.SetFeatureEnabled(cconfig.FeaturePubSub, false) + + obj := &approvalv1.ApprovalRequest{ + Spec: approvalv1.ApprovalRequestSpec{ + Action: "subscribe", + Target: ctypes.TypedObjectRef{ + TypeMeta: metav1.TypeMeta{Kind: "EventSubscription"}, + ObjectRef: ctypes.ObjectRef{Name: "my-event-sub"}, + }, + Decider: approvalv1.Decider{TeamName: "some-team"}, + }, + } + skip, reason := t.ShouldSkip(obj) + Expect(skip).To(BeTrue()) + Expect(reason).To(ContainSubstring("pubsub feature is disabled")) + }) + + It("should not skip ApiSubscription target when pubsub feature is disabled", func() { + cconfig.SetFeatureEnabled(cconfig.FeaturePubSub, false) + obj := &approvalv1.ApprovalRequest{ Spec: approvalv1.ApprovalRequestSpec{ Action: "subscribe", @@ -86,7 +141,7 @@ var _ = Describe("ApprovalRequest Translator", func() { }) Describe("Translate", func() { - It("should populate all fields from the CR", func() { + It("should populate all fields from the CR targeting ApiSubscription", func() { reason := "need access" obj := &approvalv1.ApprovalRequest{ ObjectMeta: metav1.ObjectMeta{ @@ -148,6 +203,7 @@ var _ = Describe("ApprovalRequest Translator", func() { Expect(data.State).To(Equal("GRANTED")) Expect(data.Action).To(Equal("subscribe")) Expect(data.Strategy).To(Equal("FOUR_EYES")) + Expect(data.TargetKind).To(Equal("ApiSubscription")) Expect(data.Requester.TeamName).To(Equal("narvi")) Expect(data.Requester.TeamEmail).To(Equal("narvi@example.com")) Expect(*data.Requester.Reason).To(Equal("need access")) @@ -165,6 +221,38 @@ var _ = Describe("ApprovalRequest Translator", func() { Expect(data.SubscriptionName).To(Equal("my-sub")) }) + It("should set TargetKind to EventSubscription when target kind is EventSubscription", func() { + obj := &approvalv1.ApprovalRequest{ + ObjectMeta: metav1.ObjectMeta{ + Name: "eventsubscription--my-event-sub--abc123", + Namespace: "prod--platform--narvi", + Labels: map[string]string{ + "cp.ei.telekom.de/environment": "prod", + }, + }, + Spec: approvalv1.ApprovalRequestSpec{ + Action: "subscribe", + Strategy: approvalv1.ApprovalStrategySimple, + State: approvalv1.ApprovalStatePending, + Target: ctypes.TypedObjectRef{ + TypeMeta: metav1.TypeMeta{Kind: "EventSubscription"}, + ObjectRef: ctypes.ObjectRef{ + Namespace: "prod--platform--narvi", + Name: "my-event-sub", + }, + }, + Requester: approvalv1.Requester{TeamName: "narvi"}, + Decider: approvalv1.Decider{TeamName: "provider"}, + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.TargetKind).To(Equal("EventSubscription")) + Expect(data.SubscriptionNamespace).To(Equal("prod--platform--narvi")) + Expect(data.SubscriptionName).To(Equal("my-event-sub")) + }) + It("should fall back to own namespace when target namespace is empty", func() { obj := &approvalv1.ApprovalRequest{ ObjectMeta: metav1.ObjectMeta{ diff --git a/projector/internal/domain/approvalrequest/types.go b/projector/internal/domain/approvalrequest/types.go index 1c89800ce..9a92c658e 100644 --- a/projector/internal/domain/approvalrequest/types.go +++ b/projector/internal/domain/approvalrequest/types.go @@ -4,8 +4,9 @@ // Package approvalrequest implements the ApprovalRequest resource module for // the projector. ApprovalRequest is a Level 4 entity with a required -// FK dependency on ApiSubscription (M2O). It uses namespace+name as the unique -// conflict key and resolves the subscription FK via cache-based meta-key lookup. +// FK dependency on ApiSubscription or EventSubscription (determined by +// TargetKind). It uses namespace+name as the unique conflict key and resolves +// the subscription FK via cache-based meta-key lookup. package approvalrequest import ( @@ -13,6 +14,12 @@ import ( "github.com/telekom/controlplane/projector/internal/domain/shared" ) +// TargetKind constants for FK resolution. +const ( + TargetKindAPISubscription = "ApiSubscription" + TargetKindEventSubscription = "EventSubscription" +) + // ApprovalRequestKey is the composite identity key for ApprovalRequest // entities. Namespace + Name form the unique index and are sufficient for both // upsert conflict detection and delete identification. @@ -38,7 +45,11 @@ type ApprovalRequestData struct { Decider model.DeciderInfo Decisions []model.Decision AvailableTransitions []model.AvailableTransition - // ApiSubscription reference via spec.target (k8s namespace + name). + // TargetKind indicates whether the approval request targets an + // ApiSubscription or EventSubscription. Used by the repository to + // resolve the correct FK. + TargetKind string // "ApiSubscription" or "EventSubscription" + // Subscription reference via spec.target (k8s namespace + name). SubscriptionNamespace string SubscriptionName string } diff --git a/projector/internal/domain/eventexposure/deps.go b/projector/internal/domain/eventexposure/deps.go new file mode 100644 index 000000000..e5c3190fa --- /dev/null +++ b/projector/internal/domain/eventexposure/deps.go @@ -0,0 +1,16 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventexposure + +import "context" + +// EventExposureDeps declares the FK resolution interface required by the +// EventExposure repository. Application is a required dependency — if the +// owner Application is missing, the upsert fails with ErrDependencyMissing. +// +// Satisfied by *infrastructure.IDResolver at wiring time. +type EventExposureDeps interface { + FindApplicationID(ctx context.Context, name, teamName string) (int, error) +} diff --git a/projector/internal/domain/eventexposure/eventexposure_suite_test.go b/projector/internal/domain/eventexposure/eventexposure_suite_test.go new file mode 100644 index 000000000..952e3bb82 --- /dev/null +++ b/projector/internal/domain/eventexposure/eventexposure_suite_test.go @@ -0,0 +1,17 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventexposure_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestEventExposure(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "EventExposure Suite") +} diff --git a/projector/internal/domain/eventexposure/module.go b/projector/internal/domain/eventexposure/module.go new file mode 100644 index 000000000..435c16a9e --- /dev/null +++ b/projector/internal/domain/eventexposure/module.go @@ -0,0 +1,31 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventexposure + +import ( + eventv1 "github.com/telekom/controlplane/event/api/v1" + "github.com/telekom/controlplane/projector/internal/module" + "github.com/telekom/controlplane/projector/internal/runtime" +) + +// Module is the EventExposure module registration variable. It wires the +// EventExposure translator and repository into the generic pipeline via +// TypedModule. +// +// EventExposure is a Level 3 entity with a required FK dependency on +// Application. It uses a convention-based fallback delete strategy so +// KeyFromDelete always succeeds. +var Module = &module.TypedModule[*eventv1.EventExposure, *EventExposureData, EventExposureKey]{ + ModuleName: "eventexposure", + NewObj: func() *eventv1.EventExposure { return &eventv1.EventExposure{} }, + Translator: &Translator{}, + RepoFactory: func(deps module.ModuleDeps) runtime.Repository[EventExposureKey, *EventExposureData] { + return NewRepository( + deps.EntClient, + deps.EdgeCache, + deps.IDResolver, + ) + }, +} diff --git a/projector/internal/domain/eventexposure/repository.go b/projector/internal/domain/eventexposure/repository.go new file mode 100644 index 000000000..2391ac46f --- /dev/null +++ b/projector/internal/domain/eventexposure/repository.go @@ -0,0 +1,118 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventexposure + +import ( + "context" + "errors" + "fmt" + "time" + + "github.com/telekom/controlplane/controlplane-api/ent" + "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/team" + "github.com/telekom/controlplane/projector/internal/infrastructure" + "github.com/telekom/controlplane/projector/internal/infrastructure/cachekeys" + "github.com/telekom/controlplane/projector/internal/metrics" + "github.com/telekom/controlplane/projector/internal/runtime" +) + +// entityType is the cache key prefix for EventExposure entities in the EdgeCache. +const entityType = "eventexposure" + +// Repository performs typed persistence operations for EventExposure entities. +// It implements runtime.Repository[EventExposureKey, *EventExposureData]. +// +// EventExposure has a required FK dependency on Application. If the owner +// Application is missing, Upsert returns ErrDependencyMissing. +// Delete removes the entity by event type + application name + team name. +type Repository struct { + client *ent.Client + cache *infrastructure.EdgeCache + deps EventExposureDeps +} + +// compile-time interface check. +var _ runtime.Repository[EventExposureKey, *EventExposureData] = (*Repository)(nil) + +// NewRepository creates an EventExposure repository wired with the given +// ent client, edge cache, and dependency resolver. +func NewRepository(client *ent.Client, cache *infrastructure.EdgeCache, deps EventExposureDeps) *Repository { + return &Repository{ + client: client, + cache: cache, + deps: deps, + } +} + +// Upsert creates or updates an EventExposure entity in the database. +// Resolves the owner Application FK (required) via deps, then upserts on +// the composite unique constraint (event_type, owner). +func (r *Repository) Upsert(ctx context.Context, data *EventExposureData) error { + start := time.Now() + defer func() { + metrics.DBOperationDuration.WithLabelValues(entityType, metrics.OperationUpsert).Observe(time.Since(start).Seconds()) + }() + + appID, err := r.deps.FindApplicationID(ctx, data.AppName, data.TeamName) + if err != nil { + if errors.Is(err, infrastructure.ErrEntityNotFound) { + return runtime.WrapDependencyMissing("application", data.AppName) + } + return fmt.Errorf("find application %q (team %q): %w", data.AppName, data.TeamName, err) + } + + exposureID, upsertErr := r.client.EventExposure.Create(). + SetEventType(data.EventType). + SetVisibility(eventexposure.Visibility(data.Visibility)). + SetActive(data.Active). + SetStatusPhase(eventexposure.StatusPhase(data.StatusPhase)). + SetStatusMessage(data.StatusMessage). + SetEnvironment(data.Meta.Environment). + SetNamespace(data.Meta.Namespace). + SetOwnerID(appID). + SetApprovalConfig(data.ApprovalConfig). + OnConflictColumns(eventexposure.FieldEventType, eventexposure.OwnerColumn). + UpdateNewValues(). + ID(ctx) + if upsertErr != nil { + return fmt.Errorf("upsert event_exposure %q (app %q, team %q): %w", + data.EventType, data.AppName, data.TeamName, upsertErr) + } + + et, lk := cachekeys.EventExposure(data.EventType, data.AppName, data.TeamName) + r.cache.Set(et, lk, exposureID) + return nil +} + +// Delete removes an EventExposure entity from the database by event type, +// application name, and team name. Returns nil if the entity does not exist +// (idempotent delete). +func (r *Repository) Delete(ctx context.Context, key EventExposureKey) error { + start := time.Now() + defer func() { + metrics.DBOperationDuration.WithLabelValues(entityType, metrics.OperationDelete).Observe(time.Since(start).Seconds()) + }() + + count, err := r.client.EventExposure.Delete(). + Where( + eventexposure.EventTypeEQ(key.EventType), + eventexposure.HasOwnerWith( + application.NameEQ(key.AppName), + application.HasOwnerTeamWith(team.NameEQ(key.TeamName)), + ), + ). + Exec(ctx) + if err != nil { + return fmt.Errorf("delete event_exposure %q (app %q, team %q): %w", + key.EventType, key.AppName, key.TeamName, err) + } + if count > 0 { + et, lk := cachekeys.EventExposure(key.EventType, key.AppName, key.TeamName) + r.cache.Del(et, lk) + } + return nil +} diff --git a/projector/internal/domain/eventexposure/repository_test.go b/projector/internal/domain/eventexposure/repository_test.go new file mode 100644 index 000000000..5031c5d6e --- /dev/null +++ b/projector/internal/domain/eventexposure/repository_test.go @@ -0,0 +1,272 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventexposure_test + +import ( + "context" + "errors" + "fmt" + + "entgo.io/ent/privacy" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + _ "github.com/mattn/go-sqlite3" + "github.com/telekom/controlplane/controlplane-api/ent" + "github.com/telekom/controlplane/controlplane-api/ent/enttest" + enteventexposure "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + _ "github.com/telekom/controlplane/controlplane-api/ent/runtime" + "github.com/telekom/controlplane/controlplane-api/ent/zone" + "github.com/telekom/controlplane/controlplane-api/pkg/model" + + "github.com/telekom/controlplane/projector/internal/domain/eventexposure" + "github.com/telekom/controlplane/projector/internal/domain/shared" + "github.com/telekom/controlplane/projector/internal/infrastructure" + "github.com/telekom/controlplane/projector/internal/runtime" +) + +// mockExposureDeps implements eventexposure.EventExposureDeps for testing. +type mockExposureDeps struct { + appIDs map[string]int + appErr error +} + +func (m *mockExposureDeps) FindApplicationID(_ context.Context, name, teamName string) (int, error) { + if m.appErr != nil { + return 0, m.appErr + } + key := name + ":" + teamName + if id, ok := m.appIDs[key]; ok { + return id, nil + } + return 0, fmt.Errorf("application %q (team %q): %w", name, teamName, infrastructure.ErrEntityNotFound) +} + +var _ = Describe("EventExposure Repository", func() { + var ( + client *ent.Client + cache *infrastructure.EdgeCache + deps *mockExposureDeps + repo *eventexposure.Repository + ctx context.Context + appID int + ) + + BeforeEach(func() { + ctx = privacy.DecisionContext(context.Background(), privacy.Allow) + var err error + cache, err = infrastructure.NewEdgeCache(100_000, 10<<20, 64) + Expect(err).NotTo(HaveOccurred()) + client = enttest.Open(GinkgoT(), "sqlite3", "file:ent?mode=memory&_fk=1") + + z, err := client.Zone.Create(). + SetName("caas"). + SetVisibility(zone.VisibilityEnterprise). + Save(ctx) + Expect(err).NotTo(HaveOccurred()) + + t, err := client.Team.Create(). + SetName("platform--narvi"). + SetEmail("narvi@example.com"). + SetNamespace("platform--narvi"). + Save(ctx) + Expect(err).NotTo(HaveOccurred()) + + app, err := client.Application.Create(). + SetName("my-app"). + SetNamespace("platform--narvi"). + SetOwnerTeamID(t.ID). + SetZoneID(z.ID). + Save(ctx) + Expect(err).NotTo(HaveOccurred()) + appID = app.ID + + deps = &mockExposureDeps{ + appIDs: map[string]int{"my-app:platform--narvi": appID}, + } + repo = eventexposure.NewRepository(client, cache, deps) + }) + + AfterEach(func() { + _ = client.Close() + cache.Close() + }) + + Describe("Upsert", func() { + It("should create an event exposure with valid deps", func() { + data := &eventexposure.EventExposureData{ + Meta: shared.NewMetadata("prod--platform--narvi", "exp-1", nil), + StatusPhase: "READY", + StatusMessage: "ok", + EventType: "de.telekom.eni.quickstart.v1", + Visibility: "WORLD", + Active: true, + ApprovalConfig: model.ApprovalConfig{ + Strategy: "AUTO", + TrustedTeams: []string{"team-a"}, + }, + AppName: "my-app", + TeamName: "platform--narvi", + } + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + exp, err := client.EventExposure.Query(). + Where(enteventexposure.EventTypeEQ("de.telekom.eni.quickstart.v1")). + Only(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(exp.EventType).To(Equal("de.telekom.eni.quickstart.v1")) + Expect(exp.Visibility.String()).To(Equal("WORLD")) + Expect(exp.Active).ToNot(BeNil()) + Expect(*exp.Active).To(BeTrue()) + Expect(exp.ApprovalConfig.Strategy).To(Equal("AUTO")) + + owner, err := exp.QueryOwner().Only(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(owner.ID).To(Equal(appID)) + }) + + It("should return ErrDependencyMissing when application is missing", func() { + data := &eventexposure.EventExposureData{ + Meta: shared.NewMetadata("prod--platform--narvi", "fail-exp", nil), + StatusPhase: "UNKNOWN", + EventType: "de.telekom.fail.v1", + Visibility: "ENTERPRISE", + ApprovalConfig: model.ApprovalConfig{Strategy: "AUTO"}, + AppName: "missing-app", + TeamName: "platform--narvi", + } + err := repo.Upsert(ctx, data) + Expect(err).To(HaveOccurred()) + Expect(runtime.IsDependencyMissing(err)).To(BeTrue()) + }) + + It("should propagate non-ErrEntityNotFound errors from FindApplicationID", func() { + dbErr := errors.New("connection refused") + failDeps := &mockExposureDeps{appErr: dbErr} + failRepo := eventexposure.NewRepository(client, cache, failDeps) + + data := &eventexposure.EventExposureData{ + Meta: shared.NewMetadata("prod--platform--narvi", "fail-exp", nil), + StatusPhase: "UNKNOWN", + EventType: "de.telekom.fail.v1", + Visibility: "ENTERPRISE", + ApprovalConfig: model.ApprovalConfig{Strategy: "AUTO"}, + AppName: "my-app", + TeamName: "platform--narvi", + } + err := failRepo.Upsert(ctx, data) + Expect(err).To(HaveOccurred()) + Expect(runtime.IsDependencyMissing(err)).To(BeFalse()) + Expect(errors.Is(err, dbErr)).To(BeTrue()) + }) + + It("should update existing exposure on conflict", func() { + data := &eventexposure.EventExposureData{ + Meta: shared.NewMetadata("prod--platform--narvi", "upd-exp", nil), + StatusPhase: "PENDING", + StatusMessage: "v1", + EventType: "de.telekom.update.v1", + Visibility: "ENTERPRISE", + ApprovalConfig: model.ApprovalConfig{Strategy: "AUTO"}, + AppName: "my-app", + TeamName: "platform--narvi", + } + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + data.StatusPhase = "READY" + data.Visibility = "WORLD" + data.Active = true + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + exp, err := client.EventExposure.Query(). + Where(enteventexposure.EventTypeEQ("de.telekom.update.v1")). + Only(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(exp.Visibility.String()).To(Equal("WORLD")) + Expect(*exp.Active).To(BeTrue()) + }) + + It("should populate the edge cache after upsert", func() { + data := &eventexposure.EventExposureData{ + Meta: shared.NewMetadata("prod--platform--narvi", "cached-exp", nil), + StatusPhase: "READY", + EventType: "de.telekom.cached.v1", + Visibility: "ENTERPRISE", + ApprovalConfig: model.ApprovalConfig{Strategy: "AUTO"}, + AppName: "my-app", + TeamName: "platform--narvi", + } + Expect(repo.Upsert(ctx, data)).To(Succeed()) + cache.Wait() + + id, found := cache.Get("eventexposure", "de.telekom.cached.v1:my-app:platform--narvi") + Expect(found).To(BeTrue()) + Expect(id).To(BeNumerically(">", 0)) + }) + }) + + Describe("Delete", func() { + It("should delete an existing event exposure", func() { + data := &eventexposure.EventExposureData{ + Meta: shared.NewMetadata("prod--platform--narvi", "del-exp", nil), + StatusPhase: "READY", + EventType: "de.telekom.delete.v1", + Visibility: "ENTERPRISE", + ApprovalConfig: model.ApprovalConfig{Strategy: "AUTO"}, + AppName: "my-app", + TeamName: "platform--narvi", + } + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + key := eventexposure.EventExposureKey{ + EventType: "de.telekom.delete.v1", + AppName: "my-app", + TeamName: "platform--narvi", + } + Expect(repo.Delete(ctx, key)).To(Succeed()) + + count, err := client.EventExposure.Query().Count(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(count).To(Equal(0)) + }) + + It("should be idempotent for non-existent exposure", func() { + key := eventexposure.EventExposureKey{ + EventType: "de.telekom.nonexistent.v1", + AppName: "my-app", + TeamName: "platform--narvi", + } + Expect(repo.Delete(ctx, key)).To(Succeed()) + }) + + It("should evict from edge cache after delete", func() { + data := &eventexposure.EventExposureData{ + Meta: shared.NewMetadata("prod--platform--narvi", "evict-exp", nil), + StatusPhase: "READY", + EventType: "de.telekom.evict.v1", + Visibility: "ENTERPRISE", + ApprovalConfig: model.ApprovalConfig{Strategy: "AUTO"}, + AppName: "my-app", + TeamName: "platform--narvi", + } + Expect(repo.Upsert(ctx, data)).To(Succeed()) + cache.Wait() + + _, found := cache.Get("eventexposure", "de.telekom.evict.v1:my-app:platform--narvi") + Expect(found).To(BeTrue()) + + key := eventexposure.EventExposureKey{ + EventType: "de.telekom.evict.v1", + AppName: "my-app", + TeamName: "platform--narvi", + } + Expect(repo.Delete(ctx, key)).To(Succeed()) + cache.Wait() + + _, found = cache.Get("eventexposure", "de.telekom.evict.v1:my-app:platform--narvi") + Expect(found).To(BeFalse()) + }) + }) +}) diff --git a/projector/internal/domain/eventexposure/translator.go b/projector/internal/domain/eventexposure/translator.go new file mode 100644 index 000000000..474aa8aa7 --- /dev/null +++ b/projector/internal/domain/eventexposure/translator.go @@ -0,0 +1,107 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventexposure + +import ( + "context" + "strings" + + "github.com/telekom/controlplane/controlplane-api/pkg/model" + eventv1 "github.com/telekom/controlplane/event/api/v1" + "github.com/telekom/controlplane/projector/internal/domain/shared" + "github.com/telekom/controlplane/projector/internal/runtime" + "k8s.io/apimachinery/pkg/types" +) + +// applicationLabelKey is the label key used by the Rover controller to +// associate an EventExposure CR with its owner Application. +const applicationLabelKey = "cp.ei.telekom.de/application" + +// Translator maps an EventExposure CR to an EventExposureData DTO and derives +// identity keys. +// +// EventExposure uses a convention-based fallback delete strategy: when +// lastKnown is available, KeyFromDelete reads Spec.EventType + label for +// app name + namespace for team name. Otherwise, it falls back to using +// key.Name for both eventType and appName + TeamNameFromNamespace. +// This always succeeds — no ErrDeleteKeyLost. +type Translator struct{} + +// compile-time interface check. +var _ runtime.Translator[*eventv1.EventExposure, *EventExposureData, EventExposureKey] = (*Translator)(nil) + +// ShouldSkip returns false — EventExposure CRs are always syncable. +func (t *Translator) ShouldSkip(_ *eventv1.EventExposure) (bool, string) { + return false, "" +} + +// Translate converts an EventExposure CR into an EventExposureData DTO. +// Visibility is upper-cased (World→WORLD, Zone→ZONE, Enterprise→ENTERPRISE). +// Active comes from Status.Active. ApprovalConfig strategy is mapped from +// PascalCase to DB enum (Auto→AUTO, Simple→SIMPLE, FourEyes→FOUR_EYES). +// AppName comes from the application label, TeamName from namespace. +func (t *Translator) Translate(_ context.Context, obj *eventv1.EventExposure) (*EventExposureData, error) { + phase, message := shared.StatusFromConditions(obj.Status.Conditions) + + return &EventExposureData{ + Meta: shared.NewMetadata(obj.Namespace, obj.Name, obj.Labels), + StatusPhase: phase, + StatusMessage: message, + EventType: obj.Spec.EventType, + Visibility: strings.ToUpper(string(obj.Spec.Visibility)), + Active: obj.Status.Active, + ApprovalConfig: model.ApprovalConfig{ + Strategy: mapApprovalStrategy(string(obj.Spec.Approval.Strategy)), + TrustedTeams: obj.Spec.Approval.TrustedTeams, + }, + AppName: obj.Labels[applicationLabelKey], + TeamName: shared.TeamNameFromNamespace(obj.Namespace), + }, nil +} + +// KeyFromObject derives the composite identity key from a live EventExposure. +func (t *Translator) KeyFromObject(obj *eventv1.EventExposure) EventExposureKey { + return EventExposureKey{ + EventType: obj.Spec.EventType, + AppName: obj.Labels[applicationLabelKey], + TeamName: shared.TeamNameFromNamespace(obj.Namespace), + } +} + +// KeyFromDelete derives the identity key for a delete operation. +// If lastKnown is available, eventType comes from Spec.EventType, appName +// from the application label, and teamName from the namespace. Otherwise, +// key.Name is used as best-effort for both eventType and appName, and teamName +// is derived from the namespace convention. Always succeeds. +func (t *Translator) KeyFromDelete(req types.NamespacedName, lastKnown *eventv1.EventExposure) (EventExposureKey, error) { + if lastKnown != nil { + return EventExposureKey{ + EventType: lastKnown.Spec.EventType, + AppName: lastKnown.Labels[applicationLabelKey], + TeamName: shared.TeamNameFromNamespace(lastKnown.Namespace), + }, nil + } + return EventExposureKey{ + EventType: req.Name, + AppName: req.Name, + TeamName: shared.TeamNameFromNamespace(req.Namespace), + }, nil +} + +// mapApprovalStrategy converts CR approval strategy values to the DB enum +// representation. CR uses PascalCase (Auto, Simple, FourEyes), while the DB +// uses uppercase with underscores (AUTO, SIMPLE, FOUR_EYES). +func mapApprovalStrategy(strategy string) string { + switch strategy { + case "Auto": + return "AUTO" + case "Simple": + return "SIMPLE" + case "FourEyes": + return "FOUR_EYES" + default: + return strings.ToUpper(strategy) + } +} diff --git a/projector/internal/domain/eventexposure/translator_test.go b/projector/internal/domain/eventexposure/translator_test.go new file mode 100644 index 000000000..96268ff02 --- /dev/null +++ b/projector/internal/domain/eventexposure/translator_test.go @@ -0,0 +1,215 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventexposure_test + +import ( + "context" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + eventv1 "github.com/telekom/controlplane/event/api/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + k8stypes "k8s.io/apimachinery/pkg/types" + + "github.com/telekom/controlplane/projector/internal/domain/eventexposure" +) + +var _ = Describe("EventExposure Translator", func() { + var t eventexposure.Translator + + Describe("ShouldSkip", func() { + It("should never skip", func() { + obj := &eventv1.EventExposure{} + skip, reason := t.ShouldSkip(obj) + Expect(skip).To(BeFalse()) + Expect(reason).To(BeEmpty()) + }) + }) + + Describe("Translate", func() { + It("should populate all fields from the CR", func() { + obj := &eventv1.EventExposure{ + ObjectMeta: metav1.ObjectMeta{ + Name: "my-exposure", + Namespace: "prod--platform--narvi", + Labels: map[string]string{ + "cp.ei.telekom.de/environment": "prod", + "cp.ei.telekom.de/application": "my-app", + }, + }, + Spec: eventv1.EventExposureSpec{ + EventType: "de.telekom.eni.quickstart.v1", + Visibility: eventv1.VisibilityWorld, + Approval: eventv1.Approval{ + Strategy: eventv1.ApprovalStrategyAuto, + TrustedTeams: []string{"team-a"}, + }, + }, + Status: eventv1.EventExposureStatus{ + Active: true, + Conditions: []metav1.Condition{ + { + Type: "Ready", + Status: metav1.ConditionTrue, + Message: "all good", + }, + }, + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + + Expect(data.EventType).To(Equal("de.telekom.eni.quickstart.v1")) + Expect(data.Visibility).To(Equal("WORLD")) + Expect(data.Active).To(BeTrue()) + Expect(data.ApprovalConfig.Strategy).To(Equal("AUTO")) + Expect(data.ApprovalConfig.TrustedTeams).To(Equal([]string{"team-a"})) + Expect(data.AppName).To(Equal("my-app")) + Expect(data.TeamName).To(Equal("platform--narvi")) + Expect(data.StatusPhase).To(Equal("READY")) + Expect(data.StatusMessage).To(Equal("all good")) + Expect(data.Meta.Environment).To(Equal("prod")) + }) + + It("should upper-case Zone visibility", func() { + obj := &eventv1.EventExposure{ + ObjectMeta: metav1.ObjectMeta{ + Name: "zone-exposure", + Namespace: "prod--platform--narvi", + Labels: map[string]string{"cp.ei.telekom.de/application": "app"}, + }, + Spec: eventv1.EventExposureSpec{ + EventType: "de.telekom.zone.v1", + Visibility: eventv1.VisibilityZone, + Approval: eventv1.Approval{Strategy: eventv1.ApprovalStrategySimple}, + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.Visibility).To(Equal("ZONE")) + }) + + It("should upper-case Enterprise visibility", func() { + obj := &eventv1.EventExposure{ + ObjectMeta: metav1.ObjectMeta{ + Name: "ent-exposure", + Namespace: "prod--platform--narvi", + Labels: map[string]string{"cp.ei.telekom.de/application": "app"}, + }, + Spec: eventv1.EventExposureSpec{ + EventType: "de.telekom.ent.v1", + Visibility: eventv1.VisibilityEnterprise, + Approval: eventv1.Approval{Strategy: eventv1.ApprovalStrategyAuto}, + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.Visibility).To(Equal("ENTERPRISE")) + }) + + It("should map FourEyes approval strategy to FOUR_EYES", func() { + obj := &eventv1.EventExposure{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foureyes-approval", + Namespace: "prod--platform--narvi", + Labels: map[string]string{"cp.ei.telekom.de/application": "app"}, + }, + Spec: eventv1.EventExposureSpec{ + EventType: "de.telekom.foureyes.v1", + Visibility: eventv1.VisibilityEnterprise, + Approval: eventv1.Approval{ + Strategy: eventv1.ApprovalStrategyFourEyes, + TrustedTeams: []string{"team-x", "team-y"}, + }, + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.ApprovalConfig.Strategy).To(Equal("FOUR_EYES")) + Expect(data.ApprovalConfig.TrustedTeams).To(Equal([]string{"team-x", "team-y"})) + }) + + It("should derive UNKNOWN status when no conditions are set", func() { + obj := &eventv1.EventExposure{ + ObjectMeta: metav1.ObjectMeta{ + Name: "no-conditions", + Namespace: "prod--platform--narvi", + Labels: map[string]string{"cp.ei.telekom.de/application": "app"}, + }, + Spec: eventv1.EventExposureSpec{ + EventType: "de.telekom.nocond.v1", + Visibility: eventv1.VisibilityEnterprise, + Approval: eventv1.Approval{Strategy: eventv1.ApprovalStrategyAuto}, + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.StatusPhase).To(Equal("UNKNOWN")) + }) + }) + + Describe("KeyFromObject", func() { + It("should return composite key from CR fields", func() { + obj := &eventv1.EventExposure{ + ObjectMeta: metav1.ObjectMeta{ + Name: "my-exposure", + Namespace: "prod--platform--narvi", + Labels: map[string]string{"cp.ei.telekom.de/application": "my-app"}, + }, + Spec: eventv1.EventExposureSpec{ + EventType: "de.telekom.eni.quickstart.v1", + }, + } + + key := t.KeyFromObject(obj) + Expect(key.EventType).To(Equal("de.telekom.eni.quickstart.v1")) + Expect(key.AppName).To(Equal("my-app")) + Expect(key.TeamName).To(Equal("platform--narvi")) + }) + }) + + Describe("KeyFromDelete", func() { + It("should use CR fields from lastKnown when available", func() { + req := k8stypes.NamespacedName{ + Namespace: "prod--platform--narvi", + Name: "my-exposure", + } + lastKnown := &eventv1.EventExposure{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "prod--platform--narvi", + Labels: map[string]string{"cp.ei.telekom.de/application": "my-app"}, + }, + Spec: eventv1.EventExposureSpec{ + EventType: "de.telekom.eni.quickstart.v1", + }, + } + + key, err := t.KeyFromDelete(req, lastKnown) + Expect(err).NotTo(HaveOccurred()) + Expect(key.EventType).To(Equal("de.telekom.eni.quickstart.v1")) + Expect(key.AppName).To(Equal("my-app")) + Expect(key.TeamName).To(Equal("platform--narvi")) + }) + + It("should fall back to convention when lastKnown is nil", func() { + req := k8stypes.NamespacedName{ + Namespace: "prod--platform--narvi", + Name: "my-exposure", + } + + key, err := t.KeyFromDelete(req, nil) + Expect(err).NotTo(HaveOccurred()) + Expect(key.EventType).To(Equal("my-exposure")) + Expect(key.AppName).To(Equal("my-exposure")) + Expect(key.TeamName).To(Equal("platform--narvi")) + }) + }) +}) diff --git a/projector/internal/domain/eventexposure/types.go b/projector/internal/domain/eventexposure/types.go new file mode 100644 index 000000000..e964687bb --- /dev/null +++ b/projector/internal/domain/eventexposure/types.go @@ -0,0 +1,35 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +// Package eventexposure implements the EventExposure resource module for the +// projector. EventExposure is a Level 3 entity with a required FK dependency +// on Application (which itself depends on Team + Zone). +package eventexposure + +import ( + "github.com/telekom/controlplane/controlplane-api/pkg/model" + "github.com/telekom/controlplane/projector/internal/domain/shared" +) + +// EventExposureKey is the composite identity key for EventExposure entities. +// Event types are unique per Application, and Applications are unique per +// Team, so all three components are needed. +type EventExposureKey struct { + EventType string + AppName string + TeamName string +} + +// EventExposureData carries the transformed data for an EventExposure entity. +type EventExposureData struct { + Meta shared.Metadata + StatusPhase string // "READY", "PENDING", "ERROR", "UNKNOWN" + StatusMessage string + EventType string + Visibility string // "WORLD", "ZONE", "ENTERPRISE" (upper-cased) + Active bool + ApprovalConfig model.ApprovalConfig + AppName string // resolved to owner Application FK + TeamName string // used to resolve owner Application FK +} diff --git a/projector/internal/domain/eventsubscription/deps.go b/projector/internal/domain/eventsubscription/deps.go new file mode 100644 index 000000000..2007dd5ce --- /dev/null +++ b/projector/internal/domain/eventsubscription/deps.go @@ -0,0 +1,23 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventsubscription + +import "context" + +// EventSubscriptionDeps declares the FK resolution interfaces required by the +// EventSubscription repository. +// +// - FindApplicationID: resolves the owner Application FK (required). If the +// owner Application is missing, the upsert fails with ErrDependencyMissing. +// - FindEventExposureByEventType: resolves the target EventExposure FK +// (optional). The subscription CR doesn't know the target app/team — only +// the event type. If the target EventExposure is missing, the subscription +// is stored with a NULL target FK and will be linked on a later resync. +// +// Satisfied by *infrastructure.IDResolver at wiring time. +type EventSubscriptionDeps interface { + FindApplicationID(ctx context.Context, name, teamName string) (int, error) + FindEventExposureByEventType(ctx context.Context, eventType string) (int, error) +} diff --git a/projector/internal/domain/eventsubscription/eventsubscription_suite_test.go b/projector/internal/domain/eventsubscription/eventsubscription_suite_test.go new file mode 100644 index 000000000..95771c5b1 --- /dev/null +++ b/projector/internal/domain/eventsubscription/eventsubscription_suite_test.go @@ -0,0 +1,17 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventsubscription_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestEventSubscription(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "EventSubscription Suite") +} diff --git a/projector/internal/domain/eventsubscription/module.go b/projector/internal/domain/eventsubscription/module.go new file mode 100644 index 000000000..07d024325 --- /dev/null +++ b/projector/internal/domain/eventsubscription/module.go @@ -0,0 +1,30 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventsubscription + +import ( + eventv1 "github.com/telekom/controlplane/event/api/v1" + "github.com/telekom/controlplane/projector/internal/module" + "github.com/telekom/controlplane/projector/internal/runtime" +) + +// Module is the EventSubscription module registration variable. It wires the +// EventSubscription translator and repository into the generic pipeline via +// TypedModule. +// +// EventSubscription is a Level 3 entity with a required FK dependency on +// Application (owner) and an optional FK dependency on EventExposure (target). +var Module = &module.TypedModule[*eventv1.EventSubscription, *EventSubscriptionData, EventSubscriptionKey]{ + ModuleName: "eventsubscription", + NewObj: func() *eventv1.EventSubscription { return &eventv1.EventSubscription{} }, + Translator: &Translator{}, + RepoFactory: func(deps module.ModuleDeps) runtime.Repository[EventSubscriptionKey, *EventSubscriptionData] { + return NewRepository( + deps.EntClient, + deps.EdgeCache, + deps.IDResolver, + ) + }, +} diff --git a/projector/internal/domain/eventsubscription/repository.go b/projector/internal/domain/eventsubscription/repository.go new file mode 100644 index 000000000..914ecf422 --- /dev/null +++ b/projector/internal/domain/eventsubscription/repository.go @@ -0,0 +1,149 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventsubscription + +import ( + "context" + "errors" + "fmt" + "time" + + "github.com/telekom/controlplane/controlplane-api/ent" + "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" + "github.com/telekom/controlplane/controlplane-api/ent/team" + "github.com/telekom/controlplane/projector/internal/infrastructure" + "github.com/telekom/controlplane/projector/internal/infrastructure/cachekeys" + "github.com/telekom/controlplane/projector/internal/metrics" + "github.com/telekom/controlplane/projector/internal/runtime" +) + +// entityType is the cache key prefix for EventSubscription entities in the EdgeCache. +const entityType = "eventsubscription" + +// Repository performs typed persistence operations for EventSubscription entities. +// It implements runtime.Repository[EventSubscriptionKey, *EventSubscriptionData]. +// +// EventSubscription has a required FK dependency on Application (owner) and an +// optional FK dependency on EventExposure (target). +type Repository struct { + client *ent.Client + cache *infrastructure.EdgeCache + deps EventSubscriptionDeps +} + +// compile-time interface check. +var _ runtime.Repository[EventSubscriptionKey, *EventSubscriptionData] = (*Repository)(nil) + +// NewRepository creates an EventSubscription repository wired with the given +// ent client, edge cache, and dependency resolver. +func NewRepository(client *ent.Client, cache *infrastructure.EdgeCache, deps EventSubscriptionDeps) *Repository { + return &Repository{ + client: client, + cache: cache, + deps: deps, + } +} + +// Upsert creates or updates an EventSubscription entity in the database. +// +// Steps: +// 1. Resolve owner Application FK (required) — ErrDependencyMissing if missing. +// 2. Resolve target EventExposure FK (optional) — nil FK if missing. +// 3. Create with ON CONFLICT (event_type, owner) + UpdateNewValues(). +// 4. If target is nil, explicitly clear the target FK via ClearTarget(). +// 5. Write meta cache entry (namespace, name). +func (r *Repository) Upsert(ctx context.Context, data *EventSubscriptionData) error { + start := time.Now() + defer func() { + metrics.DBOperationDuration.WithLabelValues(entityType, metrics.OperationUpsert).Observe(time.Since(start).Seconds()) + }() + + ownerAppID, err := r.deps.FindApplicationID(ctx, data.OwnerAppName, data.OwnerTeamName) + if err != nil { + if errors.Is(err, infrastructure.ErrEntityNotFound) { + return runtime.WrapDependencyMissing("application", data.OwnerAppName) + } + return fmt.Errorf("find application %q (team %q): %w", data.OwnerAppName, data.OwnerTeamName, err) + } + + // Target exposure is optional — subscription may exist before the target + // event is exposed. + var targetExposureID *int + if id, findErr := r.deps.FindEventExposureByEventType(ctx, data.TargetEventType); findErr != nil { + if !errors.Is(findErr, infrastructure.ErrEntityNotFound) { + return fmt.Errorf("find target event_exposure for subscription (eventType %q): %w", + data.TargetEventType, findErr) + } + } else { + targetExposureID = &id + } + + create := r.client.EventSubscription.Create(). + SetEventType(data.EventType). + SetEnvironment(data.Meta.Environment). + SetNamespace(data.Meta.Namespace). + SetName(data.Meta.Name). + SetDeliveryType(eventsubscription.DeliveryType(data.DeliveryType)). + SetNillableCallbackURL(data.CallbackURL). + SetStatusPhase(eventsubscription.StatusPhase(data.StatusPhase)). + SetStatusMessage(data.StatusMessage). + SetOwnerID(ownerAppID). + SetNillableTargetID(targetExposureID) + + subscriptionID, upsertErr := create. + OnConflictColumns(eventsubscription.FieldEventType, eventsubscription.OwnerColumn). + UpdateNewValues(). + ID(ctx) + if upsertErr != nil { + return fmt.Errorf("upsert event_subscription (owner %q, eventType %q): %w", + data.OwnerAppName, data.EventType, upsertErr) + } + + // When targetExposureID is nil, explicitly clear the target FK. + if targetExposureID == nil { + if err := r.client.EventSubscription.UpdateOneID(subscriptionID). + ClearTarget(). + Exec(ctx); err != nil { + return fmt.Errorf("clear target FK for event_subscription %d (owner %q, eventType %q): %w", + subscriptionID, data.OwnerAppName, data.EventType, err) + } + } + + et, lk := cachekeys.EventSubscriptionMeta(data.Meta.Namespace, data.Meta.Name) + r.cache.Set(et, lk, subscriptionID) + return nil +} + +// Delete removes an EventSubscription entity from the database by owner +// application name, team name, and event type. Also cleans the meta cache +// entry. Returns nil if the entity does not exist (idempotent delete). +func (r *Repository) Delete(ctx context.Context, key EventSubscriptionKey) error { + start := time.Now() + defer func() { + metrics.DBOperationDuration.WithLabelValues(entityType, metrics.OperationDelete).Observe(time.Since(start).Seconds()) + }() + + count, err := r.client.EventSubscription.Delete(). + Where( + eventsubscription.HasOwnerWith( + application.NameEQ(key.OwnerAppName), + application.HasOwnerTeamWith(team.NameEQ(key.OwnerTeamName)), + ), + eventsubscription.EventTypeEQ(key.EventType), + ). + Exec(ctx) + if err != nil { + return fmt.Errorf("delete event_subscription (owner %q, team %q, eventType %q): %w", + key.OwnerAppName, key.OwnerTeamName, key.EventType, err) + } + if count > 0 { + if key.Namespace != "" && key.Name != "" { + et, lk := cachekeys.EventSubscriptionMeta(key.Namespace, key.Name) + r.cache.Del(et, lk) + } + } + return nil +} diff --git a/projector/internal/domain/eventsubscription/repository_test.go b/projector/internal/domain/eventsubscription/repository_test.go new file mode 100644 index 000000000..5cb3bd0ab --- /dev/null +++ b/projector/internal/domain/eventsubscription/repository_test.go @@ -0,0 +1,234 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventsubscription_test + +import ( + "context" + "errors" + "fmt" + + "entgo.io/ent/privacy" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + _ "github.com/mattn/go-sqlite3" + "github.com/telekom/controlplane/controlplane-api/ent" + "github.com/telekom/controlplane/controlplane-api/ent/enttest" + enteventsubscription "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" + _ "github.com/telekom/controlplane/controlplane-api/ent/runtime" + "github.com/telekom/controlplane/controlplane-api/ent/zone" + + "github.com/telekom/controlplane/projector/internal/domain/eventsubscription" + "github.com/telekom/controlplane/projector/internal/domain/shared" + "github.com/telekom/controlplane/projector/internal/infrastructure" + "github.com/telekom/controlplane/projector/internal/runtime" +) + +// mockSubscriptionDeps implements eventsubscription.EventSubscriptionDeps for testing. +type mockSubscriptionDeps struct { + appIDs map[string]int + appErr error + exposureIDs map[string]int + exposureErr error +} + +func (m *mockSubscriptionDeps) FindApplicationID(_ context.Context, name, teamName string) (int, error) { + if m.appErr != nil { + return 0, m.appErr + } + key := name + ":" + teamName + if id, ok := m.appIDs[key]; ok { + return id, nil + } + return 0, fmt.Errorf("application %q (team %q): %w", name, teamName, infrastructure.ErrEntityNotFound) +} + +func (m *mockSubscriptionDeps) FindEventExposureByEventType(_ context.Context, eventType string) (int, error) { + if m.exposureErr != nil { + return 0, m.exposureErr + } + if id, ok := m.exposureIDs[eventType]; ok { + return id, nil + } + return 0, fmt.Errorf("event_exposure %q: %w", eventType, infrastructure.ErrEntityNotFound) +} + +var _ = Describe("EventSubscription Repository", func() { + var ( + client *ent.Client + cache *infrastructure.EdgeCache + deps *mockSubscriptionDeps + repo *eventsubscription.Repository + ctx context.Context + appID int + ) + + BeforeEach(func() { + ctx = privacy.DecisionContext(context.Background(), privacy.Allow) + var err error + cache, err = infrastructure.NewEdgeCache(100_000, 10<<20, 64) + Expect(err).NotTo(HaveOccurred()) + client = enttest.Open(GinkgoT(), "sqlite3", "file:ent?mode=memory&_fk=1") + + z, err := client.Zone.Create(). + SetName("caas"). + SetVisibility(zone.VisibilityEnterprise). + Save(ctx) + Expect(err).NotTo(HaveOccurred()) + + t, err := client.Team.Create(). + SetName("platform--narvi"). + SetEmail("narvi@example.com"). + SetNamespace("platform--narvi"). + Save(ctx) + Expect(err).NotTo(HaveOccurred()) + + app, err := client.Application.Create(). + SetName("consumer-app"). + SetNamespace("platform--narvi"). + SetOwnerTeamID(t.ID). + SetZoneID(z.ID). + Save(ctx) + Expect(err).NotTo(HaveOccurred()) + appID = app.ID + + deps = &mockSubscriptionDeps{ + appIDs: map[string]int{"consumer-app:platform--narvi": appID}, + exposureIDs: map[string]int{}, + } + repo = eventsubscription.NewRepository(client, cache, deps) + }) + + AfterEach(func() { + _ = client.Close() + cache.Close() + }) + + Describe("Upsert", func() { + It("should create an event subscription with valid deps (no target)", func() { + callbackURL := "https://consumer.example.com/events" + data := &eventsubscription.EventSubscriptionData{ + Meta: shared.NewMetadata("prod--platform--narvi", "sub-1", nil), + StatusPhase: "READY", + StatusMessage: "ok", + EventType: "de.telekom.eni.quickstart.v1", + DeliveryType: "CALLBACK", + CallbackURL: &callbackURL, + OwnerAppName: "consumer-app", + OwnerTeamName: "platform--narvi", + TargetEventType: "de.telekom.eni.quickstart.v1", + } + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + sub, err := client.EventSubscription.Query(). + Where(enteventsubscription.EventTypeEQ("de.telekom.eni.quickstart.v1")). + Only(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(sub.EventType).To(Equal("de.telekom.eni.quickstart.v1")) + Expect(sub.DeliveryType.String()).To(Equal("CALLBACK")) + Expect(sub.CallbackURL).ToNot(BeNil()) + Expect(*sub.CallbackURL).To(Equal("https://consumer.example.com/events")) + + owner, err := sub.QueryOwner().Only(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(owner.ID).To(Equal(appID)) + + // Target should be nil (no exposure found). + hasTarget, err := sub.QueryTarget().Exist(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(hasTarget).To(BeFalse()) + }) + + It("should return ErrDependencyMissing when application is missing", func() { + data := &eventsubscription.EventSubscriptionData{ + Meta: shared.NewMetadata("prod--platform--narvi", "fail-sub", nil), + StatusPhase: "UNKNOWN", + EventType: "de.telekom.fail.v1", + DeliveryType: "CALLBACK", + OwnerAppName: "missing-app", + OwnerTeamName: "platform--narvi", + TargetEventType: "de.telekom.fail.v1", + } + err := repo.Upsert(ctx, data) + Expect(err).To(HaveOccurred()) + Expect(runtime.IsDependencyMissing(err)).To(BeTrue()) + }) + + It("should propagate non-ErrEntityNotFound errors from FindApplicationID", func() { + dbErr := errors.New("connection refused") + failDeps := &mockSubscriptionDeps{appErr: dbErr, exposureIDs: map[string]int{}} + failRepo := eventsubscription.NewRepository(client, cache, failDeps) + + data := &eventsubscription.EventSubscriptionData{ + Meta: shared.NewMetadata("prod--platform--narvi", "fail-sub", nil), + StatusPhase: "UNKNOWN", + EventType: "de.telekom.fail.v1", + DeliveryType: "CALLBACK", + OwnerAppName: "consumer-app", + OwnerTeamName: "platform--narvi", + TargetEventType: "de.telekom.fail.v1", + } + err := failRepo.Upsert(ctx, data) + Expect(err).To(HaveOccurred()) + Expect(runtime.IsDependencyMissing(err)).To(BeFalse()) + Expect(errors.Is(err, dbErr)).To(BeTrue()) + }) + + It("should populate the meta cache after upsert", func() { + data := &eventsubscription.EventSubscriptionData{ + Meta: shared.NewMetadata("prod--platform--narvi", "cached-sub", nil), + StatusPhase: "READY", + EventType: "de.telekom.cached.v1", + DeliveryType: "CALLBACK", + OwnerAppName: "consumer-app", + OwnerTeamName: "platform--narvi", + TargetEventType: "de.telekom.cached.v1", + } + Expect(repo.Upsert(ctx, data)).To(Succeed()) + cache.Wait() + + id, found := cache.Get("eventsubscription", "meta:prod--platform--narvi:cached-sub") + Expect(found).To(BeTrue()) + Expect(id).To(BeNumerically(">", 0)) + }) + }) + + Describe("Delete", func() { + It("should delete an existing event subscription", func() { + data := &eventsubscription.EventSubscriptionData{ + Meta: shared.NewMetadata("prod--platform--narvi", "del-sub", nil), + StatusPhase: "READY", + EventType: "de.telekom.delete.v1", + DeliveryType: "CALLBACK", + OwnerAppName: "consumer-app", + OwnerTeamName: "platform--narvi", + TargetEventType: "de.telekom.delete.v1", + } + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + key := eventsubscription.EventSubscriptionKey{ + EventType: "de.telekom.delete.v1", + OwnerAppName: "consumer-app", + OwnerTeamName: "platform--narvi", + Namespace: "prod--platform--narvi", + Name: "del-sub", + } + Expect(repo.Delete(ctx, key)).To(Succeed()) + + count, err := client.EventSubscription.Query().Count(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(count).To(Equal(0)) + }) + + It("should be idempotent for non-existent subscription", func() { + key := eventsubscription.EventSubscriptionKey{ + EventType: "de.telekom.nonexistent.v1", + OwnerAppName: "consumer-app", + OwnerTeamName: "platform--narvi", + } + Expect(repo.Delete(ctx, key)).To(Succeed()) + }) + }) +}) diff --git a/projector/internal/domain/eventsubscription/translator.go b/projector/internal/domain/eventsubscription/translator.go new file mode 100644 index 000000000..62ed8156d --- /dev/null +++ b/projector/internal/domain/eventsubscription/translator.go @@ -0,0 +1,105 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventsubscription + +import ( + "context" + "strings" + + eventv1 "github.com/telekom/controlplane/event/api/v1" + "github.com/telekom/controlplane/projector/internal/domain/shared" + "github.com/telekom/controlplane/projector/internal/runtime" + "k8s.io/apimachinery/pkg/types" +) + +// applicationLabelKey is the label key used by the Rover controller to +// associate an EventSubscription CR with its owner Application. +const applicationLabelKey = "cp.ei.telekom.de/application" + +// Translator maps an EventSubscription CR to an EventSubscriptionData DTO +// and derives identity keys. +type Translator struct{} + +// compile-time interface check. +var _ runtime.Translator[*eventv1.EventSubscription, *EventSubscriptionData, EventSubscriptionKey] = (*Translator)(nil) + +// ShouldSkip returns false — EventSubscription CRs are always syncable. +func (t *Translator) ShouldSkip(_ *eventv1.EventSubscription) (bool, string) { + return false, "" +} + +// Translate converts an EventSubscription CR into an EventSubscriptionData DTO. +// DeliveryType is upper-cased with underscores (Callback→CALLBACK, +// ServerSentEvent→SERVER_SENT_EVENT). CallbackURL is set when delivery type +// is Callback. OwnerAppName from Requestor.Application.Name, OwnerTeamName +// from namespace. +func (t *Translator) Translate(_ context.Context, obj *eventv1.EventSubscription) (*EventSubscriptionData, error) { + phase, message := shared.StatusFromConditions(obj.Status.Conditions) + + var callbackURL *string + if obj.Spec.Delivery.Callback != "" { + s := obj.Spec.Delivery.Callback + callbackURL = &s + } + + return &EventSubscriptionData{ + Meta: shared.NewMetadata(obj.Namespace, obj.Name, obj.Labels), + StatusPhase: phase, + StatusMessage: message, + EventType: obj.Spec.EventType, + DeliveryType: mapDeliveryType(string(obj.Spec.Delivery.Type)), + CallbackURL: callbackURL, + OwnerAppName: obj.Spec.Requestor.Name, + OwnerTeamName: shared.TeamNameFromNamespace(obj.Namespace), + TargetEventType: obj.Spec.EventType, + }, nil +} + +// KeyFromObject derives the composite identity key from a live EventSubscription. +func (t *Translator) KeyFromObject(obj *eventv1.EventSubscription) EventSubscriptionKey { + return EventSubscriptionKey{ + EventType: obj.Spec.EventType, + OwnerAppName: obj.Spec.Requestor.Name, + OwnerTeamName: shared.TeamNameFromNamespace(obj.Namespace), + Namespace: obj.Namespace, + Name: obj.Name, + } +} + +// KeyFromDelete derives the identity key for a delete operation. +// If lastKnown is available, all fields are taken from the spec + metadata. +// Otherwise, key.Name is used as best-effort. Always succeeds. +func (t *Translator) KeyFromDelete(req types.NamespacedName, lastKnown *eventv1.EventSubscription) (EventSubscriptionKey, error) { + if lastKnown != nil { + return EventSubscriptionKey{ + EventType: lastKnown.Spec.EventType, + OwnerAppName: lastKnown.Spec.Requestor.Name, + OwnerTeamName: shared.TeamNameFromNamespace(lastKnown.Namespace), + Namespace: lastKnown.Namespace, + Name: lastKnown.Name, + }, nil + } + return EventSubscriptionKey{ + EventType: req.Name, + OwnerAppName: req.Name, + OwnerTeamName: shared.TeamNameFromNamespace(req.Namespace), + Namespace: req.Namespace, + Name: req.Name, + }, nil +} + +// mapDeliveryType converts CR delivery type values to the DB enum +// representation. CR uses PascalCase (Callback, ServerSentEvent), while +// the DB uses uppercase with underscores (CALLBACK, SERVER_SENT_EVENT). +func mapDeliveryType(dt string) string { + switch dt { + case "Callback": + return "CALLBACK" + case "ServerSentEvent": + return "SERVER_SENT_EVENT" + default: + return strings.ToUpper(dt) + } +} diff --git a/projector/internal/domain/eventsubscription/translator_test.go b/projector/internal/domain/eventsubscription/translator_test.go new file mode 100644 index 000000000..249929a21 --- /dev/null +++ b/projector/internal/domain/eventsubscription/translator_test.go @@ -0,0 +1,190 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventsubscription_test + +import ( + "context" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + ctypes "github.com/telekom/controlplane/common/pkg/types" + eventv1 "github.com/telekom/controlplane/event/api/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + k8stypes "k8s.io/apimachinery/pkg/types" + + "github.com/telekom/controlplane/projector/internal/domain/eventsubscription" +) + +var _ = Describe("EventSubscription Translator", func() { + var t eventsubscription.Translator + + Describe("ShouldSkip", func() { + It("should never skip", func() { + obj := &eventv1.EventSubscription{} + skip, reason := t.ShouldSkip(obj) + Expect(skip).To(BeFalse()) + Expect(reason).To(BeEmpty()) + }) + }) + + Describe("Translate", func() { + It("should populate all fields from the CR with Callback delivery", func() { + obj := &eventv1.EventSubscription{ + ObjectMeta: metav1.ObjectMeta{ + Name: "my-subscription", + Namespace: "prod--platform--narvi", + Labels: map[string]string{ + "cp.ei.telekom.de/environment": "prod", + "cp.ei.telekom.de/application": "my-app", + }, + }, + Spec: eventv1.EventSubscriptionSpec{ + EventType: "de.telekom.eni.quickstart.v1", + Requestor: ctypes.TypedObjectRef{ + ObjectRef: ctypes.ObjectRef{Name: "consumer-app"}, + }, + Delivery: eventv1.Delivery{ + Type: eventv1.DeliveryTypeCallback, + Callback: "https://consumer.example.com/events", + }, + }, + Status: eventv1.EventSubscriptionStatus{ + Conditions: []metav1.Condition{ + { + Type: "Ready", + Status: metav1.ConditionTrue, + Message: "subscribed", + }, + }, + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + + Expect(data.EventType).To(Equal("de.telekom.eni.quickstart.v1")) + Expect(data.DeliveryType).To(Equal("CALLBACK")) + Expect(data.CallbackURL).ToNot(BeNil()) + Expect(*data.CallbackURL).To(Equal("https://consumer.example.com/events")) + Expect(data.OwnerAppName).To(Equal("consumer-app")) + Expect(data.OwnerTeamName).To(Equal("platform--narvi")) + Expect(data.TargetEventType).To(Equal("de.telekom.eni.quickstart.v1")) + Expect(data.StatusPhase).To(Equal("READY")) + Expect(data.StatusMessage).To(Equal("subscribed")) + Expect(data.Meta.Environment).To(Equal("prod")) + }) + + It("should handle ServerSentEvent delivery with no callback", func() { + obj := &eventv1.EventSubscription{ + ObjectMeta: metav1.ObjectMeta{ + Name: "sse-sub", + Namespace: "prod--platform--narvi", + Labels: map[string]string{"cp.ei.telekom.de/application": "app"}, + }, + Spec: eventv1.EventSubscriptionSpec{ + EventType: "de.telekom.sse.v1", + Requestor: ctypes.TypedObjectRef{ + ObjectRef: ctypes.ObjectRef{Name: "sse-app"}, + }, + Delivery: eventv1.Delivery{ + Type: eventv1.DeliveryTypeServerSentEvent, + }, + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.DeliveryType).To(Equal("SERVER_SENT_EVENT")) + Expect(data.CallbackURL).To(BeNil()) + }) + + It("should derive UNKNOWN status when no conditions are set", func() { + obj := &eventv1.EventSubscription{ + ObjectMeta: metav1.ObjectMeta{ + Name: "no-conditions", + Namespace: "prod--platform--narvi", + Labels: map[string]string{"cp.ei.telekom.de/application": "app"}, + }, + Spec: eventv1.EventSubscriptionSpec{ + EventType: "de.telekom.nocond.v1", + Requestor: ctypes.TypedObjectRef{ + ObjectRef: ctypes.ObjectRef{Name: "app"}, + }, + Delivery: eventv1.Delivery{Type: eventv1.DeliveryTypeCallback, Callback: "https://example.com"}, + }, + } + + data, err := t.Translate(context.Background(), obj) + Expect(err).NotTo(HaveOccurred()) + Expect(data.StatusPhase).To(Equal("UNKNOWN")) + }) + }) + + Describe("KeyFromObject", func() { + It("should return composite key from CR fields", func() { + obj := &eventv1.EventSubscription{ + ObjectMeta: metav1.ObjectMeta{ + Name: "my-subscription", + Namespace: "prod--platform--narvi", + Labels: map[string]string{"cp.ei.telekom.de/application": "my-app"}, + }, + Spec: eventv1.EventSubscriptionSpec{ + EventType: "de.telekom.eni.quickstart.v1", + Requestor: ctypes.TypedObjectRef{ + ObjectRef: ctypes.ObjectRef{Name: "consumer-app"}, + }, + }, + } + + key := t.KeyFromObject(obj) + Expect(key.EventType).To(Equal("de.telekom.eni.quickstart.v1")) + Expect(key.OwnerAppName).To(Equal("consumer-app")) + Expect(key.OwnerTeamName).To(Equal("platform--narvi")) + Expect(key.Namespace).To(Equal("prod--platform--narvi")) + Expect(key.Name).To(Equal("my-subscription")) + }) + }) + + Describe("KeyFromDelete", func() { + It("should use CR fields from lastKnown when available", func() { + req := k8stypes.NamespacedName{ + Namespace: "prod--platform--narvi", + Name: "my-subscription", + } + lastKnown := &eventv1.EventSubscription{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "prod--platform--narvi", + Name: "my-subscription", + }, + Spec: eventv1.EventSubscriptionSpec{ + EventType: "de.telekom.eni.quickstart.v1", + Requestor: ctypes.TypedObjectRef{ + ObjectRef: ctypes.ObjectRef{Name: "consumer-app"}, + }, + }, + } + + key, err := t.KeyFromDelete(req, lastKnown) + Expect(err).NotTo(HaveOccurred()) + Expect(key.EventType).To(Equal("de.telekom.eni.quickstart.v1")) + Expect(key.OwnerAppName).To(Equal("consumer-app")) + Expect(key.OwnerTeamName).To(Equal("platform--narvi")) + }) + + It("should fall back to convention when lastKnown is nil", func() { + req := k8stypes.NamespacedName{ + Namespace: "prod--platform--narvi", + Name: "my-subscription", + } + + key, err := t.KeyFromDelete(req, nil) + Expect(err).NotTo(HaveOccurred()) + Expect(key.EventType).To(Equal("my-subscription")) + Expect(key.OwnerAppName).To(Equal("my-subscription")) + Expect(key.OwnerTeamName).To(Equal("platform--narvi")) + }) + }) +}) diff --git a/projector/internal/domain/eventsubscription/types.go b/projector/internal/domain/eventsubscription/types.go new file mode 100644 index 000000000..9769bb9c8 --- /dev/null +++ b/projector/internal/domain/eventsubscription/types.go @@ -0,0 +1,36 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +// Package eventsubscription implements the EventSubscription resource module +// for the projector. EventSubscription is a Level 3 entity with a required +// FK dependency on Application (owner) and an optional FK dependency on +// EventExposure (target). +package eventsubscription + +import "github.com/telekom/controlplane/projector/internal/domain/shared" + +// EventSubscriptionKey is the composite identity key for EventSubscription +// entities. It contains the fields needed for both the primary DB operation +// (EventType + OwnerAppName + OwnerTeamName) and the meta cache cleanup on +// delete (Namespace + Name). +type EventSubscriptionKey struct { + EventType string + OwnerAppName string + OwnerTeamName string + Namespace string + Name string +} + +// EventSubscriptionData carries the transformed data for an EventSubscription entity. +type EventSubscriptionData struct { + Meta shared.Metadata + StatusPhase string // "READY", "PENDING", "ERROR", "UNKNOWN" + StatusMessage string + EventType string + DeliveryType string // "CALLBACK", "SERVER_SENT_EVENT" + CallbackURL *string // set when delivery type is Callback + OwnerAppName string // resolved to owner Application FK (required) + OwnerTeamName string // used to resolve owner Application FK + TargetEventType string // used to resolve optional target EventExposure FK +} diff --git a/projector/internal/domain/team/repository.go b/projector/internal/domain/team/repository.go index d0aefe106..e7eddaf00 100644 --- a/projector/internal/domain/team/repository.go +++ b/projector/internal/domain/team/repository.go @@ -84,6 +84,10 @@ func (r *Repository) Upsert(ctx context.Context, data *TeamData) error { SetEnvironment(data.Meta.Environment). SetNamespace(data.Meta.Namespace) + if data.TeamToken != "" { + create = create.SetTeamToken(data.TeamToken) + } + if groupID > 0 { create = create.SetGroupID(groupID) } @@ -97,6 +101,11 @@ func (r *Repository) Upsert(ctx context.Context, data *TeamData) error { u.SetStatusMessage(data.StatusMessage) u.SetEnvironment(data.Meta.Environment) u.SetNamespace(data.Meta.Namespace) + if data.TeamToken != "" { + u.SetTeamToken(data.TeamToken) + } else { + u.ClearTeamToken() + } }). ID(ctx) if upsertErr != nil { diff --git a/projector/internal/domain/team/translator.go b/projector/internal/domain/team/translator.go index c20b693e3..6465a0c6b 100644 --- a/projector/internal/domain/team/translator.go +++ b/projector/internal/domain/team/translator.go @@ -49,6 +49,7 @@ func (t *Translator) Translate(_ context.Context, obj *orgv1.Team) (*TeamData, e Email: obj.Spec.Email, Category: strings.ToUpper(string(obj.Spec.Category)), GroupName: obj.Spec.Group, + TeamToken: obj.GetTeamToken(), Members: members, }, nil } diff --git a/projector/internal/domain/team/types.go b/projector/internal/domain/team/types.go index eac0fc220..8e7f0868e 100644 --- a/projector/internal/domain/team/types.go +++ b/projector/internal/domain/team/types.go @@ -24,6 +24,7 @@ type TeamData struct { Email string Category string // "CUSTOMER" or "INFRASTRUCTURE" (upper-cased from CR enum) GroupName string + TeamToken string // secret-manager reference for the team token Members []MemberData } diff --git a/projector/internal/domain/zone/repository.go b/projector/internal/domain/zone/repository.go index ae4429ad2..d33eb6fd1 100644 --- a/projector/internal/domain/zone/repository.go +++ b/projector/internal/domain/zone/repository.go @@ -55,6 +55,9 @@ func (r *Repository) Upsert(ctx context.Context, data *ZoneData) error { if data.GatewayURL != nil { create = create.SetGatewayURL(*data.GatewayURL) } + if data.IssuerURL != nil { + create = create.SetIssuerURL(*data.IssuerURL) + } id, err := create. OnConflictColumns(zone.FieldName). @@ -66,6 +69,11 @@ func (r *Repository) Upsert(ctx context.Context, data *ZoneData) error { } else { u.ClearGatewayURL() } + if data.IssuerURL != nil { + u.SetIssuerURL(*data.IssuerURL) + } else { + u.ClearIssuerURL() + } }). ID(ctx) if err != nil { diff --git a/projector/internal/domain/zone/repository_test.go b/projector/internal/domain/zone/repository_test.go index 4267e4833..53a9ebd4c 100644 --- a/projector/internal/domain/zone/repository_test.go +++ b/projector/internal/domain/zone/repository_test.go @@ -115,6 +115,44 @@ var _ = Describe("Zone Repository", func() { Expect(z.GatewayURL).To(BeNil()) }) + It("should create a zone with issuer URL", func() { + data := &zone.ZoneData{ + Meta: shared.NewMetadata("admin", "zone-issuer", nil), + Name: "zone-issuer", + GatewayURL: strPtr("https://gw.example.com"), + IssuerURL: strPtr("https://keycloak.example.com/auth/realms/production"), + Visibility: "WORLD", + } + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + z, err := client.Zone.Query().Only(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(z.IssuerURL).NotTo(BeNil()) + Expect(*z.IssuerURL).To(Equal("https://keycloak.example.com/auth/realms/production")) + }) + + It("should clear IssuerURL when updated to nil", func() { + data := &zone.ZoneData{ + Meta: shared.NewMetadata("admin", "zone-issuer-clear", nil), + Name: "zone-issuer-clear", + IssuerURL: strPtr("https://keycloak.example.com/auth/realms/staging"), + Visibility: "ENTERPRISE", + } + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + z, err := client.Zone.Query().Only(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(z.IssuerURL).NotTo(BeNil()) + + // Update with nil issuer URL. + data.IssuerURL = nil + Expect(repo.Upsert(ctx, data)).To(Succeed()) + + z, err = client.Zone.Query().Only(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(z.IssuerURL).To(BeNil()) + }) + It("should populate the edge cache after upsert", func() { data := &zone.ZoneData{ Meta: shared.NewMetadata("admin", "cached-zone", nil), diff --git a/projector/internal/domain/zone/translator.go b/projector/internal/domain/zone/translator.go index cb8d10cd0..3c2c29ceb 100644 --- a/projector/internal/domain/zone/translator.go +++ b/projector/internal/domain/zone/translator.go @@ -37,10 +37,17 @@ func (t *Translator) Translate(_ context.Context, obj *adminv1.Zone) (*ZoneData, gatewayURL = &url } + var issuerURL *string + if obj.Status.Links.Issuer != "" { + u := obj.Status.Links.Issuer + issuerURL = &u + } + return &ZoneData{ Meta: shared.NewMetadata(obj.Namespace, obj.Name, obj.Labels), Name: obj.Name, GatewayURL: gatewayURL, + IssuerURL: issuerURL, Visibility: strings.ToUpper(string(obj.Spec.Visibility)), }, nil } diff --git a/projector/internal/domain/zone/translator_test.go b/projector/internal/domain/zone/translator_test.go index 57303ca08..f884581b0 100644 --- a/projector/internal/domain/zone/translator_test.go +++ b/projector/internal/domain/zone/translator_test.go @@ -122,9 +122,65 @@ var _ = Describe("Zone Translator", func() { Meta: shared.NewMetadata("admin", "zone-d", nil), Name: "zone-d", GatewayURL: nil, + IssuerURL: nil, Visibility: "ENTERPRISE", }, ), + Entry("issuer URL is populated from Status.Links.Issuer", + &adminv1.Zone{ + ObjectMeta: metav1.ObjectMeta{ + Name: "zone-e", + Namespace: "admin", + Labels: map[string]string{ + "cp.ei.telekom.de/environment": "production", + }, + }, + Spec: adminv1.ZoneSpec{ + Visibility: adminv1.ZoneVisibilityWorld, + Gateway: adminv1.GatewayConfig{ + Url: "https://gateway.example.com", + }, + }, + Status: adminv1.ZoneStatus{ + Links: adminv1.Links{ + Issuer: "https://keycloak.example.com/auth/realms/production", + }, + }, + }, + &zone.ZoneData{ + Meta: shared.NewMetadata("admin", "zone-e", map[string]string{"cp.ei.telekom.de/environment": "production"}), + Name: "zone-e", + GatewayURL: strPtr("https://gateway.example.com"), + IssuerURL: strPtr("https://keycloak.example.com/auth/realms/production"), + Visibility: "WORLD", + }, + ), + Entry("empty issuer URL is treated as nil", + &adminv1.Zone{ + ObjectMeta: metav1.ObjectMeta{ + Name: "zone-f", + Namespace: "admin", + }, + Spec: adminv1.ZoneSpec{ + Visibility: adminv1.ZoneVisibilityWorld, + Gateway: adminv1.GatewayConfig{ + Url: "https://gw.test", + }, + }, + Status: adminv1.ZoneStatus{ + Links: adminv1.Links{ + Issuer: "", + }, + }, + }, + &zone.ZoneData{ + Meta: shared.NewMetadata("admin", "zone-f", nil), + Name: "zone-f", + GatewayURL: strPtr("https://gw.test"), + IssuerURL: nil, + Visibility: "WORLD", + }, + ), ) }) diff --git a/projector/internal/domain/zone/types.go b/projector/internal/domain/zone/types.go index b1d4c5bc0..b0d102adb 100644 --- a/projector/internal/domain/zone/types.go +++ b/projector/internal/domain/zone/types.go @@ -18,5 +18,6 @@ type ZoneData struct { Meta shared.Metadata Name string GatewayURL *string // optional/nillable — nil when Spec.Gateway.Url is empty + IssuerURL *string // optional/nillable — nil when Status.Links.Issuer is empty Visibility string // "WORLD" or "ENTERPRISE" (upper-cased from CR enum) } diff --git a/projector/internal/infrastructure/cachekeys/cachekeys.go b/projector/internal/infrastructure/cachekeys/cachekeys.go index 5e69eeab2..97b426b15 100644 --- a/projector/internal/infrastructure/cachekeys/cachekeys.go +++ b/projector/internal/infrastructure/cachekeys/cachekeys.go @@ -63,3 +63,25 @@ func Approval(namespace, name string) (entityType, lookupKey string) { func ApprovalRequest(namespace, name string) (entityType, lookupKey string) { return "approvalrequest", namespace + ":" + name } + +// EventExposure returns the cache key components for an EventExposure entity +// identified by event type, application name, and team name. +// Event types are unique per application, and applications per team, +// so all three are required. +func EventExposure(eventType, appName, teamName string) (entityType, lookupKey string) { + return "eventexposure", eventType + ":" + appName + ":" + teamName +} + +// EventExposureByEventType returns the cache key components for an +// EventExposure entity looked up by event type alone. Uses an "et:" prefix +// to avoid collisions with the full composite key used by [EventExposure]. +func EventExposureByEventType(eventType string) (entityType, lookupKey string) { + return "eventexposure", "et:" + eventType +} + +// EventSubscriptionMeta returns the cache key components for an +// EventSubscription entity looked up by its Kubernetes metadata +// (namespace + name). +func EventSubscriptionMeta(namespace, name string) (entityType, lookupKey string) { + return "eventsubscription", "meta:" + namespace + ":" + name +} diff --git a/projector/internal/infrastructure/errors.go b/projector/internal/infrastructure/errors.go index d9f1129bf..2cf6d371a 100644 --- a/projector/internal/infrastructure/errors.go +++ b/projector/internal/infrastructure/errors.go @@ -4,8 +4,24 @@ package infrastructure -import "errors" +import ( + "errors" + + "github.com/jackc/pgx/v5/pgconn" +) // ErrEntityNotFound is returned when an IDResolver lookup finds no matching // entity in either the cache or the database. var ErrEntityNotFound = errors.New("entity not found") + +// IsFKViolation reports whether err (or any error in its chain) is a +// PostgreSQL foreign-key constraint violation (SQLSTATE 23503). +// This is used to detect races where a cached FK ID points to a row that +// no longer exists in the database. +func IsFKViolation(err error) bool { + var pgErr *pgconn.PgError + if errors.As(err, &pgErr) { + return pgErr.Code == "23503" + } + return false +} diff --git a/projector/internal/infrastructure/errors_test.go b/projector/internal/infrastructure/errors_test.go new file mode 100644 index 000000000..f1b3f6e33 --- /dev/null +++ b/projector/internal/infrastructure/errors_test.go @@ -0,0 +1,42 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package infrastructure_test + +import ( + "errors" + "fmt" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/jackc/pgx/v5/pgconn" + "github.com/telekom/controlplane/projector/internal/infrastructure" +) + +var _ = Describe("IsFKViolation", func() { + It("should return true for a PostgreSQL foreign key violation (23503)", func() { + pgErr := &pgconn.PgError{Code: "23503"} + Expect(infrastructure.IsFKViolation(pgErr)).To(BeTrue()) + }) + + It("should return true for a wrapped foreign key violation", func() { + pgErr := &pgconn.PgError{Code: "23503"} + wrapped := fmt.Errorf("upsert failed: %w", pgErr) + Expect(infrastructure.IsFKViolation(wrapped)).To(BeTrue()) + }) + + It("should return false for a different PostgreSQL error code", func() { + pgErr := &pgconn.PgError{Code: "23505"} // unique_violation + Expect(infrastructure.IsFKViolation(pgErr)).To(BeFalse()) + }) + + It("should return false for a non-PostgreSQL error", func() { + Expect(infrastructure.IsFKViolation(errors.New("some error"))).To(BeFalse()) + }) + + It("should return false for nil", func() { + Expect(infrastructure.IsFKViolation(nil)).To(BeFalse()) + }) +}) diff --git a/projector/internal/infrastructure/idresolver.go b/projector/internal/infrastructure/idresolver.go index 1f6de7ddb..403d5ffd8 100644 --- a/projector/internal/infrastructure/idresolver.go +++ b/projector/internal/infrastructure/idresolver.go @@ -17,6 +17,8 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventsubscription" entgroup "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/team" "github.com/telekom/controlplane/controlplane-api/ent/zone" @@ -363,3 +365,110 @@ func (r *IDResolver) FindAPISubscriptionByMeta(ctx context.Context, namespace, n return sub.ID, nil }) } + +// FindEventSubscriptionByMeta looks up the DB primary key for an EventSubscription +// by its Kubernetes metadata (namespace + name). The (namespace, name) pair +// forms a unique composite index, so at most one row can match. +// Returns ErrEntityNotFound (wrapped) if no matching row exists. +func (r *IDResolver) FindEventSubscriptionByMeta(ctx context.Context, namespace, name string) (int, error) { + et, lk := cachekeys.EventSubscriptionMeta(namespace, name) + fullKey := et + ":" + lk + return r.resolve(ctx, et, lk, fmt.Sprintf("event_subscription %s/%s", namespace, name), func() (int, error) { + sub, err := r.client.EventSubscription.Query(). + Where( + eventsubscription.NamespaceEQ(namespace), + eventsubscription.NameEQ(name), + ). + Only(ctx) + if err != nil { + if ent.IsNotFound(err) { + r.setNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBMiss).Inc() + return 0, fmt.Errorf("event_subscription %s/%s: %w", namespace, name, ErrEntityNotFound) + } + return 0, fmt.Errorf("find event_subscription %s/%s: %w", namespace, name, err) + } + r.clearNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBHit).Inc() + r.cache.Set(et, lk, sub.ID) + return sub.ID, nil + }) +} + +// EvictAPISubscription removes the cached DB primary key for an ApiSubscription +// identified by namespace + name. This is called when a FK constraint violation +// indicates the cached ID is stale (e.g. the referenced row was deleted and +// re-created with a different ID). +func (r *IDResolver) EvictAPISubscription(namespace, name string) { + et, lk := cachekeys.APISubscriptionMeta(namespace, name) + r.cache.Del(et, lk) + r.clearNegCache(et + ":" + lk) +} + +// EvictEventSubscription removes the cached DB primary key for an +// EventSubscription identified by namespace + name. +func (r *IDResolver) EvictEventSubscription(namespace, name string) { + et, lk := cachekeys.EventSubscriptionMeta(namespace, name) + r.cache.Del(et, lk) + r.clearNegCache(et + ":" + lk) +} + +// FindEventExposureID looks up the DB primary key for an EventExposure by event +// type, application name, and team name. Event types are unique per application, +// and applications per team, so all three are required. +// Returns ErrEntityNotFound (wrapped) if no matching row exists. +func (r *IDResolver) FindEventExposureID(ctx context.Context, eventType, appName, teamName string) (int, error) { + et, lk := cachekeys.EventExposure(eventType, appName, teamName) + fullKey := et + ":" + lk + return r.resolve(ctx, et, lk, fmt.Sprintf("event_exposure %q (app %q, team %q)", eventType, appName, teamName), func() (int, error) { + exposure, err := r.client.EventExposure.Query(). + Where( + eventexposure.EventTypeEQ(eventType), + eventexposure.HasOwnerWith( + application.NameEQ(appName), + application.HasOwnerTeamWith(team.NameEQ(teamName)), + ), + ). + Only(ctx) + if err != nil { + if ent.IsNotFound(err) { + r.setNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBMiss).Inc() + return 0, fmt.Errorf("event_exposure %q (app %q, team %q): %w", eventType, appName, teamName, ErrEntityNotFound) + } + return 0, fmt.Errorf("find event_exposure %q (app %q, team %q): %w", eventType, appName, teamName, err) + } + r.clearNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBHit).Inc() + r.cache.Set(et, lk, exposure.ID) + return exposure.ID, nil + }) +} + +// FindEventExposureByEventType looks up the DB primary key for an EventExposure +// by event type alone (without requiring the owning application or team name). +// This is needed by EventSubscription because the CR does not carry target +// app/team information. Only active exposures are matched. +// Returns ErrEntityNotFound (wrapped) if no matching active row exists. +func (r *IDResolver) FindEventExposureByEventType(ctx context.Context, eventType string) (int, error) { + et, lk := cachekeys.EventExposureByEventType(eventType) + fullKey := et + ":" + lk + return r.resolve(ctx, et, lk, fmt.Sprintf("event_exposure eventType %q", eventType), func() (int, error) { + exposure, err := r.client.EventExposure.Query(). + Where(eventexposure.EventTypeEQ(eventType)). + Where(eventexposure.ActiveEQ(true)). + First(ctx) + if err != nil { + if ent.IsNotFound(err) { + r.setNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBMiss).Inc() + return 0, fmt.Errorf("event_exposure eventType %q: %w", eventType, ErrEntityNotFound) + } + return 0, fmt.Errorf("find event_exposure eventType %q: %w", eventType, err) + } + r.clearNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBHit).Inc() + r.cache.Set(et, lk, exposure.ID) + return exposure.ID, nil + }) +}