From ab3b6964d560c2c231015f6c051f7884ee1ed186 Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Tue, 12 May 2026 15:42:09 +0200 Subject: [PATCH 01/11] feat(schema): add zone issuer_url and rename rover_token_ref to team_token Add issuer_url field to Zone entity for per-zone identity provider configuration. Rename Team.rover_token_ref to Team.team_token to reflect the generalized token concept. Includes generated ent code and projector domain updates for both entities. --- controlplane-api/ent/schema/team.go | 2 +- controlplane-api/ent/schema/zone.go | 3 + controlplane-api/ent/team.go | 19 ++-- controlplane-api/ent/team/team.go | 13 ++- controlplane-api/ent/team/where.go | 97 +++++++++---------- controlplane-api/ent/team_create.go | 73 +++++++------- controlplane-api/ent/team_delete.go | 1 - controlplane-api/ent/team_query.go | 1 - controlplane-api/ent/team_update.go | 53 +++++----- controlplane-api/ent/zone.go | 17 +++- controlplane-api/ent/zone/where.go | 81 +++++++++++++++- controlplane-api/ent/zone/zone.go | 9 +- controlplane-api/ent/zone_create.go | 79 ++++++++++++++- controlplane-api/ent/zone_delete.go | 1 - controlplane-api/ent/zone_query.go | 1 - controlplane-api/ent/zone_update.go | 53 +++++++++- projector/internal/domain/team/repository.go | 9 ++ projector/internal/domain/team/translator.go | 1 + projector/internal/domain/team/types.go | 1 + projector/internal/domain/zone/repository.go | 8 ++ .../internal/domain/zone/repository_test.go | 38 ++++++++ projector/internal/domain/zone/translator.go | 7 ++ .../internal/domain/zone/translator_test.go | 56 +++++++++++ projector/internal/domain/zone/types.go | 1 + 24 files changed, 483 insertions(+), 141 deletions(-) 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/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/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) } From 6a1f15bcd93e32a4bd14090bd1479f61216302bf Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Tue, 12 May 2026 15:42:56 +0200 Subject: [PATCH 02/11] feat(schema): add secret rotation fields and secrets resolver Add client secret rotation support to Application entity with fields for rotated_client_secret, rotation phase tracking, and expiration timestamps. Remove issuer_url from Application (moved to Zone). Add secrets resolver package for external secret manager integration with deployment patches for SA token projection and trust bundle. Includes projector domain updates for the new application fields. --- common/pkg/config/feature.go | 5 + .../config/default/deployment_patch.yaml | 34 + .../config/default/kustomization.yaml | 4 + .../config/default/namespace_patch.yaml | 8 + controlplane-api/ent/application.go | 164 ++++- .../ent/application/application.go | 154 ++++- controlplane-api/ent/application/where.go | 353 +++++++++-- controlplane-api/ent/application_create.go | 446 +++++++++++-- controlplane-api/ent/application_delete.go | 1 - controlplane-api/ent/application_query.go | 243 +++++++- controlplane-api/ent/application_update.go | 589 +++++++++++++++++- controlplane-api/ent/schema/application.go | 19 +- controlplane-api/internal/secrets/resolver.go | 69 ++ .../internal/secrets/resolver_test.go | 108 ++++ .../internal/secrets/suite_test.go | 17 + .../internal/domain/application/repository.go | 42 +- .../domain/application/repository_test.go | 177 +++--- .../internal/domain/application/translator.go | 107 +++- .../domain/application/translator_test.go | 210 ++++++- .../internal/domain/application/types.go | 14 +- 20 files changed, 2490 insertions(+), 274 deletions(-) create mode 100644 controlplane-api/config/default/namespace_patch.yaml create mode 100644 controlplane-api/internal/secrets/resolver.go create mode 100644 controlplane-api/internal/secrets/resolver_test.go create mode 100644 controlplane-api/internal/secrets/suite_test.go 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/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/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/schema/application.go b/controlplane-api/ent/schema/application.go index ad8b06b64..19c2dce32 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(), } 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/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) } From a67680ee30471f17cdb3af131a599ff08a7a2918 Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Tue, 12 May 2026 15:43:46 +0200 Subject: [PATCH 03/11] feat(schema): add event exposure and subscription entities Introduce EventExposure and EventSubscription ent schemas with visibility, delivery type, approval config, and cascade delete support. Wire new edges from Application, Approval, and ApprovalRequest. Add cascade delete for ApiSubscription approval requests. Includes all generated ent code, projector domains for event exposure/subscription, updated approval/approvalrequest projectors, and shared infrastructure (id resolver, cache keys). --- controlplane-api/ent/apiexposure.go | 1 - .../ent/apiexposure/apiexposure.go | 1 - controlplane-api/ent/apiexposure/where.go | 1 - controlplane-api/ent/apiexposure_create.go | 1 - controlplane-api/ent/apiexposure_delete.go | 1 - controlplane-api/ent/apiexposure_query.go | 1 - controlplane-api/ent/apiexposure_update.go | 1 - controlplane-api/ent/apisubscription.go | 1 - .../ent/apisubscription/apisubscription.go | 1 - controlplane-api/ent/apisubscription/where.go | 1 - .../ent/apisubscription_create.go | 1 - .../ent/apisubscription_delete.go | 1 - controlplane-api/ent/apisubscription_query.go | 1 - .../ent/apisubscription_update.go | 1 - controlplane-api/ent/approval.go | 38 +- controlplane-api/ent/approval/approval.go | 25 +- controlplane-api/ent/approval/where.go | 24 +- controlplane-api/ent/approval_create.go | 38 +- controlplane-api/ent/approval_delete.go | 1 - controlplane-api/ent/approval_query.go | 108 +- controlplane-api/ent/approval_update.go | 110 +- controlplane-api/ent/approvalrequest.go | 38 +- .../ent/approvalrequest/approvalrequest.go | 25 +- controlplane-api/ent/approvalrequest/where.go | 24 +- .../ent/approvalrequest_create.go | 38 +- .../ent/approvalrequest_delete.go | 1 - controlplane-api/ent/approvalrequest_query.go | 108 +- .../ent/approvalrequest_update.go | 110 +- controlplane-api/ent/client.go | 501 ++- controlplane-api/ent/ent.go | 23 +- controlplane-api/ent/enttest/enttest.go | 1 - controlplane-api/ent/eventexposure.go | 311 ++ .../ent/eventexposure/eventexposure.go | 301 ++ controlplane-api/ent/eventexposure/where.go | 585 +++ controlplane-api/ent/eventexposure_create.go | 1159 ++++++ controlplane-api/ent/eventexposure_delete.go | 91 + controlplane-api/ent/eventexposure_query.go | 735 ++++ controlplane-api/ent/eventexposure_update.go | 890 +++++ controlplane-api/ent/eventsubscription.go | 351 ++ .../eventsubscription/eventsubscription.go | 349 ++ .../ent/eventsubscription/where.go | 756 ++++ .../ent/eventsubscription_create.go | 1220 ++++++ .../ent/eventsubscription_delete.go | 91 + .../ent/eventsubscription_query.go | 883 +++++ .../ent/eventsubscription_update.go | 1117 ++++++ controlplane-api/ent/gql_collection.go | 536 ++- controlplane-api/ent/gql_edge.go | 79 +- controlplane-api/ent/gql_node.go | 63 +- controlplane-api/ent/gql_pagination.go | 631 ++- controlplane-api/ent/gql_transaction.go | 1 - controlplane-api/ent/gql_where_input.go | 1883 +++++++-- controlplane-api/ent/group.go | 1 - controlplane-api/ent/group/group.go | 1 - controlplane-api/ent/group/where.go | 1 - controlplane-api/ent/group_create.go | 1 - controlplane-api/ent/group_delete.go | 1 - controlplane-api/ent/group_query.go | 1 - controlplane-api/ent/group_update.go | 1 - controlplane-api/ent/hook/hook.go | 25 +- controlplane-api/ent/member.go | 1 - controlplane-api/ent/member/member.go | 1 - controlplane-api/ent/member/where.go | 1 - controlplane-api/ent/member_create.go | 1 - controlplane-api/ent/member_delete.go | 1 - controlplane-api/ent/member_query.go | 1 - controlplane-api/ent/member_update.go | 1 - controlplane-api/ent/migrate/migrate.go | 1 - controlplane-api/ent/migrate/schema.go | 125 +- controlplane-api/ent/mutation.go | 3377 +++++++++++++++-- controlplane-api/ent/predicate/predicate.go | 7 +- controlplane-api/ent/privacy/privacy.go | 49 +- controlplane-api/ent/runtime.go | 1 - controlplane-api/ent/runtime/runtime.go | 91 +- .../ent/schema/api_subscription.go | 4 +- controlplane-api/ent/schema/application.go | 4 + controlplane-api/ent/schema/approval.go | 4 + .../ent/schema/approval_request.go | 4 + controlplane-api/ent/schema/event_exposure.go | 78 + .../ent/schema/event_subscription.go | 77 + controlplane-api/ent/tx.go | 7 +- projector/go.mod | 1 + projector/internal/bootstrap/bootstrap.go | 27 +- projector/internal/domain/approval/deps.go | 13 +- .../internal/domain/approval/repository.go | 99 +- .../domain/approval/repository_test.go | 111 +- .../internal/domain/approval/translator.go | 21 +- .../domain/approval/translator_test.go | 96 +- projector/internal/domain/approval/types.go | 16 +- .../internal/domain/approvalrequest/deps.go | 13 +- .../domain/approvalrequest/repository.go | 105 +- .../domain/approvalrequest/repository_test.go | 111 +- .../domain/approvalrequest/translator.go | 22 +- .../domain/approvalrequest/translator_test.go | 96 +- .../internal/domain/approvalrequest/types.go | 17 +- .../internal/domain/eventexposure/deps.go | 16 + .../eventexposure/eventexposure_suite_test.go | 17 + .../internal/domain/eventexposure/module.go | 31 + .../domain/eventexposure/repository.go | 118 + .../domain/eventexposure/repository_test.go | 272 ++ .../domain/eventexposure/translator.go | 107 + .../domain/eventexposure/translator_test.go | 215 ++ .../internal/domain/eventexposure/types.go | 35 + .../internal/domain/eventsubscription/deps.go | 23 + .../eventsubscription_suite_test.go | 17 + .../domain/eventsubscription/module.go | 30 + .../domain/eventsubscription/repository.go | 149 + .../eventsubscription/repository_test.go | 234 ++ .../domain/eventsubscription/translator.go | 105 + .../eventsubscription/translator_test.go | 190 + .../domain/eventsubscription/types.go | 36 + .../infrastructure/cachekeys/cachekeys.go | 22 + projector/internal/infrastructure/errors.go | 18 +- .../internal/infrastructure/errors_test.go | 42 + .../internal/infrastructure/idresolver.go | 109 + 114 files changed, 18892 insertions(+), 769 deletions(-) create mode 100644 controlplane-api/ent/eventexposure.go create mode 100644 controlplane-api/ent/eventexposure/eventexposure.go create mode 100644 controlplane-api/ent/eventexposure/where.go create mode 100644 controlplane-api/ent/eventexposure_create.go create mode 100644 controlplane-api/ent/eventexposure_delete.go create mode 100644 controlplane-api/ent/eventexposure_query.go create mode 100644 controlplane-api/ent/eventexposure_update.go create mode 100644 controlplane-api/ent/eventsubscription.go create mode 100644 controlplane-api/ent/eventsubscription/eventsubscription.go create mode 100644 controlplane-api/ent/eventsubscription/where.go create mode 100644 controlplane-api/ent/eventsubscription_create.go create mode 100644 controlplane-api/ent/eventsubscription_delete.go create mode 100644 controlplane-api/ent/eventsubscription_query.go create mode 100644 controlplane-api/ent/eventsubscription_update.go create mode 100644 controlplane-api/ent/schema/event_exposure.go create mode 100644 controlplane-api/ent/schema/event_subscription.go create mode 100644 projector/internal/domain/eventexposure/deps.go create mode 100644 projector/internal/domain/eventexposure/eventexposure_suite_test.go create mode 100644 projector/internal/domain/eventexposure/module.go create mode 100644 projector/internal/domain/eventexposure/repository.go create mode 100644 projector/internal/domain/eventexposure/repository_test.go create mode 100644 projector/internal/domain/eventexposure/translator.go create mode 100644 projector/internal/domain/eventexposure/translator_test.go create mode 100644 projector/internal/domain/eventexposure/types.go create mode 100644 projector/internal/domain/eventsubscription/deps.go create mode 100644 projector/internal/domain/eventsubscription/eventsubscription_suite_test.go create mode 100644 projector/internal/domain/eventsubscription/module.go create mode 100644 projector/internal/domain/eventsubscription/repository.go create mode 100644 projector/internal/domain/eventsubscription/repository_test.go create mode 100644 projector/internal/domain/eventsubscription/translator.go create mode 100644 projector/internal/domain/eventsubscription/translator_test.go create mode 100644 projector/internal/domain/eventsubscription/types.go create mode 100644 projector/internal/infrastructure/errors_test.go 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/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 19c2dce32..8710e38ee 100644 --- a/controlplane-api/ent/schema/application.go +++ b/controlplane-api/ent/schema/application.go @@ -79,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/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/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/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/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 + }) +} From 096a709789c0d473546bc0ea10c2ee4251232ef6 Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Tue, 12 May 2026 15:44:47 +0200 Subject: [PATCH 04/11] feat(api): add GraphQL schema and resolvers for events Add event exposure and subscription types, queries, and mutations to the GraphQL schema. Implement resolvers for creating, updating, and deleting event exposures and subscriptions with approval workflow support. Add mutation helper utilities and info type models. Includes updated gqlgen config and all generated resolver code. --- controlplane-api/ent.graphql | 903 +- controlplane-api/go.mod | 5 + controlplane-api/go.sum | 8 + controlplane-api/gqlgen.yml | 58 +- .../internal/resolvers/ent.generated.go | 18479 +++++++++------- .../internal/resolvers/ent.resolvers.go | 62 +- controlplane-api/internal/resolvers/mapper.go | 95 + .../internal/resolvers/mapper_test.go | 109 +- .../resolvers/model/models.generated.go | 69 +- .../resolvers/model/mutation_types.go | 134 +- .../internal/resolvers/mutation.generated.go | 1670 +- .../internal/resolvers/mutation.resolvers.go | 254 +- .../internal/resolvers/mutation_helpers.go | 113 + .../internal/resolvers/prelude.generated.go | 966 +- .../internal/resolvers/resolver.go | 20 +- .../internal/resolvers/root_.generated.go | 4956 +++-- .../internal/resolvers/schema.generated.go | 1379 +- .../internal/resolvers/schema.resolvers.go | 255 +- .../resolvers/schema_resolvers_test.go | 15 +- controlplane-api/mutation.graphql | 197 +- controlplane-api/pkg/model/info_types.go | 28 + controlplane-api/schema.graphql | 50 +- 22 files changed, 18977 insertions(+), 10848 deletions(-) create mode 100644 controlplane-api/internal/resolvers/mutation_helpers.go 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/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/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/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) } From 17addc5ae97e4da1d61af6211a32eff1f6aa610e Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Tue, 12 May 2026 15:45:09 +0200 Subject: [PATCH 05/11] feat(api): add error presenter and mutation logging middleware Add RFC 9457-aware GraphQL error presenter that maps Problem types to appropriate error extensions. Add mutation logging middleware for structured audit logging of all GraphQL mutations. Wire both into the GraphQL controller setup. --- .../internal/graphql/controller.go | 22 +++- .../internal/graphql/error_presenter.go | 74 +++++++++++ .../internal/graphql/error_presenter_test.go | 116 ++++++++++++++++++ .../graphql/mutation_logging_middleware.go | 40 ++++++ .../mutation_logging_middleware_test.go | 92 ++++++++++++++ 5 files changed, 342 insertions(+), 2 deletions(-) create mode 100644 controlplane-api/internal/graphql/error_presenter.go create mode 100644 controlplane-api/internal/graphql/error_presenter_test.go create mode 100644 controlplane-api/internal/graphql/mutation_logging_middleware.go create mode 100644 controlplane-api/internal/graphql/mutation_logging_middleware_test.go 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")) + }) +}) From c5c945a4b72883f5a156a5f5c81243e97ffe1061 Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Tue, 12 May 2026 15:45:38 +0200 Subject: [PATCH 06/11] refactor(api): update viewer, services, and team interceptor Refactor viewer middleware to support team-scoped authentication and updated token extraction. Extend services layer with event exposure and subscription CRUD operations. Update team interceptor filtering logic and add build decision test coverage. Remove deprecated helpers.go in favor of inline implementations. Update test utilities and seed data for new entity types. --- controlplane-api/cmd/config/config.go | 11 +- controlplane-api/cmd/main.go | 20 +- .../internal/graphql/viewer_middleware.go | 102 +++- .../graphql/viewer_middleware_test.go | 129 ++++- .../internal/interceptor/team_filter.go | 42 ++ .../internal/interceptor/team_filter_test.go | 41 +- controlplane-api/internal/rule/rule_test.go | 5 +- .../internal/service/application_k8s_test.go | 106 ++-- .../internal/service/approval_k8s_test.go | 313 +++-------- .../internal/service/build_decision_test.go | 60 +++ controlplane-api/internal/service/helpers.go | 42 -- controlplane-api/internal/service/services.go | 27 +- .../internal/service/services_k8s.go | 501 +++++++++++++----- .../internal/service/team_k8s_test.go | 250 ++------- controlplane-api/internal/testutil/seed.go | 19 + controlplane-api/internal/viewer/viewer.go | 48 +- .../internal/viewer/viewer_test.go | 37 +- 17 files changed, 997 insertions(+), 756 deletions(-) create mode 100644 controlplane-api/internal/service/build_decision_test.go 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/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/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/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()) + }) +}) From 711d4f5b6c180fccb1d3ab2c81fef62767ef47c4 Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Wed, 20 May 2026 12:03:24 +0200 Subject: [PATCH 07/11] feat(catalogue): add Api and EventType catalogue entities Introduce first-class Api and EventType entities that represent the catalogue of registered APIs and event types, independent of their exposures in specific environments. Components changed: - api: add Specification field to ApiSpec CRD type - controlplane-api: add Api and EventType ent schemas with owner/team edges, GraphQL relay connections, specification URL resolver, and file-manager base URL configuration - projector: add api and eventtype domain modules (translator, repository, cache keys, ID resolver) and wire into bootstrap - Link ApiExposure -> Api and EventExposure -> EventType via optional FK edges resolved from the active catalogue entry - rover: propagate Specification field when syncing Api CRs --- api/api/v1/api_types.go | 5 + controlplane-api/cmd/config/config.go | 21 +- controlplane-api/cmd/main.go | 6 +- controlplane-api/ent.graphql | 631 + controlplane-api/ent/api.go | 324 + controlplane-api/ent/api/api.go | 273 + controlplane-api/ent/api/where.go | 730 + controlplane-api/ent/api_create.go | 1277 ++ controlplane-api/ent/api_delete.go | 91 + controlplane-api/ent/api_query.go | 735 + controlplane-api/ent/api_update.go | 982 ++ controlplane-api/ent/apiexposure.go | 37 +- .../ent/apiexposure/apiexposure.go | 24 + controlplane-api/ent/apiexposure/where.go | 23 + controlplane-api/ent/apiexposure_create.go | 37 + controlplane-api/ent/apiexposure_query.go | 79 +- controlplane-api/ent/apiexposure_update.go | 109 + controlplane-api/ent/client.go | 434 +- controlplane-api/ent/ent.go | 4 + controlplane-api/ent/eventexposure.go | 35 +- .../ent/eventexposure/eventexposure.go | 24 + controlplane-api/ent/eventexposure/where.go | 23 + controlplane-api/ent/eventexposure_create.go | 37 + controlplane-api/ent/eventexposure_query.go | 79 +- controlplane-api/ent/eventexposure_update.go | 109 + controlplane-api/ent/eventtype.go | 297 + controlplane-api/ent/eventtype/eventtype.go | 260 + controlplane-api/ent/eventtype/where.go | 705 + controlplane-api/ent/eventtype_create.go | 1142 ++ controlplane-api/ent/eventtype_delete.go | 91 + controlplane-api/ent/eventtype_query.go | 735 + controlplane-api/ent/eventtype_update.go | 889 ++ controlplane-api/ent/gql_collection.go | 470 + controlplane-api/ent/gql_edge.go | 58 + controlplane-api/ent/gql_node.go | 62 + controlplane-api/ent/gql_pagination.go | 630 + controlplane-api/ent/gql_where_input.go | 5076 +++--- controlplane-api/ent/hook/hook.go | 24 + controlplane-api/ent/migrate/schema.go | 100 +- controlplane-api/ent/mutation.go | 10002 +++++++----- controlplane-api/ent/predicate/predicate.go | 6 + controlplane-api/ent/privacy/privacy.go | 48 + controlplane-api/ent/runtime/runtime.go | 90 + controlplane-api/ent/schema/api.go | 76 + controlplane-api/ent/schema/api_exposure.go | 3 + controlplane-api/ent/schema/event_exposure.go | 3 + controlplane-api/ent/schema/event_type.go | 71 + controlplane-api/ent/schema/team.go | 4 + controlplane-api/ent/team.go | 86 +- controlplane-api/ent/team/team.go | 60 + controlplane-api/ent/team/where.go | 46 + controlplane-api/ent/team_create.go | 64 + controlplane-api/ent/team_query.go | 196 +- controlplane-api/ent/team_update.go | 326 + controlplane-api/ent/tx.go | 8 +- controlplane-api/gqlgen.yml | 2 + .../internal/interceptor/team_filter.go | 5 +- .../internal/resolvers/ent.generated.go | 13286 +++++++++++----- .../internal/resolvers/ent.resolvers.go | 26 + .../internal/resolvers/mapper_test.go | 18 +- .../resolvers/model/models.generated.go | 6 + .../internal/resolvers/prelude.generated.go | 12 + .../internal/resolvers/resolver.go | 34 +- .../internal/resolvers/root_.generated.go | 1281 +- .../internal/resolvers/schema.generated.go | 102 + .../internal/resolvers/schema.resolvers.go | 164 + .../resolvers/schema_resolvers_test.go | 8 +- controlplane-api/schema.graphql | 31 + projector/internal/bootstrap/bootstrap.go | 5 +- projector/internal/domain/api/deps.go | 16 + projector/internal/domain/api/module.go | 28 + projector/internal/domain/api/repository.go | 139 + projector/internal/domain/api/translator.go | 73 + projector/internal/domain/api/types.go | 31 + projector/internal/domain/apiexposure/deps.go | 3 + .../internal/domain/apiexposure/repository.go | 16 + .../domain/apiexposure/repository_test.go | 10 + .../internal/domain/eventexposure/deps.go | 3 + .../domain/eventexposure/repository.go | 13 + .../domain/eventexposure/repository_test.go | 14 +- projector/internal/domain/eventtype/deps.go | 16 + projector/internal/domain/eventtype/module.go | 29 + .../internal/domain/eventtype/repository.go | 132 + .../internal/domain/eventtype/translator.go | 67 + projector/internal/domain/eventtype/types.go | 29 + .../infrastructure/cachekeys/cachekeys.go | 28 + .../internal/infrastructure/idresolver.go | 118 + .../handler/apispecification/handler.go | 11 +- 88 files changed, 33378 insertions(+), 10135 deletions(-) create mode 100644 controlplane-api/ent/api.go create mode 100644 controlplane-api/ent/api/api.go create mode 100644 controlplane-api/ent/api/where.go create mode 100644 controlplane-api/ent/api_create.go create mode 100644 controlplane-api/ent/api_delete.go create mode 100644 controlplane-api/ent/api_query.go create mode 100644 controlplane-api/ent/api_update.go create mode 100644 controlplane-api/ent/eventtype.go create mode 100644 controlplane-api/ent/eventtype/eventtype.go create mode 100644 controlplane-api/ent/eventtype/where.go create mode 100644 controlplane-api/ent/eventtype_create.go create mode 100644 controlplane-api/ent/eventtype_delete.go create mode 100644 controlplane-api/ent/eventtype_query.go create mode 100644 controlplane-api/ent/eventtype_update.go create mode 100644 controlplane-api/ent/schema/api.go create mode 100644 controlplane-api/ent/schema/event_type.go create mode 100644 projector/internal/domain/api/deps.go create mode 100644 projector/internal/domain/api/module.go create mode 100644 projector/internal/domain/api/repository.go create mode 100644 projector/internal/domain/api/translator.go create mode 100644 projector/internal/domain/api/types.go create mode 100644 projector/internal/domain/eventtype/deps.go create mode 100644 projector/internal/domain/eventtype/module.go create mode 100644 projector/internal/domain/eventtype/repository.go create mode 100644 projector/internal/domain/eventtype/translator.go create mode 100644 projector/internal/domain/eventtype/types.go diff --git a/api/api/v1/api_types.go b/api/api/v1/api_types.go index 4a8da28f1..cfda31d15 100644 --- a/api/api/v1/api_types.go +++ b/api/api/v1/api_types.go @@ -20,6 +20,11 @@ type ApiSpec struct { Category string `json:"category"` Oauth2Scopes []string `json:"oauth2Scopes,omitempty"` XVendor bool `json:"xVendor"` + + // Specification contains the file ID reference from the file manager for + // the optional OpenAPI specification document that describes this API. + // +optional + Specification string `json:"specification,omitempty"` } // ApiStatus defines the observed state of Api diff --git a/controlplane-api/cmd/config/config.go b/controlplane-api/cmd/config/config.go index 93c5c4415..5ee20f3b8 100644 --- a/controlplane-api/cmd/config/config.go +++ b/controlplane-api/cmd/config/config.go @@ -12,12 +12,13 @@ import ( ) type ServerConfig struct { - Database DatabaseConfig `yaml:"database"` - Server HTTPServerConfig `yaml:"server"` - Security SecurityConfig `yaml:"security"` - GraphQL GraphQLConfig `yaml:"graphql"` - Log LogConfig `yaml:"log"` - Kubernetes KubernetesConfig `yaml:"kubernetes"` + Database DatabaseConfig `yaml:"database"` + Server HTTPServerConfig `yaml:"server"` + Security SecurityConfig `yaml:"security"` + GraphQL GraphQLConfig `yaml:"graphql"` + Log LogConfig `yaml:"log"` + Kubernetes KubernetesConfig `yaml:"kubernetes"` + FileManager FileManagerConfig `yaml:"fileManager"` } type KubernetesConfig struct { @@ -54,6 +55,12 @@ type LogConfig struct { Level string `yaml:"level"` } +// FileManagerConfig holds the configuration for constructing specification +// download URLs. The BaseURL is the root URL of the file-manager service. +type FileManagerConfig struct { + BaseURL string `yaml:"baseUrl"` +} + func DefaultConfig() *ServerConfig { return &ServerConfig{ Database: DatabaseConfig{ @@ -74,7 +81,7 @@ func DefaultConfig() *ServerConfig { PlaygroundEnabled: true, }, Log: LogConfig{ - Level: "info", + Level: "debug", }, Kubernetes: KubernetesConfig{ Enabled: true, diff --git a/controlplane-api/cmd/main.go b/controlplane-api/cmd/main.go index 263364b0b..d7078d610 100644 --- a/controlplane-api/cmd/main.go +++ b/controlplane-api/cmd/main.go @@ -91,7 +91,7 @@ func main() { } secretResolver := secrets.NewResolver(secretsapi.NewSecrets()) - srv := newGraphQLServer(client, services, secretResolver, cfg.Security.Enabled) + srv := newGraphQLServer(client, services, secretResolver, cfg.Security.Enabled, cfg.FileManager.BaseURL) appCfg := cserver.NewAppConfig() appCfg.CtxLog = log appCfg.EnableCors = true @@ -180,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, secretResolver *secrets.Resolver, securityEnabled bool) *handler.Server { - srv := handler.New(resolvers.NewSchema(entClient, services, secretResolver)) +func newGraphQLServer(entClient *ent.Client, services service.Services, secretResolver *secrets.Resolver, securityEnabled bool, fileManagerBaseURL string) *handler.Server { + srv := handler.New(resolvers.NewSchema(entClient, services, secretResolver, fileManagerBaseURL)) srv.AddTransport(transport.Options{}) srv.AddTransport(transport.GET{}) srv.AddTransport(transport.POST{}) diff --git a/controlplane-api/ent.graphql b/controlplane-api/ent.graphql index fc9115a6c..c6fd3b60b 100644 --- a/controlplane-api/ent.graphql +++ b/controlplane-api/ent.graphql @@ -3,6 +3,50 @@ # 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 Api implements Node { + id: ID! + createdAt: Time! + lastModifiedAt: Time! + statusPhase: ApiStatusPhase + statusMessage: String + namespace: String! + basePath: String! + version: String! + category: String + oauth2Scopes: [String!] + xVendor: Boolean! + active: Boolean! +} +""" +A connection to a list of items. +""" +type ApiConnection { + """ + A list of edges. + """ + edges: [ApiEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +An edge in a connection. +""" +type ApiEdge { + """ + The item at the end of the edge. + """ + node: Api + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} type ApiExposure implements Node { id: ID! createdAt: Time! @@ -19,6 +63,7 @@ type ApiExposure implements Node { approvalConfig: ApprovalConfig! apiVersion: String owner: Application! + api: Api } """ A connection to a list of items. @@ -243,11 +288,45 @@ input ApiExposureWhereInput { hasOwner: Boolean hasOwnerWith: [ApplicationWhereInput!] """ + api edge predicates + """ + hasAPI: Boolean + hasAPIWith: [ApiWhereInput!] + """ subscriptions edge predicates """ hasSubscriptions: Boolean hasSubscriptionsWith: [ApiSubscriptionWhereInput!] } +""" +Ordering options for Api connections +""" +input ApiOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order Apis. + """ + field: ApiOrderField! +} +""" +Properties by which Api connections can be ordered. +""" +enum ApiOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +ApiStatusPhase is enum for the field status_phase +""" +enum ApiStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/api.StatusPhase") { + READY + PENDING + ERROR + UNKNOWN +} type ApiSubscription implements Node { id: ID! createdAt: Time! @@ -500,6 +579,179 @@ input ApiSubscriptionWhereInput { hasApprovalRequests: Boolean hasApprovalRequestsWith: [ApprovalRequestWhereInput!] } +""" +ApiWhereInput is used for filtering Api objects. +Input was generated by ent. +""" +input ApiWhereInput { + not: ApiWhereInput + and: [ApiWhereInput!] + or: [ApiWhereInput!] + """ + 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: ApiStatusPhase + statusPhaseNEQ: ApiStatusPhase + statusPhaseIn: [ApiStatusPhase!] + statusPhaseNotIn: [ApiStatusPhase!] + 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 + """ + 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 + """ + version field predicates + """ + version: String + versionNEQ: String + versionIn: [String!] + versionNotIn: [String!] + versionGT: String + versionGTE: String + versionLT: String + versionLTE: String + versionContains: String + versionHasPrefix: String + versionHasSuffix: String + versionEqualFold: String + versionContainsFold: String + """ + category field predicates + """ + category: String + categoryNEQ: String + categoryIn: [String!] + categoryNotIn: [String!] + categoryGT: String + categoryGTE: String + categoryLT: String + categoryLTE: String + categoryContains: String + categoryHasPrefix: String + categoryHasSuffix: String + categoryIsNil: Boolean + categoryNotNil: Boolean + categoryEqualFold: String + categoryContainsFold: String + """ + x_vendor field predicates + """ + xVendor: Boolean + xVendorNEQ: Boolean + """ + specification field predicates + """ + specification: String + specificationNEQ: String + specificationIn: [String!] + specificationNotIn: [String!] + specificationGT: String + specificationGTE: String + specificationLT: String + specificationLTE: String + specificationContains: String + specificationHasPrefix: String + specificationHasSuffix: String + specificationIsNil: Boolean + specificationNotNil: Boolean + specificationEqualFold: String + specificationContainsFold: String + """ + active field predicates + """ + active: Boolean + activeNEQ: Boolean + """ + owner edge predicates + """ + hasOwner: Boolean + hasOwnerWith: [TeamWhereInput!] + """ + exposures edge predicates + """ + hasExposures: Boolean + hasExposuresWith: [ApiExposureWhereInput!] +} type Application implements Node { id: ID! createdAt: Time! @@ -1488,6 +1740,7 @@ type EventExposure implements Node { active: Boolean approvalConfig: ApprovalConfig! owner: Application! + eventTypeDef: EventType } """ A connection to a list of items. @@ -1694,6 +1947,11 @@ input EventExposureWhereInput { hasOwner: Boolean hasOwnerWith: [ApplicationWhereInput!] """ + event_type_def edge predicates + """ + hasEventTypeDef: Boolean + hasEventTypeDefWith: [EventTypeWhereInput!] + """ subscriptions edge predicates """ hasSubscriptions: Boolean @@ -1961,6 +2219,245 @@ input EventSubscriptionWhereInput { hasApprovalRequests: Boolean hasApprovalRequestsWith: [ApprovalRequestWhereInput!] } +type EventType implements Node { + id: ID! + createdAt: Time! + lastModifiedAt: Time! + statusPhase: EventTypeStatusPhase + statusMessage: String + namespace: String! + eventType: String! + version: String! + description: String + active: Boolean! +} +""" +A connection to a list of items. +""" +type EventTypeConnection { + """ + A list of edges. + """ + edges: [EventTypeEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +An edge in a connection. +""" +type EventTypeEdge { + """ + The item at the end of the edge. + """ + node: EventType + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} +""" +Ordering options for EventType connections +""" +input EventTypeOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order EventTypes. + """ + field: EventTypeOrderField! +} +""" +Properties by which EventType connections can be ordered. +""" +enum EventTypeOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +EventTypeStatusPhase is enum for the field status_phase +""" +enum EventTypeStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/eventtype.StatusPhase") { + READY + PENDING + ERROR + UNKNOWN +} +""" +EventTypeWhereInput is used for filtering EventType objects. +Input was generated by ent. +""" +input EventTypeWhereInput { + not: EventTypeWhereInput + and: [EventTypeWhereInput!] + or: [EventTypeWhereInput!] + """ + 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: EventTypeStatusPhase + statusPhaseNEQ: EventTypeStatusPhase + statusPhaseIn: [EventTypeStatusPhase!] + statusPhaseNotIn: [EventTypeStatusPhase!] + 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 + """ + 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 + """ + version field predicates + """ + version: String + versionNEQ: String + versionIn: [String!] + versionNotIn: [String!] + versionGT: String + versionGTE: String + versionLT: String + versionLTE: String + versionContains: String + versionHasPrefix: String + versionHasSuffix: String + versionEqualFold: String + versionContainsFold: 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 + descriptionIsNil: Boolean + descriptionNotNil: Boolean + descriptionEqualFold: String + descriptionContainsFold: String + """ + specification field predicates + """ + specification: String + specificationNEQ: String + specificationIn: [String!] + specificationNotIn: [String!] + specificationGT: String + specificationGTE: String + specificationLT: String + specificationLTE: String + specificationContains: String + specificationHasPrefix: String + specificationHasSuffix: String + specificationIsNil: Boolean + specificationNotNil: Boolean + specificationEqualFold: String + specificationContainsFold: String + """ + active field predicates + """ + active: Boolean + activeNEQ: Boolean + """ + owner edge predicates + """ + hasOwner: Boolean + hasOwnerWith: [TeamWhereInput!] + """ + exposures edge predicates + """ + hasExposures: Boolean + hasExposuresWith: [EventExposureWhereInput!] +} type Group implements Node { id: ID! environment: String @@ -2223,6 +2720,37 @@ type Query { """ ids: [ID!]! ): [Node]! + apis( + """ + 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 Apis returned from the connection. + """ + orderBy: ApiOrder + + """ + Filtering options for Apis returned from the connection. + """ + where: ApiWhereInput + ): ApiConnection! apiExposures( """ Returns the elements in the list that come after the specified cursor. @@ -2440,6 +2968,37 @@ type Query { """ where: EventSubscriptionWhereInput ): EventSubscriptionConnection! + eventTypes( + """ + 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 EventTypes returned from the connection. + """ + orderBy: EventTypeOrder + + """ + Filtering options for EventTypes returned from the connection. + """ + where: EventTypeWhereInput + ): EventTypeConnection! teams( """ Returns the elements in the list that come after the specified cursor. @@ -2518,6 +3077,68 @@ type Team implements Node { """ where: ApplicationWhereInput ): ApplicationConnection! + apis( + """ + 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 Apis returned from the connection. + """ + orderBy: ApiOrder + + """ + Filtering options for Apis returned from the connection. + """ + where: ApiWhereInput + ): ApiConnection! + eventTypes( + """ + 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 EventTypes returned from the connection. + """ + orderBy: EventTypeOrder + + """ + Filtering options for EventTypes returned from the connection. + """ + where: EventTypeWhereInput + ): EventTypeConnection! } """ TeamCategory is enum for the field category @@ -2760,6 +3381,16 @@ input TeamWhereInput { """ hasApplications: Boolean hasApplicationsWith: [ApplicationWhereInput!] + """ + apis edge predicates + """ + hasApis: Boolean + hasApisWith: [ApiWhereInput!] + """ + event_types edge predicates + """ + hasEventTypes: Boolean + hasEventTypesWith: [EventTypeWhereInput!] } """ The builtin Time type diff --git a/controlplane-api/ent/api.go b/controlplane-api/ent/api.go new file mode 100644 index 000000000..7f3edeb52 --- /dev/null +++ b/controlplane-api/ent/api.go @@ -0,0 +1,324 @@ +// 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/api" + "github.com/telekom/controlplane/controlplane-api/ent/team" +) + +// Api is the model entity for the Api schema. +type Api 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 *api.StatusPhase `json:"status_phase,omitempty"` + // StatusMessage holds the value of the "status_message" field. + StatusMessage *string `json:"status_message,omitempty"` + // Namespace holds the value of the "namespace" field. + Namespace string `json:"namespace,omitempty"` + // BasePath holds the value of the "base_path" field. + BasePath string `json:"base_path,omitempty"` + // Version holds the value of the "version" field. + Version string `json:"version,omitempty"` + // Category holds the value of the "category" field. + Category string `json:"category,omitempty"` + // Oauth2Scopes holds the value of the "oauth2_scopes" field. + Oauth2Scopes []string `json:"oauth2_scopes,omitempty"` + // XVendor holds the value of the "x_vendor" field. + XVendor bool `json:"x_vendor,omitempty"` + // Specification holds the value of the "specification" field. + Specification string `json:"specification,omitempty"` + // Active holds the value of the "active" field. + Active bool `json:"active,omitempty"` + // Edges holds the relations/edges for other nodes in the graph. + // The values are being populated by the ApiQuery when eager-loading is set. + Edges ApiEdges `json:"edges"` + team_apis *int + selectValues sql.SelectValues +} + +// ApiEdges holds the relations/edges for other nodes in the graph. +type ApiEdges struct { + // Owner holds the value of the owner edge. + Owner *Team `json:"owner,omitempty"` + // Exposures holds the value of the exposures edge. + Exposures []*ApiExposure `json:"exposures,omitempty"` + // loadedTypes holds the information for reporting if a + // type was loaded (or requested) in eager-loading or not. + loadedTypes [2]bool + + namedExposures map[string][]*ApiExposure +} + +// 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 ApiEdges) OwnerOrErr() (*Team, error) { + if e.Owner != nil { + return e.Owner, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: team.Label} + } + return nil, &NotLoadedError{edge: "owner"} +} + +// ExposuresOrErr returns the Exposures value or an error if the edge +// was not loaded in eager-loading. +func (e ApiEdges) ExposuresOrErr() ([]*ApiExposure, error) { + if e.loadedTypes[1] { + return e.Exposures, nil + } + return nil, &NotLoadedError{edge: "exposures"} +} + +// scanValues returns the types for scanning values from sql.Rows. +func (*Api) scanValues(columns []string) ([]any, error) { + values := make([]any, len(columns)) + for i := range columns { + switch columns[i] { + case api.FieldOauth2Scopes: + values[i] = new([]byte) + case api.FieldXVendor, api.FieldActive: + values[i] = new(sql.NullBool) + case api.FieldID: + values[i] = new(sql.NullInt64) + case api.FieldStatusPhase, api.FieldStatusMessage, api.FieldNamespace, api.FieldBasePath, api.FieldVersion, api.FieldCategory, api.FieldSpecification: + values[i] = new(sql.NullString) + case api.FieldCreatedAt, api.FieldLastModifiedAt: + values[i] = new(sql.NullTime) + case api.ForeignKeys[0]: // team_apis + 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 Api fields. +func (_m *Api) 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 api.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 api.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 api.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 api.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(api.StatusPhase) + *_m.StatusPhase = api.StatusPhase(value.String) + } + case api.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 api.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 api.FieldBasePath: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field base_path", values[i]) + } else if value.Valid { + _m.BasePath = value.String + } + case api.FieldVersion: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field version", values[i]) + } else if value.Valid { + _m.Version = value.String + } + case api.FieldCategory: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field category", values[i]) + } else if value.Valid { + _m.Category = value.String + } + case api.FieldOauth2Scopes: + if value, ok := values[i].(*[]byte); !ok { + return fmt.Errorf("unexpected type %T for field oauth2_scopes", values[i]) + } else if value != nil && len(*value) > 0 { + if err := json.Unmarshal(*value, &_m.Oauth2Scopes); err != nil { + return fmt.Errorf("unmarshal field oauth2_scopes: %w", err) + } + } + case api.FieldXVendor: + if value, ok := values[i].(*sql.NullBool); !ok { + return fmt.Errorf("unexpected type %T for field x_vendor", values[i]) + } else if value.Valid { + _m.XVendor = value.Bool + } + case api.FieldSpecification: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field specification", values[i]) + } else if value.Valid { + _m.Specification = value.String + } + case api.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 = value.Bool + } + case api.ForeignKeys[0]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field team_apis", value) + } else if value.Valid { + _m.team_apis = new(int) + *_m.team_apis = 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 Api. +// This includes values selected through modifiers, order, etc. +func (_m *Api) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) +} + +// QueryOwner queries the "owner" edge of the Api entity. +func (_m *Api) QueryOwner() *TeamQuery { + return NewAPIClient(_m.config).QueryOwner(_m) +} + +// QueryExposures queries the "exposures" edge of the Api entity. +func (_m *Api) QueryExposures() *ApiExposureQuery { + return NewAPIClient(_m.config).QueryExposures(_m) +} + +// Update returns a builder for updating this Api. +// Note that you need to call Api.Unwrap() before calling this method if this Api +// was returned from a transaction, and the transaction was committed or rolled back. +func (_m *Api) Update() *APIUpdateOne { + return NewAPIClient(_m.config).UpdateOne(_m) +} + +// Unwrap unwraps the Api 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 *Api) Unwrap() *Api { + _tx, ok := _m.config.driver.(*txDriver) + if !ok { + panic("ent: Api is not a transactional entity") + } + _m.config.driver = _tx.drv + return _m +} + +// String implements the fmt.Stringer. +func (_m *Api) String() string { + var builder strings.Builder + builder.WriteString("Api(") + 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(", ") + builder.WriteString("namespace=") + builder.WriteString(_m.Namespace) + builder.WriteString(", ") + builder.WriteString("base_path=") + builder.WriteString(_m.BasePath) + builder.WriteString(", ") + builder.WriteString("version=") + builder.WriteString(_m.Version) + builder.WriteString(", ") + builder.WriteString("category=") + builder.WriteString(_m.Category) + builder.WriteString(", ") + builder.WriteString("oauth2_scopes=") + builder.WriteString(fmt.Sprintf("%v", _m.Oauth2Scopes)) + builder.WriteString(", ") + builder.WriteString("x_vendor=") + builder.WriteString(fmt.Sprintf("%v", _m.XVendor)) + builder.WriteString(", ") + builder.WriteString("specification=") + builder.WriteString(_m.Specification) + builder.WriteString(", ") + builder.WriteString("active=") + builder.WriteString(fmt.Sprintf("%v", _m.Active)) + builder.WriteByte(')') + return builder.String() +} + +// NamedExposures returns the Exposures named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *Api) NamedExposures(name string) ([]*ApiExposure, error) { + if _m.Edges.namedExposures == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedExposures[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *Api) appendNamedExposures(name string, edges ...*ApiExposure) { + if _m.Edges.namedExposures == nil { + _m.Edges.namedExposures = make(map[string][]*ApiExposure) + } + if len(edges) == 0 { + _m.Edges.namedExposures[name] = []*ApiExposure{} + } else { + _m.Edges.namedExposures[name] = append(_m.Edges.namedExposures[name], edges...) + } +} + +// Apis is a parsable slice of Api. +type Apis []*Api diff --git a/controlplane-api/ent/api/api.go b/controlplane-api/ent/api/api.go new file mode 100644 index 000000000..57fd3e9b1 --- /dev/null +++ b/controlplane-api/ent/api/api.go @@ -0,0 +1,273 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package api + +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 api type in the database. + Label = "api" + // 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" + // FieldNamespace holds the string denoting the namespace field in the database. + FieldNamespace = "namespace" + // FieldBasePath holds the string denoting the base_path field in the database. + FieldBasePath = "base_path" + // FieldVersion holds the string denoting the version field in the database. + FieldVersion = "version" + // FieldCategory holds the string denoting the category field in the database. + FieldCategory = "category" + // FieldOauth2Scopes holds the string denoting the oauth2_scopes field in the database. + FieldOauth2Scopes = "oauth2_scopes" + // FieldXVendor holds the string denoting the x_vendor field in the database. + FieldXVendor = "x_vendor" + // FieldSpecification holds the string denoting the specification field in the database. + FieldSpecification = "specification" + // FieldActive holds the string denoting the active field in the database. + FieldActive = "active" + // EdgeOwner holds the string denoting the owner edge name in mutations. + EdgeOwner = "owner" + // EdgeExposures holds the string denoting the exposures edge name in mutations. + EdgeExposures = "exposures" + // Table holds the table name of the api in the database. + Table = "apis" + // OwnerTable is the table that holds the owner relation/edge. + OwnerTable = "apis" + // OwnerInverseTable is the table name for the Team entity. + // It exists in this package in order to avoid circular dependency with the "team" package. + OwnerInverseTable = "teams" + // OwnerColumn is the table column denoting the owner relation/edge. + OwnerColumn = "team_apis" + // ExposuresTable is the table that holds the exposures relation/edge. + ExposuresTable = "api_exposures" + // ExposuresInverseTable is the table name for the ApiExposure entity. + // It exists in this package in order to avoid circular dependency with the "apiexposure" package. + ExposuresInverseTable = "api_exposures" + // ExposuresColumn is the table column denoting the exposures relation/edge. + ExposuresColumn = "api_exposures" +) + +// Columns holds all SQL columns for api fields. +var Columns = []string{ + FieldID, + FieldCreatedAt, + FieldLastModifiedAt, + FieldStatusPhase, + FieldStatusMessage, + FieldNamespace, + FieldBasePath, + FieldVersion, + FieldCategory, + FieldOauth2Scopes, + FieldXVendor, + FieldSpecification, + FieldActive, +} + +// ForeignKeys holds the SQL foreign-keys that are owned by the "apis" +// table and are not defined as standalone fields in the schema. +var ForeignKeys = []string{ + "team_apis", +} + +// 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 + // BasePathValidator is a validator for the "base_path" field. It is called by the builders before save. + BasePathValidator func(string) error + // VersionValidator is a validator for the "version" field. It is called by the builders before save. + VersionValidator func(string) error + // DefaultXVendor holds the default value on creation for the "x_vendor" field. + DefaultXVendor bool + // DefaultActive holds the default value on creation for the "active" field. + DefaultActive bool +) + +// 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("api: invalid enum value for status_phase field: %q", sp) + } +} + +// OrderOption defines the ordering options for the Api 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() +} + +// ByNamespace orders the results by the namespace field. +func ByNamespace(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldNamespace, opts...).ToFunc() +} + +// ByBasePath orders the results by the base_path field. +func ByBasePath(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldBasePath, opts...).ToFunc() +} + +// ByVersion orders the results by the version field. +func ByVersion(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldVersion, opts...).ToFunc() +} + +// ByCategory orders the results by the category field. +func ByCategory(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCategory, opts...).ToFunc() +} + +// ByXVendor orders the results by the x_vendor field. +func ByXVendor(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldXVendor, opts...).ToFunc() +} + +// BySpecification orders the results by the specification field. +func BySpecification(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSpecification, 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...)) + } +} + +// ByExposuresCount orders the results by exposures count. +func ByExposuresCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newExposuresStep(), opts...) + } +} + +// ByExposures orders the results by exposures terms. +func ByExposures(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newExposuresStep(), 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 newExposuresStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(ExposuresInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ExposuresTable, ExposuresColumn), + ) +} + +// 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 +} diff --git a/controlplane-api/ent/api/where.go b/controlplane-api/ent/api/where.go new file mode 100644 index 000000000..bea070d06 --- /dev/null +++ b/controlplane-api/ent/api/where.go @@ -0,0 +1,730 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package api + +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.Api { + return predicate.Api(sql.FieldEQ(FieldID, id)) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id int) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldID, id)) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id int) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldID, id)) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...int) predicate.Api { + return predicate.Api(sql.FieldIn(FieldID, ids...)) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...int) predicate.Api { + return predicate.Api(sql.FieldNotIn(FieldID, ids...)) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id int) predicate.Api { + return predicate.Api(sql.FieldGT(FieldID, id)) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id int) predicate.Api { + return predicate.Api(sql.FieldGTE(FieldID, id)) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id int) predicate.Api { + return predicate.Api(sql.FieldLT(FieldID, id)) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id int) predicate.Api { + return predicate.Api(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.Api { + return predicate.Api(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.Api { + return predicate.Api(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// StatusMessage applies equality check predicate on the "status_message" field. It's identical to StatusMessageEQ. +func StatusMessage(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldStatusMessage, v)) +} + +// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ. +func Namespace(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldNamespace, v)) +} + +// BasePath applies equality check predicate on the "base_path" field. It's identical to BasePathEQ. +func BasePath(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldBasePath, v)) +} + +// Version applies equality check predicate on the "version" field. It's identical to VersionEQ. +func Version(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldVersion, v)) +} + +// Category applies equality check predicate on the "category" field. It's identical to CategoryEQ. +func Category(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldCategory, v)) +} + +// XVendor applies equality check predicate on the "x_vendor" field. It's identical to XVendorEQ. +func XVendor(v bool) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldXVendor, v)) +} + +// Specification applies equality check predicate on the "specification" field. It's identical to SpecificationEQ. +func Specification(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldSpecification, v)) +} + +// Active applies equality check predicate on the "active" field. It's identical to ActiveEQ. +func Active(v bool) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldActive, v)) +} + +// CreatedAtEQ applies the EQ predicate on the "created_at" field. +func CreatedAtEQ(v time.Time) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldCreatedAt, v)) +} + +// CreatedAtNEQ applies the NEQ predicate on the "created_at" field. +func CreatedAtNEQ(v time.Time) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldCreatedAt, v)) +} + +// CreatedAtIn applies the In predicate on the "created_at" field. +func CreatedAtIn(vs ...time.Time) predicate.Api { + return predicate.Api(sql.FieldIn(FieldCreatedAt, vs...)) +} + +// CreatedAtNotIn applies the NotIn predicate on the "created_at" field. +func CreatedAtNotIn(vs ...time.Time) predicate.Api { + return predicate.Api(sql.FieldNotIn(FieldCreatedAt, vs...)) +} + +// CreatedAtGT applies the GT predicate on the "created_at" field. +func CreatedAtGT(v time.Time) predicate.Api { + return predicate.Api(sql.FieldGT(FieldCreatedAt, v)) +} + +// CreatedAtGTE applies the GTE predicate on the "created_at" field. +func CreatedAtGTE(v time.Time) predicate.Api { + return predicate.Api(sql.FieldGTE(FieldCreatedAt, v)) +} + +// CreatedAtLT applies the LT predicate on the "created_at" field. +func CreatedAtLT(v time.Time) predicate.Api { + return predicate.Api(sql.FieldLT(FieldCreatedAt, v)) +} + +// CreatedAtLTE applies the LTE predicate on the "created_at" field. +func CreatedAtLTE(v time.Time) predicate.Api { + return predicate.Api(sql.FieldLTE(FieldCreatedAt, v)) +} + +// LastModifiedAtEQ applies the EQ predicate on the "last_modified_at" field. +func LastModifiedAtEQ(v time.Time) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtNEQ applies the NEQ predicate on the "last_modified_at" field. +func LastModifiedAtNEQ(v time.Time) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtIn applies the In predicate on the "last_modified_at" field. +func LastModifiedAtIn(vs ...time.Time) predicate.Api { + return predicate.Api(sql.FieldIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtNotIn applies the NotIn predicate on the "last_modified_at" field. +func LastModifiedAtNotIn(vs ...time.Time) predicate.Api { + return predicate.Api(sql.FieldNotIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtGT applies the GT predicate on the "last_modified_at" field. +func LastModifiedAtGT(v time.Time) predicate.Api { + return predicate.Api(sql.FieldGT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtGTE applies the GTE predicate on the "last_modified_at" field. +func LastModifiedAtGTE(v time.Time) predicate.Api { + return predicate.Api(sql.FieldGTE(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLT applies the LT predicate on the "last_modified_at" field. +func LastModifiedAtLT(v time.Time) predicate.Api { + return predicate.Api(sql.FieldLT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLTE applies the LTE predicate on the "last_modified_at" field. +func LastModifiedAtLTE(v time.Time) predicate.Api { + return predicate.Api(sql.FieldLTE(FieldLastModifiedAt, v)) +} + +// StatusPhaseEQ applies the EQ predicate on the "status_phase" field. +func StatusPhaseEQ(v StatusPhase) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldStatusPhase, v)) +} + +// StatusPhaseNEQ applies the NEQ predicate on the "status_phase" field. +func StatusPhaseNEQ(v StatusPhase) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldStatusPhase, v)) +} + +// StatusPhaseIn applies the In predicate on the "status_phase" field. +func StatusPhaseIn(vs ...StatusPhase) predicate.Api { + return predicate.Api(sql.FieldIn(FieldStatusPhase, vs...)) +} + +// StatusPhaseNotIn applies the NotIn predicate on the "status_phase" field. +func StatusPhaseNotIn(vs ...StatusPhase) predicate.Api { + return predicate.Api(sql.FieldNotIn(FieldStatusPhase, vs...)) +} + +// StatusPhaseIsNil applies the IsNil predicate on the "status_phase" field. +func StatusPhaseIsNil() predicate.Api { + return predicate.Api(sql.FieldIsNull(FieldStatusPhase)) +} + +// StatusPhaseNotNil applies the NotNil predicate on the "status_phase" field. +func StatusPhaseNotNil() predicate.Api { + return predicate.Api(sql.FieldNotNull(FieldStatusPhase)) +} + +// StatusMessageEQ applies the EQ predicate on the "status_message" field. +func StatusMessageEQ(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldStatusMessage, v)) +} + +// StatusMessageNEQ applies the NEQ predicate on the "status_message" field. +func StatusMessageNEQ(v string) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldStatusMessage, v)) +} + +// StatusMessageIn applies the In predicate on the "status_message" field. +func StatusMessageIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldIn(FieldStatusMessage, vs...)) +} + +// StatusMessageNotIn applies the NotIn predicate on the "status_message" field. +func StatusMessageNotIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldNotIn(FieldStatusMessage, vs...)) +} + +// StatusMessageGT applies the GT predicate on the "status_message" field. +func StatusMessageGT(v string) predicate.Api { + return predicate.Api(sql.FieldGT(FieldStatusMessage, v)) +} + +// StatusMessageGTE applies the GTE predicate on the "status_message" field. +func StatusMessageGTE(v string) predicate.Api { + return predicate.Api(sql.FieldGTE(FieldStatusMessage, v)) +} + +// StatusMessageLT applies the LT predicate on the "status_message" field. +func StatusMessageLT(v string) predicate.Api { + return predicate.Api(sql.FieldLT(FieldStatusMessage, v)) +} + +// StatusMessageLTE applies the LTE predicate on the "status_message" field. +func StatusMessageLTE(v string) predicate.Api { + return predicate.Api(sql.FieldLTE(FieldStatusMessage, v)) +} + +// StatusMessageContains applies the Contains predicate on the "status_message" field. +func StatusMessageContains(v string) predicate.Api { + return predicate.Api(sql.FieldContains(FieldStatusMessage, v)) +} + +// StatusMessageHasPrefix applies the HasPrefix predicate on the "status_message" field. +func StatusMessageHasPrefix(v string) predicate.Api { + return predicate.Api(sql.FieldHasPrefix(FieldStatusMessage, v)) +} + +// StatusMessageHasSuffix applies the HasSuffix predicate on the "status_message" field. +func StatusMessageHasSuffix(v string) predicate.Api { + return predicate.Api(sql.FieldHasSuffix(FieldStatusMessage, v)) +} + +// StatusMessageIsNil applies the IsNil predicate on the "status_message" field. +func StatusMessageIsNil() predicate.Api { + return predicate.Api(sql.FieldIsNull(FieldStatusMessage)) +} + +// StatusMessageNotNil applies the NotNil predicate on the "status_message" field. +func StatusMessageNotNil() predicate.Api { + return predicate.Api(sql.FieldNotNull(FieldStatusMessage)) +} + +// StatusMessageEqualFold applies the EqualFold predicate on the "status_message" field. +func StatusMessageEqualFold(v string) predicate.Api { + return predicate.Api(sql.FieldEqualFold(FieldStatusMessage, v)) +} + +// StatusMessageContainsFold applies the ContainsFold predicate on the "status_message" field. +func StatusMessageContainsFold(v string) predicate.Api { + return predicate.Api(sql.FieldContainsFold(FieldStatusMessage, v)) +} + +// NamespaceEQ applies the EQ predicate on the "namespace" field. +func NamespaceEQ(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldNamespace, v)) +} + +// NamespaceNEQ applies the NEQ predicate on the "namespace" field. +func NamespaceNEQ(v string) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldNamespace, v)) +} + +// NamespaceIn applies the In predicate on the "namespace" field. +func NamespaceIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldIn(FieldNamespace, vs...)) +} + +// NamespaceNotIn applies the NotIn predicate on the "namespace" field. +func NamespaceNotIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldNotIn(FieldNamespace, vs...)) +} + +// NamespaceGT applies the GT predicate on the "namespace" field. +func NamespaceGT(v string) predicate.Api { + return predicate.Api(sql.FieldGT(FieldNamespace, v)) +} + +// NamespaceGTE applies the GTE predicate on the "namespace" field. +func NamespaceGTE(v string) predicate.Api { + return predicate.Api(sql.FieldGTE(FieldNamespace, v)) +} + +// NamespaceLT applies the LT predicate on the "namespace" field. +func NamespaceLT(v string) predicate.Api { + return predicate.Api(sql.FieldLT(FieldNamespace, v)) +} + +// NamespaceLTE applies the LTE predicate on the "namespace" field. +func NamespaceLTE(v string) predicate.Api { + return predicate.Api(sql.FieldLTE(FieldNamespace, v)) +} + +// NamespaceContains applies the Contains predicate on the "namespace" field. +func NamespaceContains(v string) predicate.Api { + return predicate.Api(sql.FieldContains(FieldNamespace, v)) +} + +// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field. +func NamespaceHasPrefix(v string) predicate.Api { + return predicate.Api(sql.FieldHasPrefix(FieldNamespace, v)) +} + +// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field. +func NamespaceHasSuffix(v string) predicate.Api { + return predicate.Api(sql.FieldHasSuffix(FieldNamespace, v)) +} + +// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field. +func NamespaceEqualFold(v string) predicate.Api { + return predicate.Api(sql.FieldEqualFold(FieldNamespace, v)) +} + +// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field. +func NamespaceContainsFold(v string) predicate.Api { + return predicate.Api(sql.FieldContainsFold(FieldNamespace, v)) +} + +// BasePathEQ applies the EQ predicate on the "base_path" field. +func BasePathEQ(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldBasePath, v)) +} + +// BasePathNEQ applies the NEQ predicate on the "base_path" field. +func BasePathNEQ(v string) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldBasePath, v)) +} + +// BasePathIn applies the In predicate on the "base_path" field. +func BasePathIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldIn(FieldBasePath, vs...)) +} + +// BasePathNotIn applies the NotIn predicate on the "base_path" field. +func BasePathNotIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldNotIn(FieldBasePath, vs...)) +} + +// BasePathGT applies the GT predicate on the "base_path" field. +func BasePathGT(v string) predicate.Api { + return predicate.Api(sql.FieldGT(FieldBasePath, v)) +} + +// BasePathGTE applies the GTE predicate on the "base_path" field. +func BasePathGTE(v string) predicate.Api { + return predicate.Api(sql.FieldGTE(FieldBasePath, v)) +} + +// BasePathLT applies the LT predicate on the "base_path" field. +func BasePathLT(v string) predicate.Api { + return predicate.Api(sql.FieldLT(FieldBasePath, v)) +} + +// BasePathLTE applies the LTE predicate on the "base_path" field. +func BasePathLTE(v string) predicate.Api { + return predicate.Api(sql.FieldLTE(FieldBasePath, v)) +} + +// BasePathContains applies the Contains predicate on the "base_path" field. +func BasePathContains(v string) predicate.Api { + return predicate.Api(sql.FieldContains(FieldBasePath, v)) +} + +// BasePathHasPrefix applies the HasPrefix predicate on the "base_path" field. +func BasePathHasPrefix(v string) predicate.Api { + return predicate.Api(sql.FieldHasPrefix(FieldBasePath, v)) +} + +// BasePathHasSuffix applies the HasSuffix predicate on the "base_path" field. +func BasePathHasSuffix(v string) predicate.Api { + return predicate.Api(sql.FieldHasSuffix(FieldBasePath, v)) +} + +// BasePathEqualFold applies the EqualFold predicate on the "base_path" field. +func BasePathEqualFold(v string) predicate.Api { + return predicate.Api(sql.FieldEqualFold(FieldBasePath, v)) +} + +// BasePathContainsFold applies the ContainsFold predicate on the "base_path" field. +func BasePathContainsFold(v string) predicate.Api { + return predicate.Api(sql.FieldContainsFold(FieldBasePath, v)) +} + +// VersionEQ applies the EQ predicate on the "version" field. +func VersionEQ(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldVersion, v)) +} + +// VersionNEQ applies the NEQ predicate on the "version" field. +func VersionNEQ(v string) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldVersion, v)) +} + +// VersionIn applies the In predicate on the "version" field. +func VersionIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldIn(FieldVersion, vs...)) +} + +// VersionNotIn applies the NotIn predicate on the "version" field. +func VersionNotIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldNotIn(FieldVersion, vs...)) +} + +// VersionGT applies the GT predicate on the "version" field. +func VersionGT(v string) predicate.Api { + return predicate.Api(sql.FieldGT(FieldVersion, v)) +} + +// VersionGTE applies the GTE predicate on the "version" field. +func VersionGTE(v string) predicate.Api { + return predicate.Api(sql.FieldGTE(FieldVersion, v)) +} + +// VersionLT applies the LT predicate on the "version" field. +func VersionLT(v string) predicate.Api { + return predicate.Api(sql.FieldLT(FieldVersion, v)) +} + +// VersionLTE applies the LTE predicate on the "version" field. +func VersionLTE(v string) predicate.Api { + return predicate.Api(sql.FieldLTE(FieldVersion, v)) +} + +// VersionContains applies the Contains predicate on the "version" field. +func VersionContains(v string) predicate.Api { + return predicate.Api(sql.FieldContains(FieldVersion, v)) +} + +// VersionHasPrefix applies the HasPrefix predicate on the "version" field. +func VersionHasPrefix(v string) predicate.Api { + return predicate.Api(sql.FieldHasPrefix(FieldVersion, v)) +} + +// VersionHasSuffix applies the HasSuffix predicate on the "version" field. +func VersionHasSuffix(v string) predicate.Api { + return predicate.Api(sql.FieldHasSuffix(FieldVersion, v)) +} + +// VersionEqualFold applies the EqualFold predicate on the "version" field. +func VersionEqualFold(v string) predicate.Api { + return predicate.Api(sql.FieldEqualFold(FieldVersion, v)) +} + +// VersionContainsFold applies the ContainsFold predicate on the "version" field. +func VersionContainsFold(v string) predicate.Api { + return predicate.Api(sql.FieldContainsFold(FieldVersion, v)) +} + +// CategoryEQ applies the EQ predicate on the "category" field. +func CategoryEQ(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldCategory, v)) +} + +// CategoryNEQ applies the NEQ predicate on the "category" field. +func CategoryNEQ(v string) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldCategory, v)) +} + +// CategoryIn applies the In predicate on the "category" field. +func CategoryIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldIn(FieldCategory, vs...)) +} + +// CategoryNotIn applies the NotIn predicate on the "category" field. +func CategoryNotIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldNotIn(FieldCategory, vs...)) +} + +// CategoryGT applies the GT predicate on the "category" field. +func CategoryGT(v string) predicate.Api { + return predicate.Api(sql.FieldGT(FieldCategory, v)) +} + +// CategoryGTE applies the GTE predicate on the "category" field. +func CategoryGTE(v string) predicate.Api { + return predicate.Api(sql.FieldGTE(FieldCategory, v)) +} + +// CategoryLT applies the LT predicate on the "category" field. +func CategoryLT(v string) predicate.Api { + return predicate.Api(sql.FieldLT(FieldCategory, v)) +} + +// CategoryLTE applies the LTE predicate on the "category" field. +func CategoryLTE(v string) predicate.Api { + return predicate.Api(sql.FieldLTE(FieldCategory, v)) +} + +// CategoryContains applies the Contains predicate on the "category" field. +func CategoryContains(v string) predicate.Api { + return predicate.Api(sql.FieldContains(FieldCategory, v)) +} + +// CategoryHasPrefix applies the HasPrefix predicate on the "category" field. +func CategoryHasPrefix(v string) predicate.Api { + return predicate.Api(sql.FieldHasPrefix(FieldCategory, v)) +} + +// CategoryHasSuffix applies the HasSuffix predicate on the "category" field. +func CategoryHasSuffix(v string) predicate.Api { + return predicate.Api(sql.FieldHasSuffix(FieldCategory, v)) +} + +// CategoryIsNil applies the IsNil predicate on the "category" field. +func CategoryIsNil() predicate.Api { + return predicate.Api(sql.FieldIsNull(FieldCategory)) +} + +// CategoryNotNil applies the NotNil predicate on the "category" field. +func CategoryNotNil() predicate.Api { + return predicate.Api(sql.FieldNotNull(FieldCategory)) +} + +// CategoryEqualFold applies the EqualFold predicate on the "category" field. +func CategoryEqualFold(v string) predicate.Api { + return predicate.Api(sql.FieldEqualFold(FieldCategory, v)) +} + +// CategoryContainsFold applies the ContainsFold predicate on the "category" field. +func CategoryContainsFold(v string) predicate.Api { + return predicate.Api(sql.FieldContainsFold(FieldCategory, v)) +} + +// Oauth2ScopesIsNil applies the IsNil predicate on the "oauth2_scopes" field. +func Oauth2ScopesIsNil() predicate.Api { + return predicate.Api(sql.FieldIsNull(FieldOauth2Scopes)) +} + +// Oauth2ScopesNotNil applies the NotNil predicate on the "oauth2_scopes" field. +func Oauth2ScopesNotNil() predicate.Api { + return predicate.Api(sql.FieldNotNull(FieldOauth2Scopes)) +} + +// XVendorEQ applies the EQ predicate on the "x_vendor" field. +func XVendorEQ(v bool) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldXVendor, v)) +} + +// XVendorNEQ applies the NEQ predicate on the "x_vendor" field. +func XVendorNEQ(v bool) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldXVendor, v)) +} + +// SpecificationEQ applies the EQ predicate on the "specification" field. +func SpecificationEQ(v string) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldSpecification, v)) +} + +// SpecificationNEQ applies the NEQ predicate on the "specification" field. +func SpecificationNEQ(v string) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldSpecification, v)) +} + +// SpecificationIn applies the In predicate on the "specification" field. +func SpecificationIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldIn(FieldSpecification, vs...)) +} + +// SpecificationNotIn applies the NotIn predicate on the "specification" field. +func SpecificationNotIn(vs ...string) predicate.Api { + return predicate.Api(sql.FieldNotIn(FieldSpecification, vs...)) +} + +// SpecificationGT applies the GT predicate on the "specification" field. +func SpecificationGT(v string) predicate.Api { + return predicate.Api(sql.FieldGT(FieldSpecification, v)) +} + +// SpecificationGTE applies the GTE predicate on the "specification" field. +func SpecificationGTE(v string) predicate.Api { + return predicate.Api(sql.FieldGTE(FieldSpecification, v)) +} + +// SpecificationLT applies the LT predicate on the "specification" field. +func SpecificationLT(v string) predicate.Api { + return predicate.Api(sql.FieldLT(FieldSpecification, v)) +} + +// SpecificationLTE applies the LTE predicate on the "specification" field. +func SpecificationLTE(v string) predicate.Api { + return predicate.Api(sql.FieldLTE(FieldSpecification, v)) +} + +// SpecificationContains applies the Contains predicate on the "specification" field. +func SpecificationContains(v string) predicate.Api { + return predicate.Api(sql.FieldContains(FieldSpecification, v)) +} + +// SpecificationHasPrefix applies the HasPrefix predicate on the "specification" field. +func SpecificationHasPrefix(v string) predicate.Api { + return predicate.Api(sql.FieldHasPrefix(FieldSpecification, v)) +} + +// SpecificationHasSuffix applies the HasSuffix predicate on the "specification" field. +func SpecificationHasSuffix(v string) predicate.Api { + return predicate.Api(sql.FieldHasSuffix(FieldSpecification, v)) +} + +// SpecificationIsNil applies the IsNil predicate on the "specification" field. +func SpecificationIsNil() predicate.Api { + return predicate.Api(sql.FieldIsNull(FieldSpecification)) +} + +// SpecificationNotNil applies the NotNil predicate on the "specification" field. +func SpecificationNotNil() predicate.Api { + return predicate.Api(sql.FieldNotNull(FieldSpecification)) +} + +// SpecificationEqualFold applies the EqualFold predicate on the "specification" field. +func SpecificationEqualFold(v string) predicate.Api { + return predicate.Api(sql.FieldEqualFold(FieldSpecification, v)) +} + +// SpecificationContainsFold applies the ContainsFold predicate on the "specification" field. +func SpecificationContainsFold(v string) predicate.Api { + return predicate.Api(sql.FieldContainsFold(FieldSpecification, v)) +} + +// ActiveEQ applies the EQ predicate on the "active" field. +func ActiveEQ(v bool) predicate.Api { + return predicate.Api(sql.FieldEQ(FieldActive, v)) +} + +// ActiveNEQ applies the NEQ predicate on the "active" field. +func ActiveNEQ(v bool) predicate.Api { + return predicate.Api(sql.FieldNEQ(FieldActive, v)) +} + +// HasOwner applies the HasEdge predicate on the "owner" edge. +func HasOwner() predicate.Api { + return predicate.Api(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.Team) predicate.Api { + return predicate.Api(func(s *sql.Selector) { + step := newOwnerStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasExposures applies the HasEdge predicate on the "exposures" edge. +func HasExposures() predicate.Api { + return predicate.Api(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ExposuresTable, ExposuresColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasExposuresWith applies the HasEdge predicate on the "exposures" edge with a given conditions (other predicates). +func HasExposuresWith(preds ...predicate.ApiExposure) predicate.Api { + return predicate.Api(func(s *sql.Selector) { + step := newExposuresStep() + 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.Api) predicate.Api { + return predicate.Api(sql.AndPredicates(predicates...)) +} + +// Or groups predicates with the OR operator between them. +func Or(predicates ...predicate.Api) predicate.Api { + return predicate.Api(sql.OrPredicates(predicates...)) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.Api) predicate.Api { + return predicate.Api(sql.NotPredicates(p)) +} diff --git a/controlplane-api/ent/api_create.go b/controlplane-api/ent/api_create.go new file mode 100644 index 000000000..b7e8325cf --- /dev/null +++ b/controlplane-api/ent/api_create.go @@ -0,0 +1,1277 @@ +// 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/api" + "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" + "github.com/telekom/controlplane/controlplane-api/ent/team" +) + +// APICreate is the builder for creating a Api entity. +type APICreate struct { + config + mutation *APIMutation + hooks []Hook + conflict []sql.ConflictOption +} + +// SetCreatedAt sets the "created_at" field. +func (_c *APICreate) SetCreatedAt(v time.Time) *APICreate { + _c.mutation.SetCreatedAt(v) + return _c +} + +// SetNillableCreatedAt sets the "created_at" field if the given value is not nil. +func (_c *APICreate) SetNillableCreatedAt(v *time.Time) *APICreate { + if v != nil { + _c.SetCreatedAt(*v) + } + return _c +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_c *APICreate) SetLastModifiedAt(v time.Time) *APICreate { + _c.mutation.SetLastModifiedAt(v) + return _c +} + +// SetNillableLastModifiedAt sets the "last_modified_at" field if the given value is not nil. +func (_c *APICreate) SetNillableLastModifiedAt(v *time.Time) *APICreate { + if v != nil { + _c.SetLastModifiedAt(*v) + } + return _c +} + +// SetStatusPhase sets the "status_phase" field. +func (_c *APICreate) SetStatusPhase(v api.StatusPhase) *APICreate { + _c.mutation.SetStatusPhase(v) + return _c +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_c *APICreate) SetNillableStatusPhase(v *api.StatusPhase) *APICreate { + if v != nil { + _c.SetStatusPhase(*v) + } + return _c +} + +// SetStatusMessage sets the "status_message" field. +func (_c *APICreate) SetStatusMessage(v string) *APICreate { + _c.mutation.SetStatusMessage(v) + return _c +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_c *APICreate) SetNillableStatusMessage(v *string) *APICreate { + if v != nil { + _c.SetStatusMessage(*v) + } + return _c +} + +// SetNamespace sets the "namespace" field. +func (_c *APICreate) SetNamespace(v string) *APICreate { + _c.mutation.SetNamespace(v) + return _c +} + +// SetBasePath sets the "base_path" field. +func (_c *APICreate) SetBasePath(v string) *APICreate { + _c.mutation.SetBasePath(v) + return _c +} + +// SetVersion sets the "version" field. +func (_c *APICreate) SetVersion(v string) *APICreate { + _c.mutation.SetVersion(v) + return _c +} + +// SetCategory sets the "category" field. +func (_c *APICreate) SetCategory(v string) *APICreate { + _c.mutation.SetCategory(v) + return _c +} + +// SetNillableCategory sets the "category" field if the given value is not nil. +func (_c *APICreate) SetNillableCategory(v *string) *APICreate { + if v != nil { + _c.SetCategory(*v) + } + return _c +} + +// SetOauth2Scopes sets the "oauth2_scopes" field. +func (_c *APICreate) SetOauth2Scopes(v []string) *APICreate { + _c.mutation.SetOauth2Scopes(v) + return _c +} + +// SetXVendor sets the "x_vendor" field. +func (_c *APICreate) SetXVendor(v bool) *APICreate { + _c.mutation.SetXVendor(v) + return _c +} + +// SetNillableXVendor sets the "x_vendor" field if the given value is not nil. +func (_c *APICreate) SetNillableXVendor(v *bool) *APICreate { + if v != nil { + _c.SetXVendor(*v) + } + return _c +} + +// SetSpecification sets the "specification" field. +func (_c *APICreate) SetSpecification(v string) *APICreate { + _c.mutation.SetSpecification(v) + return _c +} + +// SetNillableSpecification sets the "specification" field if the given value is not nil. +func (_c *APICreate) SetNillableSpecification(v *string) *APICreate { + if v != nil { + _c.SetSpecification(*v) + } + return _c +} + +// SetActive sets the "active" field. +func (_c *APICreate) SetActive(v bool) *APICreate { + _c.mutation.SetActive(v) + return _c +} + +// SetNillableActive sets the "active" field if the given value is not nil. +func (_c *APICreate) SetNillableActive(v *bool) *APICreate { + if v != nil { + _c.SetActive(*v) + } + return _c +} + +// SetOwnerID sets the "owner" edge to the Team entity by ID. +func (_c *APICreate) SetOwnerID(id int) *APICreate { + _c.mutation.SetOwnerID(id) + return _c +} + +// SetOwner sets the "owner" edge to the Team entity. +func (_c *APICreate) SetOwner(v *Team) *APICreate { + return _c.SetOwnerID(v.ID) +} + +// AddExposureIDs adds the "exposures" edge to the ApiExposure entity by IDs. +func (_c *APICreate) AddExposureIDs(ids ...int) *APICreate { + _c.mutation.AddExposureIDs(ids...) + return _c +} + +// AddExposures adds the "exposures" edges to the ApiExposure entity. +func (_c *APICreate) AddExposures(v ...*ApiExposure) *APICreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _c.AddExposureIDs(ids...) +} + +// Mutation returns the APIMutation object of the builder. +func (_c *APICreate) Mutation() *APIMutation { + return _c.mutation +} + +// Save creates the Api in the database. +func (_c *APICreate) Save(ctx context.Context) (*Api, 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 *APICreate) SaveX(ctx context.Context) *Api { + v, err := _c.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (_c *APICreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_c *APICreate) 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 *APICreate) defaults() error { + if _, ok := _c.mutation.CreatedAt(); !ok { + if api.DefaultCreatedAt == nil { + return fmt.Errorf("ent: uninitialized api.DefaultCreatedAt (forgotten import ent/runtime?)") + } + v := api.DefaultCreatedAt() + _c.mutation.SetCreatedAt(v) + } + if _, ok := _c.mutation.LastModifiedAt(); !ok { + if api.DefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized api.DefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := api.DefaultLastModifiedAt() + _c.mutation.SetLastModifiedAt(v) + } + if _, ok := _c.mutation.XVendor(); !ok { + v := api.DefaultXVendor + _c.mutation.SetXVendor(v) + } + if _, ok := _c.mutation.Active(); !ok { + v := api.DefaultActive + _c.mutation.SetActive(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_c *APICreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { + return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Api.created_at"`)} + } + if _, ok := _c.mutation.LastModifiedAt(); !ok { + return &ValidationError{Name: "last_modified_at", err: errors.New(`ent: missing required field "Api.last_modified_at"`)} + } + if v, ok := _c.mutation.StatusPhase(); ok { + if err := api.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "Api.status_phase": %w`, err)} + } + } + if _, ok := _c.mutation.Namespace(); !ok { + return &ValidationError{Name: "namespace", err: errors.New(`ent: missing required field "Api.namespace"`)} + } + if v, ok := _c.mutation.Namespace(); ok { + if err := api.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "Api.namespace": %w`, err)} + } + } + if _, ok := _c.mutation.BasePath(); !ok { + return &ValidationError{Name: "base_path", err: errors.New(`ent: missing required field "Api.base_path"`)} + } + if v, ok := _c.mutation.BasePath(); ok { + if err := api.BasePathValidator(v); err != nil { + return &ValidationError{Name: "base_path", err: fmt.Errorf(`ent: validator failed for field "Api.base_path": %w`, err)} + } + } + if _, ok := _c.mutation.Version(); !ok { + return &ValidationError{Name: "version", err: errors.New(`ent: missing required field "Api.version"`)} + } + if v, ok := _c.mutation.Version(); ok { + if err := api.VersionValidator(v); err != nil { + return &ValidationError{Name: "version", err: fmt.Errorf(`ent: validator failed for field "Api.version": %w`, err)} + } + } + if _, ok := _c.mutation.XVendor(); !ok { + return &ValidationError{Name: "x_vendor", err: errors.New(`ent: missing required field "Api.x_vendor"`)} + } + if _, ok := _c.mutation.Active(); !ok { + return &ValidationError{Name: "active", err: errors.New(`ent: missing required field "Api.active"`)} + } + if len(_c.mutation.OwnerIDs()) == 0 { + return &ValidationError{Name: "owner", err: errors.New(`ent: missing required edge "Api.owner"`)} + } + return nil +} + +func (_c *APICreate) sqlSave(ctx context.Context) (*Api, 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 *APICreate) createSpec() (*Api, *sqlgraph.CreateSpec) { + var ( + _node = &Api{config: _c.config} + _spec = sqlgraph.NewCreateSpec(api.Table, sqlgraph.NewFieldSpec(api.FieldID, field.TypeInt)) + ) + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { + _spec.SetField(api.FieldCreatedAt, field.TypeTime, value) + _node.CreatedAt = value + } + if value, ok := _c.mutation.LastModifiedAt(); ok { + _spec.SetField(api.FieldLastModifiedAt, field.TypeTime, value) + _node.LastModifiedAt = value + } + if value, ok := _c.mutation.StatusPhase(); ok { + _spec.SetField(api.FieldStatusPhase, field.TypeEnum, value) + _node.StatusPhase = &value + } + if value, ok := _c.mutation.StatusMessage(); ok { + _spec.SetField(api.FieldStatusMessage, field.TypeString, value) + _node.StatusMessage = &value + } + if value, ok := _c.mutation.Namespace(); ok { + _spec.SetField(api.FieldNamespace, field.TypeString, value) + _node.Namespace = value + } + if value, ok := _c.mutation.BasePath(); ok { + _spec.SetField(api.FieldBasePath, field.TypeString, value) + _node.BasePath = value + } + if value, ok := _c.mutation.Version(); ok { + _spec.SetField(api.FieldVersion, field.TypeString, value) + _node.Version = value + } + if value, ok := _c.mutation.Category(); ok { + _spec.SetField(api.FieldCategory, field.TypeString, value) + _node.Category = value + } + if value, ok := _c.mutation.Oauth2Scopes(); ok { + _spec.SetField(api.FieldOauth2Scopes, field.TypeJSON, value) + _node.Oauth2Scopes = value + } + if value, ok := _c.mutation.XVendor(); ok { + _spec.SetField(api.FieldXVendor, field.TypeBool, value) + _node.XVendor = value + } + if value, ok := _c.mutation.Specification(); ok { + _spec.SetField(api.FieldSpecification, field.TypeString, value) + _node.Specification = value + } + if value, ok := _c.mutation.Active(); ok { + _spec.SetField(api.FieldActive, field.TypeBool, value) + _node.Active = value + } + if nodes := _c.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: api.OwnerTable, + Columns: []string{api.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(team.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.team_apis = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := _c.mutation.ExposuresIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: api.ExposuresTable, + Columns: []string{api.ExposuresColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(apiexposure.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.Api.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.ApiUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (_c *APICreate) OnConflict(opts ...sql.ConflictOption) *ApiUpsertOne { + _c.conflict = opts + return &ApiUpsertOne{ + create: _c, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.Api.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (_c *APICreate) OnConflictColumns(columns ...string) *ApiUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) + return &ApiUpsertOne{ + create: _c, + } +} + +type ( + // ApiUpsertOne is the builder for "upsert"-ing + // one Api node. + ApiUpsertOne struct { + create *APICreate + } + + // ApiUpsert is the "OnConflict" setter. + ApiUpsert struct { + *sql.UpdateSet + } +) + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *ApiUpsert) SetLastModifiedAt(v time.Time) *ApiUpsert { + u.Set(api.FieldLastModifiedAt, v) + return u +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *ApiUpsert) UpdateLastModifiedAt() *ApiUpsert { + u.SetExcluded(api.FieldLastModifiedAt) + return u +} + +// SetStatusPhase sets the "status_phase" field. +func (u *ApiUpsert) SetStatusPhase(v api.StatusPhase) *ApiUpsert { + u.Set(api.FieldStatusPhase, v) + return u +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *ApiUpsert) UpdateStatusPhase() *ApiUpsert { + u.SetExcluded(api.FieldStatusPhase) + return u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *ApiUpsert) ClearStatusPhase() *ApiUpsert { + u.SetNull(api.FieldStatusPhase) + return u +} + +// SetStatusMessage sets the "status_message" field. +func (u *ApiUpsert) SetStatusMessage(v string) *ApiUpsert { + u.Set(api.FieldStatusMessage, v) + return u +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *ApiUpsert) UpdateStatusMessage() *ApiUpsert { + u.SetExcluded(api.FieldStatusMessage) + return u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *ApiUpsert) ClearStatusMessage() *ApiUpsert { + u.SetNull(api.FieldStatusMessage) + return u +} + +// SetNamespace sets the "namespace" field. +func (u *ApiUpsert) SetNamespace(v string) *ApiUpsert { + u.Set(api.FieldNamespace, v) + return u +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *ApiUpsert) UpdateNamespace() *ApiUpsert { + u.SetExcluded(api.FieldNamespace) + return u +} + +// SetBasePath sets the "base_path" field. +func (u *ApiUpsert) SetBasePath(v string) *ApiUpsert { + u.Set(api.FieldBasePath, v) + return u +} + +// UpdateBasePath sets the "base_path" field to the value that was provided on create. +func (u *ApiUpsert) UpdateBasePath() *ApiUpsert { + u.SetExcluded(api.FieldBasePath) + return u +} + +// SetVersion sets the "version" field. +func (u *ApiUpsert) SetVersion(v string) *ApiUpsert { + u.Set(api.FieldVersion, v) + return u +} + +// UpdateVersion sets the "version" field to the value that was provided on create. +func (u *ApiUpsert) UpdateVersion() *ApiUpsert { + u.SetExcluded(api.FieldVersion) + return u +} + +// SetCategory sets the "category" field. +func (u *ApiUpsert) SetCategory(v string) *ApiUpsert { + u.Set(api.FieldCategory, v) + return u +} + +// UpdateCategory sets the "category" field to the value that was provided on create. +func (u *ApiUpsert) UpdateCategory() *ApiUpsert { + u.SetExcluded(api.FieldCategory) + return u +} + +// ClearCategory clears the value of the "category" field. +func (u *ApiUpsert) ClearCategory() *ApiUpsert { + u.SetNull(api.FieldCategory) + return u +} + +// SetOauth2Scopes sets the "oauth2_scopes" field. +func (u *ApiUpsert) SetOauth2Scopes(v []string) *ApiUpsert { + u.Set(api.FieldOauth2Scopes, v) + return u +} + +// UpdateOauth2Scopes sets the "oauth2_scopes" field to the value that was provided on create. +func (u *ApiUpsert) UpdateOauth2Scopes() *ApiUpsert { + u.SetExcluded(api.FieldOauth2Scopes) + return u +} + +// ClearOauth2Scopes clears the value of the "oauth2_scopes" field. +func (u *ApiUpsert) ClearOauth2Scopes() *ApiUpsert { + u.SetNull(api.FieldOauth2Scopes) + return u +} + +// SetXVendor sets the "x_vendor" field. +func (u *ApiUpsert) SetXVendor(v bool) *ApiUpsert { + u.Set(api.FieldXVendor, v) + return u +} + +// UpdateXVendor sets the "x_vendor" field to the value that was provided on create. +func (u *ApiUpsert) UpdateXVendor() *ApiUpsert { + u.SetExcluded(api.FieldXVendor) + return u +} + +// SetSpecification sets the "specification" field. +func (u *ApiUpsert) SetSpecification(v string) *ApiUpsert { + u.Set(api.FieldSpecification, v) + return u +} + +// UpdateSpecification sets the "specification" field to the value that was provided on create. +func (u *ApiUpsert) UpdateSpecification() *ApiUpsert { + u.SetExcluded(api.FieldSpecification) + return u +} + +// ClearSpecification clears the value of the "specification" field. +func (u *ApiUpsert) ClearSpecification() *ApiUpsert { + u.SetNull(api.FieldSpecification) + return u +} + +// SetActive sets the "active" field. +func (u *ApiUpsert) SetActive(v bool) *ApiUpsert { + u.Set(api.FieldActive, v) + return u +} + +// UpdateActive sets the "active" field to the value that was provided on create. +func (u *ApiUpsert) UpdateActive() *ApiUpsert { + u.SetExcluded(api.FieldActive) + return u +} + +// UpdateNewValues updates the mutable fields using the new values that were set on create. +// Using this option is equivalent to using: +// +// client.Api.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *ApiUpsertOne) UpdateNewValues() *ApiUpsertOne { + 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(api.FieldCreatedAt) + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.Api.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *ApiUpsertOne) Ignore() *ApiUpsertOne { + 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 *ApiUpsertOne) DoNothing() *ApiUpsertOne { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the APICreate.OnConflict +// documentation for more info. +func (u *ApiUpsertOne) Update(set func(*ApiUpsert)) *ApiUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&ApiUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *ApiUpsertOne) SetLastModifiedAt(v time.Time) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateLastModifiedAt() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetStatusPhase sets the "status_phase" field. +func (u *ApiUpsertOne) SetStatusPhase(v api.StatusPhase) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetStatusPhase(v) + }) +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateStatusPhase() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateStatusPhase() + }) +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *ApiUpsertOne) ClearStatusPhase() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.ClearStatusPhase() + }) +} + +// SetStatusMessage sets the "status_message" field. +func (u *ApiUpsertOne) SetStatusMessage(v string) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetStatusMessage(v) + }) +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateStatusMessage() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateStatusMessage() + }) +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *ApiUpsertOne) ClearStatusMessage() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.ClearStatusMessage() + }) +} + +// SetNamespace sets the "namespace" field. +func (u *ApiUpsertOne) SetNamespace(v string) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetNamespace(v) + }) +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateNamespace() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateNamespace() + }) +} + +// SetBasePath sets the "base_path" field. +func (u *ApiUpsertOne) SetBasePath(v string) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetBasePath(v) + }) +} + +// UpdateBasePath sets the "base_path" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateBasePath() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateBasePath() + }) +} + +// SetVersion sets the "version" field. +func (u *ApiUpsertOne) SetVersion(v string) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetVersion(v) + }) +} + +// UpdateVersion sets the "version" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateVersion() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateVersion() + }) +} + +// SetCategory sets the "category" field. +func (u *ApiUpsertOne) SetCategory(v string) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetCategory(v) + }) +} + +// UpdateCategory sets the "category" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateCategory() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateCategory() + }) +} + +// ClearCategory clears the value of the "category" field. +func (u *ApiUpsertOne) ClearCategory() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.ClearCategory() + }) +} + +// SetOauth2Scopes sets the "oauth2_scopes" field. +func (u *ApiUpsertOne) SetOauth2Scopes(v []string) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetOauth2Scopes(v) + }) +} + +// UpdateOauth2Scopes sets the "oauth2_scopes" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateOauth2Scopes() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateOauth2Scopes() + }) +} + +// ClearOauth2Scopes clears the value of the "oauth2_scopes" field. +func (u *ApiUpsertOne) ClearOauth2Scopes() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.ClearOauth2Scopes() + }) +} + +// SetXVendor sets the "x_vendor" field. +func (u *ApiUpsertOne) SetXVendor(v bool) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetXVendor(v) + }) +} + +// UpdateXVendor sets the "x_vendor" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateXVendor() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateXVendor() + }) +} + +// SetSpecification sets the "specification" field. +func (u *ApiUpsertOne) SetSpecification(v string) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetSpecification(v) + }) +} + +// UpdateSpecification sets the "specification" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateSpecification() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateSpecification() + }) +} + +// ClearSpecification clears the value of the "specification" field. +func (u *ApiUpsertOne) ClearSpecification() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.ClearSpecification() + }) +} + +// SetActive sets the "active" field. +func (u *ApiUpsertOne) SetActive(v bool) *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.SetActive(v) + }) +} + +// UpdateActive sets the "active" field to the value that was provided on create. +func (u *ApiUpsertOne) UpdateActive() *ApiUpsertOne { + return u.Update(func(s *ApiUpsert) { + s.UpdateActive() + }) +} + +// Exec executes the query. +func (u *ApiUpsertOne) Exec(ctx context.Context) error { + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for APICreate.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *ApiUpsertOne) 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 *ApiUpsertOne) 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 *ApiUpsertOne) IDX(ctx context.Context) int { + id, err := u.ID(ctx) + if err != nil { + panic(err) + } + return id +} + +// APICreateBulk is the builder for creating many Api entities in bulk. +type APICreateBulk struct { + config + err error + builders []*APICreate + conflict []sql.ConflictOption +} + +// Save creates the Api entities in the database. +func (_c *APICreateBulk) Save(ctx context.Context) ([]*Api, error) { + if _c.err != nil { + return nil, _c.err + } + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*Api, 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.(*APIMutation) + 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 *APICreateBulk) SaveX(ctx context.Context) []*Api { + v, err := _c.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (_c *APICreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_c *APICreateBulk) 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.Api.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.ApiUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (_c *APICreateBulk) OnConflict(opts ...sql.ConflictOption) *ApiUpsertBulk { + _c.conflict = opts + return &ApiUpsertBulk{ + create: _c, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.Api.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (_c *APICreateBulk) OnConflictColumns(columns ...string) *ApiUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) + return &ApiUpsertBulk{ + create: _c, + } +} + +// ApiUpsertBulk is the builder for "upsert"-ing +// a bulk of Api nodes. +type ApiUpsertBulk struct { + create *APICreateBulk +} + +// UpdateNewValues updates the mutable fields using the new values that +// were set on create. Using this option is equivalent to using: +// +// client.Api.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *ApiUpsertBulk) UpdateNewValues() *ApiUpsertBulk { + 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(api.FieldCreatedAt) + } + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.Api.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *ApiUpsertBulk) Ignore() *ApiUpsertBulk { + 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 *ApiUpsertBulk) DoNothing() *ApiUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the APICreateBulk.OnConflict +// documentation for more info. +func (u *ApiUpsertBulk) Update(set func(*ApiUpsert)) *ApiUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&ApiUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *ApiUpsertBulk) SetLastModifiedAt(v time.Time) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateLastModifiedAt() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetStatusPhase sets the "status_phase" field. +func (u *ApiUpsertBulk) SetStatusPhase(v api.StatusPhase) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetStatusPhase(v) + }) +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateStatusPhase() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateStatusPhase() + }) +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *ApiUpsertBulk) ClearStatusPhase() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.ClearStatusPhase() + }) +} + +// SetStatusMessage sets the "status_message" field. +func (u *ApiUpsertBulk) SetStatusMessage(v string) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetStatusMessage(v) + }) +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateStatusMessage() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateStatusMessage() + }) +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *ApiUpsertBulk) ClearStatusMessage() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.ClearStatusMessage() + }) +} + +// SetNamespace sets the "namespace" field. +func (u *ApiUpsertBulk) SetNamespace(v string) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetNamespace(v) + }) +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateNamespace() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateNamespace() + }) +} + +// SetBasePath sets the "base_path" field. +func (u *ApiUpsertBulk) SetBasePath(v string) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetBasePath(v) + }) +} + +// UpdateBasePath sets the "base_path" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateBasePath() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateBasePath() + }) +} + +// SetVersion sets the "version" field. +func (u *ApiUpsertBulk) SetVersion(v string) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetVersion(v) + }) +} + +// UpdateVersion sets the "version" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateVersion() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateVersion() + }) +} + +// SetCategory sets the "category" field. +func (u *ApiUpsertBulk) SetCategory(v string) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetCategory(v) + }) +} + +// UpdateCategory sets the "category" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateCategory() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateCategory() + }) +} + +// ClearCategory clears the value of the "category" field. +func (u *ApiUpsertBulk) ClearCategory() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.ClearCategory() + }) +} + +// SetOauth2Scopes sets the "oauth2_scopes" field. +func (u *ApiUpsertBulk) SetOauth2Scopes(v []string) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetOauth2Scopes(v) + }) +} + +// UpdateOauth2Scopes sets the "oauth2_scopes" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateOauth2Scopes() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateOauth2Scopes() + }) +} + +// ClearOauth2Scopes clears the value of the "oauth2_scopes" field. +func (u *ApiUpsertBulk) ClearOauth2Scopes() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.ClearOauth2Scopes() + }) +} + +// SetXVendor sets the "x_vendor" field. +func (u *ApiUpsertBulk) SetXVendor(v bool) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetXVendor(v) + }) +} + +// UpdateXVendor sets the "x_vendor" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateXVendor() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateXVendor() + }) +} + +// SetSpecification sets the "specification" field. +func (u *ApiUpsertBulk) SetSpecification(v string) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetSpecification(v) + }) +} + +// UpdateSpecification sets the "specification" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateSpecification() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateSpecification() + }) +} + +// ClearSpecification clears the value of the "specification" field. +func (u *ApiUpsertBulk) ClearSpecification() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.ClearSpecification() + }) +} + +// SetActive sets the "active" field. +func (u *ApiUpsertBulk) SetActive(v bool) *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.SetActive(v) + }) +} + +// UpdateActive sets the "active" field to the value that was provided on create. +func (u *ApiUpsertBulk) UpdateActive() *ApiUpsertBulk { + return u.Update(func(s *ApiUpsert) { + s.UpdateActive() + }) +} + +// Exec executes the query. +func (u *ApiUpsertBulk) 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 APICreateBulk instead", i) + } + } + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for APICreateBulk.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *ApiUpsertBulk) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/controlplane-api/ent/api_delete.go b/controlplane-api/ent/api_delete.go new file mode 100644 index 000000000..35fc2fe64 --- /dev/null +++ b/controlplane-api/ent/api_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/api" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" +) + +// APIDelete is the builder for deleting a Api entity. +type APIDelete struct { + config + hooks []Hook + mutation *APIMutation +} + +// Where appends a list predicates to the APIDelete builder. +func (_d *APIDelete) Where(ps ...predicate.Api) *APIDelete { + _d.mutation.Where(ps...) + return _d +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (_d *APIDelete) 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 *APIDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (_d *APIDelete) sqlExec(ctx context.Context) (int, error) { + _spec := sqlgraph.NewDeleteSpec(api.Table, sqlgraph.NewFieldSpec(api.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 +} + +// APIDeleteOne is the builder for deleting a single Api entity. +type APIDeleteOne struct { + _d *APIDelete +} + +// Where appends a list predicates to the APIDelete builder. +func (_d *APIDeleteOne) Where(ps ...predicate.Api) *APIDeleteOne { + _d._d.mutation.Where(ps...) + return _d +} + +// Exec executes the deletion query. +func (_d *APIDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{api.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (_d *APIDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/controlplane-api/ent/api_query.go b/controlplane-api/ent/api_query.go new file mode 100644 index 000000000..fb7c0e34b --- /dev/null +++ b/controlplane-api/ent/api_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/api" + "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" + "github.com/telekom/controlplane/controlplane-api/ent/team" +) + +// APIQuery is the builder for querying Api entities. +type APIQuery struct { + config + ctx *QueryContext + order []api.OrderOption + inters []Interceptor + predicates []predicate.Api + withOwner *TeamQuery + withExposures *ApiExposureQuery + withFKs bool + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*Api) error + withNamedExposures map[string]*ApiExposureQuery + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Where adds a new predicate for the APIQuery builder. +func (_q *APIQuery) Where(ps ...predicate.Api) *APIQuery { + _q.predicates = append(_q.predicates, ps...) + return _q +} + +// Limit the number of records to be returned by this query. +func (_q *APIQuery) Limit(limit int) *APIQuery { + _q.ctx.Limit = &limit + return _q +} + +// Offset to start from. +func (_q *APIQuery) Offset(offset int) *APIQuery { + _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 *APIQuery) Unique(unique bool) *APIQuery { + _q.ctx.Unique = &unique + return _q +} + +// Order specifies how the records should be ordered. +func (_q *APIQuery) Order(o ...api.OrderOption) *APIQuery { + _q.order = append(_q.order, o...) + return _q +} + +// QueryOwner chains the current query on the "owner" edge. +func (_q *APIQuery) QueryOwner() *TeamQuery { + query := (&TeamClient{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(api.Table, api.FieldID, selector), + sqlgraph.To(team.Table, team.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, api.OwnerTable, api.OwnerColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryExposures chains the current query on the "exposures" edge. +func (_q *APIQuery) QueryExposures() *ApiExposureQuery { + query := (&ApiExposureClient{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(api.Table, api.FieldID, selector), + sqlgraph.To(apiexposure.Table, apiexposure.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, api.ExposuresTable, api.ExposuresColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// First returns the first Api entity from the query. +// Returns a *NotFoundError when no Api was found. +func (_q *APIQuery) First(ctx context.Context) (*Api, 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{api.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (_q *APIQuery) FirstX(ctx context.Context) *Api { + node, err := _q.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first Api ID from the query. +// Returns a *NotFoundError when no Api ID was found. +func (_q *APIQuery) 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{api.Label} + return + } + return ids[0], nil +} + +// FirstIDX is like FirstID, but panics if an error occurs. +func (_q *APIQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns a single Api entity found by the query, ensuring it only returns one. +// Returns a *NotSingularError when more than one Api entity is found. +// Returns a *NotFoundError when no Api entities are found. +func (_q *APIQuery) Only(ctx context.Context) (*Api, 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{api.Label} + default: + return nil, &NotSingularError{api.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (_q *APIQuery) OnlyX(ctx context.Context) *Api { + node, err := _q.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID is like Only, but returns the only Api ID in the query. +// Returns a *NotSingularError when more than one Api ID is found. +// Returns a *NotFoundError when no entities are found. +func (_q *APIQuery) 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{api.Label} + default: + err = &NotSingularError{api.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (_q *APIQuery) 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 Apis. +func (_q *APIQuery) All(ctx context.Context) ([]*Api, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + qr := querierAll[[]*Api, *APIQuery]() + return withInterceptors[[]*Api](ctx, _q, qr, _q.inters) +} + +// AllX is like All, but panics if an error occurs. +func (_q *APIQuery) AllX(ctx context.Context) []*Api { + nodes, err := _q.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of Api IDs. +func (_q *APIQuery) 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(api.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (_q *APIQuery) 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 *APIQuery) 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[*APIQuery](), _q.inters) +} + +// CountX is like Count, but panics if an error occurs. +func (_q *APIQuery) 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 *APIQuery) 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 *APIQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the APIQuery 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 *APIQuery) Clone() *APIQuery { + if _q == nil { + return nil + } + return &APIQuery{ + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]api.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Api{}, _q.predicates...), + withOwner: _q.withOwner.Clone(), + withExposures: _q.withExposures.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 *APIQuery) WithOwner(opts ...func(*TeamQuery)) *APIQuery { + query := (&TeamClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withOwner = query + return _q +} + +// WithExposures tells the query-builder to eager-load the nodes that are connected to +// the "exposures" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *APIQuery) WithExposures(opts ...func(*ApiExposureQuery)) *APIQuery { + query := (&ApiExposureClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withExposures = 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.API.Query(). +// GroupBy(api.FieldCreatedAt). +// Aggregate(ent.Count()). +// Scan(ctx, &v) +func (_q *APIQuery) GroupBy(field string, fields ...string) *APIGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &APIGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields + grbuild.label = api.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.API.Query(). +// Select(api.FieldCreatedAt). +// Scan(ctx, &v) +func (_q *APIQuery) Select(fields ...string) *APISelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &APISelect{APIQuery: _q} + sbuild.label = api.Label + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan + return sbuild +} + +// Aggregate returns a APISelect configured with the given aggregations. +func (_q *APIQuery) Aggregate(fns ...AggregateFunc) *APISelect { + return _q.Select().Aggregate(fns...) +} + +func (_q *APIQuery) 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 !api.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 api.Policy == nil { + return errors.New("ent: uninitialized api.Policy (forgotten import ent/runtime?)") + } + if err := api.Policy.EvalQuery(ctx, _q); err != nil { + return err + } + return nil +} + +func (_q *APIQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Api, error) { + var ( + nodes = []*Api{} + withFKs = _q.withFKs + _spec = _q.querySpec() + loadedTypes = [2]bool{ + _q.withOwner != nil, + _q.withExposures != nil, + } + ) + if _q.withOwner != nil { + withFKs = true + } + if withFKs { + _spec.Node.Columns = append(_spec.Node.Columns, api.ForeignKeys...) + } + _spec.ScanValues = func(columns []string) ([]any, error) { + return (*Api).scanValues(nil, columns) + } + _spec.Assign = func(columns []string, values []any) error { + node := &Api{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 *Api, e *Team) { n.Edges.Owner = e }); err != nil { + return nil, err + } + } + if query := _q.withExposures; query != nil { + if err := _q.loadExposures(ctx, query, nodes, + func(n *Api) { n.Edges.Exposures = []*ApiExposure{} }, + func(n *Api, e *ApiExposure) { n.Edges.Exposures = append(n.Edges.Exposures, e) }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedExposures { + if err := _q.loadExposures(ctx, query, nodes, + func(n *Api) { n.appendNamedExposures(name) }, + func(n *Api, e *ApiExposure) { n.appendNamedExposures(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 *APIQuery) loadOwner(ctx context.Context, query *TeamQuery, nodes []*Api, init func(*Api), assign func(*Api, *Team)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*Api) + for i := range nodes { + if nodes[i].team_apis == nil { + continue + } + fk := *nodes[i].team_apis + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(team.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 "team_apis" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (_q *APIQuery) loadExposures(ctx context.Context, query *ApiExposureQuery, nodes []*Api, init func(*Api), assign func(*Api, *ApiExposure)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*Api) + 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.ApiExposure(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(api.ExposuresColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.api_exposures + if fk == nil { + return fmt.Errorf(`foreign-key "api_exposures" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "api_exposures" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} + +func (_q *APIQuery) 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 *APIQuery) querySpec() *sqlgraph.QuerySpec { + _spec := sqlgraph.NewQuerySpec(api.Table, api.Columns, sqlgraph.NewFieldSpec(api.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, api.FieldID) + for i := range fields { + if fields[i] != api.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 *APIQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) + t1 := builder.Table(api.Table) + columns := _q.ctx.Fields + if len(columns) == 0 { + columns = api.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 +} + +// WithNamedExposures tells the query-builder to eager-load the nodes that are connected to the "exposures" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *APIQuery) WithNamedExposures(name string, opts ...func(*ApiExposureQuery)) *APIQuery { + query := (&ApiExposureClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedExposures == nil { + _q.withNamedExposures = make(map[string]*ApiExposureQuery) + } + _q.withNamedExposures[name] = query + return _q +} + +// APIGroupBy is the group-by builder for Api entities. +type APIGroupBy struct { + selector + build *APIQuery +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (_g *APIGroupBy) Aggregate(fns ...AggregateFunc) *APIGroupBy { + _g.fns = append(_g.fns, fns...) + return _g +} + +// Scan applies the selector query and scans the result into the given value. +func (_g *APIGroupBy) 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[*APIQuery, *APIGroupBy](ctx, _g.build, _g, _g.build.inters, v) +} + +func (_g *APIGroupBy) sqlScan(ctx context.Context, root *APIQuery, 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) +} + +// APISelect is the builder for selecting fields of API entities. +type APISelect struct { + *APIQuery + selector +} + +// Aggregate adds the given aggregation functions to the selector query. +func (_s *APISelect) Aggregate(fns ...AggregateFunc) *APISelect { + _s.fns = append(_s.fns, fns...) + return _s +} + +// Scan applies the selector query and scans the result into the given value. +func (_s *APISelect) 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[*APIQuery, *APISelect](ctx, _s.APIQuery, _s, _s.inters, v) +} + +func (_s *APISelect) sqlScan(ctx context.Context, root *APIQuery, 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/api_update.go b/controlplane-api/ent/api_update.go new file mode 100644 index 000000000..81a54cb72 --- /dev/null +++ b/controlplane-api/ent/api_update.go @@ -0,0 +1,982 @@ +// 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/dialect/sql/sqljson" + "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/api" + "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" + "github.com/telekom/controlplane/controlplane-api/ent/team" +) + +// APIUpdate is the builder for updating Api entities. +type APIUpdate struct { + config + hooks []Hook + mutation *APIMutation +} + +// Where appends a list predicates to the APIUpdate builder. +func (_u *APIUpdate) Where(ps ...predicate.Api) *APIUpdate { + _u.mutation.Where(ps...) + return _u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_u *APIUpdate) SetLastModifiedAt(v time.Time) *APIUpdate { + _u.mutation.SetLastModifiedAt(v) + return _u +} + +// SetStatusPhase sets the "status_phase" field. +func (_u *APIUpdate) SetStatusPhase(v api.StatusPhase) *APIUpdate { + _u.mutation.SetStatusPhase(v) + return _u +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_u *APIUpdate) SetNillableStatusPhase(v *api.StatusPhase) *APIUpdate { + if v != nil { + _u.SetStatusPhase(*v) + } + return _u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (_u *APIUpdate) ClearStatusPhase() *APIUpdate { + _u.mutation.ClearStatusPhase() + return _u +} + +// SetStatusMessage sets the "status_message" field. +func (_u *APIUpdate) SetStatusMessage(v string) *APIUpdate { + _u.mutation.SetStatusMessage(v) + return _u +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_u *APIUpdate) SetNillableStatusMessage(v *string) *APIUpdate { + if v != nil { + _u.SetStatusMessage(*v) + } + return _u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (_u *APIUpdate) ClearStatusMessage() *APIUpdate { + _u.mutation.ClearStatusMessage() + return _u +} + +// SetNamespace sets the "namespace" field. +func (_u *APIUpdate) SetNamespace(v string) *APIUpdate { + _u.mutation.SetNamespace(v) + return _u +} + +// SetNillableNamespace sets the "namespace" field if the given value is not nil. +func (_u *APIUpdate) SetNillableNamespace(v *string) *APIUpdate { + if v != nil { + _u.SetNamespace(*v) + } + return _u +} + +// SetBasePath sets the "base_path" field. +func (_u *APIUpdate) SetBasePath(v string) *APIUpdate { + _u.mutation.SetBasePath(v) + return _u +} + +// SetNillableBasePath sets the "base_path" field if the given value is not nil. +func (_u *APIUpdate) SetNillableBasePath(v *string) *APIUpdate { + if v != nil { + _u.SetBasePath(*v) + } + return _u +} + +// SetVersion sets the "version" field. +func (_u *APIUpdate) SetVersion(v string) *APIUpdate { + _u.mutation.SetVersion(v) + return _u +} + +// SetNillableVersion sets the "version" field if the given value is not nil. +func (_u *APIUpdate) SetNillableVersion(v *string) *APIUpdate { + if v != nil { + _u.SetVersion(*v) + } + return _u +} + +// SetCategory sets the "category" field. +func (_u *APIUpdate) SetCategory(v string) *APIUpdate { + _u.mutation.SetCategory(v) + return _u +} + +// SetNillableCategory sets the "category" field if the given value is not nil. +func (_u *APIUpdate) SetNillableCategory(v *string) *APIUpdate { + if v != nil { + _u.SetCategory(*v) + } + return _u +} + +// ClearCategory clears the value of the "category" field. +func (_u *APIUpdate) ClearCategory() *APIUpdate { + _u.mutation.ClearCategory() + return _u +} + +// SetOauth2Scopes sets the "oauth2_scopes" field. +func (_u *APIUpdate) SetOauth2Scopes(v []string) *APIUpdate { + _u.mutation.SetOauth2Scopes(v) + return _u +} + +// AppendOauth2Scopes appends value to the "oauth2_scopes" field. +func (_u *APIUpdate) AppendOauth2Scopes(v []string) *APIUpdate { + _u.mutation.AppendOauth2Scopes(v) + return _u +} + +// ClearOauth2Scopes clears the value of the "oauth2_scopes" field. +func (_u *APIUpdate) ClearOauth2Scopes() *APIUpdate { + _u.mutation.ClearOauth2Scopes() + return _u +} + +// SetXVendor sets the "x_vendor" field. +func (_u *APIUpdate) SetXVendor(v bool) *APIUpdate { + _u.mutation.SetXVendor(v) + return _u +} + +// SetNillableXVendor sets the "x_vendor" field if the given value is not nil. +func (_u *APIUpdate) SetNillableXVendor(v *bool) *APIUpdate { + if v != nil { + _u.SetXVendor(*v) + } + return _u +} + +// SetSpecification sets the "specification" field. +func (_u *APIUpdate) SetSpecification(v string) *APIUpdate { + _u.mutation.SetSpecification(v) + return _u +} + +// SetNillableSpecification sets the "specification" field if the given value is not nil. +func (_u *APIUpdate) SetNillableSpecification(v *string) *APIUpdate { + if v != nil { + _u.SetSpecification(*v) + } + return _u +} + +// ClearSpecification clears the value of the "specification" field. +func (_u *APIUpdate) ClearSpecification() *APIUpdate { + _u.mutation.ClearSpecification() + return _u +} + +// SetActive sets the "active" field. +func (_u *APIUpdate) SetActive(v bool) *APIUpdate { + _u.mutation.SetActive(v) + return _u +} + +// SetNillableActive sets the "active" field if the given value is not nil. +func (_u *APIUpdate) SetNillableActive(v *bool) *APIUpdate { + if v != nil { + _u.SetActive(*v) + } + return _u +} + +// SetOwnerID sets the "owner" edge to the Team entity by ID. +func (_u *APIUpdate) SetOwnerID(id int) *APIUpdate { + _u.mutation.SetOwnerID(id) + return _u +} + +// SetOwner sets the "owner" edge to the Team entity. +func (_u *APIUpdate) SetOwner(v *Team) *APIUpdate { + return _u.SetOwnerID(v.ID) +} + +// AddExposureIDs adds the "exposures" edge to the ApiExposure entity by IDs. +func (_u *APIUpdate) AddExposureIDs(ids ...int) *APIUpdate { + _u.mutation.AddExposureIDs(ids...) + return _u +} + +// AddExposures adds the "exposures" edges to the ApiExposure entity. +func (_u *APIUpdate) AddExposures(v ...*ApiExposure) *APIUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddExposureIDs(ids...) +} + +// Mutation returns the APIMutation object of the builder. +func (_u *APIUpdate) Mutation() *APIMutation { + return _u.mutation +} + +// ClearOwner clears the "owner" edge to the Team entity. +func (_u *APIUpdate) ClearOwner() *APIUpdate { + _u.mutation.ClearOwner() + return _u +} + +// ClearExposures clears all "exposures" edges to the ApiExposure entity. +func (_u *APIUpdate) ClearExposures() *APIUpdate { + _u.mutation.ClearExposures() + return _u +} + +// RemoveExposureIDs removes the "exposures" edge to ApiExposure entities by IDs. +func (_u *APIUpdate) RemoveExposureIDs(ids ...int) *APIUpdate { + _u.mutation.RemoveExposureIDs(ids...) + return _u +} + +// RemoveExposures removes "exposures" edges to ApiExposure entities. +func (_u *APIUpdate) RemoveExposures(v ...*ApiExposure) *APIUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveExposureIDs(ids...) +} + +// Save executes the query and returns the number of nodes affected by the update operation. +func (_u *APIUpdate) 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 *APIUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (_u *APIUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_u *APIUpdate) 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 *APIUpdate) defaults() error { + if _, ok := _u.mutation.LastModifiedAt(); !ok { + if api.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized api.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := api.UpdateDefaultLastModifiedAt() + _u.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_u *APIUpdate) check() error { + if v, ok := _u.mutation.StatusPhase(); ok { + if err := api.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "Api.status_phase": %w`, err)} + } + } + if v, ok := _u.mutation.Namespace(); ok { + if err := api.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "Api.namespace": %w`, err)} + } + } + if v, ok := _u.mutation.BasePath(); ok { + if err := api.BasePathValidator(v); err != nil { + return &ValidationError{Name: "base_path", err: fmt.Errorf(`ent: validator failed for field "Api.base_path": %w`, err)} + } + } + if v, ok := _u.mutation.Version(); ok { + if err := api.VersionValidator(v); err != nil { + return &ValidationError{Name: "version", err: fmt.Errorf(`ent: validator failed for field "Api.version": %w`, err)} + } + } + if _u.mutation.OwnerCleared() && len(_u.mutation.OwnerIDs()) > 0 { + return errors.New(`ent: clearing a required unique edge "Api.owner"`) + } + return nil +} + +func (_u *APIUpdate) sqlSave(ctx context.Context) (_node int, err error) { + if err := _u.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(api.Table, api.Columns, sqlgraph.NewFieldSpec(api.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(api.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := _u.mutation.StatusPhase(); ok { + _spec.SetField(api.FieldStatusPhase, field.TypeEnum, value) + } + if _u.mutation.StatusPhaseCleared() { + _spec.ClearField(api.FieldStatusPhase, field.TypeEnum) + } + if value, ok := _u.mutation.StatusMessage(); ok { + _spec.SetField(api.FieldStatusMessage, field.TypeString, value) + } + if _u.mutation.StatusMessageCleared() { + _spec.ClearField(api.FieldStatusMessage, field.TypeString) + } + if value, ok := _u.mutation.Namespace(); ok { + _spec.SetField(api.FieldNamespace, field.TypeString, value) + } + if value, ok := _u.mutation.BasePath(); ok { + _spec.SetField(api.FieldBasePath, field.TypeString, value) + } + if value, ok := _u.mutation.Version(); ok { + _spec.SetField(api.FieldVersion, field.TypeString, value) + } + if value, ok := _u.mutation.Category(); ok { + _spec.SetField(api.FieldCategory, field.TypeString, value) + } + if _u.mutation.CategoryCleared() { + _spec.ClearField(api.FieldCategory, field.TypeString) + } + if value, ok := _u.mutation.Oauth2Scopes(); ok { + _spec.SetField(api.FieldOauth2Scopes, field.TypeJSON, value) + } + if value, ok := _u.mutation.AppendedOauth2Scopes(); ok { + _spec.AddModifier(func(u *sql.UpdateBuilder) { + sqljson.Append(u, api.FieldOauth2Scopes, value) + }) + } + if _u.mutation.Oauth2ScopesCleared() { + _spec.ClearField(api.FieldOauth2Scopes, field.TypeJSON) + } + if value, ok := _u.mutation.XVendor(); ok { + _spec.SetField(api.FieldXVendor, field.TypeBool, value) + } + if value, ok := _u.mutation.Specification(); ok { + _spec.SetField(api.FieldSpecification, field.TypeString, value) + } + if _u.mutation.SpecificationCleared() { + _spec.ClearField(api.FieldSpecification, field.TypeString) + } + if value, ok := _u.mutation.Active(); ok { + _spec.SetField(api.FieldActive, field.TypeBool, value) + } + if _u.mutation.OwnerCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: api.OwnerTable, + Columns: []string{api.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(team.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: api.OwnerTable, + Columns: []string{api.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(team.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.ExposuresCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: api.ExposuresTable, + Columns: []string{api.ExposuresColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(apiexposure.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedExposuresIDs(); len(nodes) > 0 && !_u.mutation.ExposuresCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: api.ExposuresTable, + Columns: []string{api.ExposuresColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(apiexposure.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.ExposuresIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: api.ExposuresTable, + Columns: []string{api.ExposuresColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(apiexposure.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{api.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return 0, err + } + _u.mutation.done = true + return _node, nil +} + +// APIUpdateOne is the builder for updating a single Api entity. +type APIUpdateOne struct { + config + fields []string + hooks []Hook + mutation *APIMutation +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_u *APIUpdateOne) SetLastModifiedAt(v time.Time) *APIUpdateOne { + _u.mutation.SetLastModifiedAt(v) + return _u +} + +// SetStatusPhase sets the "status_phase" field. +func (_u *APIUpdateOne) SetStatusPhase(v api.StatusPhase) *APIUpdateOne { + _u.mutation.SetStatusPhase(v) + return _u +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_u *APIUpdateOne) SetNillableStatusPhase(v *api.StatusPhase) *APIUpdateOne { + if v != nil { + _u.SetStatusPhase(*v) + } + return _u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (_u *APIUpdateOne) ClearStatusPhase() *APIUpdateOne { + _u.mutation.ClearStatusPhase() + return _u +} + +// SetStatusMessage sets the "status_message" field. +func (_u *APIUpdateOne) SetStatusMessage(v string) *APIUpdateOne { + _u.mutation.SetStatusMessage(v) + return _u +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_u *APIUpdateOne) SetNillableStatusMessage(v *string) *APIUpdateOne { + if v != nil { + _u.SetStatusMessage(*v) + } + return _u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (_u *APIUpdateOne) ClearStatusMessage() *APIUpdateOne { + _u.mutation.ClearStatusMessage() + return _u +} + +// SetNamespace sets the "namespace" field. +func (_u *APIUpdateOne) SetNamespace(v string) *APIUpdateOne { + _u.mutation.SetNamespace(v) + return _u +} + +// SetNillableNamespace sets the "namespace" field if the given value is not nil. +func (_u *APIUpdateOne) SetNillableNamespace(v *string) *APIUpdateOne { + if v != nil { + _u.SetNamespace(*v) + } + return _u +} + +// SetBasePath sets the "base_path" field. +func (_u *APIUpdateOne) SetBasePath(v string) *APIUpdateOne { + _u.mutation.SetBasePath(v) + return _u +} + +// SetNillableBasePath sets the "base_path" field if the given value is not nil. +func (_u *APIUpdateOne) SetNillableBasePath(v *string) *APIUpdateOne { + if v != nil { + _u.SetBasePath(*v) + } + return _u +} + +// SetVersion sets the "version" field. +func (_u *APIUpdateOne) SetVersion(v string) *APIUpdateOne { + _u.mutation.SetVersion(v) + return _u +} + +// SetNillableVersion sets the "version" field if the given value is not nil. +func (_u *APIUpdateOne) SetNillableVersion(v *string) *APIUpdateOne { + if v != nil { + _u.SetVersion(*v) + } + return _u +} + +// SetCategory sets the "category" field. +func (_u *APIUpdateOne) SetCategory(v string) *APIUpdateOne { + _u.mutation.SetCategory(v) + return _u +} + +// SetNillableCategory sets the "category" field if the given value is not nil. +func (_u *APIUpdateOne) SetNillableCategory(v *string) *APIUpdateOne { + if v != nil { + _u.SetCategory(*v) + } + return _u +} + +// ClearCategory clears the value of the "category" field. +func (_u *APIUpdateOne) ClearCategory() *APIUpdateOne { + _u.mutation.ClearCategory() + return _u +} + +// SetOauth2Scopes sets the "oauth2_scopes" field. +func (_u *APIUpdateOne) SetOauth2Scopes(v []string) *APIUpdateOne { + _u.mutation.SetOauth2Scopes(v) + return _u +} + +// AppendOauth2Scopes appends value to the "oauth2_scopes" field. +func (_u *APIUpdateOne) AppendOauth2Scopes(v []string) *APIUpdateOne { + _u.mutation.AppendOauth2Scopes(v) + return _u +} + +// ClearOauth2Scopes clears the value of the "oauth2_scopes" field. +func (_u *APIUpdateOne) ClearOauth2Scopes() *APIUpdateOne { + _u.mutation.ClearOauth2Scopes() + return _u +} + +// SetXVendor sets the "x_vendor" field. +func (_u *APIUpdateOne) SetXVendor(v bool) *APIUpdateOne { + _u.mutation.SetXVendor(v) + return _u +} + +// SetNillableXVendor sets the "x_vendor" field if the given value is not nil. +func (_u *APIUpdateOne) SetNillableXVendor(v *bool) *APIUpdateOne { + if v != nil { + _u.SetXVendor(*v) + } + return _u +} + +// SetSpecification sets the "specification" field. +func (_u *APIUpdateOne) SetSpecification(v string) *APIUpdateOne { + _u.mutation.SetSpecification(v) + return _u +} + +// SetNillableSpecification sets the "specification" field if the given value is not nil. +func (_u *APIUpdateOne) SetNillableSpecification(v *string) *APIUpdateOne { + if v != nil { + _u.SetSpecification(*v) + } + return _u +} + +// ClearSpecification clears the value of the "specification" field. +func (_u *APIUpdateOne) ClearSpecification() *APIUpdateOne { + _u.mutation.ClearSpecification() + return _u +} + +// SetActive sets the "active" field. +func (_u *APIUpdateOne) SetActive(v bool) *APIUpdateOne { + _u.mutation.SetActive(v) + return _u +} + +// SetNillableActive sets the "active" field if the given value is not nil. +func (_u *APIUpdateOne) SetNillableActive(v *bool) *APIUpdateOne { + if v != nil { + _u.SetActive(*v) + } + return _u +} + +// SetOwnerID sets the "owner" edge to the Team entity by ID. +func (_u *APIUpdateOne) SetOwnerID(id int) *APIUpdateOne { + _u.mutation.SetOwnerID(id) + return _u +} + +// SetOwner sets the "owner" edge to the Team entity. +func (_u *APIUpdateOne) SetOwner(v *Team) *APIUpdateOne { + return _u.SetOwnerID(v.ID) +} + +// AddExposureIDs adds the "exposures" edge to the ApiExposure entity by IDs. +func (_u *APIUpdateOne) AddExposureIDs(ids ...int) *APIUpdateOne { + _u.mutation.AddExposureIDs(ids...) + return _u +} + +// AddExposures adds the "exposures" edges to the ApiExposure entity. +func (_u *APIUpdateOne) AddExposures(v ...*ApiExposure) *APIUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddExposureIDs(ids...) +} + +// Mutation returns the APIMutation object of the builder. +func (_u *APIUpdateOne) Mutation() *APIMutation { + return _u.mutation +} + +// ClearOwner clears the "owner" edge to the Team entity. +func (_u *APIUpdateOne) ClearOwner() *APIUpdateOne { + _u.mutation.ClearOwner() + return _u +} + +// ClearExposures clears all "exposures" edges to the ApiExposure entity. +func (_u *APIUpdateOne) ClearExposures() *APIUpdateOne { + _u.mutation.ClearExposures() + return _u +} + +// RemoveExposureIDs removes the "exposures" edge to ApiExposure entities by IDs. +func (_u *APIUpdateOne) RemoveExposureIDs(ids ...int) *APIUpdateOne { + _u.mutation.RemoveExposureIDs(ids...) + return _u +} + +// RemoveExposures removes "exposures" edges to ApiExposure entities. +func (_u *APIUpdateOne) RemoveExposures(v ...*ApiExposure) *APIUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveExposureIDs(ids...) +} + +// Where appends a list predicates to the APIUpdate builder. +func (_u *APIUpdateOne) Where(ps ...predicate.Api) *APIUpdateOne { + _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 *APIUpdateOne) Select(field string, fields ...string) *APIUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u +} + +// Save executes the query and returns the updated Api entity. +func (_u *APIUpdateOne) Save(ctx context.Context) (*Api, 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 *APIUpdateOne) SaveX(ctx context.Context) *Api { + node, err := _u.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (_u *APIUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_u *APIUpdateOne) 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 *APIUpdateOne) defaults() error { + if _, ok := _u.mutation.LastModifiedAt(); !ok { + if api.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized api.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := api.UpdateDefaultLastModifiedAt() + _u.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_u *APIUpdateOne) check() error { + if v, ok := _u.mutation.StatusPhase(); ok { + if err := api.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "Api.status_phase": %w`, err)} + } + } + if v, ok := _u.mutation.Namespace(); ok { + if err := api.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "Api.namespace": %w`, err)} + } + } + if v, ok := _u.mutation.BasePath(); ok { + if err := api.BasePathValidator(v); err != nil { + return &ValidationError{Name: "base_path", err: fmt.Errorf(`ent: validator failed for field "Api.base_path": %w`, err)} + } + } + if v, ok := _u.mutation.Version(); ok { + if err := api.VersionValidator(v); err != nil { + return &ValidationError{Name: "version", err: fmt.Errorf(`ent: validator failed for field "Api.version": %w`, err)} + } + } + if _u.mutation.OwnerCleared() && len(_u.mutation.OwnerIDs()) > 0 { + return errors.New(`ent: clearing a required unique edge "Api.owner"`) + } + return nil +} + +func (_u *APIUpdateOne) sqlSave(ctx context.Context) (_node *Api, err error) { + if err := _u.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(api.Table, api.Columns, sqlgraph.NewFieldSpec(api.FieldID, field.TypeInt)) + id, ok := _u.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Api.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, api.FieldID) + for _, f := range fields { + if !api.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != api.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(api.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := _u.mutation.StatusPhase(); ok { + _spec.SetField(api.FieldStatusPhase, field.TypeEnum, value) + } + if _u.mutation.StatusPhaseCleared() { + _spec.ClearField(api.FieldStatusPhase, field.TypeEnum) + } + if value, ok := _u.mutation.StatusMessage(); ok { + _spec.SetField(api.FieldStatusMessage, field.TypeString, value) + } + if _u.mutation.StatusMessageCleared() { + _spec.ClearField(api.FieldStatusMessage, field.TypeString) + } + if value, ok := _u.mutation.Namespace(); ok { + _spec.SetField(api.FieldNamespace, field.TypeString, value) + } + if value, ok := _u.mutation.BasePath(); ok { + _spec.SetField(api.FieldBasePath, field.TypeString, value) + } + if value, ok := _u.mutation.Version(); ok { + _spec.SetField(api.FieldVersion, field.TypeString, value) + } + if value, ok := _u.mutation.Category(); ok { + _spec.SetField(api.FieldCategory, field.TypeString, value) + } + if _u.mutation.CategoryCleared() { + _spec.ClearField(api.FieldCategory, field.TypeString) + } + if value, ok := _u.mutation.Oauth2Scopes(); ok { + _spec.SetField(api.FieldOauth2Scopes, field.TypeJSON, value) + } + if value, ok := _u.mutation.AppendedOauth2Scopes(); ok { + _spec.AddModifier(func(u *sql.UpdateBuilder) { + sqljson.Append(u, api.FieldOauth2Scopes, value) + }) + } + if _u.mutation.Oauth2ScopesCleared() { + _spec.ClearField(api.FieldOauth2Scopes, field.TypeJSON) + } + if value, ok := _u.mutation.XVendor(); ok { + _spec.SetField(api.FieldXVendor, field.TypeBool, value) + } + if value, ok := _u.mutation.Specification(); ok { + _spec.SetField(api.FieldSpecification, field.TypeString, value) + } + if _u.mutation.SpecificationCleared() { + _spec.ClearField(api.FieldSpecification, field.TypeString) + } + if value, ok := _u.mutation.Active(); ok { + _spec.SetField(api.FieldActive, field.TypeBool, value) + } + if _u.mutation.OwnerCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: api.OwnerTable, + Columns: []string{api.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(team.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: api.OwnerTable, + Columns: []string{api.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(team.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.ExposuresCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: api.ExposuresTable, + Columns: []string{api.ExposuresColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(apiexposure.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedExposuresIDs(); len(nodes) > 0 && !_u.mutation.ExposuresCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: api.ExposuresTable, + Columns: []string{api.ExposuresColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(apiexposure.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.ExposuresIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: api.ExposuresTable, + Columns: []string{api.ExposuresColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(apiexposure.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + _node = &Api{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{api.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/apiexposure.go b/controlplane-api/ent/apiexposure.go index d191597a4..f43031192 100644 --- a/controlplane-api/ent/apiexposure.go +++ b/controlplane-api/ent/apiexposure.go @@ -13,6 +13,7 @@ import ( "entgo.io/ent" "entgo.io/ent/dialect/sql" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/application" "github.com/telekom/controlplane/controlplane-api/pkg/model" @@ -52,6 +53,7 @@ type ApiExposure struct { // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ApiExposureQuery when eager-loading is set. Edges ApiExposureEdges `json:"edges"` + api_exposures *int application_exposed_apis *int selectValues sql.SelectValues } @@ -60,13 +62,15 @@ type ApiExposure struct { type ApiExposureEdges struct { // Owner holds the value of the owner edge. Owner *Application `json:"owner,omitempty"` + // API holds the value of the api edge. + API *Api `json:"api,omitempty"` // Subscriptions holds the value of the subscriptions edge. Subscriptions []*ApiSubscription `json:"subscriptions,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [2]bool + loadedTypes [3]bool // totalCount holds the count of the edges above. - totalCount [1]map[string]int + totalCount [2]map[string]int namedSubscriptions map[string][]*ApiSubscription } @@ -82,10 +86,21 @@ func (e ApiExposureEdges) OwnerOrErr() (*Application, error) { return nil, &NotLoadedError{edge: "owner"} } +// APIOrErr returns the API value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e ApiExposureEdges) APIOrErr() (*Api, error) { + if e.API != nil { + return e.API, nil + } else if e.loadedTypes[1] { + return nil, &NotFoundError{label: api.Label} + } + return nil, &NotLoadedError{edge: "api"} +} + // SubscriptionsOrErr returns the Subscriptions value or an error if the edge // was not loaded in eager-loading. func (e ApiExposureEdges) SubscriptionsOrErr() ([]*ApiSubscription, error) { - if e.loadedTypes[1] { + if e.loadedTypes[2] { return e.Subscriptions, nil } return nil, &NotLoadedError{edge: "subscriptions"} @@ -106,7 +121,9 @@ func (*ApiExposure) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullString) case apiexposure.FieldCreatedAt, apiexposure.FieldLastModifiedAt: values[i] = new(sql.NullTime) - case apiexposure.ForeignKeys[0]: // application_exposed_apis + case apiexposure.ForeignKeys[0]: // api_exposures + values[i] = new(sql.NullInt64) + case apiexposure.ForeignKeys[1]: // application_exposed_apis values[i] = new(sql.NullInt64) default: values[i] = new(sql.UnknownType) @@ -219,6 +236,13 @@ func (_m *ApiExposure) assignValues(columns []string, values []any) error { *_m.APIVersion = value.String } case apiexposure.ForeignKeys[0]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field api_exposures", value) + } else if value.Valid { + _m.api_exposures = new(int) + *_m.api_exposures = int(value.Int64) + } + case apiexposure.ForeignKeys[1]: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for edge-field application_exposed_apis", value) } else if value.Valid { @@ -243,6 +267,11 @@ func (_m *ApiExposure) QueryOwner() *ApplicationQuery { return NewApiExposureClient(_m.config).QueryOwner(_m) } +// QueryAPI queries the "api" edge of the ApiExposure entity. +func (_m *ApiExposure) QueryAPI() *APIQuery { + return NewApiExposureClient(_m.config).QueryAPI(_m) +} + // QuerySubscriptions queries the "subscriptions" edge of the ApiExposure entity. func (_m *ApiExposure) QuerySubscriptions() *ApiSubscriptionQuery { return NewApiExposureClient(_m.config).QuerySubscriptions(_m) diff --git a/controlplane-api/ent/apiexposure/apiexposure.go b/controlplane-api/ent/apiexposure/apiexposure.go index 90f94b4f1..5efde67a4 100644 --- a/controlplane-api/ent/apiexposure/apiexposure.go +++ b/controlplane-api/ent/apiexposure/apiexposure.go @@ -50,6 +50,8 @@ const ( FieldAPIVersion = "api_version" // EdgeOwner holds the string denoting the owner edge name in mutations. EdgeOwner = "owner" + // EdgeAPI holds the string denoting the api edge name in mutations. + EdgeAPI = "api" // EdgeSubscriptions holds the string denoting the subscriptions edge name in mutations. EdgeSubscriptions = "subscriptions" // Table holds the table name of the apiexposure in the database. @@ -61,6 +63,13 @@ const ( OwnerInverseTable = "applications" // OwnerColumn is the table column denoting the owner relation/edge. OwnerColumn = "application_exposed_apis" + // APITable is the table that holds the api relation/edge. + APITable = "api_exposures" + // APIInverseTable is the table name for the Api entity. + // It exists in this package in order to avoid circular dependency with the "api" package. + APIInverseTable = "apis" + // APIColumn is the table column denoting the api relation/edge. + APIColumn = "api_exposures" // SubscriptionsTable is the table that holds the subscriptions relation/edge. SubscriptionsTable = "api_subscriptions" // SubscriptionsInverseTable is the table name for the ApiSubscription entity. @@ -91,6 +100,7 @@ var Columns = []string{ // ForeignKeys holds the SQL foreign-keys that are owned by the "api_exposures" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ + "api_exposures", "application_exposed_apis", } @@ -254,6 +264,13 @@ func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption { } } +// ByAPIField orders the results by api field. +func ByAPIField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newAPIStep(), sql.OrderByField(field, opts...)) + } +} + // BySubscriptionsCount orders the results by subscriptions count. func BySubscriptionsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { @@ -274,6 +291,13 @@ func newOwnerStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn), ) } +func newAPIStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(APIInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, APITable, APIColumn), + ) +} func newSubscriptionsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), diff --git a/controlplane-api/ent/apiexposure/where.go b/controlplane-api/ent/apiexposure/where.go index cf8f968bd..d1d1cc8ff 100644 --- a/controlplane-api/ent/apiexposure/where.go +++ b/controlplane-api/ent/apiexposure/where.go @@ -626,6 +626,29 @@ func HasOwnerWith(preds ...predicate.Application) predicate.ApiExposure { }) } +// HasAPI applies the HasEdge predicate on the "api" edge. +func HasAPI() predicate.ApiExposure { + return predicate.ApiExposure(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, APITable, APIColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasAPIWith applies the HasEdge predicate on the "api" edge with a given conditions (other predicates). +func HasAPIWith(preds ...predicate.Api) predicate.ApiExposure { + return predicate.ApiExposure(func(s *sql.Selector) { + step := newAPIStep() + 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.ApiExposure { return predicate.ApiExposure(func(s *sql.Selector) { diff --git a/controlplane-api/ent/apiexposure_create.go b/controlplane-api/ent/apiexposure_create.go index 2c4408eb7..c15aeb683 100644 --- a/controlplane-api/ent/apiexposure_create.go +++ b/controlplane-api/ent/apiexposure_create.go @@ -14,6 +14,7 @@ import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -189,6 +190,25 @@ func (_c *ApiExposureCreate) SetOwner(v *Application) *ApiExposureCreate { return _c.SetOwnerID(v.ID) } +// SetAPIID sets the "api" edge to the Api entity by ID. +func (_c *ApiExposureCreate) SetAPIID(id int) *ApiExposureCreate { + _c.mutation.SetAPIID(id) + return _c +} + +// SetNillableAPIID sets the "api" edge to the Api entity by ID if the given value is not nil. +func (_c *ApiExposureCreate) SetNillableAPIID(id *int) *ApiExposureCreate { + if id != nil { + _c = _c.SetAPIID(*id) + } + return _c +} + +// SetAPI sets the "api" edge to the Api entity. +func (_c *ApiExposureCreate) SetAPI(v *Api) *ApiExposureCreate { + return _c.SetAPIID(v.ID) +} + // AddSubscriptionIDs adds the "subscriptions" edge to the ApiSubscription entity by IDs. func (_c *ApiExposureCreate) AddSubscriptionIDs(ids ...int) *ApiExposureCreate { _c.mutation.AddSubscriptionIDs(ids...) @@ -423,6 +443,23 @@ func (_c *ApiExposureCreate) createSpec() (*ApiExposure, *sqlgraph.CreateSpec) { _node.application_exposed_apis = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } + if nodes := _c.mutation.APIIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: apiexposure.APITable, + Columns: []string{apiexposure.APIColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.api_exposures = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } if nodes := _c.mutation.SubscriptionsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, diff --git a/controlplane-api/ent/apiexposure_query.go b/controlplane-api/ent/apiexposure_query.go index f8380264d..e947038f5 100644 --- a/controlplane-api/ent/apiexposure_query.go +++ b/controlplane-api/ent/apiexposure_query.go @@ -16,6 +16,7 @@ import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -30,6 +31,7 @@ type ApiExposureQuery struct { inters []Interceptor predicates []predicate.ApiExposure withOwner *ApplicationQuery + withAPI *APIQuery withSubscriptions *ApiSubscriptionQuery withFKs bool modifiers []func(*sql.Selector) @@ -93,6 +95,28 @@ func (_q *ApiExposureQuery) QueryOwner() *ApplicationQuery { return query } +// QueryAPI chains the current query on the "api" edge. +func (_q *ApiExposureQuery) QueryAPI() *APIQuery { + query := (&APIClient{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(apiexposure.Table, apiexposure.FieldID, selector), + sqlgraph.To(api.Table, api.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, apiexposure.APITable, apiexposure.APIColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + // QuerySubscriptions chains the current query on the "subscriptions" edge. func (_q *ApiExposureQuery) QuerySubscriptions() *ApiSubscriptionQuery { query := (&ApiSubscriptionClient{config: _q.config}).Query() @@ -308,6 +332,7 @@ func (_q *ApiExposureQuery) Clone() *ApiExposureQuery { inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.ApiExposure{}, _q.predicates...), withOwner: _q.withOwner.Clone(), + withAPI: _q.withAPI.Clone(), withSubscriptions: _q.withSubscriptions.Clone(), // clone intermediate query. sql: _q.sql.Clone(), @@ -326,6 +351,17 @@ func (_q *ApiExposureQuery) WithOwner(opts ...func(*ApplicationQuery)) *ApiExpos return _q } +// WithAPI tells the query-builder to eager-load the nodes that are connected to +// the "api" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *ApiExposureQuery) WithAPI(opts ...func(*APIQuery)) *ApiExposureQuery { + query := (&APIClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withAPI = 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 *ApiExposureQuery) WithSubscriptions(opts ...func(*ApiSubscriptionQuery)) *ApiExposureQuery { @@ -422,12 +458,13 @@ func (_q *ApiExposureQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]* nodes = []*ApiExposure{} withFKs = _q.withFKs _spec = _q.querySpec() - loadedTypes = [2]bool{ + loadedTypes = [3]bool{ _q.withOwner != nil, + _q.withAPI != nil, _q.withSubscriptions != nil, } ) - if _q.withOwner != nil { + if _q.withOwner != nil || _q.withAPI != nil { withFKs = true } if withFKs { @@ -460,6 +497,12 @@ func (_q *ApiExposureQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]* return nil, err } } + if query := _q.withAPI; query != nil { + if err := _q.loadAPI(ctx, query, nodes, nil, + func(n *ApiExposure, e *Api) { n.Edges.API = e }); err != nil { + return nil, err + } + } if query := _q.withSubscriptions; query != nil { if err := _q.loadSubscriptions(ctx, query, nodes, func(n *ApiExposure) { n.Edges.Subscriptions = []*ApiSubscription{} }, @@ -514,6 +557,38 @@ func (_q *ApiExposureQuery) loadOwner(ctx context.Context, query *ApplicationQue } return nil } +func (_q *ApiExposureQuery) loadAPI(ctx context.Context, query *APIQuery, nodes []*ApiExposure, init func(*ApiExposure), assign func(*ApiExposure, *Api)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*ApiExposure) + for i := range nodes { + if nodes[i].api_exposures == nil { + continue + } + fk := *nodes[i].api_exposures + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(api.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 "api_exposures" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} func (_q *ApiExposureQuery) loadSubscriptions(ctx context.Context, query *ApiSubscriptionQuery, nodes []*ApiExposure, init func(*ApiExposure), assign func(*ApiExposure, *ApiSubscription)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[int]*ApiExposure) diff --git a/controlplane-api/ent/apiexposure_update.go b/controlplane-api/ent/apiexposure_update.go index 3977b7d5b..5f6b64fc9 100644 --- a/controlplane-api/ent/apiexposure_update.go +++ b/controlplane-api/ent/apiexposure_update.go @@ -15,6 +15,7 @@ import ( "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/dialect/sql/sqljson" "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -232,6 +233,25 @@ func (_u *ApiExposureUpdate) SetOwner(v *Application) *ApiExposureUpdate { return _u.SetOwnerID(v.ID) } +// SetAPIID sets the "api" edge to the Api entity by ID. +func (_u *ApiExposureUpdate) SetAPIID(id int) *ApiExposureUpdate { + _u.mutation.SetAPIID(id) + return _u +} + +// SetNillableAPIID sets the "api" edge to the Api entity by ID if the given value is not nil. +func (_u *ApiExposureUpdate) SetNillableAPIID(id *int) *ApiExposureUpdate { + if id != nil { + _u = _u.SetAPIID(*id) + } + return _u +} + +// SetAPI sets the "api" edge to the Api entity. +func (_u *ApiExposureUpdate) SetAPI(v *Api) *ApiExposureUpdate { + return _u.SetAPIID(v.ID) +} + // AddSubscriptionIDs adds the "subscriptions" edge to the ApiSubscription entity by IDs. func (_u *ApiExposureUpdate) AddSubscriptionIDs(ids ...int) *ApiExposureUpdate { _u.mutation.AddSubscriptionIDs(ids...) @@ -258,6 +278,12 @@ func (_u *ApiExposureUpdate) ClearOwner() *ApiExposureUpdate { return _u } +// ClearAPI clears the "api" edge to the Api entity. +func (_u *ApiExposureUpdate) ClearAPI() *ApiExposureUpdate { + _u.mutation.ClearAPI() + return _u +} + // ClearSubscriptions clears all "subscriptions" edges to the ApiSubscription entity. func (_u *ApiExposureUpdate) ClearSubscriptions() *ApiExposureUpdate { _u.mutation.ClearSubscriptions() @@ -451,6 +477,35 @@ func (_u *ApiExposureUpdate) sqlSave(ctx context.Context) (_node int, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.APICleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: apiexposure.APITable, + Columns: []string{apiexposure.APIColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.APIIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: apiexposure.APITable, + Columns: []string{apiexposure.APIColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.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, @@ -713,6 +768,25 @@ func (_u *ApiExposureUpdateOne) SetOwner(v *Application) *ApiExposureUpdateOne { return _u.SetOwnerID(v.ID) } +// SetAPIID sets the "api" edge to the Api entity by ID. +func (_u *ApiExposureUpdateOne) SetAPIID(id int) *ApiExposureUpdateOne { + _u.mutation.SetAPIID(id) + return _u +} + +// SetNillableAPIID sets the "api" edge to the Api entity by ID if the given value is not nil. +func (_u *ApiExposureUpdateOne) SetNillableAPIID(id *int) *ApiExposureUpdateOne { + if id != nil { + _u = _u.SetAPIID(*id) + } + return _u +} + +// SetAPI sets the "api" edge to the Api entity. +func (_u *ApiExposureUpdateOne) SetAPI(v *Api) *ApiExposureUpdateOne { + return _u.SetAPIID(v.ID) +} + // AddSubscriptionIDs adds the "subscriptions" edge to the ApiSubscription entity by IDs. func (_u *ApiExposureUpdateOne) AddSubscriptionIDs(ids ...int) *ApiExposureUpdateOne { _u.mutation.AddSubscriptionIDs(ids...) @@ -739,6 +813,12 @@ func (_u *ApiExposureUpdateOne) ClearOwner() *ApiExposureUpdateOne { return _u } +// ClearAPI clears the "api" edge to the Api entity. +func (_u *ApiExposureUpdateOne) ClearAPI() *ApiExposureUpdateOne { + _u.mutation.ClearAPI() + return _u +} + // ClearSubscriptions clears all "subscriptions" edges to the ApiSubscription entity. func (_u *ApiExposureUpdateOne) ClearSubscriptions() *ApiExposureUpdateOne { _u.mutation.ClearSubscriptions() @@ -962,6 +1042,35 @@ func (_u *ApiExposureUpdateOne) sqlSave(ctx context.Context) (_node *ApiExposure } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.APICleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: apiexposure.APITable, + Columns: []string{apiexposure.APIColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.APIIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: apiexposure.APITable, + Columns: []string{apiexposure.APIColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.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, diff --git a/controlplane-api/ent/client.go b/controlplane-api/ent/client.go index d5559cd8b..987b39bc0 100644 --- a/controlplane-api/ent/client.go +++ b/controlplane-api/ent/client.go @@ -18,6 +18,7 @@ import ( "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -25,6 +26,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" @@ -36,6 +38,8 @@ type Client struct { config // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema + // Api is the client for interacting with the Api builders. + Api *APIClient // ApiExposure is the client for interacting with the ApiExposure builders. ApiExposure *ApiExposureClient // ApiSubscription is the client for interacting with the ApiSubscription builders. @@ -50,6 +54,8 @@ type Client struct { EventExposure *EventExposureClient // EventSubscription is the client for interacting with the EventSubscription builders. EventSubscription *EventSubscriptionClient + // EventType is the client for interacting with the EventType builders. + EventType *EventTypeClient // Group is the client for interacting with the Group builders. Group *GroupClient // Member is the client for interacting with the Member builders. @@ -71,6 +77,7 @@ func NewClient(opts ...Option) *Client { func (c *Client) init() { c.Schema = migrate.NewSchema(c.driver) + c.Api = NewAPIClient(c.config) c.ApiExposure = NewApiExposureClient(c.config) c.ApiSubscription = NewApiSubscriptionClient(c.config) c.Application = NewApplicationClient(c.config) @@ -78,6 +85,7 @@ func (c *Client) init() { c.ApprovalRequest = NewApprovalRequestClient(c.config) c.EventExposure = NewEventExposureClient(c.config) c.EventSubscription = NewEventSubscriptionClient(c.config) + c.EventType = NewEventTypeClient(c.config) c.Group = NewGroupClient(c.config) c.Member = NewMemberClient(c.config) c.Team = NewTeamClient(c.config) @@ -174,6 +182,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { return &Tx{ ctx: ctx, config: cfg, + Api: NewAPIClient(cfg), ApiExposure: NewApiExposureClient(cfg), ApiSubscription: NewApiSubscriptionClient(cfg), Application: NewApplicationClient(cfg), @@ -181,6 +190,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { ApprovalRequest: NewApprovalRequestClient(cfg), EventExposure: NewEventExposureClient(cfg), EventSubscription: NewEventSubscriptionClient(cfg), + EventType: NewEventTypeClient(cfg), Group: NewGroupClient(cfg), Member: NewMemberClient(cfg), Team: NewTeamClient(cfg), @@ -204,6 +214,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) return &Tx{ ctx: ctx, config: cfg, + Api: NewAPIClient(cfg), ApiExposure: NewApiExposureClient(cfg), ApiSubscription: NewApiSubscriptionClient(cfg), Application: NewApplicationClient(cfg), @@ -211,6 +222,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) ApprovalRequest: NewApprovalRequestClient(cfg), EventExposure: NewEventExposureClient(cfg), EventSubscription: NewEventSubscriptionClient(cfg), + EventType: NewEventTypeClient(cfg), Group: NewGroupClient(cfg), Member: NewMemberClient(cfg), Team: NewTeamClient(cfg), @@ -221,7 +233,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) // Debug returns a new debug-client. It's used to get verbose logging on specific operations. // // client.Debug(). -// ApiExposure. +// Api. // Query(). // Count(ctx) func (c *Client) Debug() *Client { @@ -244,8 +256,9 @@ func (c *Client) Close() error { // In order to add hooks to a specific client, call: `client.Node.Use(...)`. func (c *Client) Use(hooks ...Hook) { for _, n := range []interface{ Use(...Hook) }{ - c.ApiExposure, c.ApiSubscription, c.Application, c.Approval, c.ApprovalRequest, - c.EventExposure, c.EventSubscription, c.Group, c.Member, c.Team, c.Zone, + c.Api, c.ApiExposure, c.ApiSubscription, c.Application, c.Approval, + c.ApprovalRequest, c.EventExposure, c.EventSubscription, c.EventType, c.Group, + c.Member, c.Team, c.Zone, } { n.Use(hooks...) } @@ -255,8 +268,9 @@ func (c *Client) Use(hooks ...Hook) { // In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`. func (c *Client) Intercept(interceptors ...Interceptor) { for _, n := range []interface{ Intercept(...Interceptor) }{ - c.ApiExposure, c.ApiSubscription, c.Application, c.Approval, c.ApprovalRequest, - c.EventExposure, c.EventSubscription, c.Group, c.Member, c.Team, c.Zone, + c.Api, c.ApiExposure, c.ApiSubscription, c.Application, c.Approval, + c.ApprovalRequest, c.EventExposure, c.EventSubscription, c.EventType, c.Group, + c.Member, c.Team, c.Zone, } { n.Intercept(interceptors...) } @@ -265,6 +279,8 @@ func (c *Client) Intercept(interceptors ...Interceptor) { // Mutate implements the ent.Mutator interface. func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { switch m := m.(type) { + case *APIMutation: + return c.Api.mutate(ctx, m) case *ApiExposureMutation: return c.ApiExposure.mutate(ctx, m) case *ApiSubscriptionMutation: @@ -279,6 +295,8 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { return c.EventExposure.mutate(ctx, m) case *EventSubscriptionMutation: return c.EventSubscription.mutate(ctx, m) + case *EventTypeMutation: + return c.EventType.mutate(ctx, m) case *GroupMutation: return c.Group.mutate(ctx, m) case *MemberMutation: @@ -292,6 +310,172 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { } } +// APIClient is a client for the Api schema. +type APIClient struct { + config +} + +// NewAPIClient returns a client for the Api from the given config. +func NewAPIClient(c config) *APIClient { + return &APIClient{config: c} +} + +// Use adds a list of mutation hooks to the hooks stack. +// A call to `Use(f, g, h)` equals to `api.Hooks(f(g(h())))`. +func (c *APIClient) Use(hooks ...Hook) { + c.hooks.Api = append(c.hooks.Api, hooks...) +} + +// Intercept adds a list of query interceptors to the interceptors stack. +// A call to `Intercept(f, g, h)` equals to `api.Intercept(f(g(h())))`. +func (c *APIClient) Intercept(interceptors ...Interceptor) { + c.inters.Api = append(c.inters.Api, interceptors...) +} + +// Create returns a builder for creating a Api entity. +func (c *APIClient) Create() *APICreate { + mutation := newAPIMutation(c.config, OpCreate) + return &APICreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// CreateBulk returns a builder for creating a bulk of Api entities. +func (c *APIClient) CreateBulk(builders ...*APICreate) *APICreateBulk { + return &APICreateBulk{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 *APIClient) MapCreateBulk(slice any, setFunc func(*APICreate, int)) *APICreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &APICreateBulk{err: fmt.Errorf("calling to APIClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*APICreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &APICreateBulk{config: c.config, builders: builders} +} + +// Update returns an update builder for Api. +func (c *APIClient) Update() *APIUpdate { + mutation := newAPIMutation(c.config, OpUpdate) + return &APIUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOne returns an update builder for the given entity. +func (c *APIClient) UpdateOne(_m *Api) *APIUpdateOne { + mutation := newAPIMutation(c.config, OpUpdateOne, withApi(_m)) + return &APIUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOneID returns an update builder for the given id. +func (c *APIClient) UpdateOneID(id int) *APIUpdateOne { + mutation := newAPIMutation(c.config, OpUpdateOne, withApiID(id)) + return &APIUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// Delete returns a delete builder for Api. +func (c *APIClient) Delete() *APIDelete { + mutation := newAPIMutation(c.config, OpDelete) + return &APIDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// DeleteOne returns a builder for deleting the given entity. +func (c *APIClient) DeleteOne(_m *Api) *APIDeleteOne { + return c.DeleteOneID(_m.ID) +} + +// DeleteOneID returns a builder for deleting the given entity by its id. +func (c *APIClient) DeleteOneID(id int) *APIDeleteOne { + builder := c.Delete().Where(api.ID(id)) + builder.mutation.id = &id + builder.mutation.op = OpDeleteOne + return &APIDeleteOne{builder} +} + +// Query returns a query builder for Api. +func (c *APIClient) Query() *APIQuery { + return &APIQuery{ + config: c.config, + ctx: &QueryContext{Type: TypeAPI}, + inters: c.Interceptors(), + } +} + +// Get returns a Api entity by its id. +func (c *APIClient) Get(ctx context.Context, id int) (*Api, error) { + return c.Query().Where(api.ID(id)).Only(ctx) +} + +// GetX is like Get, but panics if an error occurs. +func (c *APIClient) GetX(ctx context.Context, id int) *Api { + obj, err := c.Get(ctx, id) + if err != nil { + panic(err) + } + return obj +} + +// QueryOwner queries the owner edge of a Api. +func (c *APIClient) QueryOwner(_m *Api) *TeamQuery { + query := (&TeamClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(api.Table, api.FieldID, id), + sqlgraph.To(team.Table, team.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, api.OwnerTable, api.OwnerColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryExposures queries the exposures edge of a Api. +func (c *APIClient) QueryExposures(_m *Api) *ApiExposureQuery { + query := (&ApiExposureClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(api.Table, api.FieldID, id), + sqlgraph.To(apiexposure.Table, apiexposure.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, api.ExposuresTable, api.ExposuresColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// Hooks returns the client hooks. +func (c *APIClient) Hooks() []Hook { + hooks := c.hooks.Api + return append(hooks[:len(hooks):len(hooks)], api.Hooks[:]...) +} + +// Interceptors returns the client interceptors. +func (c *APIClient) Interceptors() []Interceptor { + return c.inters.Api +} + +func (c *APIClient) mutate(ctx context.Context, m *APIMutation) (Value, error) { + switch m.Op() { + case OpCreate: + return (&APICreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdate: + return (&APIUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdateOne: + return (&APIUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpDelete, OpDeleteOne: + return (&APIDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) + default: + return nil, fmt.Errorf("ent: unknown Api mutation op: %q", m.Op()) + } +} + // ApiExposureClient is a client for the ApiExposure schema. type ApiExposureClient struct { config @@ -416,6 +600,22 @@ func (c *ApiExposureClient) QueryOwner(_m *ApiExposure) *ApplicationQuery { return query } +// QueryAPI queries the api edge of a ApiExposure. +func (c *ApiExposureClient) QueryAPI(_m *ApiExposure) *APIQuery { + query := (&APIClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(apiexposure.Table, apiexposure.FieldID, id), + sqlgraph.To(api.Table, api.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, apiexposure.APITable, apiexposure.APIColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + // QuerySubscriptions queries the subscriptions edge of a ApiExposure. func (c *ApiExposureClient) QuerySubscriptions(_m *ApiExposure) *ApiSubscriptionQuery { query := (&ApiSubscriptionClient{config: c.config}).Query() @@ -1358,6 +1558,22 @@ func (c *EventExposureClient) QueryOwner(_m *EventExposure) *ApplicationQuery { return query } +// QueryEventTypeDef queries the event_type_def edge of a EventExposure. +func (c *EventExposureClient) QueryEventTypeDef(_m *EventExposure) *EventTypeQuery { + query := (&EventTypeClient{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(eventtype.Table, eventtype.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, eventexposure.EventTypeDefTable, eventexposure.EventTypeDefColumn), + ) + 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() @@ -1598,6 +1814,172 @@ func (c *EventSubscriptionClient) mutate(ctx context.Context, m *EventSubscripti } } +// EventTypeClient is a client for the EventType schema. +type EventTypeClient struct { + config +} + +// NewEventTypeClient returns a client for the EventType from the given config. +func NewEventTypeClient(c config) *EventTypeClient { + return &EventTypeClient{config: c} +} + +// Use adds a list of mutation hooks to the hooks stack. +// A call to `Use(f, g, h)` equals to `eventtype.Hooks(f(g(h())))`. +func (c *EventTypeClient) Use(hooks ...Hook) { + c.hooks.EventType = append(c.hooks.EventType, hooks...) +} + +// Intercept adds a list of query interceptors to the interceptors stack. +// A call to `Intercept(f, g, h)` equals to `eventtype.Intercept(f(g(h())))`. +func (c *EventTypeClient) Intercept(interceptors ...Interceptor) { + c.inters.EventType = append(c.inters.EventType, interceptors...) +} + +// Create returns a builder for creating a EventType entity. +func (c *EventTypeClient) Create() *EventTypeCreate { + mutation := newEventTypeMutation(c.config, OpCreate) + return &EventTypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// CreateBulk returns a builder for creating a bulk of EventType entities. +func (c *EventTypeClient) CreateBulk(builders ...*EventTypeCreate) *EventTypeCreateBulk { + return &EventTypeCreateBulk{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 *EventTypeClient) MapCreateBulk(slice any, setFunc func(*EventTypeCreate, int)) *EventTypeCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &EventTypeCreateBulk{err: fmt.Errorf("calling to EventTypeClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*EventTypeCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &EventTypeCreateBulk{config: c.config, builders: builders} +} + +// Update returns an update builder for EventType. +func (c *EventTypeClient) Update() *EventTypeUpdate { + mutation := newEventTypeMutation(c.config, OpUpdate) + return &EventTypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOne returns an update builder for the given entity. +func (c *EventTypeClient) UpdateOne(_m *EventType) *EventTypeUpdateOne { + mutation := newEventTypeMutation(c.config, OpUpdateOne, withEventType(_m)) + return &EventTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOneID returns an update builder for the given id. +func (c *EventTypeClient) UpdateOneID(id int) *EventTypeUpdateOne { + mutation := newEventTypeMutation(c.config, OpUpdateOne, withEventTypeID(id)) + return &EventTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// Delete returns a delete builder for EventType. +func (c *EventTypeClient) Delete() *EventTypeDelete { + mutation := newEventTypeMutation(c.config, OpDelete) + return &EventTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// DeleteOne returns a builder for deleting the given entity. +func (c *EventTypeClient) DeleteOne(_m *EventType) *EventTypeDeleteOne { + return c.DeleteOneID(_m.ID) +} + +// DeleteOneID returns a builder for deleting the given entity by its id. +func (c *EventTypeClient) DeleteOneID(id int) *EventTypeDeleteOne { + builder := c.Delete().Where(eventtype.ID(id)) + builder.mutation.id = &id + builder.mutation.op = OpDeleteOne + return &EventTypeDeleteOne{builder} +} + +// Query returns a query builder for EventType. +func (c *EventTypeClient) Query() *EventTypeQuery { + return &EventTypeQuery{ + config: c.config, + ctx: &QueryContext{Type: TypeEventType}, + inters: c.Interceptors(), + } +} + +// Get returns a EventType entity by its id. +func (c *EventTypeClient) Get(ctx context.Context, id int) (*EventType, error) { + return c.Query().Where(eventtype.ID(id)).Only(ctx) +} + +// GetX is like Get, but panics if an error occurs. +func (c *EventTypeClient) GetX(ctx context.Context, id int) *EventType { + obj, err := c.Get(ctx, id) + if err != nil { + panic(err) + } + return obj +} + +// QueryOwner queries the owner edge of a EventType. +func (c *EventTypeClient) QueryOwner(_m *EventType) *TeamQuery { + query := (&TeamClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(eventtype.Table, eventtype.FieldID, id), + sqlgraph.To(team.Table, team.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, eventtype.OwnerTable, eventtype.OwnerColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryExposures queries the exposures edge of a EventType. +func (c *EventTypeClient) QueryExposures(_m *EventType) *EventExposureQuery { + query := (&EventExposureClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(eventtype.Table, eventtype.FieldID, id), + sqlgraph.To(eventexposure.Table, eventexposure.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, eventtype.ExposuresTable, eventtype.ExposuresColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// Hooks returns the client hooks. +func (c *EventTypeClient) Hooks() []Hook { + hooks := c.hooks.EventType + return append(hooks[:len(hooks):len(hooks)], eventtype.Hooks[:]...) +} + +// Interceptors returns the client interceptors. +func (c *EventTypeClient) Interceptors() []Interceptor { + return c.inters.EventType +} + +func (c *EventTypeClient) mutate(ctx context.Context, m *EventTypeMutation) (Value, error) { + switch m.Op() { + case OpCreate: + return (&EventTypeCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdate: + return (&EventTypeUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdateOne: + return (&EventTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpDelete, OpDeleteOne: + return (&EventTypeDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) + default: + return nil, fmt.Errorf("ent: unknown EventType mutation op: %q", m.Op()) + } +} + // GroupClient is a client for the Group schema. type GroupClient struct { config @@ -2054,6 +2436,38 @@ func (c *TeamClient) QueryApplications(_m *Team) *ApplicationQuery { return query } +// QueryApis queries the apis edge of a Team. +func (c *TeamClient) QueryApis(_m *Team) *APIQuery { + query := (&APIClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(team.Table, team.FieldID, id), + sqlgraph.To(api.Table, api.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, team.ApisTable, team.ApisColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryEventTypes queries the event_types edge of a Team. +func (c *TeamClient) QueryEventTypes(_m *Team) *EventTypeQuery { + query := (&EventTypeClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := _m.ID + step := sqlgraph.NewStep( + sqlgraph.From(team.Table, team.FieldID, id), + sqlgraph.To(eventtype.Table, eventtype.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, team.EventTypesTable, team.EventTypesColumn), + ) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *TeamClient) Hooks() []Hook { hooks := c.hooks.Team @@ -2233,11 +2647,13 @@ 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, - EventExposure, EventSubscription, Group, Member, Team, Zone []ent.Hook + Api, ApiExposure, ApiSubscription, Application, Approval, ApprovalRequest, + EventExposure, EventSubscription, EventType, Group, Member, Team, + Zone []ent.Hook } inters struct { - ApiExposure, ApiSubscription, Application, Approval, ApprovalRequest, - EventExposure, EventSubscription, Group, Member, Team, Zone []ent.Interceptor + Api, ApiExposure, ApiSubscription, Application, Approval, ApprovalRequest, + EventExposure, EventSubscription, EventType, Group, Member, Team, + Zone []ent.Interceptor } ) diff --git a/controlplane-api/ent/ent.go b/controlplane-api/ent/ent.go index 9253fdc6a..f5f4dfb6a 100644 --- a/controlplane-api/ent/ent.go +++ b/controlplane-api/ent/ent.go @@ -15,6 +15,7 @@ import ( "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -22,6 +23,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" @@ -86,6 +88,7 @@ var ( func checkColumn(t, c string) error { initCheck.Do(func() { columnCheck = sql.NewColumnCheck(map[string]func(string) bool{ + api.Table: api.ValidColumn, apiexposure.Table: apiexposure.ValidColumn, apisubscription.Table: apisubscription.ValidColumn, application.Table: application.ValidColumn, @@ -93,6 +96,7 @@ func checkColumn(t, c string) error { approvalrequest.Table: approvalrequest.ValidColumn, eventexposure.Table: eventexposure.ValidColumn, eventsubscription.Table: eventsubscription.ValidColumn, + eventtype.Table: eventtype.ValidColumn, group.Table: group.ValidColumn, member.Table: member.ValidColumn, team.Table: team.ValidColumn, diff --git a/controlplane-api/ent/eventexposure.go b/controlplane-api/ent/eventexposure.go index f59435632..314dffa78 100644 --- a/controlplane-api/ent/eventexposure.go +++ b/controlplane-api/ent/eventexposure.go @@ -15,6 +15,7 @@ import ( "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/ent/eventtype" "github.com/telekom/controlplane/controlplane-api/pkg/model" ) @@ -47,6 +48,7 @@ type EventExposure struct { // The values are being populated by the EventExposureQuery when eager-loading is set. Edges EventExposureEdges `json:"edges"` application_exposed_events *int + event_type_exposures *int selectValues sql.SelectValues } @@ -54,13 +56,15 @@ type EventExposure struct { type EventExposureEdges struct { // Owner holds the value of the owner edge. Owner *Application `json:"owner,omitempty"` + // EventTypeDef holds the value of the event_type_def edge. + EventTypeDef *EventType `json:"event_type_def,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 + loadedTypes [3]bool // totalCount holds the count of the edges above. - totalCount [1]map[string]int + totalCount [2]map[string]int namedSubscriptions map[string][]*EventSubscription } @@ -76,10 +80,21 @@ func (e EventExposureEdges) OwnerOrErr() (*Application, error) { return nil, &NotLoadedError{edge: "owner"} } +// EventTypeDefOrErr returns the EventTypeDef value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e EventExposureEdges) EventTypeDefOrErr() (*EventType, error) { + if e.EventTypeDef != nil { + return e.EventTypeDef, nil + } else if e.loadedTypes[1] { + return nil, &NotFoundError{label: eventtype.Label} + } + return nil, &NotLoadedError{edge: "event_type_def"} +} + // 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] { + if e.loadedTypes[2] { return e.Subscriptions, nil } return nil, &NotLoadedError{edge: "subscriptions"} @@ -102,6 +117,8 @@ func (*EventExposure) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullTime) case eventexposure.ForeignKeys[0]: // application_exposed_events values[i] = new(sql.NullInt64) + case eventexposure.ForeignKeys[1]: // event_type_exposures + values[i] = new(sql.NullInt64) default: values[i] = new(sql.UnknownType) } @@ -196,6 +213,13 @@ func (_m *EventExposure) assignValues(columns []string, values []any) error { _m.application_exposed_events = new(int) *_m.application_exposed_events = int(value.Int64) } + case eventexposure.ForeignKeys[1]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field event_type_exposures", value) + } else if value.Valid { + _m.event_type_exposures = new(int) + *_m.event_type_exposures = int(value.Int64) + } default: _m.selectValues.Set(columns[i], values[i]) } @@ -214,6 +238,11 @@ func (_m *EventExposure) QueryOwner() *ApplicationQuery { return NewEventExposureClient(_m.config).QueryOwner(_m) } +// QueryEventTypeDef queries the "event_type_def" edge of the EventExposure entity. +func (_m *EventExposure) QueryEventTypeDef() *EventTypeQuery { + return NewEventExposureClient(_m.config).QueryEventTypeDef(_m) +} + // QuerySubscriptions queries the "subscriptions" edge of the EventExposure entity. func (_m *EventExposure) QuerySubscriptions() *EventSubscriptionQuery { return NewEventExposureClient(_m.config).QuerySubscriptions(_m) diff --git a/controlplane-api/ent/eventexposure/eventexposure.go b/controlplane-api/ent/eventexposure/eventexposure.go index 70f6d6e73..f82b4da50 100644 --- a/controlplane-api/ent/eventexposure/eventexposure.go +++ b/controlplane-api/ent/eventexposure/eventexposure.go @@ -44,6 +44,8 @@ const ( FieldApprovalConfig = "approval_config" // EdgeOwner holds the string denoting the owner edge name in mutations. EdgeOwner = "owner" + // EdgeEventTypeDef holds the string denoting the event_type_def edge name in mutations. + EdgeEventTypeDef = "event_type_def" // EdgeSubscriptions holds the string denoting the subscriptions edge name in mutations. EdgeSubscriptions = "subscriptions" // Table holds the table name of the eventexposure in the database. @@ -55,6 +57,13 @@ const ( OwnerInverseTable = "applications" // OwnerColumn is the table column denoting the owner relation/edge. OwnerColumn = "application_exposed_events" + // EventTypeDefTable is the table that holds the event_type_def relation/edge. + EventTypeDefTable = "event_exposures" + // EventTypeDefInverseTable is the table name for the EventType entity. + // It exists in this package in order to avoid circular dependency with the "eventtype" package. + EventTypeDefInverseTable = "event_types" + // EventTypeDefColumn is the table column denoting the event_type_def relation/edge. + EventTypeDefColumn = "event_type_exposures" // SubscriptionsTable is the table that holds the subscriptions relation/edge. SubscriptionsTable = "event_subscriptions" // SubscriptionsInverseTable is the table name for the EventSubscription entity. @@ -83,6 +92,7 @@ var Columns = []string{ // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "application_exposed_events", + "event_type_exposures", } // ValidColumn reports if the column name is valid (part of the table columns). @@ -236,6 +246,13 @@ func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption { } } +// ByEventTypeDefField orders the results by event_type_def field. +func ByEventTypeDefField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newEventTypeDefStep(), sql.OrderByField(field, opts...)) + } +} + // BySubscriptionsCount orders the results by subscriptions count. func BySubscriptionsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { @@ -256,6 +273,13 @@ func newOwnerStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn), ) } +func newEventTypeDefStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(EventTypeDefInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, EventTypeDefTable, EventTypeDefColumn), + ) +} func newSubscriptionsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), diff --git a/controlplane-api/ent/eventexposure/where.go b/controlplane-api/ent/eventexposure/where.go index 8d6263ed7..5fb3d0603 100644 --- a/controlplane-api/ent/eventexposure/where.go +++ b/controlplane-api/ent/eventexposure/where.go @@ -546,6 +546,29 @@ func HasOwnerWith(preds ...predicate.Application) predicate.EventExposure { }) } +// HasEventTypeDef applies the HasEdge predicate on the "event_type_def" edge. +func HasEventTypeDef() predicate.EventExposure { + return predicate.EventExposure(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, EventTypeDefTable, EventTypeDefColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasEventTypeDefWith applies the HasEdge predicate on the "event_type_def" edge with a given conditions (other predicates). +func HasEventTypeDefWith(preds ...predicate.EventType) predicate.EventExposure { + return predicate.EventExposure(func(s *sql.Selector) { + step := newEventTypeDefStep() + 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) { diff --git a/controlplane-api/ent/eventexposure_create.go b/controlplane-api/ent/eventexposure_create.go index 0d3315e09..104a6998a 100644 --- a/controlplane-api/ent/eventexposure_create.go +++ b/controlplane-api/ent/eventexposure_create.go @@ -17,6 +17,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/pkg/model" ) @@ -163,6 +164,25 @@ func (_c *EventExposureCreate) SetOwner(v *Application) *EventExposureCreate { return _c.SetOwnerID(v.ID) } +// SetEventTypeDefID sets the "event_type_def" edge to the EventType entity by ID. +func (_c *EventExposureCreate) SetEventTypeDefID(id int) *EventExposureCreate { + _c.mutation.SetEventTypeDefID(id) + return _c +} + +// SetNillableEventTypeDefID sets the "event_type_def" edge to the EventType entity by ID if the given value is not nil. +func (_c *EventExposureCreate) SetNillableEventTypeDefID(id *int) *EventExposureCreate { + if id != nil { + _c = _c.SetEventTypeDefID(*id) + } + return _c +} + +// SetEventTypeDef sets the "event_type_def" edge to the EventType entity. +func (_c *EventExposureCreate) SetEventTypeDef(v *EventType) *EventExposureCreate { + return _c.SetEventTypeDefID(v.ID) +} + // AddSubscriptionIDs adds the "subscriptions" edge to the EventSubscription entity by IDs. func (_c *EventExposureCreate) AddSubscriptionIDs(ids ...int) *EventExposureCreate { _c.mutation.AddSubscriptionIDs(ids...) @@ -371,6 +391,23 @@ func (_c *EventExposureCreate) createSpec() (*EventExposure, *sqlgraph.CreateSpe _node.application_exposed_events = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } + if nodes := _c.mutation.EventTypeDefIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventexposure.EventTypeDefTable, + Columns: []string{eventexposure.EventTypeDefColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.event_type_exposures = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } if nodes := _c.mutation.SubscriptionsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, diff --git a/controlplane-api/ent/eventexposure_query.go b/controlplane-api/ent/eventexposure_query.go index d56094d28..588b76753 100644 --- a/controlplane-api/ent/eventexposure_query.go +++ b/controlplane-api/ent/eventexposure_query.go @@ -19,6 +19,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/predicate" ) @@ -30,6 +31,7 @@ type EventExposureQuery struct { inters []Interceptor predicates []predicate.EventExposure withOwner *ApplicationQuery + withEventTypeDef *EventTypeQuery withSubscriptions *EventSubscriptionQuery withFKs bool modifiers []func(*sql.Selector) @@ -93,6 +95,28 @@ func (_q *EventExposureQuery) QueryOwner() *ApplicationQuery { return query } +// QueryEventTypeDef chains the current query on the "event_type_def" edge. +func (_q *EventExposureQuery) QueryEventTypeDef() *EventTypeQuery { + query := (&EventTypeClient{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(eventtype.Table, eventtype.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, eventexposure.EventTypeDefTable, eventexposure.EventTypeDefColumn), + ) + 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() @@ -308,6 +332,7 @@ func (_q *EventExposureQuery) Clone() *EventExposureQuery { inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.EventExposure{}, _q.predicates...), withOwner: _q.withOwner.Clone(), + withEventTypeDef: _q.withEventTypeDef.Clone(), withSubscriptions: _q.withSubscriptions.Clone(), // clone intermediate query. sql: _q.sql.Clone(), @@ -326,6 +351,17 @@ func (_q *EventExposureQuery) WithOwner(opts ...func(*ApplicationQuery)) *EventE return _q } +// WithEventTypeDef tells the query-builder to eager-load the nodes that are connected to +// the "event_type_def" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *EventExposureQuery) WithEventTypeDef(opts ...func(*EventTypeQuery)) *EventExposureQuery { + query := (&EventTypeClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withEventTypeDef = 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 { @@ -422,12 +458,13 @@ func (_q *EventExposureQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([ nodes = []*EventExposure{} withFKs = _q.withFKs _spec = _q.querySpec() - loadedTypes = [2]bool{ + loadedTypes = [3]bool{ _q.withOwner != nil, + _q.withEventTypeDef != nil, _q.withSubscriptions != nil, } ) - if _q.withOwner != nil { + if _q.withOwner != nil || _q.withEventTypeDef != nil { withFKs = true } if withFKs { @@ -460,6 +497,12 @@ func (_q *EventExposureQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([ return nil, err } } + if query := _q.withEventTypeDef; query != nil { + if err := _q.loadEventTypeDef(ctx, query, nodes, nil, + func(n *EventExposure, e *EventType) { n.Edges.EventTypeDef = 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{} }, @@ -514,6 +557,38 @@ func (_q *EventExposureQuery) loadOwner(ctx context.Context, query *ApplicationQ } return nil } +func (_q *EventExposureQuery) loadEventTypeDef(ctx context.Context, query *EventTypeQuery, nodes []*EventExposure, init func(*EventExposure), assign func(*EventExposure, *EventType)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*EventExposure) + for i := range nodes { + if nodes[i].event_type_exposures == nil { + continue + } + fk := *nodes[i].event_type_exposures + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(eventtype.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_type_exposures" 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) diff --git a/controlplane-api/ent/eventexposure_update.go b/controlplane-api/ent/eventexposure_update.go index 327e270b1..35b60691e 100644 --- a/controlplane-api/ent/eventexposure_update.go +++ b/controlplane-api/ent/eventexposure_update.go @@ -17,6 +17,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/predicate" "github.com/telekom/controlplane/controlplane-api/pkg/model" ) @@ -187,6 +188,25 @@ func (_u *EventExposureUpdate) SetOwner(v *Application) *EventExposureUpdate { return _u.SetOwnerID(v.ID) } +// SetEventTypeDefID sets the "event_type_def" edge to the EventType entity by ID. +func (_u *EventExposureUpdate) SetEventTypeDefID(id int) *EventExposureUpdate { + _u.mutation.SetEventTypeDefID(id) + return _u +} + +// SetNillableEventTypeDefID sets the "event_type_def" edge to the EventType entity by ID if the given value is not nil. +func (_u *EventExposureUpdate) SetNillableEventTypeDefID(id *int) *EventExposureUpdate { + if id != nil { + _u = _u.SetEventTypeDefID(*id) + } + return _u +} + +// SetEventTypeDef sets the "event_type_def" edge to the EventType entity. +func (_u *EventExposureUpdate) SetEventTypeDef(v *EventType) *EventExposureUpdate { + return _u.SetEventTypeDefID(v.ID) +} + // AddSubscriptionIDs adds the "subscriptions" edge to the EventSubscription entity by IDs. func (_u *EventExposureUpdate) AddSubscriptionIDs(ids ...int) *EventExposureUpdate { _u.mutation.AddSubscriptionIDs(ids...) @@ -213,6 +233,12 @@ func (_u *EventExposureUpdate) ClearOwner() *EventExposureUpdate { return _u } +// ClearEventTypeDef clears the "event_type_def" edge to the EventType entity. +func (_u *EventExposureUpdate) ClearEventTypeDef() *EventExposureUpdate { + _u.mutation.ClearEventTypeDef() + return _u +} + // ClearSubscriptions clears all "subscriptions" edges to the EventSubscription entity. func (_u *EventExposureUpdate) ClearSubscriptions() *EventExposureUpdate { _u.mutation.ClearSubscriptions() @@ -384,6 +410,35 @@ func (_u *EventExposureUpdate) sqlSave(ctx context.Context) (_node int, err erro } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.EventTypeDefCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventexposure.EventTypeDefTable, + Columns: []string{eventexposure.EventTypeDefColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.EventTypeDefIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventexposure.EventTypeDefTable, + Columns: []string{eventexposure.EventTypeDefColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.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, @@ -602,6 +657,25 @@ func (_u *EventExposureUpdateOne) SetOwner(v *Application) *EventExposureUpdateO return _u.SetOwnerID(v.ID) } +// SetEventTypeDefID sets the "event_type_def" edge to the EventType entity by ID. +func (_u *EventExposureUpdateOne) SetEventTypeDefID(id int) *EventExposureUpdateOne { + _u.mutation.SetEventTypeDefID(id) + return _u +} + +// SetNillableEventTypeDefID sets the "event_type_def" edge to the EventType entity by ID if the given value is not nil. +func (_u *EventExposureUpdateOne) SetNillableEventTypeDefID(id *int) *EventExposureUpdateOne { + if id != nil { + _u = _u.SetEventTypeDefID(*id) + } + return _u +} + +// SetEventTypeDef sets the "event_type_def" edge to the EventType entity. +func (_u *EventExposureUpdateOne) SetEventTypeDef(v *EventType) *EventExposureUpdateOne { + return _u.SetEventTypeDefID(v.ID) +} + // AddSubscriptionIDs adds the "subscriptions" edge to the EventSubscription entity by IDs. func (_u *EventExposureUpdateOne) AddSubscriptionIDs(ids ...int) *EventExposureUpdateOne { _u.mutation.AddSubscriptionIDs(ids...) @@ -628,6 +702,12 @@ func (_u *EventExposureUpdateOne) ClearOwner() *EventExposureUpdateOne { return _u } +// ClearEventTypeDef clears the "event_type_def" edge to the EventType entity. +func (_u *EventExposureUpdateOne) ClearEventTypeDef() *EventExposureUpdateOne { + _u.mutation.ClearEventTypeDef() + return _u +} + // ClearSubscriptions clears all "subscriptions" edges to the EventSubscription entity. func (_u *EventExposureUpdateOne) ClearSubscriptions() *EventExposureUpdateOne { _u.mutation.ClearSubscriptions() @@ -829,6 +909,35 @@ func (_u *EventExposureUpdateOne) sqlSave(ctx context.Context) (_node *EventExpo } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.EventTypeDefCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventexposure.EventTypeDefTable, + Columns: []string{eventexposure.EventTypeDefColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.EventTypeDefIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventexposure.EventTypeDefTable, + Columns: []string{eventexposure.EventTypeDefColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.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, diff --git a/controlplane-api/ent/eventtype.go b/controlplane-api/ent/eventtype.go new file mode 100644 index 000000000..47ca44ad7 --- /dev/null +++ b/controlplane-api/ent/eventtype.go @@ -0,0 +1,297 @@ +// 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/eventtype" + "github.com/telekom/controlplane/controlplane-api/ent/team" +) + +// EventType is the model entity for the EventType schema. +type EventType 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 *eventtype.StatusPhase `json:"status_phase,omitempty"` + // StatusMessage holds the value of the "status_message" field. + StatusMessage *string `json:"status_message,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"` + // Version holds the value of the "version" field. + Version string `json:"version,omitempty"` + // Description holds the value of the "description" field. + Description string `json:"description,omitempty"` + // Specification holds the value of the "specification" field. + Specification string `json:"specification,omitempty"` + // Active holds the value of the "active" field. + Active bool `json:"active,omitempty"` + // Edges holds the relations/edges for other nodes in the graph. + // The values are being populated by the EventTypeQuery when eager-loading is set. + Edges EventTypeEdges `json:"edges"` + team_event_types *int + selectValues sql.SelectValues +} + +// EventTypeEdges holds the relations/edges for other nodes in the graph. +type EventTypeEdges struct { + // Owner holds the value of the owner edge. + Owner *Team `json:"owner,omitempty"` + // Exposures holds the value of the exposures edge. + Exposures []*EventExposure `json:"exposures,omitempty"` + // loadedTypes holds the information for reporting if a + // type was loaded (or requested) in eager-loading or not. + loadedTypes [2]bool + + namedExposures map[string][]*EventExposure +} + +// 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 EventTypeEdges) OwnerOrErr() (*Team, error) { + if e.Owner != nil { + return e.Owner, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: team.Label} + } + return nil, &NotLoadedError{edge: "owner"} +} + +// ExposuresOrErr returns the Exposures value or an error if the edge +// was not loaded in eager-loading. +func (e EventTypeEdges) ExposuresOrErr() ([]*EventExposure, error) { + if e.loadedTypes[1] { + return e.Exposures, nil + } + return nil, &NotLoadedError{edge: "exposures"} +} + +// scanValues returns the types for scanning values from sql.Rows. +func (*EventType) scanValues(columns []string) ([]any, error) { + values := make([]any, len(columns)) + for i := range columns { + switch columns[i] { + case eventtype.FieldActive: + values[i] = new(sql.NullBool) + case eventtype.FieldID: + values[i] = new(sql.NullInt64) + case eventtype.FieldStatusPhase, eventtype.FieldStatusMessage, eventtype.FieldNamespace, eventtype.FieldEventType, eventtype.FieldVersion, eventtype.FieldDescription, eventtype.FieldSpecification: + values[i] = new(sql.NullString) + case eventtype.FieldCreatedAt, eventtype.FieldLastModifiedAt: + values[i] = new(sql.NullTime) + case eventtype.ForeignKeys[0]: // team_event_types + 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 EventType fields. +func (_m *EventType) 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 eventtype.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 eventtype.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 eventtype.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 eventtype.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(eventtype.StatusPhase) + *_m.StatusPhase = eventtype.StatusPhase(value.String) + } + case eventtype.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 eventtype.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 eventtype.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 eventtype.FieldVersion: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field version", values[i]) + } else if value.Valid { + _m.Version = value.String + } + case eventtype.FieldDescription: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field description", values[i]) + } else if value.Valid { + _m.Description = value.String + } + case eventtype.FieldSpecification: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field specification", values[i]) + } else if value.Valid { + _m.Specification = value.String + } + case eventtype.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 = value.Bool + } + case eventtype.ForeignKeys[0]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field team_event_types", value) + } else if value.Valid { + _m.team_event_types = new(int) + *_m.team_event_types = 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 EventType. +// This includes values selected through modifiers, order, etc. +func (_m *EventType) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) +} + +// QueryOwner queries the "owner" edge of the EventType entity. +func (_m *EventType) QueryOwner() *TeamQuery { + return NewEventTypeClient(_m.config).QueryOwner(_m) +} + +// QueryExposures queries the "exposures" edge of the EventType entity. +func (_m *EventType) QueryExposures() *EventExposureQuery { + return NewEventTypeClient(_m.config).QueryExposures(_m) +} + +// Update returns a builder for updating this EventType. +// Note that you need to call EventType.Unwrap() before calling this method if this EventType +// was returned from a transaction, and the transaction was committed or rolled back. +func (_m *EventType) Update() *EventTypeUpdateOne { + return NewEventTypeClient(_m.config).UpdateOne(_m) +} + +// Unwrap unwraps the EventType 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 *EventType) Unwrap() *EventType { + _tx, ok := _m.config.driver.(*txDriver) + if !ok { + panic("ent: EventType is not a transactional entity") + } + _m.config.driver = _tx.drv + return _m +} + +// String implements the fmt.Stringer. +func (_m *EventType) String() string { + var builder strings.Builder + builder.WriteString("EventType(") + 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(", ") + builder.WriteString("namespace=") + builder.WriteString(_m.Namespace) + builder.WriteString(", ") + builder.WriteString("event_type=") + builder.WriteString(_m.EventType) + builder.WriteString(", ") + builder.WriteString("version=") + builder.WriteString(_m.Version) + builder.WriteString(", ") + builder.WriteString("description=") + builder.WriteString(_m.Description) + builder.WriteString(", ") + builder.WriteString("specification=") + builder.WriteString(_m.Specification) + builder.WriteString(", ") + builder.WriteString("active=") + builder.WriteString(fmt.Sprintf("%v", _m.Active)) + builder.WriteByte(')') + return builder.String() +} + +// NamedExposures returns the Exposures named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *EventType) NamedExposures(name string) ([]*EventExposure, error) { + if _m.Edges.namedExposures == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedExposures[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *EventType) appendNamedExposures(name string, edges ...*EventExposure) { + if _m.Edges.namedExposures == nil { + _m.Edges.namedExposures = make(map[string][]*EventExposure) + } + if len(edges) == 0 { + _m.Edges.namedExposures[name] = []*EventExposure{} + } else { + _m.Edges.namedExposures[name] = append(_m.Edges.namedExposures[name], edges...) + } +} + +// EventTypes is a parsable slice of EventType. +type EventTypes []*EventType diff --git a/controlplane-api/ent/eventtype/eventtype.go b/controlplane-api/ent/eventtype/eventtype.go new file mode 100644 index 000000000..246148221 --- /dev/null +++ b/controlplane-api/ent/eventtype/eventtype.go @@ -0,0 +1,260 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package eventtype + +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 eventtype type in the database. + Label = "event_type" + // 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" + // 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" + // FieldVersion holds the string denoting the version field in the database. + FieldVersion = "version" + // FieldDescription holds the string denoting the description field in the database. + FieldDescription = "description" + // FieldSpecification holds the string denoting the specification field in the database. + FieldSpecification = "specification" + // FieldActive holds the string denoting the active field in the database. + FieldActive = "active" + // EdgeOwner holds the string denoting the owner edge name in mutations. + EdgeOwner = "owner" + // EdgeExposures holds the string denoting the exposures edge name in mutations. + EdgeExposures = "exposures" + // Table holds the table name of the eventtype in the database. + Table = "event_types" + // OwnerTable is the table that holds the owner relation/edge. + OwnerTable = "event_types" + // OwnerInverseTable is the table name for the Team entity. + // It exists in this package in order to avoid circular dependency with the "team" package. + OwnerInverseTable = "teams" + // OwnerColumn is the table column denoting the owner relation/edge. + OwnerColumn = "team_event_types" + // ExposuresTable is the table that holds the exposures relation/edge. + ExposuresTable = "event_exposures" + // ExposuresInverseTable is the table name for the EventExposure entity. + // It exists in this package in order to avoid circular dependency with the "eventexposure" package. + ExposuresInverseTable = "event_exposures" + // ExposuresColumn is the table column denoting the exposures relation/edge. + ExposuresColumn = "event_type_exposures" +) + +// Columns holds all SQL columns for eventtype fields. +var Columns = []string{ + FieldID, + FieldCreatedAt, + FieldLastModifiedAt, + FieldStatusPhase, + FieldStatusMessage, + FieldNamespace, + FieldEventType, + FieldVersion, + FieldDescription, + FieldSpecification, + FieldActive, +} + +// ForeignKeys holds the SQL foreign-keys that are owned by the "event_types" +// table and are not defined as standalone fields in the schema. +var ForeignKeys = []string{ + "team_event_types", +} + +// 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 + // VersionValidator is a validator for the "version" field. It is called by the builders before save. + VersionValidator func(string) error + // DefaultActive holds the default value on creation for the "active" field. + DefaultActive bool +) + +// 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("eventtype: invalid enum value for status_phase field: %q", sp) + } +} + +// OrderOption defines the ordering options for the EventType 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() +} + +// 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() +} + +// ByVersion orders the results by the version field. +func ByVersion(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldVersion, opts...).ToFunc() +} + +// ByDescription orders the results by the description field. +func ByDescription(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldDescription, opts...).ToFunc() +} + +// BySpecification orders the results by the specification field. +func BySpecification(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSpecification, 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...)) + } +} + +// ByExposuresCount orders the results by exposures count. +func ByExposuresCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newExposuresStep(), opts...) + } +} + +// ByExposures orders the results by exposures terms. +func ByExposures(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newExposuresStep(), 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 newExposuresStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(ExposuresInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ExposuresTable, ExposuresColumn), + ) +} + +// 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 +} diff --git a/controlplane-api/ent/eventtype/where.go b/controlplane-api/ent/eventtype/where.go new file mode 100644 index 000000000..0125afc8e --- /dev/null +++ b/controlplane-api/ent/eventtype/where.go @@ -0,0 +1,705 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by ent, DO NOT EDIT. + +package eventtype + +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.EventType { + return predicate.EventType(sql.FieldEQ(FieldID, id)) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id int) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldID, id)) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id int) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldID, id)) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...int) predicate.EventType { + return predicate.EventType(sql.FieldIn(FieldID, ids...)) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...int) predicate.EventType { + return predicate.EventType(sql.FieldNotIn(FieldID, ids...)) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id int) predicate.EventType { + return predicate.EventType(sql.FieldGT(FieldID, id)) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id int) predicate.EventType { + return predicate.EventType(sql.FieldGTE(FieldID, id)) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id int) predicate.EventType { + return predicate.EventType(sql.FieldLT(FieldID, id)) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id int) predicate.EventType { + return predicate.EventType(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.EventType { + return predicate.EventType(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.EventType { + return predicate.EventType(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// StatusMessage applies equality check predicate on the "status_message" field. It's identical to StatusMessageEQ. +func StatusMessage(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldStatusMessage, v)) +} + +// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ. +func Namespace(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldNamespace, v)) +} + +// EventType applies equality check predicate on the "event_type" field. It's identical to EventTypeEQ. +func EventType(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldEventType, v)) +} + +// Version applies equality check predicate on the "version" field. It's identical to VersionEQ. +func Version(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldVersion, v)) +} + +// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ. +func Description(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldDescription, v)) +} + +// Specification applies equality check predicate on the "specification" field. It's identical to SpecificationEQ. +func Specification(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldSpecification, v)) +} + +// Active applies equality check predicate on the "active" field. It's identical to ActiveEQ. +func Active(v bool) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldActive, v)) +} + +// CreatedAtEQ applies the EQ predicate on the "created_at" field. +func CreatedAtEQ(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldCreatedAt, v)) +} + +// CreatedAtNEQ applies the NEQ predicate on the "created_at" field. +func CreatedAtNEQ(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldCreatedAt, v)) +} + +// CreatedAtIn applies the In predicate on the "created_at" field. +func CreatedAtIn(vs ...time.Time) predicate.EventType { + return predicate.EventType(sql.FieldIn(FieldCreatedAt, vs...)) +} + +// CreatedAtNotIn applies the NotIn predicate on the "created_at" field. +func CreatedAtNotIn(vs ...time.Time) predicate.EventType { + return predicate.EventType(sql.FieldNotIn(FieldCreatedAt, vs...)) +} + +// CreatedAtGT applies the GT predicate on the "created_at" field. +func CreatedAtGT(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldGT(FieldCreatedAt, v)) +} + +// CreatedAtGTE applies the GTE predicate on the "created_at" field. +func CreatedAtGTE(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldGTE(FieldCreatedAt, v)) +} + +// CreatedAtLT applies the LT predicate on the "created_at" field. +func CreatedAtLT(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldLT(FieldCreatedAt, v)) +} + +// CreatedAtLTE applies the LTE predicate on the "created_at" field. +func CreatedAtLTE(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldLTE(FieldCreatedAt, v)) +} + +// LastModifiedAtEQ applies the EQ predicate on the "last_modified_at" field. +func LastModifiedAtEQ(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtNEQ applies the NEQ predicate on the "last_modified_at" field. +func LastModifiedAtNEQ(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtIn applies the In predicate on the "last_modified_at" field. +func LastModifiedAtIn(vs ...time.Time) predicate.EventType { + return predicate.EventType(sql.FieldIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtNotIn applies the NotIn predicate on the "last_modified_at" field. +func LastModifiedAtNotIn(vs ...time.Time) predicate.EventType { + return predicate.EventType(sql.FieldNotIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtGT applies the GT predicate on the "last_modified_at" field. +func LastModifiedAtGT(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldGT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtGTE applies the GTE predicate on the "last_modified_at" field. +func LastModifiedAtGTE(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldGTE(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLT applies the LT predicate on the "last_modified_at" field. +func LastModifiedAtLT(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldLT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLTE applies the LTE predicate on the "last_modified_at" field. +func LastModifiedAtLTE(v time.Time) predicate.EventType { + return predicate.EventType(sql.FieldLTE(FieldLastModifiedAt, v)) +} + +// StatusPhaseEQ applies the EQ predicate on the "status_phase" field. +func StatusPhaseEQ(v StatusPhase) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldStatusPhase, v)) +} + +// StatusPhaseNEQ applies the NEQ predicate on the "status_phase" field. +func StatusPhaseNEQ(v StatusPhase) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldStatusPhase, v)) +} + +// StatusPhaseIn applies the In predicate on the "status_phase" field. +func StatusPhaseIn(vs ...StatusPhase) predicate.EventType { + return predicate.EventType(sql.FieldIn(FieldStatusPhase, vs...)) +} + +// StatusPhaseNotIn applies the NotIn predicate on the "status_phase" field. +func StatusPhaseNotIn(vs ...StatusPhase) predicate.EventType { + return predicate.EventType(sql.FieldNotIn(FieldStatusPhase, vs...)) +} + +// StatusPhaseIsNil applies the IsNil predicate on the "status_phase" field. +func StatusPhaseIsNil() predicate.EventType { + return predicate.EventType(sql.FieldIsNull(FieldStatusPhase)) +} + +// StatusPhaseNotNil applies the NotNil predicate on the "status_phase" field. +func StatusPhaseNotNil() predicate.EventType { + return predicate.EventType(sql.FieldNotNull(FieldStatusPhase)) +} + +// StatusMessageEQ applies the EQ predicate on the "status_message" field. +func StatusMessageEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldStatusMessage, v)) +} + +// StatusMessageNEQ applies the NEQ predicate on the "status_message" field. +func StatusMessageNEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldStatusMessage, v)) +} + +// StatusMessageIn applies the In predicate on the "status_message" field. +func StatusMessageIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldIn(FieldStatusMessage, vs...)) +} + +// StatusMessageNotIn applies the NotIn predicate on the "status_message" field. +func StatusMessageNotIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldNotIn(FieldStatusMessage, vs...)) +} + +// StatusMessageGT applies the GT predicate on the "status_message" field. +func StatusMessageGT(v string) predicate.EventType { + return predicate.EventType(sql.FieldGT(FieldStatusMessage, v)) +} + +// StatusMessageGTE applies the GTE predicate on the "status_message" field. +func StatusMessageGTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldGTE(FieldStatusMessage, v)) +} + +// StatusMessageLT applies the LT predicate on the "status_message" field. +func StatusMessageLT(v string) predicate.EventType { + return predicate.EventType(sql.FieldLT(FieldStatusMessage, v)) +} + +// StatusMessageLTE applies the LTE predicate on the "status_message" field. +func StatusMessageLTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldLTE(FieldStatusMessage, v)) +} + +// StatusMessageContains applies the Contains predicate on the "status_message" field. +func StatusMessageContains(v string) predicate.EventType { + return predicate.EventType(sql.FieldContains(FieldStatusMessage, v)) +} + +// StatusMessageHasPrefix applies the HasPrefix predicate on the "status_message" field. +func StatusMessageHasPrefix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasPrefix(FieldStatusMessage, v)) +} + +// StatusMessageHasSuffix applies the HasSuffix predicate on the "status_message" field. +func StatusMessageHasSuffix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasSuffix(FieldStatusMessage, v)) +} + +// StatusMessageIsNil applies the IsNil predicate on the "status_message" field. +func StatusMessageIsNil() predicate.EventType { + return predicate.EventType(sql.FieldIsNull(FieldStatusMessage)) +} + +// StatusMessageNotNil applies the NotNil predicate on the "status_message" field. +func StatusMessageNotNil() predicate.EventType { + return predicate.EventType(sql.FieldNotNull(FieldStatusMessage)) +} + +// StatusMessageEqualFold applies the EqualFold predicate on the "status_message" field. +func StatusMessageEqualFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldEqualFold(FieldStatusMessage, v)) +} + +// StatusMessageContainsFold applies the ContainsFold predicate on the "status_message" field. +func StatusMessageContainsFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldContainsFold(FieldStatusMessage, v)) +} + +// NamespaceEQ applies the EQ predicate on the "namespace" field. +func NamespaceEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldNamespace, v)) +} + +// NamespaceNEQ applies the NEQ predicate on the "namespace" field. +func NamespaceNEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldNamespace, v)) +} + +// NamespaceIn applies the In predicate on the "namespace" field. +func NamespaceIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldIn(FieldNamespace, vs...)) +} + +// NamespaceNotIn applies the NotIn predicate on the "namespace" field. +func NamespaceNotIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldNotIn(FieldNamespace, vs...)) +} + +// NamespaceGT applies the GT predicate on the "namespace" field. +func NamespaceGT(v string) predicate.EventType { + return predicate.EventType(sql.FieldGT(FieldNamespace, v)) +} + +// NamespaceGTE applies the GTE predicate on the "namespace" field. +func NamespaceGTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldGTE(FieldNamespace, v)) +} + +// NamespaceLT applies the LT predicate on the "namespace" field. +func NamespaceLT(v string) predicate.EventType { + return predicate.EventType(sql.FieldLT(FieldNamespace, v)) +} + +// NamespaceLTE applies the LTE predicate on the "namespace" field. +func NamespaceLTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldLTE(FieldNamespace, v)) +} + +// NamespaceContains applies the Contains predicate on the "namespace" field. +func NamespaceContains(v string) predicate.EventType { + return predicate.EventType(sql.FieldContains(FieldNamespace, v)) +} + +// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field. +func NamespaceHasPrefix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasPrefix(FieldNamespace, v)) +} + +// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field. +func NamespaceHasSuffix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasSuffix(FieldNamespace, v)) +} + +// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field. +func NamespaceEqualFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldEqualFold(FieldNamespace, v)) +} + +// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field. +func NamespaceContainsFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldContainsFold(FieldNamespace, v)) +} + +// EventTypeEQ applies the EQ predicate on the "event_type" field. +func EventTypeEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldEventType, v)) +} + +// EventTypeNEQ applies the NEQ predicate on the "event_type" field. +func EventTypeNEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldEventType, v)) +} + +// EventTypeIn applies the In predicate on the "event_type" field. +func EventTypeIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldIn(FieldEventType, vs...)) +} + +// EventTypeNotIn applies the NotIn predicate on the "event_type" field. +func EventTypeNotIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldNotIn(FieldEventType, vs...)) +} + +// EventTypeGT applies the GT predicate on the "event_type" field. +func EventTypeGT(v string) predicate.EventType { + return predicate.EventType(sql.FieldGT(FieldEventType, v)) +} + +// EventTypeGTE applies the GTE predicate on the "event_type" field. +func EventTypeGTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldGTE(FieldEventType, v)) +} + +// EventTypeLT applies the LT predicate on the "event_type" field. +func EventTypeLT(v string) predicate.EventType { + return predicate.EventType(sql.FieldLT(FieldEventType, v)) +} + +// EventTypeLTE applies the LTE predicate on the "event_type" field. +func EventTypeLTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldLTE(FieldEventType, v)) +} + +// EventTypeContains applies the Contains predicate on the "event_type" field. +func EventTypeContains(v string) predicate.EventType { + return predicate.EventType(sql.FieldContains(FieldEventType, v)) +} + +// EventTypeHasPrefix applies the HasPrefix predicate on the "event_type" field. +func EventTypeHasPrefix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasPrefix(FieldEventType, v)) +} + +// EventTypeHasSuffix applies the HasSuffix predicate on the "event_type" field. +func EventTypeHasSuffix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasSuffix(FieldEventType, v)) +} + +// EventTypeEqualFold applies the EqualFold predicate on the "event_type" field. +func EventTypeEqualFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldEqualFold(FieldEventType, v)) +} + +// EventTypeContainsFold applies the ContainsFold predicate on the "event_type" field. +func EventTypeContainsFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldContainsFold(FieldEventType, v)) +} + +// VersionEQ applies the EQ predicate on the "version" field. +func VersionEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldVersion, v)) +} + +// VersionNEQ applies the NEQ predicate on the "version" field. +func VersionNEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldVersion, v)) +} + +// VersionIn applies the In predicate on the "version" field. +func VersionIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldIn(FieldVersion, vs...)) +} + +// VersionNotIn applies the NotIn predicate on the "version" field. +func VersionNotIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldNotIn(FieldVersion, vs...)) +} + +// VersionGT applies the GT predicate on the "version" field. +func VersionGT(v string) predicate.EventType { + return predicate.EventType(sql.FieldGT(FieldVersion, v)) +} + +// VersionGTE applies the GTE predicate on the "version" field. +func VersionGTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldGTE(FieldVersion, v)) +} + +// VersionLT applies the LT predicate on the "version" field. +func VersionLT(v string) predicate.EventType { + return predicate.EventType(sql.FieldLT(FieldVersion, v)) +} + +// VersionLTE applies the LTE predicate on the "version" field. +func VersionLTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldLTE(FieldVersion, v)) +} + +// VersionContains applies the Contains predicate on the "version" field. +func VersionContains(v string) predicate.EventType { + return predicate.EventType(sql.FieldContains(FieldVersion, v)) +} + +// VersionHasPrefix applies the HasPrefix predicate on the "version" field. +func VersionHasPrefix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasPrefix(FieldVersion, v)) +} + +// VersionHasSuffix applies the HasSuffix predicate on the "version" field. +func VersionHasSuffix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasSuffix(FieldVersion, v)) +} + +// VersionEqualFold applies the EqualFold predicate on the "version" field. +func VersionEqualFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldEqualFold(FieldVersion, v)) +} + +// VersionContainsFold applies the ContainsFold predicate on the "version" field. +func VersionContainsFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldContainsFold(FieldVersion, v)) +} + +// DescriptionEQ applies the EQ predicate on the "description" field. +func DescriptionEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldDescription, v)) +} + +// DescriptionNEQ applies the NEQ predicate on the "description" field. +func DescriptionNEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldDescription, v)) +} + +// DescriptionIn applies the In predicate on the "description" field. +func DescriptionIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldIn(FieldDescription, vs...)) +} + +// DescriptionNotIn applies the NotIn predicate on the "description" field. +func DescriptionNotIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldNotIn(FieldDescription, vs...)) +} + +// DescriptionGT applies the GT predicate on the "description" field. +func DescriptionGT(v string) predicate.EventType { + return predicate.EventType(sql.FieldGT(FieldDescription, v)) +} + +// DescriptionGTE applies the GTE predicate on the "description" field. +func DescriptionGTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldGTE(FieldDescription, v)) +} + +// DescriptionLT applies the LT predicate on the "description" field. +func DescriptionLT(v string) predicate.EventType { + return predicate.EventType(sql.FieldLT(FieldDescription, v)) +} + +// DescriptionLTE applies the LTE predicate on the "description" field. +func DescriptionLTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldLTE(FieldDescription, v)) +} + +// DescriptionContains applies the Contains predicate on the "description" field. +func DescriptionContains(v string) predicate.EventType { + return predicate.EventType(sql.FieldContains(FieldDescription, v)) +} + +// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field. +func DescriptionHasPrefix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasPrefix(FieldDescription, v)) +} + +// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field. +func DescriptionHasSuffix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasSuffix(FieldDescription, v)) +} + +// DescriptionIsNil applies the IsNil predicate on the "description" field. +func DescriptionIsNil() predicate.EventType { + return predicate.EventType(sql.FieldIsNull(FieldDescription)) +} + +// DescriptionNotNil applies the NotNil predicate on the "description" field. +func DescriptionNotNil() predicate.EventType { + return predicate.EventType(sql.FieldNotNull(FieldDescription)) +} + +// DescriptionEqualFold applies the EqualFold predicate on the "description" field. +func DescriptionEqualFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldEqualFold(FieldDescription, v)) +} + +// DescriptionContainsFold applies the ContainsFold predicate on the "description" field. +func DescriptionContainsFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldContainsFold(FieldDescription, v)) +} + +// SpecificationEQ applies the EQ predicate on the "specification" field. +func SpecificationEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldSpecification, v)) +} + +// SpecificationNEQ applies the NEQ predicate on the "specification" field. +func SpecificationNEQ(v string) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldSpecification, v)) +} + +// SpecificationIn applies the In predicate on the "specification" field. +func SpecificationIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldIn(FieldSpecification, vs...)) +} + +// SpecificationNotIn applies the NotIn predicate on the "specification" field. +func SpecificationNotIn(vs ...string) predicate.EventType { + return predicate.EventType(sql.FieldNotIn(FieldSpecification, vs...)) +} + +// SpecificationGT applies the GT predicate on the "specification" field. +func SpecificationGT(v string) predicate.EventType { + return predicate.EventType(sql.FieldGT(FieldSpecification, v)) +} + +// SpecificationGTE applies the GTE predicate on the "specification" field. +func SpecificationGTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldGTE(FieldSpecification, v)) +} + +// SpecificationLT applies the LT predicate on the "specification" field. +func SpecificationLT(v string) predicate.EventType { + return predicate.EventType(sql.FieldLT(FieldSpecification, v)) +} + +// SpecificationLTE applies the LTE predicate on the "specification" field. +func SpecificationLTE(v string) predicate.EventType { + return predicate.EventType(sql.FieldLTE(FieldSpecification, v)) +} + +// SpecificationContains applies the Contains predicate on the "specification" field. +func SpecificationContains(v string) predicate.EventType { + return predicate.EventType(sql.FieldContains(FieldSpecification, v)) +} + +// SpecificationHasPrefix applies the HasPrefix predicate on the "specification" field. +func SpecificationHasPrefix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasPrefix(FieldSpecification, v)) +} + +// SpecificationHasSuffix applies the HasSuffix predicate on the "specification" field. +func SpecificationHasSuffix(v string) predicate.EventType { + return predicate.EventType(sql.FieldHasSuffix(FieldSpecification, v)) +} + +// SpecificationIsNil applies the IsNil predicate on the "specification" field. +func SpecificationIsNil() predicate.EventType { + return predicate.EventType(sql.FieldIsNull(FieldSpecification)) +} + +// SpecificationNotNil applies the NotNil predicate on the "specification" field. +func SpecificationNotNil() predicate.EventType { + return predicate.EventType(sql.FieldNotNull(FieldSpecification)) +} + +// SpecificationEqualFold applies the EqualFold predicate on the "specification" field. +func SpecificationEqualFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldEqualFold(FieldSpecification, v)) +} + +// SpecificationContainsFold applies the ContainsFold predicate on the "specification" field. +func SpecificationContainsFold(v string) predicate.EventType { + return predicate.EventType(sql.FieldContainsFold(FieldSpecification, v)) +} + +// ActiveEQ applies the EQ predicate on the "active" field. +func ActiveEQ(v bool) predicate.EventType { + return predicate.EventType(sql.FieldEQ(FieldActive, v)) +} + +// ActiveNEQ applies the NEQ predicate on the "active" field. +func ActiveNEQ(v bool) predicate.EventType { + return predicate.EventType(sql.FieldNEQ(FieldActive, v)) +} + +// HasOwner applies the HasEdge predicate on the "owner" edge. +func HasOwner() predicate.EventType { + return predicate.EventType(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.Team) predicate.EventType { + return predicate.EventType(func(s *sql.Selector) { + step := newOwnerStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasExposures applies the HasEdge predicate on the "exposures" edge. +func HasExposures() predicate.EventType { + return predicate.EventType(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ExposuresTable, ExposuresColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasExposuresWith applies the HasEdge predicate on the "exposures" edge with a given conditions (other predicates). +func HasExposuresWith(preds ...predicate.EventExposure) predicate.EventType { + return predicate.EventType(func(s *sql.Selector) { + step := newExposuresStep() + 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.EventType) predicate.EventType { + return predicate.EventType(sql.AndPredicates(predicates...)) +} + +// Or groups predicates with the OR operator between them. +func Or(predicates ...predicate.EventType) predicate.EventType { + return predicate.EventType(sql.OrPredicates(predicates...)) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.EventType) predicate.EventType { + return predicate.EventType(sql.NotPredicates(p)) +} diff --git a/controlplane-api/ent/eventtype_create.go b/controlplane-api/ent/eventtype_create.go new file mode 100644 index 000000000..63028ec58 --- /dev/null +++ b/controlplane-api/ent/eventtype_create.go @@ -0,0 +1,1142 @@ +// 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/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventtype" + "github.com/telekom/controlplane/controlplane-api/ent/team" +) + +// EventTypeCreate is the builder for creating a EventType entity. +type EventTypeCreate struct { + config + mutation *EventTypeMutation + hooks []Hook + conflict []sql.ConflictOption +} + +// SetCreatedAt sets the "created_at" field. +func (_c *EventTypeCreate) SetCreatedAt(v time.Time) *EventTypeCreate { + _c.mutation.SetCreatedAt(v) + return _c +} + +// SetNillableCreatedAt sets the "created_at" field if the given value is not nil. +func (_c *EventTypeCreate) SetNillableCreatedAt(v *time.Time) *EventTypeCreate { + if v != nil { + _c.SetCreatedAt(*v) + } + return _c +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_c *EventTypeCreate) SetLastModifiedAt(v time.Time) *EventTypeCreate { + _c.mutation.SetLastModifiedAt(v) + return _c +} + +// SetNillableLastModifiedAt sets the "last_modified_at" field if the given value is not nil. +func (_c *EventTypeCreate) SetNillableLastModifiedAt(v *time.Time) *EventTypeCreate { + if v != nil { + _c.SetLastModifiedAt(*v) + } + return _c +} + +// SetStatusPhase sets the "status_phase" field. +func (_c *EventTypeCreate) SetStatusPhase(v eventtype.StatusPhase) *EventTypeCreate { + _c.mutation.SetStatusPhase(v) + return _c +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_c *EventTypeCreate) SetNillableStatusPhase(v *eventtype.StatusPhase) *EventTypeCreate { + if v != nil { + _c.SetStatusPhase(*v) + } + return _c +} + +// SetStatusMessage sets the "status_message" field. +func (_c *EventTypeCreate) SetStatusMessage(v string) *EventTypeCreate { + _c.mutation.SetStatusMessage(v) + return _c +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_c *EventTypeCreate) SetNillableStatusMessage(v *string) *EventTypeCreate { + if v != nil { + _c.SetStatusMessage(*v) + } + return _c +} + +// SetNamespace sets the "namespace" field. +func (_c *EventTypeCreate) SetNamespace(v string) *EventTypeCreate { + _c.mutation.SetNamespace(v) + return _c +} + +// SetEventType sets the "event_type" field. +func (_c *EventTypeCreate) SetEventType(v string) *EventTypeCreate { + _c.mutation.SetEventType(v) + return _c +} + +// SetVersion sets the "version" field. +func (_c *EventTypeCreate) SetVersion(v string) *EventTypeCreate { + _c.mutation.SetVersion(v) + return _c +} + +// SetDescription sets the "description" field. +func (_c *EventTypeCreate) SetDescription(v string) *EventTypeCreate { + _c.mutation.SetDescription(v) + return _c +} + +// SetNillableDescription sets the "description" field if the given value is not nil. +func (_c *EventTypeCreate) SetNillableDescription(v *string) *EventTypeCreate { + if v != nil { + _c.SetDescription(*v) + } + return _c +} + +// SetSpecification sets the "specification" field. +func (_c *EventTypeCreate) SetSpecification(v string) *EventTypeCreate { + _c.mutation.SetSpecification(v) + return _c +} + +// SetNillableSpecification sets the "specification" field if the given value is not nil. +func (_c *EventTypeCreate) SetNillableSpecification(v *string) *EventTypeCreate { + if v != nil { + _c.SetSpecification(*v) + } + return _c +} + +// SetActive sets the "active" field. +func (_c *EventTypeCreate) SetActive(v bool) *EventTypeCreate { + _c.mutation.SetActive(v) + return _c +} + +// SetNillableActive sets the "active" field if the given value is not nil. +func (_c *EventTypeCreate) SetNillableActive(v *bool) *EventTypeCreate { + if v != nil { + _c.SetActive(*v) + } + return _c +} + +// SetOwnerID sets the "owner" edge to the Team entity by ID. +func (_c *EventTypeCreate) SetOwnerID(id int) *EventTypeCreate { + _c.mutation.SetOwnerID(id) + return _c +} + +// SetOwner sets the "owner" edge to the Team entity. +func (_c *EventTypeCreate) SetOwner(v *Team) *EventTypeCreate { + return _c.SetOwnerID(v.ID) +} + +// AddExposureIDs adds the "exposures" edge to the EventExposure entity by IDs. +func (_c *EventTypeCreate) AddExposureIDs(ids ...int) *EventTypeCreate { + _c.mutation.AddExposureIDs(ids...) + return _c +} + +// AddExposures adds the "exposures" edges to the EventExposure entity. +func (_c *EventTypeCreate) AddExposures(v ...*EventExposure) *EventTypeCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _c.AddExposureIDs(ids...) +} + +// Mutation returns the EventTypeMutation object of the builder. +func (_c *EventTypeCreate) Mutation() *EventTypeMutation { + return _c.mutation +} + +// Save creates the EventType in the database. +func (_c *EventTypeCreate) Save(ctx context.Context) (*EventType, 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 *EventTypeCreate) SaveX(ctx context.Context) *EventType { + v, err := _c.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (_c *EventTypeCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_c *EventTypeCreate) 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 *EventTypeCreate) defaults() error { + if _, ok := _c.mutation.CreatedAt(); !ok { + if eventtype.DefaultCreatedAt == nil { + return fmt.Errorf("ent: uninitialized eventtype.DefaultCreatedAt (forgotten import ent/runtime?)") + } + v := eventtype.DefaultCreatedAt() + _c.mutation.SetCreatedAt(v) + } + if _, ok := _c.mutation.LastModifiedAt(); !ok { + if eventtype.DefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized eventtype.DefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := eventtype.DefaultLastModifiedAt() + _c.mutation.SetLastModifiedAt(v) + } + if _, ok := _c.mutation.Active(); !ok { + v := eventtype.DefaultActive + _c.mutation.SetActive(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_c *EventTypeCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { + return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "EventType.created_at"`)} + } + if _, ok := _c.mutation.LastModifiedAt(); !ok { + return &ValidationError{Name: "last_modified_at", err: errors.New(`ent: missing required field "EventType.last_modified_at"`)} + } + if v, ok := _c.mutation.StatusPhase(); ok { + if err := eventtype.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "EventType.status_phase": %w`, err)} + } + } + if _, ok := _c.mutation.Namespace(); !ok { + return &ValidationError{Name: "namespace", err: errors.New(`ent: missing required field "EventType.namespace"`)} + } + if v, ok := _c.mutation.Namespace(); ok { + if err := eventtype.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "EventType.namespace": %w`, err)} + } + } + if _, ok := _c.mutation.EventType(); !ok { + return &ValidationError{Name: "event_type", err: errors.New(`ent: missing required field "EventType.event_type"`)} + } + if v, ok := _c.mutation.EventType(); ok { + if err := eventtype.EventTypeValidator(v); err != nil { + return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "EventType.event_type": %w`, err)} + } + } + if _, ok := _c.mutation.Version(); !ok { + return &ValidationError{Name: "version", err: errors.New(`ent: missing required field "EventType.version"`)} + } + if v, ok := _c.mutation.Version(); ok { + if err := eventtype.VersionValidator(v); err != nil { + return &ValidationError{Name: "version", err: fmt.Errorf(`ent: validator failed for field "EventType.version": %w`, err)} + } + } + if _, ok := _c.mutation.Active(); !ok { + return &ValidationError{Name: "active", err: errors.New(`ent: missing required field "EventType.active"`)} + } + if len(_c.mutation.OwnerIDs()) == 0 { + return &ValidationError{Name: "owner", err: errors.New(`ent: missing required edge "EventType.owner"`)} + } + return nil +} + +func (_c *EventTypeCreate) sqlSave(ctx context.Context) (*EventType, 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 *EventTypeCreate) createSpec() (*EventType, *sqlgraph.CreateSpec) { + var ( + _node = &EventType{config: _c.config} + _spec = sqlgraph.NewCreateSpec(eventtype.Table, sqlgraph.NewFieldSpec(eventtype.FieldID, field.TypeInt)) + ) + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { + _spec.SetField(eventtype.FieldCreatedAt, field.TypeTime, value) + _node.CreatedAt = value + } + if value, ok := _c.mutation.LastModifiedAt(); ok { + _spec.SetField(eventtype.FieldLastModifiedAt, field.TypeTime, value) + _node.LastModifiedAt = value + } + if value, ok := _c.mutation.StatusPhase(); ok { + _spec.SetField(eventtype.FieldStatusPhase, field.TypeEnum, value) + _node.StatusPhase = &value + } + if value, ok := _c.mutation.StatusMessage(); ok { + _spec.SetField(eventtype.FieldStatusMessage, field.TypeString, value) + _node.StatusMessage = &value + } + if value, ok := _c.mutation.Namespace(); ok { + _spec.SetField(eventtype.FieldNamespace, field.TypeString, value) + _node.Namespace = value + } + if value, ok := _c.mutation.EventType(); ok { + _spec.SetField(eventtype.FieldEventType, field.TypeString, value) + _node.EventType = value + } + if value, ok := _c.mutation.Version(); ok { + _spec.SetField(eventtype.FieldVersion, field.TypeString, value) + _node.Version = value + } + if value, ok := _c.mutation.Description(); ok { + _spec.SetField(eventtype.FieldDescription, field.TypeString, value) + _node.Description = value + } + if value, ok := _c.mutation.Specification(); ok { + _spec.SetField(eventtype.FieldSpecification, field.TypeString, value) + _node.Specification = value + } + if value, ok := _c.mutation.Active(); ok { + _spec.SetField(eventtype.FieldActive, field.TypeBool, value) + _node.Active = value + } + if nodes := _c.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventtype.OwnerTable, + Columns: []string{eventtype.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(team.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.team_event_types = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := _c.mutation.ExposuresIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventtype.ExposuresTable, + Columns: []string{eventtype.ExposuresColumn}, + 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) + } + return _node, _spec +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.EventType.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.EventTypeUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (_c *EventTypeCreate) OnConflict(opts ...sql.ConflictOption) *EventTypeUpsertOne { + _c.conflict = opts + return &EventTypeUpsertOne{ + create: _c, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.EventType.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (_c *EventTypeCreate) OnConflictColumns(columns ...string) *EventTypeUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) + return &EventTypeUpsertOne{ + create: _c, + } +} + +type ( + // EventTypeUpsertOne is the builder for "upsert"-ing + // one EventType node. + EventTypeUpsertOne struct { + create *EventTypeCreate + } + + // EventTypeUpsert is the "OnConflict" setter. + EventTypeUpsert struct { + *sql.UpdateSet + } +) + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *EventTypeUpsert) SetLastModifiedAt(v time.Time) *EventTypeUpsert { + u.Set(eventtype.FieldLastModifiedAt, v) + return u +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *EventTypeUpsert) UpdateLastModifiedAt() *EventTypeUpsert { + u.SetExcluded(eventtype.FieldLastModifiedAt) + return u +} + +// SetStatusPhase sets the "status_phase" field. +func (u *EventTypeUpsert) SetStatusPhase(v eventtype.StatusPhase) *EventTypeUpsert { + u.Set(eventtype.FieldStatusPhase, v) + return u +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *EventTypeUpsert) UpdateStatusPhase() *EventTypeUpsert { + u.SetExcluded(eventtype.FieldStatusPhase) + return u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *EventTypeUpsert) ClearStatusPhase() *EventTypeUpsert { + u.SetNull(eventtype.FieldStatusPhase) + return u +} + +// SetStatusMessage sets the "status_message" field. +func (u *EventTypeUpsert) SetStatusMessage(v string) *EventTypeUpsert { + u.Set(eventtype.FieldStatusMessage, v) + return u +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *EventTypeUpsert) UpdateStatusMessage() *EventTypeUpsert { + u.SetExcluded(eventtype.FieldStatusMessage) + return u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *EventTypeUpsert) ClearStatusMessage() *EventTypeUpsert { + u.SetNull(eventtype.FieldStatusMessage) + return u +} + +// SetNamespace sets the "namespace" field. +func (u *EventTypeUpsert) SetNamespace(v string) *EventTypeUpsert { + u.Set(eventtype.FieldNamespace, v) + return u +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *EventTypeUpsert) UpdateNamespace() *EventTypeUpsert { + u.SetExcluded(eventtype.FieldNamespace) + return u +} + +// SetEventType sets the "event_type" field. +func (u *EventTypeUpsert) SetEventType(v string) *EventTypeUpsert { + u.Set(eventtype.FieldEventType, v) + return u +} + +// UpdateEventType sets the "event_type" field to the value that was provided on create. +func (u *EventTypeUpsert) UpdateEventType() *EventTypeUpsert { + u.SetExcluded(eventtype.FieldEventType) + return u +} + +// SetVersion sets the "version" field. +func (u *EventTypeUpsert) SetVersion(v string) *EventTypeUpsert { + u.Set(eventtype.FieldVersion, v) + return u +} + +// UpdateVersion sets the "version" field to the value that was provided on create. +func (u *EventTypeUpsert) UpdateVersion() *EventTypeUpsert { + u.SetExcluded(eventtype.FieldVersion) + return u +} + +// SetDescription sets the "description" field. +func (u *EventTypeUpsert) SetDescription(v string) *EventTypeUpsert { + u.Set(eventtype.FieldDescription, v) + return u +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *EventTypeUpsert) UpdateDescription() *EventTypeUpsert { + u.SetExcluded(eventtype.FieldDescription) + return u +} + +// ClearDescription clears the value of the "description" field. +func (u *EventTypeUpsert) ClearDescription() *EventTypeUpsert { + u.SetNull(eventtype.FieldDescription) + return u +} + +// SetSpecification sets the "specification" field. +func (u *EventTypeUpsert) SetSpecification(v string) *EventTypeUpsert { + u.Set(eventtype.FieldSpecification, v) + return u +} + +// UpdateSpecification sets the "specification" field to the value that was provided on create. +func (u *EventTypeUpsert) UpdateSpecification() *EventTypeUpsert { + u.SetExcluded(eventtype.FieldSpecification) + return u +} + +// ClearSpecification clears the value of the "specification" field. +func (u *EventTypeUpsert) ClearSpecification() *EventTypeUpsert { + u.SetNull(eventtype.FieldSpecification) + return u +} + +// SetActive sets the "active" field. +func (u *EventTypeUpsert) SetActive(v bool) *EventTypeUpsert { + u.Set(eventtype.FieldActive, v) + return u +} + +// UpdateActive sets the "active" field to the value that was provided on create. +func (u *EventTypeUpsert) UpdateActive() *EventTypeUpsert { + u.SetExcluded(eventtype.FieldActive) + return u +} + +// UpdateNewValues updates the mutable fields using the new values that were set on create. +// Using this option is equivalent to using: +// +// client.EventType.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *EventTypeUpsertOne) UpdateNewValues() *EventTypeUpsertOne { + 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(eventtype.FieldCreatedAt) + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.EventType.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *EventTypeUpsertOne) Ignore() *EventTypeUpsertOne { + 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 *EventTypeUpsertOne) DoNothing() *EventTypeUpsertOne { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the EventTypeCreate.OnConflict +// documentation for more info. +func (u *EventTypeUpsertOne) Update(set func(*EventTypeUpsert)) *EventTypeUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&EventTypeUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *EventTypeUpsertOne) SetLastModifiedAt(v time.Time) *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *EventTypeUpsertOne) UpdateLastModifiedAt() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetStatusPhase sets the "status_phase" field. +func (u *EventTypeUpsertOne) SetStatusPhase(v eventtype.StatusPhase) *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.SetStatusPhase(v) + }) +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *EventTypeUpsertOne) UpdateStatusPhase() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateStatusPhase() + }) +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *EventTypeUpsertOne) ClearStatusPhase() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.ClearStatusPhase() + }) +} + +// SetStatusMessage sets the "status_message" field. +func (u *EventTypeUpsertOne) SetStatusMessage(v string) *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.SetStatusMessage(v) + }) +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *EventTypeUpsertOne) UpdateStatusMessage() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateStatusMessage() + }) +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *EventTypeUpsertOne) ClearStatusMessage() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.ClearStatusMessage() + }) +} + +// SetNamespace sets the "namespace" field. +func (u *EventTypeUpsertOne) SetNamespace(v string) *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.SetNamespace(v) + }) +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *EventTypeUpsertOne) UpdateNamespace() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateNamespace() + }) +} + +// SetEventType sets the "event_type" field. +func (u *EventTypeUpsertOne) SetEventType(v string) *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.SetEventType(v) + }) +} + +// UpdateEventType sets the "event_type" field to the value that was provided on create. +func (u *EventTypeUpsertOne) UpdateEventType() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateEventType() + }) +} + +// SetVersion sets the "version" field. +func (u *EventTypeUpsertOne) SetVersion(v string) *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.SetVersion(v) + }) +} + +// UpdateVersion sets the "version" field to the value that was provided on create. +func (u *EventTypeUpsertOne) UpdateVersion() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateVersion() + }) +} + +// SetDescription sets the "description" field. +func (u *EventTypeUpsertOne) SetDescription(v string) *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.SetDescription(v) + }) +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *EventTypeUpsertOne) UpdateDescription() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateDescription() + }) +} + +// ClearDescription clears the value of the "description" field. +func (u *EventTypeUpsertOne) ClearDescription() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.ClearDescription() + }) +} + +// SetSpecification sets the "specification" field. +func (u *EventTypeUpsertOne) SetSpecification(v string) *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.SetSpecification(v) + }) +} + +// UpdateSpecification sets the "specification" field to the value that was provided on create. +func (u *EventTypeUpsertOne) UpdateSpecification() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateSpecification() + }) +} + +// ClearSpecification clears the value of the "specification" field. +func (u *EventTypeUpsertOne) ClearSpecification() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.ClearSpecification() + }) +} + +// SetActive sets the "active" field. +func (u *EventTypeUpsertOne) SetActive(v bool) *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.SetActive(v) + }) +} + +// UpdateActive sets the "active" field to the value that was provided on create. +func (u *EventTypeUpsertOne) UpdateActive() *EventTypeUpsertOne { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateActive() + }) +} + +// Exec executes the query. +func (u *EventTypeUpsertOne) Exec(ctx context.Context) error { + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for EventTypeCreate.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *EventTypeUpsertOne) 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 *EventTypeUpsertOne) 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 *EventTypeUpsertOne) IDX(ctx context.Context) int { + id, err := u.ID(ctx) + if err != nil { + panic(err) + } + return id +} + +// EventTypeCreateBulk is the builder for creating many EventType entities in bulk. +type EventTypeCreateBulk struct { + config + err error + builders []*EventTypeCreate + conflict []sql.ConflictOption +} + +// Save creates the EventType entities in the database. +func (_c *EventTypeCreateBulk) Save(ctx context.Context) ([]*EventType, error) { + if _c.err != nil { + return nil, _c.err + } + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*EventType, 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.(*EventTypeMutation) + 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 *EventTypeCreateBulk) SaveX(ctx context.Context) []*EventType { + v, err := _c.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (_c *EventTypeCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_c *EventTypeCreateBulk) 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.EventType.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.EventTypeUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (_c *EventTypeCreateBulk) OnConflict(opts ...sql.ConflictOption) *EventTypeUpsertBulk { + _c.conflict = opts + return &EventTypeUpsertBulk{ + create: _c, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.EventType.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (_c *EventTypeCreateBulk) OnConflictColumns(columns ...string) *EventTypeUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) + return &EventTypeUpsertBulk{ + create: _c, + } +} + +// EventTypeUpsertBulk is the builder for "upsert"-ing +// a bulk of EventType nodes. +type EventTypeUpsertBulk struct { + create *EventTypeCreateBulk +} + +// UpdateNewValues updates the mutable fields using the new values that +// were set on create. Using this option is equivalent to using: +// +// client.EventType.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *EventTypeUpsertBulk) UpdateNewValues() *EventTypeUpsertBulk { + 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(eventtype.FieldCreatedAt) + } + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.EventType.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *EventTypeUpsertBulk) Ignore() *EventTypeUpsertBulk { + 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 *EventTypeUpsertBulk) DoNothing() *EventTypeUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the EventTypeCreateBulk.OnConflict +// documentation for more info. +func (u *EventTypeUpsertBulk) Update(set func(*EventTypeUpsert)) *EventTypeUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&EventTypeUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *EventTypeUpsertBulk) SetLastModifiedAt(v time.Time) *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *EventTypeUpsertBulk) UpdateLastModifiedAt() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetStatusPhase sets the "status_phase" field. +func (u *EventTypeUpsertBulk) SetStatusPhase(v eventtype.StatusPhase) *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.SetStatusPhase(v) + }) +} + +// UpdateStatusPhase sets the "status_phase" field to the value that was provided on create. +func (u *EventTypeUpsertBulk) UpdateStatusPhase() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateStatusPhase() + }) +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (u *EventTypeUpsertBulk) ClearStatusPhase() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.ClearStatusPhase() + }) +} + +// SetStatusMessage sets the "status_message" field. +func (u *EventTypeUpsertBulk) SetStatusMessage(v string) *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.SetStatusMessage(v) + }) +} + +// UpdateStatusMessage sets the "status_message" field to the value that was provided on create. +func (u *EventTypeUpsertBulk) UpdateStatusMessage() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateStatusMessage() + }) +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (u *EventTypeUpsertBulk) ClearStatusMessage() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.ClearStatusMessage() + }) +} + +// SetNamespace sets the "namespace" field. +func (u *EventTypeUpsertBulk) SetNamespace(v string) *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.SetNamespace(v) + }) +} + +// UpdateNamespace sets the "namespace" field to the value that was provided on create. +func (u *EventTypeUpsertBulk) UpdateNamespace() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateNamespace() + }) +} + +// SetEventType sets the "event_type" field. +func (u *EventTypeUpsertBulk) SetEventType(v string) *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.SetEventType(v) + }) +} + +// UpdateEventType sets the "event_type" field to the value that was provided on create. +func (u *EventTypeUpsertBulk) UpdateEventType() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateEventType() + }) +} + +// SetVersion sets the "version" field. +func (u *EventTypeUpsertBulk) SetVersion(v string) *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.SetVersion(v) + }) +} + +// UpdateVersion sets the "version" field to the value that was provided on create. +func (u *EventTypeUpsertBulk) UpdateVersion() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateVersion() + }) +} + +// SetDescription sets the "description" field. +func (u *EventTypeUpsertBulk) SetDescription(v string) *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.SetDescription(v) + }) +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *EventTypeUpsertBulk) UpdateDescription() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateDescription() + }) +} + +// ClearDescription clears the value of the "description" field. +func (u *EventTypeUpsertBulk) ClearDescription() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.ClearDescription() + }) +} + +// SetSpecification sets the "specification" field. +func (u *EventTypeUpsertBulk) SetSpecification(v string) *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.SetSpecification(v) + }) +} + +// UpdateSpecification sets the "specification" field to the value that was provided on create. +func (u *EventTypeUpsertBulk) UpdateSpecification() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateSpecification() + }) +} + +// ClearSpecification clears the value of the "specification" field. +func (u *EventTypeUpsertBulk) ClearSpecification() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.ClearSpecification() + }) +} + +// SetActive sets the "active" field. +func (u *EventTypeUpsertBulk) SetActive(v bool) *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.SetActive(v) + }) +} + +// UpdateActive sets the "active" field to the value that was provided on create. +func (u *EventTypeUpsertBulk) UpdateActive() *EventTypeUpsertBulk { + return u.Update(func(s *EventTypeUpsert) { + s.UpdateActive() + }) +} + +// Exec executes the query. +func (u *EventTypeUpsertBulk) 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 EventTypeCreateBulk instead", i) + } + } + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for EventTypeCreateBulk.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *EventTypeUpsertBulk) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/controlplane-api/ent/eventtype_delete.go b/controlplane-api/ent/eventtype_delete.go new file mode 100644 index 000000000..f2d8b2c5c --- /dev/null +++ b/controlplane-api/ent/eventtype_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/eventtype" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" +) + +// EventTypeDelete is the builder for deleting a EventType entity. +type EventTypeDelete struct { + config + hooks []Hook + mutation *EventTypeMutation +} + +// Where appends a list predicates to the EventTypeDelete builder. +func (_d *EventTypeDelete) Where(ps ...predicate.EventType) *EventTypeDelete { + _d.mutation.Where(ps...) + return _d +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (_d *EventTypeDelete) 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 *EventTypeDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (_d *EventTypeDelete) sqlExec(ctx context.Context) (int, error) { + _spec := sqlgraph.NewDeleteSpec(eventtype.Table, sqlgraph.NewFieldSpec(eventtype.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 +} + +// EventTypeDeleteOne is the builder for deleting a single EventType entity. +type EventTypeDeleteOne struct { + _d *EventTypeDelete +} + +// Where appends a list predicates to the EventTypeDelete builder. +func (_d *EventTypeDeleteOne) Where(ps ...predicate.EventType) *EventTypeDeleteOne { + _d._d.mutation.Where(ps...) + return _d +} + +// Exec executes the deletion query. +func (_d *EventTypeDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{eventtype.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (_d *EventTypeDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/controlplane-api/ent/eventtype_query.go b/controlplane-api/ent/eventtype_query.go new file mode 100644 index 000000000..faa492f30 --- /dev/null +++ b/controlplane-api/ent/eventtype_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/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventtype" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" + "github.com/telekom/controlplane/controlplane-api/ent/team" +) + +// EventTypeQuery is the builder for querying EventType entities. +type EventTypeQuery struct { + config + ctx *QueryContext + order []eventtype.OrderOption + inters []Interceptor + predicates []predicate.EventType + withOwner *TeamQuery + withExposures *EventExposureQuery + withFKs bool + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*EventType) error + withNamedExposures map[string]*EventExposureQuery + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Where adds a new predicate for the EventTypeQuery builder. +func (_q *EventTypeQuery) Where(ps ...predicate.EventType) *EventTypeQuery { + _q.predicates = append(_q.predicates, ps...) + return _q +} + +// Limit the number of records to be returned by this query. +func (_q *EventTypeQuery) Limit(limit int) *EventTypeQuery { + _q.ctx.Limit = &limit + return _q +} + +// Offset to start from. +func (_q *EventTypeQuery) Offset(offset int) *EventTypeQuery { + _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 *EventTypeQuery) Unique(unique bool) *EventTypeQuery { + _q.ctx.Unique = &unique + return _q +} + +// Order specifies how the records should be ordered. +func (_q *EventTypeQuery) Order(o ...eventtype.OrderOption) *EventTypeQuery { + _q.order = append(_q.order, o...) + return _q +} + +// QueryOwner chains the current query on the "owner" edge. +func (_q *EventTypeQuery) QueryOwner() *TeamQuery { + query := (&TeamClient{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(eventtype.Table, eventtype.FieldID, selector), + sqlgraph.To(team.Table, team.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, eventtype.OwnerTable, eventtype.OwnerColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryExposures chains the current query on the "exposures" edge. +func (_q *EventTypeQuery) QueryExposures() *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(eventtype.Table, eventtype.FieldID, selector), + sqlgraph.To(eventexposure.Table, eventexposure.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, eventtype.ExposuresTable, eventtype.ExposuresColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// First returns the first EventType entity from the query. +// Returns a *NotFoundError when no EventType was found. +func (_q *EventTypeQuery) First(ctx context.Context) (*EventType, 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{eventtype.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (_q *EventTypeQuery) FirstX(ctx context.Context) *EventType { + node, err := _q.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first EventType ID from the query. +// Returns a *NotFoundError when no EventType ID was found. +func (_q *EventTypeQuery) 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{eventtype.Label} + return + } + return ids[0], nil +} + +// FirstIDX is like FirstID, but panics if an error occurs. +func (_q *EventTypeQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns a single EventType entity found by the query, ensuring it only returns one. +// Returns a *NotSingularError when more than one EventType entity is found. +// Returns a *NotFoundError when no EventType entities are found. +func (_q *EventTypeQuery) Only(ctx context.Context) (*EventType, 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{eventtype.Label} + default: + return nil, &NotSingularError{eventtype.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (_q *EventTypeQuery) OnlyX(ctx context.Context) *EventType { + node, err := _q.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID is like Only, but returns the only EventType ID in the query. +// Returns a *NotSingularError when more than one EventType ID is found. +// Returns a *NotFoundError when no entities are found. +func (_q *EventTypeQuery) 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{eventtype.Label} + default: + err = &NotSingularError{eventtype.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (_q *EventTypeQuery) 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 EventTypes. +func (_q *EventTypeQuery) All(ctx context.Context) ([]*EventType, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { + return nil, err + } + qr := querierAll[[]*EventType, *EventTypeQuery]() + return withInterceptors[[]*EventType](ctx, _q, qr, _q.inters) +} + +// AllX is like All, but panics if an error occurs. +func (_q *EventTypeQuery) AllX(ctx context.Context) []*EventType { + nodes, err := _q.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of EventType IDs. +func (_q *EventTypeQuery) 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(eventtype.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (_q *EventTypeQuery) 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 *EventTypeQuery) 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[*EventTypeQuery](), _q.inters) +} + +// CountX is like Count, but panics if an error occurs. +func (_q *EventTypeQuery) 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 *EventTypeQuery) 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 *EventTypeQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the EventTypeQuery 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 *EventTypeQuery) Clone() *EventTypeQuery { + if _q == nil { + return nil + } + return &EventTypeQuery{ + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]eventtype.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.EventType{}, _q.predicates...), + withOwner: _q.withOwner.Clone(), + withExposures: _q.withExposures.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 *EventTypeQuery) WithOwner(opts ...func(*TeamQuery)) *EventTypeQuery { + query := (&TeamClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withOwner = query + return _q +} + +// WithExposures tells the query-builder to eager-load the nodes that are connected to +// the "exposures" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *EventTypeQuery) WithExposures(opts ...func(*EventExposureQuery)) *EventTypeQuery { + query := (&EventExposureClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withExposures = 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.EventType.Query(). +// GroupBy(eventtype.FieldCreatedAt). +// Aggregate(ent.Count()). +// Scan(ctx, &v) +func (_q *EventTypeQuery) GroupBy(field string, fields ...string) *EventTypeGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &EventTypeGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields + grbuild.label = eventtype.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.EventType.Query(). +// Select(eventtype.FieldCreatedAt). +// Scan(ctx, &v) +func (_q *EventTypeQuery) Select(fields ...string) *EventTypeSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &EventTypeSelect{EventTypeQuery: _q} + sbuild.label = eventtype.Label + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan + return sbuild +} + +// Aggregate returns a EventTypeSelect configured with the given aggregations. +func (_q *EventTypeQuery) Aggregate(fns ...AggregateFunc) *EventTypeSelect { + return _q.Select().Aggregate(fns...) +} + +func (_q *EventTypeQuery) 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 !eventtype.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 eventtype.Policy == nil { + return errors.New("ent: uninitialized eventtype.Policy (forgotten import ent/runtime?)") + } + if err := eventtype.Policy.EvalQuery(ctx, _q); err != nil { + return err + } + return nil +} + +func (_q *EventTypeQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*EventType, error) { + var ( + nodes = []*EventType{} + withFKs = _q.withFKs + _spec = _q.querySpec() + loadedTypes = [2]bool{ + _q.withOwner != nil, + _q.withExposures != nil, + } + ) + if _q.withOwner != nil { + withFKs = true + } + if withFKs { + _spec.Node.Columns = append(_spec.Node.Columns, eventtype.ForeignKeys...) + } + _spec.ScanValues = func(columns []string) ([]any, error) { + return (*EventType).scanValues(nil, columns) + } + _spec.Assign = func(columns []string, values []any) error { + node := &EventType{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 *EventType, e *Team) { n.Edges.Owner = e }); err != nil { + return nil, err + } + } + if query := _q.withExposures; query != nil { + if err := _q.loadExposures(ctx, query, nodes, + func(n *EventType) { n.Edges.Exposures = []*EventExposure{} }, + func(n *EventType, e *EventExposure) { n.Edges.Exposures = append(n.Edges.Exposures, e) }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedExposures { + if err := _q.loadExposures(ctx, query, nodes, + func(n *EventType) { n.appendNamedExposures(name) }, + func(n *EventType, e *EventExposure) { n.appendNamedExposures(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 *EventTypeQuery) loadOwner(ctx context.Context, query *TeamQuery, nodes []*EventType, init func(*EventType), assign func(*EventType, *Team)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*EventType) + for i := range nodes { + if nodes[i].team_event_types == nil { + continue + } + fk := *nodes[i].team_event_types + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(team.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 "team_event_types" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (_q *EventTypeQuery) loadExposures(ctx context.Context, query *EventExposureQuery, nodes []*EventType, init func(*EventType), assign func(*EventType, *EventExposure)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*EventType) + 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(eventtype.ExposuresColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.event_type_exposures + if fk == nil { + return fmt.Errorf(`foreign-key "event_type_exposures" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "event_type_exposures" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} + +func (_q *EventTypeQuery) 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 *EventTypeQuery) querySpec() *sqlgraph.QuerySpec { + _spec := sqlgraph.NewQuerySpec(eventtype.Table, eventtype.Columns, sqlgraph.NewFieldSpec(eventtype.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, eventtype.FieldID) + for i := range fields { + if fields[i] != eventtype.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 *EventTypeQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) + t1 := builder.Table(eventtype.Table) + columns := _q.ctx.Fields + if len(columns) == 0 { + columns = eventtype.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 +} + +// WithNamedExposures tells the query-builder to eager-load the nodes that are connected to the "exposures" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *EventTypeQuery) WithNamedExposures(name string, opts ...func(*EventExposureQuery)) *EventTypeQuery { + query := (&EventExposureClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedExposures == nil { + _q.withNamedExposures = make(map[string]*EventExposureQuery) + } + _q.withNamedExposures[name] = query + return _q +} + +// EventTypeGroupBy is the group-by builder for EventType entities. +type EventTypeGroupBy struct { + selector + build *EventTypeQuery +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (_g *EventTypeGroupBy) Aggregate(fns ...AggregateFunc) *EventTypeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g +} + +// Scan applies the selector query and scans the result into the given value. +func (_g *EventTypeGroupBy) 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[*EventTypeQuery, *EventTypeGroupBy](ctx, _g.build, _g, _g.build.inters, v) +} + +func (_g *EventTypeGroupBy) sqlScan(ctx context.Context, root *EventTypeQuery, 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) +} + +// EventTypeSelect is the builder for selecting fields of EventType entities. +type EventTypeSelect struct { + *EventTypeQuery + selector +} + +// Aggregate adds the given aggregation functions to the selector query. +func (_s *EventTypeSelect) Aggregate(fns ...AggregateFunc) *EventTypeSelect { + _s.fns = append(_s.fns, fns...) + return _s +} + +// Scan applies the selector query and scans the result into the given value. +func (_s *EventTypeSelect) 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[*EventTypeQuery, *EventTypeSelect](ctx, _s.EventTypeQuery, _s, _s.inters, v) +} + +func (_s *EventTypeSelect) sqlScan(ctx context.Context, root *EventTypeQuery, 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/eventtype_update.go b/controlplane-api/ent/eventtype_update.go new file mode 100644 index 000000000..e30be1341 --- /dev/null +++ b/controlplane-api/ent/eventtype_update.go @@ -0,0 +1,889 @@ +// 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/eventexposure" + "github.com/telekom/controlplane/controlplane-api/ent/eventtype" + "github.com/telekom/controlplane/controlplane-api/ent/predicate" + "github.com/telekom/controlplane/controlplane-api/ent/team" +) + +// EventTypeUpdate is the builder for updating EventType entities. +type EventTypeUpdate struct { + config + hooks []Hook + mutation *EventTypeMutation +} + +// Where appends a list predicates to the EventTypeUpdate builder. +func (_u *EventTypeUpdate) Where(ps ...predicate.EventType) *EventTypeUpdate { + _u.mutation.Where(ps...) + return _u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_u *EventTypeUpdate) SetLastModifiedAt(v time.Time) *EventTypeUpdate { + _u.mutation.SetLastModifiedAt(v) + return _u +} + +// SetStatusPhase sets the "status_phase" field. +func (_u *EventTypeUpdate) SetStatusPhase(v eventtype.StatusPhase) *EventTypeUpdate { + _u.mutation.SetStatusPhase(v) + return _u +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_u *EventTypeUpdate) SetNillableStatusPhase(v *eventtype.StatusPhase) *EventTypeUpdate { + if v != nil { + _u.SetStatusPhase(*v) + } + return _u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (_u *EventTypeUpdate) ClearStatusPhase() *EventTypeUpdate { + _u.mutation.ClearStatusPhase() + return _u +} + +// SetStatusMessage sets the "status_message" field. +func (_u *EventTypeUpdate) SetStatusMessage(v string) *EventTypeUpdate { + _u.mutation.SetStatusMessage(v) + return _u +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_u *EventTypeUpdate) SetNillableStatusMessage(v *string) *EventTypeUpdate { + if v != nil { + _u.SetStatusMessage(*v) + } + return _u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (_u *EventTypeUpdate) ClearStatusMessage() *EventTypeUpdate { + _u.mutation.ClearStatusMessage() + return _u +} + +// SetNamespace sets the "namespace" field. +func (_u *EventTypeUpdate) SetNamespace(v string) *EventTypeUpdate { + _u.mutation.SetNamespace(v) + return _u +} + +// SetNillableNamespace sets the "namespace" field if the given value is not nil. +func (_u *EventTypeUpdate) SetNillableNamespace(v *string) *EventTypeUpdate { + if v != nil { + _u.SetNamespace(*v) + } + return _u +} + +// SetEventType sets the "event_type" field. +func (_u *EventTypeUpdate) SetEventType(v string) *EventTypeUpdate { + _u.mutation.SetEventType(v) + return _u +} + +// SetNillableEventType sets the "event_type" field if the given value is not nil. +func (_u *EventTypeUpdate) SetNillableEventType(v *string) *EventTypeUpdate { + if v != nil { + _u.SetEventType(*v) + } + return _u +} + +// SetVersion sets the "version" field. +func (_u *EventTypeUpdate) SetVersion(v string) *EventTypeUpdate { + _u.mutation.SetVersion(v) + return _u +} + +// SetNillableVersion sets the "version" field if the given value is not nil. +func (_u *EventTypeUpdate) SetNillableVersion(v *string) *EventTypeUpdate { + if v != nil { + _u.SetVersion(*v) + } + return _u +} + +// SetDescription sets the "description" field. +func (_u *EventTypeUpdate) SetDescription(v string) *EventTypeUpdate { + _u.mutation.SetDescription(v) + return _u +} + +// SetNillableDescription sets the "description" field if the given value is not nil. +func (_u *EventTypeUpdate) SetNillableDescription(v *string) *EventTypeUpdate { + if v != nil { + _u.SetDescription(*v) + } + return _u +} + +// ClearDescription clears the value of the "description" field. +func (_u *EventTypeUpdate) ClearDescription() *EventTypeUpdate { + _u.mutation.ClearDescription() + return _u +} + +// SetSpecification sets the "specification" field. +func (_u *EventTypeUpdate) SetSpecification(v string) *EventTypeUpdate { + _u.mutation.SetSpecification(v) + return _u +} + +// SetNillableSpecification sets the "specification" field if the given value is not nil. +func (_u *EventTypeUpdate) SetNillableSpecification(v *string) *EventTypeUpdate { + if v != nil { + _u.SetSpecification(*v) + } + return _u +} + +// ClearSpecification clears the value of the "specification" field. +func (_u *EventTypeUpdate) ClearSpecification() *EventTypeUpdate { + _u.mutation.ClearSpecification() + return _u +} + +// SetActive sets the "active" field. +func (_u *EventTypeUpdate) SetActive(v bool) *EventTypeUpdate { + _u.mutation.SetActive(v) + return _u +} + +// SetNillableActive sets the "active" field if the given value is not nil. +func (_u *EventTypeUpdate) SetNillableActive(v *bool) *EventTypeUpdate { + if v != nil { + _u.SetActive(*v) + } + return _u +} + +// SetOwnerID sets the "owner" edge to the Team entity by ID. +func (_u *EventTypeUpdate) SetOwnerID(id int) *EventTypeUpdate { + _u.mutation.SetOwnerID(id) + return _u +} + +// SetOwner sets the "owner" edge to the Team entity. +func (_u *EventTypeUpdate) SetOwner(v *Team) *EventTypeUpdate { + return _u.SetOwnerID(v.ID) +} + +// AddExposureIDs adds the "exposures" edge to the EventExposure entity by IDs. +func (_u *EventTypeUpdate) AddExposureIDs(ids ...int) *EventTypeUpdate { + _u.mutation.AddExposureIDs(ids...) + return _u +} + +// AddExposures adds the "exposures" edges to the EventExposure entity. +func (_u *EventTypeUpdate) AddExposures(v ...*EventExposure) *EventTypeUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddExposureIDs(ids...) +} + +// Mutation returns the EventTypeMutation object of the builder. +func (_u *EventTypeUpdate) Mutation() *EventTypeMutation { + return _u.mutation +} + +// ClearOwner clears the "owner" edge to the Team entity. +func (_u *EventTypeUpdate) ClearOwner() *EventTypeUpdate { + _u.mutation.ClearOwner() + return _u +} + +// ClearExposures clears all "exposures" edges to the EventExposure entity. +func (_u *EventTypeUpdate) ClearExposures() *EventTypeUpdate { + _u.mutation.ClearExposures() + return _u +} + +// RemoveExposureIDs removes the "exposures" edge to EventExposure entities by IDs. +func (_u *EventTypeUpdate) RemoveExposureIDs(ids ...int) *EventTypeUpdate { + _u.mutation.RemoveExposureIDs(ids...) + return _u +} + +// RemoveExposures removes "exposures" edges to EventExposure entities. +func (_u *EventTypeUpdate) RemoveExposures(v ...*EventExposure) *EventTypeUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveExposureIDs(ids...) +} + +// Save executes the query and returns the number of nodes affected by the update operation. +func (_u *EventTypeUpdate) 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 *EventTypeUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (_u *EventTypeUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_u *EventTypeUpdate) 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 *EventTypeUpdate) defaults() error { + if _, ok := _u.mutation.LastModifiedAt(); !ok { + if eventtype.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized eventtype.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := eventtype.UpdateDefaultLastModifiedAt() + _u.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_u *EventTypeUpdate) check() error { + if v, ok := _u.mutation.StatusPhase(); ok { + if err := eventtype.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "EventType.status_phase": %w`, err)} + } + } + if v, ok := _u.mutation.Namespace(); ok { + if err := eventtype.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "EventType.namespace": %w`, err)} + } + } + if v, ok := _u.mutation.EventType(); ok { + if err := eventtype.EventTypeValidator(v); err != nil { + return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "EventType.event_type": %w`, err)} + } + } + if v, ok := _u.mutation.Version(); ok { + if err := eventtype.VersionValidator(v); err != nil { + return &ValidationError{Name: "version", err: fmt.Errorf(`ent: validator failed for field "EventType.version": %w`, err)} + } + } + if _u.mutation.OwnerCleared() && len(_u.mutation.OwnerIDs()) > 0 { + return errors.New(`ent: clearing a required unique edge "EventType.owner"`) + } + return nil +} + +func (_u *EventTypeUpdate) sqlSave(ctx context.Context) (_node int, err error) { + if err := _u.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(eventtype.Table, eventtype.Columns, sqlgraph.NewFieldSpec(eventtype.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(eventtype.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := _u.mutation.StatusPhase(); ok { + _spec.SetField(eventtype.FieldStatusPhase, field.TypeEnum, value) + } + if _u.mutation.StatusPhaseCleared() { + _spec.ClearField(eventtype.FieldStatusPhase, field.TypeEnum) + } + if value, ok := _u.mutation.StatusMessage(); ok { + _spec.SetField(eventtype.FieldStatusMessage, field.TypeString, value) + } + if _u.mutation.StatusMessageCleared() { + _spec.ClearField(eventtype.FieldStatusMessage, field.TypeString) + } + if value, ok := _u.mutation.Namespace(); ok { + _spec.SetField(eventtype.FieldNamespace, field.TypeString, value) + } + if value, ok := _u.mutation.EventType(); ok { + _spec.SetField(eventtype.FieldEventType, field.TypeString, value) + } + if value, ok := _u.mutation.Version(); ok { + _spec.SetField(eventtype.FieldVersion, field.TypeString, value) + } + if value, ok := _u.mutation.Description(); ok { + _spec.SetField(eventtype.FieldDescription, field.TypeString, value) + } + if _u.mutation.DescriptionCleared() { + _spec.ClearField(eventtype.FieldDescription, field.TypeString) + } + if value, ok := _u.mutation.Specification(); ok { + _spec.SetField(eventtype.FieldSpecification, field.TypeString, value) + } + if _u.mutation.SpecificationCleared() { + _spec.ClearField(eventtype.FieldSpecification, field.TypeString) + } + if value, ok := _u.mutation.Active(); ok { + _spec.SetField(eventtype.FieldActive, field.TypeBool, value) + } + if _u.mutation.OwnerCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventtype.OwnerTable, + Columns: []string{eventtype.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(team.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: eventtype.OwnerTable, + Columns: []string{eventtype.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(team.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.ExposuresCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventtype.ExposuresTable, + Columns: []string{eventtype.ExposuresColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedExposuresIDs(); len(nodes) > 0 && !_u.mutation.ExposuresCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventtype.ExposuresTable, + Columns: []string{eventtype.ExposuresColumn}, + 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.ExposuresIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventtype.ExposuresTable, + Columns: []string{eventtype.ExposuresColumn}, + 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 _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{eventtype.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return 0, err + } + _u.mutation.done = true + return _node, nil +} + +// EventTypeUpdateOne is the builder for updating a single EventType entity. +type EventTypeUpdateOne struct { + config + fields []string + hooks []Hook + mutation *EventTypeMutation +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (_u *EventTypeUpdateOne) SetLastModifiedAt(v time.Time) *EventTypeUpdateOne { + _u.mutation.SetLastModifiedAt(v) + return _u +} + +// SetStatusPhase sets the "status_phase" field. +func (_u *EventTypeUpdateOne) SetStatusPhase(v eventtype.StatusPhase) *EventTypeUpdateOne { + _u.mutation.SetStatusPhase(v) + return _u +} + +// SetNillableStatusPhase sets the "status_phase" field if the given value is not nil. +func (_u *EventTypeUpdateOne) SetNillableStatusPhase(v *eventtype.StatusPhase) *EventTypeUpdateOne { + if v != nil { + _u.SetStatusPhase(*v) + } + return _u +} + +// ClearStatusPhase clears the value of the "status_phase" field. +func (_u *EventTypeUpdateOne) ClearStatusPhase() *EventTypeUpdateOne { + _u.mutation.ClearStatusPhase() + return _u +} + +// SetStatusMessage sets the "status_message" field. +func (_u *EventTypeUpdateOne) SetStatusMessage(v string) *EventTypeUpdateOne { + _u.mutation.SetStatusMessage(v) + return _u +} + +// SetNillableStatusMessage sets the "status_message" field if the given value is not nil. +func (_u *EventTypeUpdateOne) SetNillableStatusMessage(v *string) *EventTypeUpdateOne { + if v != nil { + _u.SetStatusMessage(*v) + } + return _u +} + +// ClearStatusMessage clears the value of the "status_message" field. +func (_u *EventTypeUpdateOne) ClearStatusMessage() *EventTypeUpdateOne { + _u.mutation.ClearStatusMessage() + return _u +} + +// SetNamespace sets the "namespace" field. +func (_u *EventTypeUpdateOne) SetNamespace(v string) *EventTypeUpdateOne { + _u.mutation.SetNamespace(v) + return _u +} + +// SetNillableNamespace sets the "namespace" field if the given value is not nil. +func (_u *EventTypeUpdateOne) SetNillableNamespace(v *string) *EventTypeUpdateOne { + if v != nil { + _u.SetNamespace(*v) + } + return _u +} + +// SetEventType sets the "event_type" field. +func (_u *EventTypeUpdateOne) SetEventType(v string) *EventTypeUpdateOne { + _u.mutation.SetEventType(v) + return _u +} + +// SetNillableEventType sets the "event_type" field if the given value is not nil. +func (_u *EventTypeUpdateOne) SetNillableEventType(v *string) *EventTypeUpdateOne { + if v != nil { + _u.SetEventType(*v) + } + return _u +} + +// SetVersion sets the "version" field. +func (_u *EventTypeUpdateOne) SetVersion(v string) *EventTypeUpdateOne { + _u.mutation.SetVersion(v) + return _u +} + +// SetNillableVersion sets the "version" field if the given value is not nil. +func (_u *EventTypeUpdateOne) SetNillableVersion(v *string) *EventTypeUpdateOne { + if v != nil { + _u.SetVersion(*v) + } + return _u +} + +// SetDescription sets the "description" field. +func (_u *EventTypeUpdateOne) SetDescription(v string) *EventTypeUpdateOne { + _u.mutation.SetDescription(v) + return _u +} + +// SetNillableDescription sets the "description" field if the given value is not nil. +func (_u *EventTypeUpdateOne) SetNillableDescription(v *string) *EventTypeUpdateOne { + if v != nil { + _u.SetDescription(*v) + } + return _u +} + +// ClearDescription clears the value of the "description" field. +func (_u *EventTypeUpdateOne) ClearDescription() *EventTypeUpdateOne { + _u.mutation.ClearDescription() + return _u +} + +// SetSpecification sets the "specification" field. +func (_u *EventTypeUpdateOne) SetSpecification(v string) *EventTypeUpdateOne { + _u.mutation.SetSpecification(v) + return _u +} + +// SetNillableSpecification sets the "specification" field if the given value is not nil. +func (_u *EventTypeUpdateOne) SetNillableSpecification(v *string) *EventTypeUpdateOne { + if v != nil { + _u.SetSpecification(*v) + } + return _u +} + +// ClearSpecification clears the value of the "specification" field. +func (_u *EventTypeUpdateOne) ClearSpecification() *EventTypeUpdateOne { + _u.mutation.ClearSpecification() + return _u +} + +// SetActive sets the "active" field. +func (_u *EventTypeUpdateOne) SetActive(v bool) *EventTypeUpdateOne { + _u.mutation.SetActive(v) + return _u +} + +// SetNillableActive sets the "active" field if the given value is not nil. +func (_u *EventTypeUpdateOne) SetNillableActive(v *bool) *EventTypeUpdateOne { + if v != nil { + _u.SetActive(*v) + } + return _u +} + +// SetOwnerID sets the "owner" edge to the Team entity by ID. +func (_u *EventTypeUpdateOne) SetOwnerID(id int) *EventTypeUpdateOne { + _u.mutation.SetOwnerID(id) + return _u +} + +// SetOwner sets the "owner" edge to the Team entity. +func (_u *EventTypeUpdateOne) SetOwner(v *Team) *EventTypeUpdateOne { + return _u.SetOwnerID(v.ID) +} + +// AddExposureIDs adds the "exposures" edge to the EventExposure entity by IDs. +func (_u *EventTypeUpdateOne) AddExposureIDs(ids ...int) *EventTypeUpdateOne { + _u.mutation.AddExposureIDs(ids...) + return _u +} + +// AddExposures adds the "exposures" edges to the EventExposure entity. +func (_u *EventTypeUpdateOne) AddExposures(v ...*EventExposure) *EventTypeUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddExposureIDs(ids...) +} + +// Mutation returns the EventTypeMutation object of the builder. +func (_u *EventTypeUpdateOne) Mutation() *EventTypeMutation { + return _u.mutation +} + +// ClearOwner clears the "owner" edge to the Team entity. +func (_u *EventTypeUpdateOne) ClearOwner() *EventTypeUpdateOne { + _u.mutation.ClearOwner() + return _u +} + +// ClearExposures clears all "exposures" edges to the EventExposure entity. +func (_u *EventTypeUpdateOne) ClearExposures() *EventTypeUpdateOne { + _u.mutation.ClearExposures() + return _u +} + +// RemoveExposureIDs removes the "exposures" edge to EventExposure entities by IDs. +func (_u *EventTypeUpdateOne) RemoveExposureIDs(ids ...int) *EventTypeUpdateOne { + _u.mutation.RemoveExposureIDs(ids...) + return _u +} + +// RemoveExposures removes "exposures" edges to EventExposure entities. +func (_u *EventTypeUpdateOne) RemoveExposures(v ...*EventExposure) *EventTypeUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveExposureIDs(ids...) +} + +// Where appends a list predicates to the EventTypeUpdate builder. +func (_u *EventTypeUpdateOne) Where(ps ...predicate.EventType) *EventTypeUpdateOne { + _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 *EventTypeUpdateOne) Select(field string, fields ...string) *EventTypeUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u +} + +// Save executes the query and returns the updated EventType entity. +func (_u *EventTypeUpdateOne) Save(ctx context.Context) (*EventType, 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 *EventTypeUpdateOne) SaveX(ctx context.Context) *EventType { + node, err := _u.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (_u *EventTypeUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (_u *EventTypeUpdateOne) 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 *EventTypeUpdateOne) defaults() error { + if _, ok := _u.mutation.LastModifiedAt(); !ok { + if eventtype.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized eventtype.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := eventtype.UpdateDefaultLastModifiedAt() + _u.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (_u *EventTypeUpdateOne) check() error { + if v, ok := _u.mutation.StatusPhase(); ok { + if err := eventtype.StatusPhaseValidator(v); err != nil { + return &ValidationError{Name: "status_phase", err: fmt.Errorf(`ent: validator failed for field "EventType.status_phase": %w`, err)} + } + } + if v, ok := _u.mutation.Namespace(); ok { + if err := eventtype.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`ent: validator failed for field "EventType.namespace": %w`, err)} + } + } + if v, ok := _u.mutation.EventType(); ok { + if err := eventtype.EventTypeValidator(v); err != nil { + return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "EventType.event_type": %w`, err)} + } + } + if v, ok := _u.mutation.Version(); ok { + if err := eventtype.VersionValidator(v); err != nil { + return &ValidationError{Name: "version", err: fmt.Errorf(`ent: validator failed for field "EventType.version": %w`, err)} + } + } + if _u.mutation.OwnerCleared() && len(_u.mutation.OwnerIDs()) > 0 { + return errors.New(`ent: clearing a required unique edge "EventType.owner"`) + } + return nil +} + +func (_u *EventTypeUpdateOne) sqlSave(ctx context.Context) (_node *EventType, err error) { + if err := _u.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(eventtype.Table, eventtype.Columns, sqlgraph.NewFieldSpec(eventtype.FieldID, field.TypeInt)) + id, ok := _u.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "EventType.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, eventtype.FieldID) + for _, f := range fields { + if !eventtype.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != eventtype.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(eventtype.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := _u.mutation.StatusPhase(); ok { + _spec.SetField(eventtype.FieldStatusPhase, field.TypeEnum, value) + } + if _u.mutation.StatusPhaseCleared() { + _spec.ClearField(eventtype.FieldStatusPhase, field.TypeEnum) + } + if value, ok := _u.mutation.StatusMessage(); ok { + _spec.SetField(eventtype.FieldStatusMessage, field.TypeString, value) + } + if _u.mutation.StatusMessageCleared() { + _spec.ClearField(eventtype.FieldStatusMessage, field.TypeString) + } + if value, ok := _u.mutation.Namespace(); ok { + _spec.SetField(eventtype.FieldNamespace, field.TypeString, value) + } + if value, ok := _u.mutation.EventType(); ok { + _spec.SetField(eventtype.FieldEventType, field.TypeString, value) + } + if value, ok := _u.mutation.Version(); ok { + _spec.SetField(eventtype.FieldVersion, field.TypeString, value) + } + if value, ok := _u.mutation.Description(); ok { + _spec.SetField(eventtype.FieldDescription, field.TypeString, value) + } + if _u.mutation.DescriptionCleared() { + _spec.ClearField(eventtype.FieldDescription, field.TypeString) + } + if value, ok := _u.mutation.Specification(); ok { + _spec.SetField(eventtype.FieldSpecification, field.TypeString, value) + } + if _u.mutation.SpecificationCleared() { + _spec.ClearField(eventtype.FieldSpecification, field.TypeString) + } + if value, ok := _u.mutation.Active(); ok { + _spec.SetField(eventtype.FieldActive, field.TypeBool, value) + } + if _u.mutation.OwnerCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: eventtype.OwnerTable, + Columns: []string{eventtype.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(team.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: eventtype.OwnerTable, + Columns: []string{eventtype.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(team.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.ExposuresCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventtype.ExposuresTable, + Columns: []string{eventtype.ExposuresColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventexposure.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedExposuresIDs(); len(nodes) > 0 && !_u.mutation.ExposuresCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventtype.ExposuresTable, + Columns: []string{eventtype.ExposuresColumn}, + 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.ExposuresIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: eventtype.ExposuresTable, + Columns: []string{eventtype.ExposuresColumn}, + 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) + } + _node = &EventType{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{eventtype.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 801975632..815daaa84 100644 --- a/controlplane-api/ent/gql_collection.go +++ b/controlplane-api/ent/gql_collection.go @@ -13,6 +13,7 @@ import ( "entgo.io/contrib/entgql" "entgo.io/ent/dialect/sql" "github.com/99designs/gqlgen/graphql" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -20,12 +21,152 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" "github.com/telekom/controlplane/controlplane-api/ent/zone" ) +// CollectFields tells the query-builder to eagerly load connected nodes by resolver context. +func (_q *APIQuery) CollectFields(ctx context.Context, satisfies ...string) (*APIQuery, 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 *APIQuery) 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(api.Columns)) + selectedFields = []string{api.FieldID} + ) + for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { + switch field.Name { + case "createdAt": + if _, ok := fieldSeen[api.FieldCreatedAt]; !ok { + selectedFields = append(selectedFields, api.FieldCreatedAt) + fieldSeen[api.FieldCreatedAt] = struct{}{} + } + case "lastModifiedAt": + if _, ok := fieldSeen[api.FieldLastModifiedAt]; !ok { + selectedFields = append(selectedFields, api.FieldLastModifiedAt) + fieldSeen[api.FieldLastModifiedAt] = struct{}{} + } + case "statusPhase": + if _, ok := fieldSeen[api.FieldStatusPhase]; !ok { + selectedFields = append(selectedFields, api.FieldStatusPhase) + fieldSeen[api.FieldStatusPhase] = struct{}{} + } + case "statusMessage": + if _, ok := fieldSeen[api.FieldStatusMessage]; !ok { + selectedFields = append(selectedFields, api.FieldStatusMessage) + fieldSeen[api.FieldStatusMessage] = struct{}{} + } + case "namespace": + if _, ok := fieldSeen[api.FieldNamespace]; !ok { + selectedFields = append(selectedFields, api.FieldNamespace) + fieldSeen[api.FieldNamespace] = struct{}{} + } + case "basePath": + if _, ok := fieldSeen[api.FieldBasePath]; !ok { + selectedFields = append(selectedFields, api.FieldBasePath) + fieldSeen[api.FieldBasePath] = struct{}{} + } + case "version": + if _, ok := fieldSeen[api.FieldVersion]; !ok { + selectedFields = append(selectedFields, api.FieldVersion) + fieldSeen[api.FieldVersion] = struct{}{} + } + case "category": + if _, ok := fieldSeen[api.FieldCategory]; !ok { + selectedFields = append(selectedFields, api.FieldCategory) + fieldSeen[api.FieldCategory] = struct{}{} + } + case "oauth2Scopes": + if _, ok := fieldSeen[api.FieldOauth2Scopes]; !ok { + selectedFields = append(selectedFields, api.FieldOauth2Scopes) + fieldSeen[api.FieldOauth2Scopes] = struct{}{} + } + case "xVendor": + if _, ok := fieldSeen[api.FieldXVendor]; !ok { + selectedFields = append(selectedFields, api.FieldXVendor) + fieldSeen[api.FieldXVendor] = struct{}{} + } + case "active": + if _, ok := fieldSeen[api.FieldActive]; !ok { + selectedFields = append(selectedFields, api.FieldActive) + fieldSeen[api.FieldActive] = struct{}{} + } + case "id": + case "__typename": + default: + unknownSeen = true + } + } + if !unknownSeen { + _q.Select(selectedFields...) + } + return nil +} + +type apiPaginateArgs struct { + first, last *int + after, before *Cursor + opts []ApiPaginateOption +} + +func newApiPaginateArgs(rv map[string]any) *apiPaginateArgs { + args := &apiPaginateArgs{} + 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 = &ApiOrder{Field: &ApiOrderField{}, 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, WithApiOrder(order)) + } + case *ApiOrder: + if v != nil { + args.opts = append(args.opts, WithApiOrder(v)) + } + } + } + if v, ok := rv[whereField].(*ApiWhereInput); ok { + args.opts = append(args.opts, WithApiFilter(v.Filter)) + } + return args +} + // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *ApiExposureQuery) CollectFields(ctx context.Context, satisfies ...string) (*ApiExposureQuery, error) { fc := graphql.GetFieldContext(ctx) @@ -58,6 +199,17 @@ func (_q *ApiExposureQuery) collectField(ctx context.Context, oneNode bool, opCt return err } _q.withOwner = query + + case "api": + var ( + alias = field.Alias + path = append(path, alias) + query = (&APIClient{config: _q.config}).Query() + ) + if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, apiImplementors)...); err != nil { + return err + } + _q.withAPI = query case "createdAt": if _, ok := fieldSeen[apiexposure.FieldCreatedAt]; !ok { selectedFields = append(selectedFields, apiexposure.FieldCreatedAt) @@ -1257,6 +1409,17 @@ func (_q *EventExposureQuery) collectField(ctx context.Context, oneNode bool, op return err } _q.withOwner = query + + case "eventTypeDef": + var ( + alias = field.Alias + path = append(path, alias) + query = (&EventTypeClient{config: _q.config}).Query() + ) + if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, eventtypeImplementors)...); err != nil { + return err + } + _q.withEventTypeDef = query case "createdAt": if _, ok := fieldSeen[eventexposure.FieldCreatedAt]; !ok { selectedFields = append(selectedFields, eventexposure.FieldCreatedAt) @@ -1539,6 +1702,135 @@ func newEventSubscriptionPaginateArgs(rv map[string]any) *eventsubscriptionPagin return args } +// CollectFields tells the query-builder to eagerly load connected nodes by resolver context. +func (_q *EventTypeQuery) CollectFields(ctx context.Context, satisfies ...string) (*EventTypeQuery, 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 *EventTypeQuery) 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(eventtype.Columns)) + selectedFields = []string{eventtype.FieldID} + ) + for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { + switch field.Name { + case "createdAt": + if _, ok := fieldSeen[eventtype.FieldCreatedAt]; !ok { + selectedFields = append(selectedFields, eventtype.FieldCreatedAt) + fieldSeen[eventtype.FieldCreatedAt] = struct{}{} + } + case "lastModifiedAt": + if _, ok := fieldSeen[eventtype.FieldLastModifiedAt]; !ok { + selectedFields = append(selectedFields, eventtype.FieldLastModifiedAt) + fieldSeen[eventtype.FieldLastModifiedAt] = struct{}{} + } + case "statusPhase": + if _, ok := fieldSeen[eventtype.FieldStatusPhase]; !ok { + selectedFields = append(selectedFields, eventtype.FieldStatusPhase) + fieldSeen[eventtype.FieldStatusPhase] = struct{}{} + } + case "statusMessage": + if _, ok := fieldSeen[eventtype.FieldStatusMessage]; !ok { + selectedFields = append(selectedFields, eventtype.FieldStatusMessage) + fieldSeen[eventtype.FieldStatusMessage] = struct{}{} + } + case "namespace": + if _, ok := fieldSeen[eventtype.FieldNamespace]; !ok { + selectedFields = append(selectedFields, eventtype.FieldNamespace) + fieldSeen[eventtype.FieldNamespace] = struct{}{} + } + case "eventType": + if _, ok := fieldSeen[eventtype.FieldEventType]; !ok { + selectedFields = append(selectedFields, eventtype.FieldEventType) + fieldSeen[eventtype.FieldEventType] = struct{}{} + } + case "version": + if _, ok := fieldSeen[eventtype.FieldVersion]; !ok { + selectedFields = append(selectedFields, eventtype.FieldVersion) + fieldSeen[eventtype.FieldVersion] = struct{}{} + } + case "description": + if _, ok := fieldSeen[eventtype.FieldDescription]; !ok { + selectedFields = append(selectedFields, eventtype.FieldDescription) + fieldSeen[eventtype.FieldDescription] = struct{}{} + } + case "active": + if _, ok := fieldSeen[eventtype.FieldActive]; !ok { + selectedFields = append(selectedFields, eventtype.FieldActive) + fieldSeen[eventtype.FieldActive] = struct{}{} + } + case "id": + case "__typename": + default: + unknownSeen = true + } + } + if !unknownSeen { + _q.Select(selectedFields...) + } + return nil +} + +type eventtypePaginateArgs struct { + first, last *int + after, before *Cursor + opts []EventTypePaginateOption +} + +func newEventTypePaginateArgs(rv map[string]any) *eventtypePaginateArgs { + args := &eventtypePaginateArgs{} + 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 = &EventTypeOrder{Field: &EventTypeOrderField{}, 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, WithEventTypeOrder(order)) + } + case *EventTypeOrder: + if v != nil { + args.opts = append(args.opts, WithEventTypeOrder(v)) + } + } + } + if v, ok := rv[whereField].(*EventTypeWhereInput); ok { + args.opts = append(args.opts, WithEventTypeFilter(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) @@ -1861,6 +2153,184 @@ func (_q *TeamQuery) collectField(ctx context.Context, oneNode bool, opCtx *grap _q.WithNamedApplications(alias, func(wq *ApplicationQuery) { *wq = *query }) + + case "apis": + var ( + alias = field.Alias + path = append(path, alias) + query = (&APIClient{config: _q.config}).Query() + ) + args := newApiPaginateArgs(fieldArgs(ctx, new(ApiWhereInput), 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 := newApiPager(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 []*Team) error { + ids := make([]driver.Value, len(nodes)) + for i := range nodes { + ids[i] = nodes[i].ID + } + var v []struct { + NodeID int `sql:"team_apis"` + Count int `sql:"count"` + } + query.Where(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(team.ApisColumn), ids...)) + }) + if err := query.GroupBy(team.ApisColumn).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 []*Team) error { + for i := range nodes { + n := len(nodes[i].Edges.Apis) + 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, apiImplementors)...); err != nil { + return err + } + } + if limit := paginateLimit(args.first, args.last); limit > 0 { + if oneNode { + pager.applyOrder(query.Limit(limit)) + } else { + modify := entgql.LimitPerRow(team.ApisColumn, limit, pager.orderExpr(query)) + query.modifiers = append(query.modifiers, modify) + } + } else { + query = pager.applyOrder(query) + } + _q.WithNamedApis(alias, func(wq *APIQuery) { + *wq = *query + }) + + case "eventTypes": + var ( + alias = field.Alias + path = append(path, alias) + query = (&EventTypeClient{config: _q.config}).Query() + ) + args := newEventTypePaginateArgs(fieldArgs(ctx, new(EventTypeWhereInput), 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 := newEventTypePager(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 []*Team) error { + ids := make([]driver.Value, len(nodes)) + for i := range nodes { + ids[i] = nodes[i].ID + } + var v []struct { + NodeID int `sql:"team_event_types"` + Count int `sql:"count"` + } + query.Where(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(team.EventTypesColumn), ids...)) + }) + if err := query.GroupBy(team.EventTypesColumn).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 []*Team) error { + for i := range nodes { + n := len(nodes[i].Edges.EventTypes) + 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, eventtypeImplementors)...); err != nil { + return err + } + } + if limit := paginateLimit(args.first, args.last); limit > 0 { + if oneNode { + pager.applyOrder(query.Limit(limit)) + } else { + modify := entgql.LimitPerRow(team.EventTypesColumn, limit, pager.orderExpr(query)) + query.modifiers = append(query.modifiers, modify) + } + } else { + query = pager.applyOrder(query) + } + _q.WithNamedEventTypes(alias, func(wq *EventTypeQuery) { + *wq = *query + }) case "createdAt": if _, ok := fieldSeen[team.FieldCreatedAt]; !ok { selectedFields = append(selectedFields, team.FieldCreatedAt) diff --git a/controlplane-api/ent/gql_edge.go b/controlplane-api/ent/gql_edge.go index 8be9df261..7893f01df 100644 --- a/controlplane-api/ent/gql_edge.go +++ b/controlplane-api/ent/gql_edge.go @@ -19,6 +19,14 @@ func (_m *ApiExposure) Owner(ctx context.Context) (*Application, error) { return result, err } +func (_m *ApiExposure) API(ctx context.Context) (*Api, error) { + result, err := _m.Edges.APIOrErr() + if IsNotLoaded(err) { + result, err = _m.QueryAPI().Only(ctx) + } + return result, MaskNotFound(err) +} + func (_m *ApiSubscription) Owner(ctx context.Context) (*Application, error) { result, err := _m.Edges.OwnerOrErr() if IsNotLoaded(err) { @@ -159,6 +167,14 @@ func (_m *EventExposure) Owner(ctx context.Context) (*Application, error) { return result, err } +func (_m *EventExposure) EventTypeDef(ctx context.Context) (*EventType, error) { + result, err := _m.Edges.EventTypeDefOrErr() + if IsNotLoaded(err) { + result, err = _m.QueryEventTypeDef().Only(ctx) + } + return result, MaskNotFound(err) +} + func (_m *EventSubscription) Owner(ctx context.Context) (*Application, error) { result, err := _m.Edges.OwnerOrErr() if IsNotLoaded(err) { @@ -248,6 +264,48 @@ func (_m *Team) Applications( return _m.QueryApplications().Paginate(ctx, after, first, before, last, opts...) } +func (_m *Team) Apis( + ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, orderBy *ApiOrder, where *ApiWhereInput, +) (*ApiConnection, error) { + opts := []ApiPaginateOption{ + WithApiOrder(orderBy), + WithApiFilter(where.Filter), + } + alias := graphql.GetFieldContext(ctx).Field.Alias + totalCount, hasTotalCount := _m.Edges.totalCount[3][alias] + if nodes, err := _m.NamedApis(alias); err == nil || hasTotalCount { + pager, err := newApiPager(opts, last != nil) + if err != nil { + return nil, err + } + conn := &ApiConnection{Edges: []*ApiEdge{}, TotalCount: totalCount} + conn.build(nodes, pager, after, first, before, last) + return conn, nil + } + return _m.QueryApis().Paginate(ctx, after, first, before, last, opts...) +} + +func (_m *Team) EventTypes( + ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, orderBy *EventTypeOrder, where *EventTypeWhereInput, +) (*EventTypeConnection, error) { + opts := []EventTypePaginateOption{ + WithEventTypeOrder(orderBy), + WithEventTypeFilter(where.Filter), + } + alias := graphql.GetFieldContext(ctx).Field.Alias + totalCount, hasTotalCount := _m.Edges.totalCount[4][alias] + if nodes, err := _m.NamedEventTypes(alias); err == nil || hasTotalCount { + pager, err := newEventTypePager(opts, last != nil) + if err != nil { + return nil, err + } + conn := &EventTypeConnection{Edges: []*EventTypeEdge{}, TotalCount: totalCount} + conn.build(nodes, pager, after, first, before, last) + return conn, nil + } + return _m.QueryEventTypes().Paginate(ctx, after, first, before, last, opts...) +} + func (_m *Zone) Applications(ctx context.Context) (result []*Application, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = _m.NamedApplications(graphql.GetFieldContext(ctx).Field.Alias) diff --git a/controlplane-api/ent/gql_node.go b/controlplane-api/ent/gql_node.go index 3a3b5ebb4..a60ed1da1 100644 --- a/controlplane-api/ent/gql_node.go +++ b/controlplane-api/ent/gql_node.go @@ -17,6 +17,7 @@ import ( "entgo.io/ent/dialect/sql/schema" "github.com/99designs/gqlgen/graphql" "github.com/hashicorp/go-multierror" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -24,6 +25,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" @@ -36,6 +38,11 @@ type Noder interface { IsNode() } +var apiImplementors = []string{"Api", "Node"} + +// IsNode implements the Node interface check for GQLGen. +func (*Api) IsNode() {} + var apiexposureImplementors = []string{"ApiExposure", "Node"} // IsNode implements the Node interface check for GQLGen. @@ -71,6 +78,11 @@ var eventsubscriptionImplementors = []string{"EventSubscription", "Node"} // IsNode implements the Node interface check for GQLGen. func (*EventSubscription) IsNode() {} +var eventtypeImplementors = []string{"EventType", "Node"} + +// IsNode implements the Node interface check for GQLGen. +func (*EventType) IsNode() {} + var groupImplementors = []string{"Group", "Node"} // IsNode implements the Node interface check for GQLGen. @@ -149,6 +161,15 @@ func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder func (c *Client) noder(ctx context.Context, table string, id int) (Noder, error) { switch table { + case api.Table: + query := c.Api.Query(). + Where(api.ID(id)) + if fc := graphql.GetFieldContext(ctx); fc != nil { + if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, apiImplementors...); err != nil { + return nil, err + } + } + return query.Only(ctx) case apiexposure.Table: query := c.ApiExposure.Query(). Where(apiexposure.ID(id)) @@ -212,6 +233,15 @@ func (c *Client) noder(ctx context.Context, table string, id int) (Noder, error) } } return query.Only(ctx) + case eventtype.Table: + query := c.EventType.Query(). + Where(eventtype.ID(id)) + if fc := graphql.GetFieldContext(ctx); fc != nil { + if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, eventtypeImplementors...); err != nil { + return nil, err + } + } + return query.Only(ctx) case group.Table: query := c.Group.Query(). Where(group.ID(id)) @@ -321,6 +351,22 @@ func (c *Client) noders(ctx context.Context, table string, ids []int) ([]Noder, idmap[id] = append(idmap[id], &noders[i]) } switch table { + case api.Table: + query := c.Api.Query(). + Where(api.IDIn(ids...)) + query, err := query.CollectFields(ctx, apiImplementors...) + 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 apiexposure.Table: query := c.ApiExposure.Query(). Where(apiexposure.IDIn(ids...)) @@ -433,6 +479,22 @@ func (c *Client) noders(ctx context.Context, table string, ids []int) ([]Noder, *noder = node } } + case eventtype.Table: + query := c.EventType.Query(). + Where(eventtype.IDIn(ids...)) + query, err := query.CollectFields(ctx, eventtypeImplementors...) + 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 e7f64a23c..8a1a2770d 100644 --- a/controlplane-api/ent/gql_pagination.go +++ b/controlplane-api/ent/gql_pagination.go @@ -17,6 +17,7 @@ import ( "entgo.io/ent/dialect/sql" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/errcode" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -24,6 +25,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" @@ -111,6 +113,320 @@ func paginateLimit(first, last *int) int { return limit } +// ApiEdge is the edge representation of Api. +type ApiEdge struct { + Node *Api `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// ApiConnection is the connection containing edges to Api. +type ApiConnection struct { + Edges []*ApiEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} + +func (c *ApiConnection) build(nodes []*Api, pager *apiPager, 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) *Api + if last != nil { + n := len(nodes) - 1 + nodeAt = func(i int) *Api { + return nodes[n-i] + } + } else { + nodeAt = func(i int) *Api { + return nodes[i] + } + } + c.Edges = make([]*ApiEdge, len(nodes)) + for i := range nodes { + node := nodeAt(i) + c.Edges[i] = &ApiEdge{ + 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) + } +} + +// ApiPaginateOption enables pagination customization. +type ApiPaginateOption func(*apiPager) error + +// WithApiOrder configures pagination ordering. +func WithApiOrder(order *ApiOrder) ApiPaginateOption { + if order == nil { + order = DefaultApiOrder + } + o := *order + return func(pager *apiPager) error { + if err := o.Direction.Validate(); err != nil { + return err + } + if o.Field == nil { + o.Field = DefaultApiOrder.Field + } + pager.order = &o + return nil + } +} + +// WithApiFilter configures pagination filter. +func WithApiFilter(filter func(*APIQuery) (*APIQuery, error)) ApiPaginateOption { + return func(pager *apiPager) error { + if filter == nil { + return errors.New("APIQuery filter cannot be nil") + } + pager.filter = filter + return nil + } +} + +type apiPager struct { + reverse bool + order *ApiOrder + filter func(*APIQuery) (*APIQuery, error) +} + +func newApiPager(opts []ApiPaginateOption, reverse bool) (*apiPager, error) { + pager := &apiPager{reverse: reverse} + for _, opt := range opts { + if err := opt(pager); err != nil { + return nil, err + } + } + if pager.order == nil { + pager.order = DefaultApiOrder + } + return pager, nil +} + +func (p *apiPager) applyFilter(query *APIQuery) (*APIQuery, error) { + if p.filter != nil { + return p.filter(query) + } + return query, nil +} + +func (p *apiPager) toCursor(_m *Api) Cursor { + return p.order.Field.toCursor(_m) +} + +func (p *apiPager) applyCursors(query *APIQuery, after, before *Cursor) (*APIQuery, error) { + direction := p.order.Direction + if p.reverse { + direction = direction.Reverse() + } + for _, predicate := range entgql.CursorsPredicate(after, before, DefaultApiOrder.Field.column, p.order.Field.column, direction) { + query = query.Where(predicate) + } + return query, nil +} + +func (p *apiPager) applyOrder(query *APIQuery) *APIQuery { + direction := p.order.Direction + if p.reverse { + direction = direction.Reverse() + } + query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) + if p.order.Field != DefaultApiOrder.Field { + query = query.Order(DefaultApiOrder.Field.toTerm(direction.OrderTermOption())) + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(p.order.Field.column) + } + return query +} + +func (p *apiPager) orderExpr(query *APIQuery) 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 != DefaultApiOrder.Field { + b.Comma().Ident(DefaultApiOrder.Field.column).Pad().WriteString(string(direction)) + } + }) +} + +// Paginate executes the query and returns a relay based cursor connection to Api. +func (_m *APIQuery) Paginate( + ctx context.Context, after *Cursor, first *int, + before *Cursor, last *int, opts ...ApiPaginateOption, +) (*ApiConnection, error) { + if err := validateFirstLast(first, last); err != nil { + return nil, err + } + pager, err := newApiPager(opts, last != nil) + if err != nil { + return nil, err + } + if _m, err = pager.applyFilter(_m); err != nil { + return nil, err + } + conn := &ApiConnection{Edges: []*ApiEdge{}} + 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 ( + // ApiOrderFieldCreatedAt orders Api by created_at. + ApiOrderFieldCreatedAt = &ApiOrderField{ + Value: func(_m *Api) (ent.Value, error) { + return _m.CreatedAt, nil + }, + column: api.FieldCreatedAt, + toTerm: api.ByCreatedAt, + toCursor: func(_m *Api) Cursor { + return Cursor{ + ID: _m.ID, + Value: _m.CreatedAt, + } + }, + } + // ApiOrderFieldLastModifiedAt orders Api by last_modified_at. + ApiOrderFieldLastModifiedAt = &ApiOrderField{ + Value: func(_m *Api) (ent.Value, error) { + return _m.LastModifiedAt, nil + }, + column: api.FieldLastModifiedAt, + toTerm: api.ByLastModifiedAt, + toCursor: func(_m *Api) Cursor { + return Cursor{ + ID: _m.ID, + Value: _m.LastModifiedAt, + } + }, + } +) + +// String implement fmt.Stringer interface. +func (f ApiOrderField) String() string { + var str string + switch f.column { + case ApiOrderFieldCreatedAt.column: + str = "CREATED_AT" + case ApiOrderFieldLastModifiedAt.column: + str = "LAST_MODIFIED_AT" + } + return str +} + +// MarshalGQL implements graphql.Marshaler interface. +func (f ApiOrderField) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(f.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (f *ApiOrderField) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("ApiOrderField %T must be a string", v) + } + switch str { + case "CREATED_AT": + *f = *ApiOrderFieldCreatedAt + case "LAST_MODIFIED_AT": + *f = *ApiOrderFieldLastModifiedAt + default: + return fmt.Errorf("%s is not a valid ApiOrderField", str) + } + return nil +} + +// ApiOrderField defines the ordering field of Api. +type ApiOrderField struct { + // Value extracts the ordering value from the given Api. + Value func(*Api) (ent.Value, error) + column string // field or computed. + toTerm func(...sql.OrderTermOption) api.OrderOption + toCursor func(*Api) Cursor +} + +// ApiOrder defines the ordering of Api. +type ApiOrder struct { + Direction OrderDirection `json:"direction"` + Field *ApiOrderField `json:"field"` +} + +// DefaultApiOrder is the default ordering of Api. +var DefaultApiOrder = &ApiOrder{ + Direction: entgql.OrderDirectionAsc, + Field: &ApiOrderField{ + Value: func(_m *Api) (ent.Value, error) { + return _m.ID, nil + }, + column: api.FieldID, + toTerm: api.ByID, + toCursor: func(_m *Api) Cursor { + return Cursor{ID: _m.ID} + }, + }, +} + +// ToEdge converts Api into ApiEdge. +func (_m *Api) ToEdge(order *ApiOrder) *ApiEdge { + if order == nil { + order = DefaultApiOrder + } + return &ApiEdge{ + Node: _m, + Cursor: order.Field.toCursor(_m), + } +} + // ApiExposureEdge is the edge representation of ApiExposure. type ApiExposureEdge struct { Node *ApiExposure `json:"node"` @@ -2435,6 +2751,320 @@ func (_m *EventSubscription) ToEdge(order *EventSubscriptionOrder) *EventSubscri } } +// EventTypeEdge is the edge representation of EventType. +type EventTypeEdge struct { + Node *EventType `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EventTypeConnection is the connection containing edges to EventType. +type EventTypeConnection struct { + Edges []*EventTypeEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} + +func (c *EventTypeConnection) build(nodes []*EventType, pager *eventtypePager, 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) *EventType + if last != nil { + n := len(nodes) - 1 + nodeAt = func(i int) *EventType { + return nodes[n-i] + } + } else { + nodeAt = func(i int) *EventType { + return nodes[i] + } + } + c.Edges = make([]*EventTypeEdge, len(nodes)) + for i := range nodes { + node := nodeAt(i) + c.Edges[i] = &EventTypeEdge{ + 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) + } +} + +// EventTypePaginateOption enables pagination customization. +type EventTypePaginateOption func(*eventtypePager) error + +// WithEventTypeOrder configures pagination ordering. +func WithEventTypeOrder(order *EventTypeOrder) EventTypePaginateOption { + if order == nil { + order = DefaultEventTypeOrder + } + o := *order + return func(pager *eventtypePager) error { + if err := o.Direction.Validate(); err != nil { + return err + } + if o.Field == nil { + o.Field = DefaultEventTypeOrder.Field + } + pager.order = &o + return nil + } +} + +// WithEventTypeFilter configures pagination filter. +func WithEventTypeFilter(filter func(*EventTypeQuery) (*EventTypeQuery, error)) EventTypePaginateOption { + return func(pager *eventtypePager) error { + if filter == nil { + return errors.New("EventTypeQuery filter cannot be nil") + } + pager.filter = filter + return nil + } +} + +type eventtypePager struct { + reverse bool + order *EventTypeOrder + filter func(*EventTypeQuery) (*EventTypeQuery, error) +} + +func newEventTypePager(opts []EventTypePaginateOption, reverse bool) (*eventtypePager, error) { + pager := &eventtypePager{reverse: reverse} + for _, opt := range opts { + if err := opt(pager); err != nil { + return nil, err + } + } + if pager.order == nil { + pager.order = DefaultEventTypeOrder + } + return pager, nil +} + +func (p *eventtypePager) applyFilter(query *EventTypeQuery) (*EventTypeQuery, error) { + if p.filter != nil { + return p.filter(query) + } + return query, nil +} + +func (p *eventtypePager) toCursor(_m *EventType) Cursor { + return p.order.Field.toCursor(_m) +} + +func (p *eventtypePager) applyCursors(query *EventTypeQuery, after, before *Cursor) (*EventTypeQuery, error) { + direction := p.order.Direction + if p.reverse { + direction = direction.Reverse() + } + for _, predicate := range entgql.CursorsPredicate(after, before, DefaultEventTypeOrder.Field.column, p.order.Field.column, direction) { + query = query.Where(predicate) + } + return query, nil +} + +func (p *eventtypePager) applyOrder(query *EventTypeQuery) *EventTypeQuery { + direction := p.order.Direction + if p.reverse { + direction = direction.Reverse() + } + query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) + if p.order.Field != DefaultEventTypeOrder.Field { + query = query.Order(DefaultEventTypeOrder.Field.toTerm(direction.OrderTermOption())) + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(p.order.Field.column) + } + return query +} + +func (p *eventtypePager) orderExpr(query *EventTypeQuery) 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 != DefaultEventTypeOrder.Field { + b.Comma().Ident(DefaultEventTypeOrder.Field.column).Pad().WriteString(string(direction)) + } + }) +} + +// Paginate executes the query and returns a relay based cursor connection to EventType. +func (_m *EventTypeQuery) Paginate( + ctx context.Context, after *Cursor, first *int, + before *Cursor, last *int, opts ...EventTypePaginateOption, +) (*EventTypeConnection, error) { + if err := validateFirstLast(first, last); err != nil { + return nil, err + } + pager, err := newEventTypePager(opts, last != nil) + if err != nil { + return nil, err + } + if _m, err = pager.applyFilter(_m); err != nil { + return nil, err + } + conn := &EventTypeConnection{Edges: []*EventTypeEdge{}} + 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 ( + // EventTypeOrderFieldCreatedAt orders EventType by created_at. + EventTypeOrderFieldCreatedAt = &EventTypeOrderField{ + Value: func(_m *EventType) (ent.Value, error) { + return _m.CreatedAt, nil + }, + column: eventtype.FieldCreatedAt, + toTerm: eventtype.ByCreatedAt, + toCursor: func(_m *EventType) Cursor { + return Cursor{ + ID: _m.ID, + Value: _m.CreatedAt, + } + }, + } + // EventTypeOrderFieldLastModifiedAt orders EventType by last_modified_at. + EventTypeOrderFieldLastModifiedAt = &EventTypeOrderField{ + Value: func(_m *EventType) (ent.Value, error) { + return _m.LastModifiedAt, nil + }, + column: eventtype.FieldLastModifiedAt, + toTerm: eventtype.ByLastModifiedAt, + toCursor: func(_m *EventType) Cursor { + return Cursor{ + ID: _m.ID, + Value: _m.LastModifiedAt, + } + }, + } +) + +// String implement fmt.Stringer interface. +func (f EventTypeOrderField) String() string { + var str string + switch f.column { + case EventTypeOrderFieldCreatedAt.column: + str = "CREATED_AT" + case EventTypeOrderFieldLastModifiedAt.column: + str = "LAST_MODIFIED_AT" + } + return str +} + +// MarshalGQL implements graphql.Marshaler interface. +func (f EventTypeOrderField) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(f.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (f *EventTypeOrderField) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("EventTypeOrderField %T must be a string", v) + } + switch str { + case "CREATED_AT": + *f = *EventTypeOrderFieldCreatedAt + case "LAST_MODIFIED_AT": + *f = *EventTypeOrderFieldLastModifiedAt + default: + return fmt.Errorf("%s is not a valid EventTypeOrderField", str) + } + return nil +} + +// EventTypeOrderField defines the ordering field of EventType. +type EventTypeOrderField struct { + // Value extracts the ordering value from the given EventType. + Value func(*EventType) (ent.Value, error) + column string // field or computed. + toTerm func(...sql.OrderTermOption) eventtype.OrderOption + toCursor func(*EventType) Cursor +} + +// EventTypeOrder defines the ordering of EventType. +type EventTypeOrder struct { + Direction OrderDirection `json:"direction"` + Field *EventTypeOrderField `json:"field"` +} + +// DefaultEventTypeOrder is the default ordering of EventType. +var DefaultEventTypeOrder = &EventTypeOrder{ + Direction: entgql.OrderDirectionAsc, + Field: &EventTypeOrderField{ + Value: func(_m *EventType) (ent.Value, error) { + return _m.ID, nil + }, + column: eventtype.FieldID, + toTerm: eventtype.ByID, + toCursor: func(_m *EventType) Cursor { + return Cursor{ID: _m.ID} + }, + }, +} + +// ToEdge converts EventType into EventTypeEdge. +func (_m *EventType) ToEdge(order *EventTypeOrder) *EventTypeEdge { + if order == nil { + order = DefaultEventTypeOrder + } + return &EventTypeEdge{ + 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_where_input.go b/controlplane-api/ent/gql_where_input.go index 462490c6e..f7ee0e0ac 100644 --- a/controlplane-api/ent/gql_where_input.go +++ b/controlplane-api/ent/gql_where_input.go @@ -10,6 +10,7 @@ import ( "fmt" "time" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -17,6 +18,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/predicate" @@ -24,12 +26,12 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent/zone" ) -// ApiExposureWhereInput represents a where input for filtering ApiExposure queries. -type ApiExposureWhereInput struct { - Predicates []predicate.ApiExposure `json:"-"` - Not *ApiExposureWhereInput `json:"not,omitempty"` - Or []*ApiExposureWhereInput `json:"or,omitempty"` - And []*ApiExposureWhereInput `json:"and,omitempty"` +// ApiWhereInput represents a where input for filtering Api queries. +type ApiWhereInput struct { + Predicates []predicate.Api `json:"-"` + Not *ApiWhereInput `json:"not,omitempty"` + Or []*ApiWhereInput `json:"or,omitempty"` + And []*ApiWhereInput `json:"and,omitempty"` // "id" field predicates. ID *int `json:"id,omitempty"` @@ -62,12 +64,12 @@ type ApiExposureWhereInput struct { LastModifiedAtLTE *time.Time `json:"lastModifiedAtLTE,omitempty"` // "status_phase" field predicates. - StatusPhase *apiexposure.StatusPhase `json:"statusPhase,omitempty"` - StatusPhaseNEQ *apiexposure.StatusPhase `json:"statusPhaseNEQ,omitempty"` - StatusPhaseIn []apiexposure.StatusPhase `json:"statusPhaseIn,omitempty"` - StatusPhaseNotIn []apiexposure.StatusPhase `json:"statusPhaseNotIn,omitempty"` - StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` - StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` + StatusPhase *api.StatusPhase `json:"statusPhase,omitempty"` + StatusPhaseNEQ *api.StatusPhase `json:"statusPhaseNEQ,omitempty"` + StatusPhaseIn []api.StatusPhase `json:"statusPhaseIn,omitempty"` + StatusPhaseNotIn []api.StatusPhase `json:"statusPhaseNotIn,omitempty"` + StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` + StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` // "status_message" field predicates. StatusMessage *string `json:"statusMessage,omitempty"` @@ -86,23 +88,6 @@ type ApiExposureWhereInput struct { 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"` @@ -133,57 +118,85 @@ type ApiExposureWhereInput struct { BasePathEqualFold *string `json:"basePathEqualFold,omitempty"` BasePathContainsFold *string `json:"basePathContainsFold,omitempty"` - // "visibility" field predicates. - Visibility *apiexposure.Visibility `json:"visibility,omitempty"` - VisibilityNEQ *apiexposure.Visibility `json:"visibilityNEQ,omitempty"` - VisibilityIn []apiexposure.Visibility `json:"visibilityIn,omitempty"` - VisibilityNotIn []apiexposure.Visibility `json:"visibilityNotIn,omitempty"` + // "version" field predicates. + Version *string `json:"version,omitempty"` + VersionNEQ *string `json:"versionNEQ,omitempty"` + VersionIn []string `json:"versionIn,omitempty"` + VersionNotIn []string `json:"versionNotIn,omitempty"` + VersionGT *string `json:"versionGT,omitempty"` + VersionGTE *string `json:"versionGTE,omitempty"` + VersionLT *string `json:"versionLT,omitempty"` + VersionLTE *string `json:"versionLTE,omitempty"` + VersionContains *string `json:"versionContains,omitempty"` + VersionHasPrefix *string `json:"versionHasPrefix,omitempty"` + VersionHasSuffix *string `json:"versionHasSuffix,omitempty"` + VersionEqualFold *string `json:"versionEqualFold,omitempty"` + VersionContainsFold *string `json:"versionContainsFold,omitempty"` - // "active" field predicates. - Active *bool `json:"active,omitempty"` - ActiveNEQ *bool `json:"activeNEQ,omitempty"` - ActiveIsNil bool `json:"activeIsNil,omitempty"` - ActiveNotNil bool `json:"activeNotNil,omitempty"` + // "category" field predicates. + Category *string `json:"category,omitempty"` + CategoryNEQ *string `json:"categoryNEQ,omitempty"` + CategoryIn []string `json:"categoryIn,omitempty"` + CategoryNotIn []string `json:"categoryNotIn,omitempty"` + CategoryGT *string `json:"categoryGT,omitempty"` + CategoryGTE *string `json:"categoryGTE,omitempty"` + CategoryLT *string `json:"categoryLT,omitempty"` + CategoryLTE *string `json:"categoryLTE,omitempty"` + CategoryContains *string `json:"categoryContains,omitempty"` + CategoryHasPrefix *string `json:"categoryHasPrefix,omitempty"` + CategoryHasSuffix *string `json:"categoryHasSuffix,omitempty"` + CategoryIsNil bool `json:"categoryIsNil,omitempty"` + CategoryNotNil bool `json:"categoryNotNil,omitempty"` + CategoryEqualFold *string `json:"categoryEqualFold,omitempty"` + CategoryContainsFold *string `json:"categoryContainsFold,omitempty"` + + // "x_vendor" field predicates. + XVendor *bool `json:"xVendor,omitempty"` + XVendorNEQ *bool `json:"xVendorNEQ,omitempty"` + + // "specification" field predicates. + Specification *string `json:"specification,omitempty"` + SpecificationNEQ *string `json:"specificationNEQ,omitempty"` + SpecificationIn []string `json:"specificationIn,omitempty"` + SpecificationNotIn []string `json:"specificationNotIn,omitempty"` + SpecificationGT *string `json:"specificationGT,omitempty"` + SpecificationGTE *string `json:"specificationGTE,omitempty"` + SpecificationLT *string `json:"specificationLT,omitempty"` + SpecificationLTE *string `json:"specificationLTE,omitempty"` + SpecificationContains *string `json:"specificationContains,omitempty"` + SpecificationHasPrefix *string `json:"specificationHasPrefix,omitempty"` + SpecificationHasSuffix *string `json:"specificationHasSuffix,omitempty"` + SpecificationIsNil bool `json:"specificationIsNil,omitempty"` + SpecificationNotNil bool `json:"specificationNotNil,omitempty"` + SpecificationEqualFold *string `json:"specificationEqualFold,omitempty"` + SpecificationContainsFold *string `json:"specificationContainsFold,omitempty"` - // "api_version" field predicates. - APIVersion *string `json:"apiVersion,omitempty"` - APIVersionNEQ *string `json:"apiVersionNEQ,omitempty"` - APIVersionIn []string `json:"apiVersionIn,omitempty"` - APIVersionNotIn []string `json:"apiVersionNotIn,omitempty"` - APIVersionGT *string `json:"apiVersionGT,omitempty"` - APIVersionGTE *string `json:"apiVersionGTE,omitempty"` - APIVersionLT *string `json:"apiVersionLT,omitempty"` - APIVersionLTE *string `json:"apiVersionLTE,omitempty"` - APIVersionContains *string `json:"apiVersionContains,omitempty"` - APIVersionHasPrefix *string `json:"apiVersionHasPrefix,omitempty"` - APIVersionHasSuffix *string `json:"apiVersionHasSuffix,omitempty"` - APIVersionIsNil bool `json:"apiVersionIsNil,omitempty"` - APIVersionNotNil bool `json:"apiVersionNotNil,omitempty"` - APIVersionEqualFold *string `json:"apiVersionEqualFold,omitempty"` - APIVersionContainsFold *string `json:"apiVersionContainsFold,omitempty"` + // "active" field predicates. + Active *bool `json:"active,omitempty"` + ActiveNEQ *bool `json:"activeNEQ,omitempty"` // "owner" edge predicates. - HasOwner *bool `json:"hasOwner,omitempty"` - HasOwnerWith []*ApplicationWhereInput `json:"hasOwnerWith,omitempty"` + HasOwner *bool `json:"hasOwner,omitempty"` + HasOwnerWith []*TeamWhereInput `json:"hasOwnerWith,omitempty"` - // "subscriptions" edge predicates. - HasSubscriptions *bool `json:"hasSubscriptions,omitempty"` - HasSubscriptionsWith []*ApiSubscriptionWhereInput `json:"hasSubscriptionsWith,omitempty"` + // "exposures" edge predicates. + HasExposures *bool `json:"hasExposures,omitempty"` + HasExposuresWith []*ApiExposureWhereInput `json:"hasExposuresWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. -func (i *ApiExposureWhereInput) AddPredicates(predicates ...predicate.ApiExposure) { +func (i *ApiWhereInput) AddPredicates(predicates ...predicate.Api) { i.Predicates = append(i.Predicates, predicates...) } -// Filter applies the ApiExposureWhereInput filter on the ApiExposureQuery builder. -func (i *ApiExposureWhereInput) Filter(q *ApiExposureQuery) (*ApiExposureQuery, error) { +// Filter applies the ApiWhereInput filter on the APIQuery builder. +func (i *ApiWhereInput) Filter(q *APIQuery) (*APIQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { - if err == ErrEmptyApiExposureWhereInput { + if err == ErrEmptyApiWhereInput { return q, nil } return nil, err @@ -191,19 +204,19 @@ func (i *ApiExposureWhereInput) Filter(q *ApiExposureQuery) (*ApiExposureQuery, return q.Where(p), nil } -// ErrEmptyApiExposureWhereInput is returned in case the ApiExposureWhereInput is empty. -var ErrEmptyApiExposureWhereInput = errors.New("ent: empty predicate ApiExposureWhereInput") +// ErrEmptyApiWhereInput is returned in case the ApiWhereInput is empty. +var ErrEmptyApiWhereInput = errors.New("ent: empty predicate ApiWhereInput") -// P returns a predicate for filtering apiexposures. +// P returns a predicate for filtering apis. // An error is returned if the input is empty or invalid. -func (i *ApiExposureWhereInput) P() (predicate.ApiExposure, error) { - var predicates []predicate.ApiExposure +func (i *ApiWhereInput) P() (predicate.Api, error) { + var predicates []predicate.Api if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } - predicates = append(predicates, apiexposure.Not(p)) + predicates = append(predicates, api.Not(p)) } switch n := len(i.Or); { case n == 1: @@ -213,7 +226,7 @@ func (i *ApiExposureWhereInput) P() (predicate.ApiExposure, error) { } predicates = append(predicates, p) case n > 1: - or := make([]predicate.ApiExposure, 0, n) + or := make([]predicate.Api, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { @@ -221,7 +234,7 @@ func (i *ApiExposureWhereInput) P() (predicate.ApiExposure, error) { } or = append(or, p) } - predicates = append(predicates, apiexposure.Or(or...)) + predicates = append(predicates, api.Or(or...)) } switch n := len(i.And); { case n == 1: @@ -231,7 +244,7 @@ func (i *ApiExposureWhereInput) P() (predicate.ApiExposure, error) { } predicates = append(predicates, p) case n > 1: - and := make([]predicate.ApiExposure, 0, n) + and := make([]predicate.Api, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { @@ -239,389 +252,416 @@ func (i *ApiExposureWhereInput) P() (predicate.ApiExposure, error) { } and = append(and, p) } - predicates = append(predicates, apiexposure.And(and...)) + predicates = append(predicates, api.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { - predicates = append(predicates, apiexposure.IDEQ(*i.ID)) + predicates = append(predicates, api.IDEQ(*i.ID)) } if i.IDNEQ != nil { - predicates = append(predicates, apiexposure.IDNEQ(*i.IDNEQ)) + predicates = append(predicates, api.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { - predicates = append(predicates, apiexposure.IDIn(i.IDIn...)) + predicates = append(predicates, api.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { - predicates = append(predicates, apiexposure.IDNotIn(i.IDNotIn...)) + predicates = append(predicates, api.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { - predicates = append(predicates, apiexposure.IDGT(*i.IDGT)) + predicates = append(predicates, api.IDGT(*i.IDGT)) } if i.IDGTE != nil { - predicates = append(predicates, apiexposure.IDGTE(*i.IDGTE)) + predicates = append(predicates, api.IDGTE(*i.IDGTE)) } if i.IDLT != nil { - predicates = append(predicates, apiexposure.IDLT(*i.IDLT)) + predicates = append(predicates, api.IDLT(*i.IDLT)) } if i.IDLTE != nil { - predicates = append(predicates, apiexposure.IDLTE(*i.IDLTE)) + predicates = append(predicates, api.IDLTE(*i.IDLTE)) } if i.CreatedAt != nil { - predicates = append(predicates, apiexposure.CreatedAtEQ(*i.CreatedAt)) + predicates = append(predicates, api.CreatedAtEQ(*i.CreatedAt)) } if i.CreatedAtNEQ != nil { - predicates = append(predicates, apiexposure.CreatedAtNEQ(*i.CreatedAtNEQ)) + predicates = append(predicates, api.CreatedAtNEQ(*i.CreatedAtNEQ)) } if len(i.CreatedAtIn) > 0 { - predicates = append(predicates, apiexposure.CreatedAtIn(i.CreatedAtIn...)) + predicates = append(predicates, api.CreatedAtIn(i.CreatedAtIn...)) } if len(i.CreatedAtNotIn) > 0 { - predicates = append(predicates, apiexposure.CreatedAtNotIn(i.CreatedAtNotIn...)) + predicates = append(predicates, api.CreatedAtNotIn(i.CreatedAtNotIn...)) } if i.CreatedAtGT != nil { - predicates = append(predicates, apiexposure.CreatedAtGT(*i.CreatedAtGT)) + predicates = append(predicates, api.CreatedAtGT(*i.CreatedAtGT)) } if i.CreatedAtGTE != nil { - predicates = append(predicates, apiexposure.CreatedAtGTE(*i.CreatedAtGTE)) + predicates = append(predicates, api.CreatedAtGTE(*i.CreatedAtGTE)) } if i.CreatedAtLT != nil { - predicates = append(predicates, apiexposure.CreatedAtLT(*i.CreatedAtLT)) + predicates = append(predicates, api.CreatedAtLT(*i.CreatedAtLT)) } if i.CreatedAtLTE != nil { - predicates = append(predicates, apiexposure.CreatedAtLTE(*i.CreatedAtLTE)) + predicates = append(predicates, api.CreatedAtLTE(*i.CreatedAtLTE)) } if i.LastModifiedAt != nil { - predicates = append(predicates, apiexposure.LastModifiedAtEQ(*i.LastModifiedAt)) + predicates = append(predicates, api.LastModifiedAtEQ(*i.LastModifiedAt)) } if i.LastModifiedAtNEQ != nil { - predicates = append(predicates, apiexposure.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + predicates = append(predicates, api.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) } if len(i.LastModifiedAtIn) > 0 { - predicates = append(predicates, apiexposure.LastModifiedAtIn(i.LastModifiedAtIn...)) + predicates = append(predicates, api.LastModifiedAtIn(i.LastModifiedAtIn...)) } if len(i.LastModifiedAtNotIn) > 0 { - predicates = append(predicates, apiexposure.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + predicates = append(predicates, api.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) } if i.LastModifiedAtGT != nil { - predicates = append(predicates, apiexposure.LastModifiedAtGT(*i.LastModifiedAtGT)) + predicates = append(predicates, api.LastModifiedAtGT(*i.LastModifiedAtGT)) } if i.LastModifiedAtGTE != nil { - predicates = append(predicates, apiexposure.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + predicates = append(predicates, api.LastModifiedAtGTE(*i.LastModifiedAtGTE)) } if i.LastModifiedAtLT != nil { - predicates = append(predicates, apiexposure.LastModifiedAtLT(*i.LastModifiedAtLT)) + predicates = append(predicates, api.LastModifiedAtLT(*i.LastModifiedAtLT)) } if i.LastModifiedAtLTE != nil { - predicates = append(predicates, apiexposure.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + predicates = append(predicates, api.LastModifiedAtLTE(*i.LastModifiedAtLTE)) } if i.StatusPhase != nil { - predicates = append(predicates, apiexposure.StatusPhaseEQ(*i.StatusPhase)) + predicates = append(predicates, api.StatusPhaseEQ(*i.StatusPhase)) } if i.StatusPhaseNEQ != nil { - predicates = append(predicates, apiexposure.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + predicates = append(predicates, api.StatusPhaseNEQ(*i.StatusPhaseNEQ)) } if len(i.StatusPhaseIn) > 0 { - predicates = append(predicates, apiexposure.StatusPhaseIn(i.StatusPhaseIn...)) + predicates = append(predicates, api.StatusPhaseIn(i.StatusPhaseIn...)) } if len(i.StatusPhaseNotIn) > 0 { - predicates = append(predicates, apiexposure.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + predicates = append(predicates, api.StatusPhaseNotIn(i.StatusPhaseNotIn...)) } if i.StatusPhaseIsNil { - predicates = append(predicates, apiexposure.StatusPhaseIsNil()) + predicates = append(predicates, api.StatusPhaseIsNil()) } if i.StatusPhaseNotNil { - predicates = append(predicates, apiexposure.StatusPhaseNotNil()) + predicates = append(predicates, api.StatusPhaseNotNil()) } if i.StatusMessage != nil { - predicates = append(predicates, apiexposure.StatusMessageEQ(*i.StatusMessage)) + predicates = append(predicates, api.StatusMessageEQ(*i.StatusMessage)) } if i.StatusMessageNEQ != nil { - predicates = append(predicates, apiexposure.StatusMessageNEQ(*i.StatusMessageNEQ)) + predicates = append(predicates, api.StatusMessageNEQ(*i.StatusMessageNEQ)) } if len(i.StatusMessageIn) > 0 { - predicates = append(predicates, apiexposure.StatusMessageIn(i.StatusMessageIn...)) + predicates = append(predicates, api.StatusMessageIn(i.StatusMessageIn...)) } if len(i.StatusMessageNotIn) > 0 { - predicates = append(predicates, apiexposure.StatusMessageNotIn(i.StatusMessageNotIn...)) + predicates = append(predicates, api.StatusMessageNotIn(i.StatusMessageNotIn...)) } if i.StatusMessageGT != nil { - predicates = append(predicates, apiexposure.StatusMessageGT(*i.StatusMessageGT)) + predicates = append(predicates, api.StatusMessageGT(*i.StatusMessageGT)) } if i.StatusMessageGTE != nil { - predicates = append(predicates, apiexposure.StatusMessageGTE(*i.StatusMessageGTE)) + predicates = append(predicates, api.StatusMessageGTE(*i.StatusMessageGTE)) } if i.StatusMessageLT != nil { - predicates = append(predicates, apiexposure.StatusMessageLT(*i.StatusMessageLT)) + predicates = append(predicates, api.StatusMessageLT(*i.StatusMessageLT)) } if i.StatusMessageLTE != nil { - predicates = append(predicates, apiexposure.StatusMessageLTE(*i.StatusMessageLTE)) + predicates = append(predicates, api.StatusMessageLTE(*i.StatusMessageLTE)) } if i.StatusMessageContains != nil { - predicates = append(predicates, apiexposure.StatusMessageContains(*i.StatusMessageContains)) + predicates = append(predicates, api.StatusMessageContains(*i.StatusMessageContains)) } if i.StatusMessageHasPrefix != nil { - predicates = append(predicates, apiexposure.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) + predicates = append(predicates, api.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) } if i.StatusMessageHasSuffix != nil { - predicates = append(predicates, apiexposure.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) + predicates = append(predicates, api.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) } if i.StatusMessageIsNil { - predicates = append(predicates, apiexposure.StatusMessageIsNil()) + predicates = append(predicates, api.StatusMessageIsNil()) } if i.StatusMessageNotNil { - predicates = append(predicates, apiexposure.StatusMessageNotNil()) + predicates = append(predicates, api.StatusMessageNotNil()) } if i.StatusMessageEqualFold != nil { - predicates = append(predicates, apiexposure.StatusMessageEqualFold(*i.StatusMessageEqualFold)) + predicates = append(predicates, api.StatusMessageEqualFold(*i.StatusMessageEqualFold)) } if i.StatusMessageContainsFold != nil { - predicates = append(predicates, apiexposure.StatusMessageContainsFold(*i.StatusMessageContainsFold)) - } - if i.Environment != nil { - predicates = append(predicates, apiexposure.EnvironmentEQ(*i.Environment)) - } - if i.EnvironmentNEQ != nil { - predicates = append(predicates, apiexposure.EnvironmentNEQ(*i.EnvironmentNEQ)) - } - if len(i.EnvironmentIn) > 0 { - predicates = append(predicates, apiexposure.EnvironmentIn(i.EnvironmentIn...)) - } - if len(i.EnvironmentNotIn) > 0 { - predicates = append(predicates, apiexposure.EnvironmentNotIn(i.EnvironmentNotIn...)) - } - if i.EnvironmentGT != nil { - predicates = append(predicates, apiexposure.EnvironmentGT(*i.EnvironmentGT)) - } - if i.EnvironmentGTE != nil { - predicates = append(predicates, apiexposure.EnvironmentGTE(*i.EnvironmentGTE)) - } - if i.EnvironmentLT != nil { - predicates = append(predicates, apiexposure.EnvironmentLT(*i.EnvironmentLT)) - } - if i.EnvironmentLTE != nil { - predicates = append(predicates, apiexposure.EnvironmentLTE(*i.EnvironmentLTE)) - } - if i.EnvironmentContains != nil { - predicates = append(predicates, apiexposure.EnvironmentContains(*i.EnvironmentContains)) - } - if i.EnvironmentHasPrefix != nil { - predicates = append(predicates, apiexposure.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) - } - if i.EnvironmentHasSuffix != nil { - predicates = append(predicates, apiexposure.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) - } - if i.EnvironmentIsNil { - predicates = append(predicates, apiexposure.EnvironmentIsNil()) - } - if i.EnvironmentNotNil { - predicates = append(predicates, apiexposure.EnvironmentNotNil()) - } - if i.EnvironmentEqualFold != nil { - predicates = append(predicates, apiexposure.EnvironmentEqualFold(*i.EnvironmentEqualFold)) - } - if i.EnvironmentContainsFold != nil { - predicates = append(predicates, apiexposure.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + predicates = append(predicates, api.StatusMessageContainsFold(*i.StatusMessageContainsFold)) } if i.Namespace != nil { - predicates = append(predicates, apiexposure.NamespaceEQ(*i.Namespace)) + predicates = append(predicates, api.NamespaceEQ(*i.Namespace)) } if i.NamespaceNEQ != nil { - predicates = append(predicates, apiexposure.NamespaceNEQ(*i.NamespaceNEQ)) + predicates = append(predicates, api.NamespaceNEQ(*i.NamespaceNEQ)) } if len(i.NamespaceIn) > 0 { - predicates = append(predicates, apiexposure.NamespaceIn(i.NamespaceIn...)) + predicates = append(predicates, api.NamespaceIn(i.NamespaceIn...)) } if len(i.NamespaceNotIn) > 0 { - predicates = append(predicates, apiexposure.NamespaceNotIn(i.NamespaceNotIn...)) + predicates = append(predicates, api.NamespaceNotIn(i.NamespaceNotIn...)) } if i.NamespaceGT != nil { - predicates = append(predicates, apiexposure.NamespaceGT(*i.NamespaceGT)) + predicates = append(predicates, api.NamespaceGT(*i.NamespaceGT)) } if i.NamespaceGTE != nil { - predicates = append(predicates, apiexposure.NamespaceGTE(*i.NamespaceGTE)) + predicates = append(predicates, api.NamespaceGTE(*i.NamespaceGTE)) } if i.NamespaceLT != nil { - predicates = append(predicates, apiexposure.NamespaceLT(*i.NamespaceLT)) + predicates = append(predicates, api.NamespaceLT(*i.NamespaceLT)) } if i.NamespaceLTE != nil { - predicates = append(predicates, apiexposure.NamespaceLTE(*i.NamespaceLTE)) + predicates = append(predicates, api.NamespaceLTE(*i.NamespaceLTE)) } if i.NamespaceContains != nil { - predicates = append(predicates, apiexposure.NamespaceContains(*i.NamespaceContains)) + predicates = append(predicates, api.NamespaceContains(*i.NamespaceContains)) } if i.NamespaceHasPrefix != nil { - predicates = append(predicates, apiexposure.NamespaceHasPrefix(*i.NamespaceHasPrefix)) + predicates = append(predicates, api.NamespaceHasPrefix(*i.NamespaceHasPrefix)) } if i.NamespaceHasSuffix != nil { - predicates = append(predicates, apiexposure.NamespaceHasSuffix(*i.NamespaceHasSuffix)) + predicates = append(predicates, api.NamespaceHasSuffix(*i.NamespaceHasSuffix)) } if i.NamespaceEqualFold != nil { - predicates = append(predicates, apiexposure.NamespaceEqualFold(*i.NamespaceEqualFold)) + predicates = append(predicates, api.NamespaceEqualFold(*i.NamespaceEqualFold)) } if i.NamespaceContainsFold != nil { - predicates = append(predicates, apiexposure.NamespaceContainsFold(*i.NamespaceContainsFold)) + predicates = append(predicates, api.NamespaceContainsFold(*i.NamespaceContainsFold)) } if i.BasePath != nil { - predicates = append(predicates, apiexposure.BasePathEQ(*i.BasePath)) + predicates = append(predicates, api.BasePathEQ(*i.BasePath)) } if i.BasePathNEQ != nil { - predicates = append(predicates, apiexposure.BasePathNEQ(*i.BasePathNEQ)) + predicates = append(predicates, api.BasePathNEQ(*i.BasePathNEQ)) } if len(i.BasePathIn) > 0 { - predicates = append(predicates, apiexposure.BasePathIn(i.BasePathIn...)) + predicates = append(predicates, api.BasePathIn(i.BasePathIn...)) } if len(i.BasePathNotIn) > 0 { - predicates = append(predicates, apiexposure.BasePathNotIn(i.BasePathNotIn...)) + predicates = append(predicates, api.BasePathNotIn(i.BasePathNotIn...)) } if i.BasePathGT != nil { - predicates = append(predicates, apiexposure.BasePathGT(*i.BasePathGT)) + predicates = append(predicates, api.BasePathGT(*i.BasePathGT)) } if i.BasePathGTE != nil { - predicates = append(predicates, apiexposure.BasePathGTE(*i.BasePathGTE)) + predicates = append(predicates, api.BasePathGTE(*i.BasePathGTE)) } if i.BasePathLT != nil { - predicates = append(predicates, apiexposure.BasePathLT(*i.BasePathLT)) + predicates = append(predicates, api.BasePathLT(*i.BasePathLT)) } if i.BasePathLTE != nil { - predicates = append(predicates, apiexposure.BasePathLTE(*i.BasePathLTE)) + predicates = append(predicates, api.BasePathLTE(*i.BasePathLTE)) } if i.BasePathContains != nil { - predicates = append(predicates, apiexposure.BasePathContains(*i.BasePathContains)) + predicates = append(predicates, api.BasePathContains(*i.BasePathContains)) } if i.BasePathHasPrefix != nil { - predicates = append(predicates, apiexposure.BasePathHasPrefix(*i.BasePathHasPrefix)) + predicates = append(predicates, api.BasePathHasPrefix(*i.BasePathHasPrefix)) } if i.BasePathHasSuffix != nil { - predicates = append(predicates, apiexposure.BasePathHasSuffix(*i.BasePathHasSuffix)) + predicates = append(predicates, api.BasePathHasSuffix(*i.BasePathHasSuffix)) } if i.BasePathEqualFold != nil { - predicates = append(predicates, apiexposure.BasePathEqualFold(*i.BasePathEqualFold)) + predicates = append(predicates, api.BasePathEqualFold(*i.BasePathEqualFold)) } if i.BasePathContainsFold != nil { - predicates = append(predicates, apiexposure.BasePathContainsFold(*i.BasePathContainsFold)) + predicates = append(predicates, api.BasePathContainsFold(*i.BasePathContainsFold)) } - if i.Visibility != nil { - predicates = append(predicates, apiexposure.VisibilityEQ(*i.Visibility)) + if i.Version != nil { + predicates = append(predicates, api.VersionEQ(*i.Version)) } - if i.VisibilityNEQ != nil { - predicates = append(predicates, apiexposure.VisibilityNEQ(*i.VisibilityNEQ)) + if i.VersionNEQ != nil { + predicates = append(predicates, api.VersionNEQ(*i.VersionNEQ)) } - if len(i.VisibilityIn) > 0 { - predicates = append(predicates, apiexposure.VisibilityIn(i.VisibilityIn...)) + if len(i.VersionIn) > 0 { + predicates = append(predicates, api.VersionIn(i.VersionIn...)) } - if len(i.VisibilityNotIn) > 0 { - predicates = append(predicates, apiexposure.VisibilityNotIn(i.VisibilityNotIn...)) + if len(i.VersionNotIn) > 0 { + predicates = append(predicates, api.VersionNotIn(i.VersionNotIn...)) } - if i.Active != nil { - predicates = append(predicates, apiexposure.ActiveEQ(*i.Active)) + if i.VersionGT != nil { + predicates = append(predicates, api.VersionGT(*i.VersionGT)) } - if i.ActiveNEQ != nil { - predicates = append(predicates, apiexposure.ActiveNEQ(*i.ActiveNEQ)) + if i.VersionGTE != nil { + predicates = append(predicates, api.VersionGTE(*i.VersionGTE)) } - if i.ActiveIsNil { - predicates = append(predicates, apiexposure.ActiveIsNil()) + if i.VersionLT != nil { + predicates = append(predicates, api.VersionLT(*i.VersionLT)) } - if i.ActiveNotNil { - predicates = append(predicates, apiexposure.ActiveNotNil()) + if i.VersionLTE != nil { + predicates = append(predicates, api.VersionLTE(*i.VersionLTE)) } - if i.APIVersion != nil { - predicates = append(predicates, apiexposure.APIVersionEQ(*i.APIVersion)) + if i.VersionContains != nil { + predicates = append(predicates, api.VersionContains(*i.VersionContains)) } - if i.APIVersionNEQ != nil { - predicates = append(predicates, apiexposure.APIVersionNEQ(*i.APIVersionNEQ)) + if i.VersionHasPrefix != nil { + predicates = append(predicates, api.VersionHasPrefix(*i.VersionHasPrefix)) } - if len(i.APIVersionIn) > 0 { - predicates = append(predicates, apiexposure.APIVersionIn(i.APIVersionIn...)) + if i.VersionHasSuffix != nil { + predicates = append(predicates, api.VersionHasSuffix(*i.VersionHasSuffix)) } - if len(i.APIVersionNotIn) > 0 { - predicates = append(predicates, apiexposure.APIVersionNotIn(i.APIVersionNotIn...)) + if i.VersionEqualFold != nil { + predicates = append(predicates, api.VersionEqualFold(*i.VersionEqualFold)) } - if i.APIVersionGT != nil { - predicates = append(predicates, apiexposure.APIVersionGT(*i.APIVersionGT)) + if i.VersionContainsFold != nil { + predicates = append(predicates, api.VersionContainsFold(*i.VersionContainsFold)) } - if i.APIVersionGTE != nil { - predicates = append(predicates, apiexposure.APIVersionGTE(*i.APIVersionGTE)) + if i.Category != nil { + predicates = append(predicates, api.CategoryEQ(*i.Category)) } - if i.APIVersionLT != nil { - predicates = append(predicates, apiexposure.APIVersionLT(*i.APIVersionLT)) + if i.CategoryNEQ != nil { + predicates = append(predicates, api.CategoryNEQ(*i.CategoryNEQ)) } - if i.APIVersionLTE != nil { - predicates = append(predicates, apiexposure.APIVersionLTE(*i.APIVersionLTE)) + if len(i.CategoryIn) > 0 { + predicates = append(predicates, api.CategoryIn(i.CategoryIn...)) } - if i.APIVersionContains != nil { - predicates = append(predicates, apiexposure.APIVersionContains(*i.APIVersionContains)) + if len(i.CategoryNotIn) > 0 { + predicates = append(predicates, api.CategoryNotIn(i.CategoryNotIn...)) } - if i.APIVersionHasPrefix != nil { - predicates = append(predicates, apiexposure.APIVersionHasPrefix(*i.APIVersionHasPrefix)) + if i.CategoryGT != nil { + predicates = append(predicates, api.CategoryGT(*i.CategoryGT)) } - if i.APIVersionHasSuffix != nil { - predicates = append(predicates, apiexposure.APIVersionHasSuffix(*i.APIVersionHasSuffix)) + if i.CategoryGTE != nil { + predicates = append(predicates, api.CategoryGTE(*i.CategoryGTE)) } - if i.APIVersionIsNil { - predicates = append(predicates, apiexposure.APIVersionIsNil()) + if i.CategoryLT != nil { + predicates = append(predicates, api.CategoryLT(*i.CategoryLT)) } - if i.APIVersionNotNil { - predicates = append(predicates, apiexposure.APIVersionNotNil()) + if i.CategoryLTE != nil { + predicates = append(predicates, api.CategoryLTE(*i.CategoryLTE)) } - if i.APIVersionEqualFold != nil { - predicates = append(predicates, apiexposure.APIVersionEqualFold(*i.APIVersionEqualFold)) + if i.CategoryContains != nil { + predicates = append(predicates, api.CategoryContains(*i.CategoryContains)) } - if i.APIVersionContainsFold != nil { - predicates = append(predicates, apiexposure.APIVersionContainsFold(*i.APIVersionContainsFold)) + if i.CategoryHasPrefix != nil { + predicates = append(predicates, api.CategoryHasPrefix(*i.CategoryHasPrefix)) } - - if i.HasOwner != nil { - p := apiexposure.HasOwner() - if !*i.HasOwner { - p = apiexposure.Not(p) - } - predicates = append(predicates, p) + if i.CategoryHasSuffix != nil { + predicates = append(predicates, api.CategoryHasSuffix(*i.CategoryHasSuffix)) } - 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) - } + if i.CategoryIsNil { + predicates = append(predicates, api.CategoryIsNil()) + } + if i.CategoryNotNil { + predicates = append(predicates, api.CategoryNotNil()) + } + if i.CategoryEqualFold != nil { + predicates = append(predicates, api.CategoryEqualFold(*i.CategoryEqualFold)) + } + if i.CategoryContainsFold != nil { + predicates = append(predicates, api.CategoryContainsFold(*i.CategoryContainsFold)) + } + if i.XVendor != nil { + predicates = append(predicates, api.XVendorEQ(*i.XVendor)) + } + if i.XVendorNEQ != nil { + predicates = append(predicates, api.XVendorNEQ(*i.XVendorNEQ)) + } + if i.Specification != nil { + predicates = append(predicates, api.SpecificationEQ(*i.Specification)) + } + if i.SpecificationNEQ != nil { + predicates = append(predicates, api.SpecificationNEQ(*i.SpecificationNEQ)) + } + if len(i.SpecificationIn) > 0 { + predicates = append(predicates, api.SpecificationIn(i.SpecificationIn...)) + } + if len(i.SpecificationNotIn) > 0 { + predicates = append(predicates, api.SpecificationNotIn(i.SpecificationNotIn...)) + } + if i.SpecificationGT != nil { + predicates = append(predicates, api.SpecificationGT(*i.SpecificationGT)) + } + if i.SpecificationGTE != nil { + predicates = append(predicates, api.SpecificationGTE(*i.SpecificationGTE)) + } + if i.SpecificationLT != nil { + predicates = append(predicates, api.SpecificationLT(*i.SpecificationLT)) + } + if i.SpecificationLTE != nil { + predicates = append(predicates, api.SpecificationLTE(*i.SpecificationLTE)) + } + if i.SpecificationContains != nil { + predicates = append(predicates, api.SpecificationContains(*i.SpecificationContains)) + } + if i.SpecificationHasPrefix != nil { + predicates = append(predicates, api.SpecificationHasPrefix(*i.SpecificationHasPrefix)) + } + if i.SpecificationHasSuffix != nil { + predicates = append(predicates, api.SpecificationHasSuffix(*i.SpecificationHasSuffix)) + } + if i.SpecificationIsNil { + predicates = append(predicates, api.SpecificationIsNil()) + } + if i.SpecificationNotNil { + predicates = append(predicates, api.SpecificationNotNil()) + } + if i.SpecificationEqualFold != nil { + predicates = append(predicates, api.SpecificationEqualFold(*i.SpecificationEqualFold)) + } + if i.SpecificationContainsFold != nil { + predicates = append(predicates, api.SpecificationContainsFold(*i.SpecificationContainsFold)) + } + if i.Active != nil { + predicates = append(predicates, api.ActiveEQ(*i.Active)) + } + if i.ActiveNEQ != nil { + predicates = append(predicates, api.ActiveNEQ(*i.ActiveNEQ)) + } + + if i.HasOwner != nil { + p := api.HasOwner() + if !*i.HasOwner { + p = api.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasOwnerWith) > 0 { + with := make([]predicate.Team, 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, apiexposure.HasOwnerWith(with...)) + predicates = append(predicates, api.HasOwnerWith(with...)) } - if i.HasSubscriptions != nil { - p := apiexposure.HasSubscriptions() - if !*i.HasSubscriptions { - p = apiexposure.Not(p) + if i.HasExposures != nil { + p := api.HasExposures() + if !*i.HasExposures { + p = api.Not(p) } predicates = append(predicates, p) } - if len(i.HasSubscriptionsWith) > 0 { - with := make([]predicate.ApiSubscription, 0, len(i.HasSubscriptionsWith)) - for _, w := range i.HasSubscriptionsWith { + if len(i.HasExposuresWith) > 0 { + with := make([]predicate.ApiExposure, 0, len(i.HasExposuresWith)) + for _, w := range i.HasExposuresWith { p, err := w.P() if err != nil { - return nil, fmt.Errorf("%w: field 'HasSubscriptionsWith'", err) + return nil, fmt.Errorf("%w: field 'HasExposuresWith'", err) } with = append(with, p) } - predicates = append(predicates, apiexposure.HasSubscriptionsWith(with...)) + predicates = append(predicates, api.HasExposuresWith(with...)) } switch len(predicates) { case 0: - return nil, ErrEmptyApiExposureWhereInput + return nil, ErrEmptyApiWhereInput case 1: return predicates[0], nil default: - return apiexposure.And(predicates...), nil + return api.And(predicates...), nil } } -// ApiSubscriptionWhereInput represents a where input for filtering ApiSubscription queries. -type ApiSubscriptionWhereInput struct { - Predicates []predicate.ApiSubscription `json:"-"` - Not *ApiSubscriptionWhereInput `json:"not,omitempty"` - Or []*ApiSubscriptionWhereInput `json:"or,omitempty"` - And []*ApiSubscriptionWhereInput `json:"and,omitempty"` +// ApiExposureWhereInput represents a where input for filtering ApiExposure queries. +type ApiExposureWhereInput struct { + Predicates []predicate.ApiExposure `json:"-"` + Not *ApiExposureWhereInput `json:"not,omitempty"` + Or []*ApiExposureWhereInput `json:"or,omitempty"` + And []*ApiExposureWhereInput `json:"and,omitempty"` // "id" field predicates. ID *int `json:"id,omitempty"` @@ -654,12 +694,12 @@ type ApiSubscriptionWhereInput struct { LastModifiedAtLTE *time.Time `json:"lastModifiedAtLTE,omitempty"` // "status_phase" field predicates. - StatusPhase *apisubscription.StatusPhase `json:"statusPhase,omitempty"` - StatusPhaseNEQ *apisubscription.StatusPhase `json:"statusPhaseNEQ,omitempty"` - StatusPhaseIn []apisubscription.StatusPhase `json:"statusPhaseIn,omitempty"` - StatusPhaseNotIn []apisubscription.StatusPhase `json:"statusPhaseNotIn,omitempty"` - StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` - StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` + StatusPhase *apiexposure.StatusPhase `json:"statusPhase,omitempty"` + StatusPhaseNEQ *apiexposure.StatusPhase `json:"statusPhaseNEQ,omitempty"` + StatusPhaseIn []apiexposure.StatusPhase `json:"statusPhaseIn,omitempty"` + StatusPhaseNotIn []apiexposure.StatusPhase `json:"statusPhaseNotIn,omitempty"` + StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` + StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` // "status_message" field predicates. StatusMessage *string `json:"statusMessage,omitempty"` @@ -710,21 +750,6 @@ type ApiSubscriptionWhereInput 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"` - // "base_path" field predicates. BasePath *string `json:"basePath,omitempty"` BasePathNEQ *string `json:"basePathNEQ,omitempty"` @@ -740,46 +765,61 @@ type ApiSubscriptionWhereInput struct { BasePathEqualFold *string `json:"basePathEqualFold,omitempty"` BasePathContainsFold *string `json:"basePathContainsFold,omitempty"` - // "m2m_auth_method" field predicates. - M2mAuthMethod *apisubscription.M2mAuthMethod `json:"m2mAuthMethod,omitempty"` - M2mAuthMethodNEQ *apisubscription.M2mAuthMethod `json:"m2mAuthMethodNEQ,omitempty"` - M2mAuthMethodIn []apisubscription.M2mAuthMethod `json:"m2mAuthMethodIn,omitempty"` - M2mAuthMethodNotIn []apisubscription.M2mAuthMethod `json:"m2mAuthMethodNotIn,omitempty"` + // "visibility" field predicates. + Visibility *apiexposure.Visibility `json:"visibility,omitempty"` + VisibilityNEQ *apiexposure.Visibility `json:"visibilityNEQ,omitempty"` + VisibilityIn []apiexposure.Visibility `json:"visibilityIn,omitempty"` + VisibilityNotIn []apiexposure.Visibility `json:"visibilityNotIn,omitempty"` + + // "active" field predicates. + Active *bool `json:"active,omitempty"` + ActiveNEQ *bool `json:"activeNEQ,omitempty"` + ActiveIsNil bool `json:"activeIsNil,omitempty"` + ActiveNotNil bool `json:"activeNotNil,omitempty"` + + // "api_version" field predicates. + APIVersion *string `json:"apiVersion,omitempty"` + APIVersionNEQ *string `json:"apiVersionNEQ,omitempty"` + APIVersionIn []string `json:"apiVersionIn,omitempty"` + APIVersionNotIn []string `json:"apiVersionNotIn,omitempty"` + APIVersionGT *string `json:"apiVersionGT,omitempty"` + APIVersionGTE *string `json:"apiVersionGTE,omitempty"` + APIVersionLT *string `json:"apiVersionLT,omitempty"` + APIVersionLTE *string `json:"apiVersionLTE,omitempty"` + APIVersionContains *string `json:"apiVersionContains,omitempty"` + APIVersionHasPrefix *string `json:"apiVersionHasPrefix,omitempty"` + APIVersionHasSuffix *string `json:"apiVersionHasSuffix,omitempty"` + APIVersionIsNil bool `json:"apiVersionIsNil,omitempty"` + APIVersionNotNil bool `json:"apiVersionNotNil,omitempty"` + APIVersionEqualFold *string `json:"apiVersionEqualFold,omitempty"` + APIVersionContainsFold *string `json:"apiVersionContainsFold,omitempty"` // "owner" edge predicates. HasOwner *bool `json:"hasOwner,omitempty"` HasOwnerWith []*ApplicationWhereInput `json:"hasOwnerWith,omitempty"` - // "target" edge predicates. - HasTarget *bool `json:"hasTarget,omitempty"` - HasTargetWith []*ApiExposureWhereInput `json:"hasTargetWith,omitempty"` - - // "failover_zones" edge predicates. - HasFailoverZones *bool `json:"hasFailoverZones,omitempty"` - HasFailoverZonesWith []*ZoneWhereInput `json:"hasFailoverZonesWith,omitempty"` - - // "approval" edge predicates. - HasApproval *bool `json:"hasApproval,omitempty"` - HasApprovalWith []*ApprovalWhereInput `json:"hasApprovalWith,omitempty"` + // "api" edge predicates. + HasAPI *bool `json:"hasAPI,omitempty"` + HasAPIWith []*ApiWhereInput `json:"hasAPIWith,omitempty"` - // "approval_requests" edge predicates. - HasApprovalRequests *bool `json:"hasApprovalRequests,omitempty"` - HasApprovalRequestsWith []*ApprovalRequestWhereInput `json:"hasApprovalRequestsWith,omitempty"` + // "subscriptions" edge predicates. + HasSubscriptions *bool `json:"hasSubscriptions,omitempty"` + HasSubscriptionsWith []*ApiSubscriptionWhereInput `json:"hasSubscriptionsWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. -func (i *ApiSubscriptionWhereInput) AddPredicates(predicates ...predicate.ApiSubscription) { +func (i *ApiExposureWhereInput) AddPredicates(predicates ...predicate.ApiExposure) { i.Predicates = append(i.Predicates, predicates...) } -// Filter applies the ApiSubscriptionWhereInput filter on the ApiSubscriptionQuery builder. -func (i *ApiSubscriptionWhereInput) Filter(q *ApiSubscriptionQuery) (*ApiSubscriptionQuery, error) { +// Filter applies the ApiExposureWhereInput filter on the ApiExposureQuery builder. +func (i *ApiExposureWhereInput) Filter(q *ApiExposureQuery) (*ApiExposureQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { - if err == ErrEmptyApiSubscriptionWhereInput { + if err == ErrEmptyApiExposureWhereInput { return q, nil } return nil, err @@ -787,19 +827,19 @@ func (i *ApiSubscriptionWhereInput) Filter(q *ApiSubscriptionQuery) (*ApiSubscri return q.Where(p), nil } -// ErrEmptyApiSubscriptionWhereInput is returned in case the ApiSubscriptionWhereInput is empty. -var ErrEmptyApiSubscriptionWhereInput = errors.New("ent: empty predicate ApiSubscriptionWhereInput") +// ErrEmptyApiExposureWhereInput is returned in case the ApiExposureWhereInput is empty. +var ErrEmptyApiExposureWhereInput = errors.New("ent: empty predicate ApiExposureWhereInput") -// P returns a predicate for filtering apisubscriptions. +// P returns a predicate for filtering apiexposures. // An error is returned if the input is empty or invalid. -func (i *ApiSubscriptionWhereInput) P() (predicate.ApiSubscription, error) { - var predicates []predicate.ApiSubscription +func (i *ApiExposureWhereInput) P() (predicate.ApiExposure, error) { + var predicates []predicate.ApiExposure if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } - predicates = append(predicates, apisubscription.Not(p)) + predicates = append(predicates, apiexposure.Not(p)) } switch n := len(i.Or); { case n == 1: @@ -809,7 +849,7 @@ func (i *ApiSubscriptionWhereInput) P() (predicate.ApiSubscription, error) { } predicates = append(predicates, p) case n > 1: - or := make([]predicate.ApiSubscription, 0, n) + or := make([]predicate.ApiExposure, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { @@ -817,7 +857,7 @@ func (i *ApiSubscriptionWhereInput) P() (predicate.ApiSubscription, error) { } or = append(or, p) } - predicates = append(predicates, apisubscription.Or(or...)) + predicates = append(predicates, apiexposure.Or(or...)) } switch n := len(i.And); { case n == 1: @@ -827,7 +867,7 @@ func (i *ApiSubscriptionWhereInput) P() (predicate.ApiSubscription, error) { } predicates = append(predicates, p) case n > 1: - and := make([]predicate.ApiSubscription, 0, n) + and := make([]predicate.ApiExposure, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { @@ -835,323 +875,341 @@ func (i *ApiSubscriptionWhereInput) P() (predicate.ApiSubscription, error) { } and = append(and, p) } - predicates = append(predicates, apisubscription.And(and...)) + predicates = append(predicates, apiexposure.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { - predicates = append(predicates, apisubscription.IDEQ(*i.ID)) + predicates = append(predicates, apiexposure.IDEQ(*i.ID)) } if i.IDNEQ != nil { - predicates = append(predicates, apisubscription.IDNEQ(*i.IDNEQ)) + predicates = append(predicates, apiexposure.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { - predicates = append(predicates, apisubscription.IDIn(i.IDIn...)) + predicates = append(predicates, apiexposure.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { - predicates = append(predicates, apisubscription.IDNotIn(i.IDNotIn...)) + predicates = append(predicates, apiexposure.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { - predicates = append(predicates, apisubscription.IDGT(*i.IDGT)) + predicates = append(predicates, apiexposure.IDGT(*i.IDGT)) } if i.IDGTE != nil { - predicates = append(predicates, apisubscription.IDGTE(*i.IDGTE)) + predicates = append(predicates, apiexposure.IDGTE(*i.IDGTE)) } if i.IDLT != nil { - predicates = append(predicates, apisubscription.IDLT(*i.IDLT)) + predicates = append(predicates, apiexposure.IDLT(*i.IDLT)) } if i.IDLTE != nil { - predicates = append(predicates, apisubscription.IDLTE(*i.IDLTE)) + predicates = append(predicates, apiexposure.IDLTE(*i.IDLTE)) } if i.CreatedAt != nil { - predicates = append(predicates, apisubscription.CreatedAtEQ(*i.CreatedAt)) + predicates = append(predicates, apiexposure.CreatedAtEQ(*i.CreatedAt)) } if i.CreatedAtNEQ != nil { - predicates = append(predicates, apisubscription.CreatedAtNEQ(*i.CreatedAtNEQ)) + predicates = append(predicates, apiexposure.CreatedAtNEQ(*i.CreatedAtNEQ)) } if len(i.CreatedAtIn) > 0 { - predicates = append(predicates, apisubscription.CreatedAtIn(i.CreatedAtIn...)) + predicates = append(predicates, apiexposure.CreatedAtIn(i.CreatedAtIn...)) } if len(i.CreatedAtNotIn) > 0 { - predicates = append(predicates, apisubscription.CreatedAtNotIn(i.CreatedAtNotIn...)) + predicates = append(predicates, apiexposure.CreatedAtNotIn(i.CreatedAtNotIn...)) } if i.CreatedAtGT != nil { - predicates = append(predicates, apisubscription.CreatedAtGT(*i.CreatedAtGT)) + predicates = append(predicates, apiexposure.CreatedAtGT(*i.CreatedAtGT)) } if i.CreatedAtGTE != nil { - predicates = append(predicates, apisubscription.CreatedAtGTE(*i.CreatedAtGTE)) + predicates = append(predicates, apiexposure.CreatedAtGTE(*i.CreatedAtGTE)) } if i.CreatedAtLT != nil { - predicates = append(predicates, apisubscription.CreatedAtLT(*i.CreatedAtLT)) + predicates = append(predicates, apiexposure.CreatedAtLT(*i.CreatedAtLT)) } if i.CreatedAtLTE != nil { - predicates = append(predicates, apisubscription.CreatedAtLTE(*i.CreatedAtLTE)) + predicates = append(predicates, apiexposure.CreatedAtLTE(*i.CreatedAtLTE)) } if i.LastModifiedAt != nil { - predicates = append(predicates, apisubscription.LastModifiedAtEQ(*i.LastModifiedAt)) + predicates = append(predicates, apiexposure.LastModifiedAtEQ(*i.LastModifiedAt)) } if i.LastModifiedAtNEQ != nil { - predicates = append(predicates, apisubscription.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + predicates = append(predicates, apiexposure.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) } if len(i.LastModifiedAtIn) > 0 { - predicates = append(predicates, apisubscription.LastModifiedAtIn(i.LastModifiedAtIn...)) + predicates = append(predicates, apiexposure.LastModifiedAtIn(i.LastModifiedAtIn...)) } if len(i.LastModifiedAtNotIn) > 0 { - predicates = append(predicates, apisubscription.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + predicates = append(predicates, apiexposure.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) } if i.LastModifiedAtGT != nil { - predicates = append(predicates, apisubscription.LastModifiedAtGT(*i.LastModifiedAtGT)) + predicates = append(predicates, apiexposure.LastModifiedAtGT(*i.LastModifiedAtGT)) } if i.LastModifiedAtGTE != nil { - predicates = append(predicates, apisubscription.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + predicates = append(predicates, apiexposure.LastModifiedAtGTE(*i.LastModifiedAtGTE)) } if i.LastModifiedAtLT != nil { - predicates = append(predicates, apisubscription.LastModifiedAtLT(*i.LastModifiedAtLT)) + predicates = append(predicates, apiexposure.LastModifiedAtLT(*i.LastModifiedAtLT)) } if i.LastModifiedAtLTE != nil { - predicates = append(predicates, apisubscription.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + predicates = append(predicates, apiexposure.LastModifiedAtLTE(*i.LastModifiedAtLTE)) } if i.StatusPhase != nil { - predicates = append(predicates, apisubscription.StatusPhaseEQ(*i.StatusPhase)) + predicates = append(predicates, apiexposure.StatusPhaseEQ(*i.StatusPhase)) } if i.StatusPhaseNEQ != nil { - predicates = append(predicates, apisubscription.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + predicates = append(predicates, apiexposure.StatusPhaseNEQ(*i.StatusPhaseNEQ)) } if len(i.StatusPhaseIn) > 0 { - predicates = append(predicates, apisubscription.StatusPhaseIn(i.StatusPhaseIn...)) + predicates = append(predicates, apiexposure.StatusPhaseIn(i.StatusPhaseIn...)) } if len(i.StatusPhaseNotIn) > 0 { - predicates = append(predicates, apisubscription.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + predicates = append(predicates, apiexposure.StatusPhaseNotIn(i.StatusPhaseNotIn...)) } if i.StatusPhaseIsNil { - predicates = append(predicates, apisubscription.StatusPhaseIsNil()) + predicates = append(predicates, apiexposure.StatusPhaseIsNil()) } if i.StatusPhaseNotNil { - predicates = append(predicates, apisubscription.StatusPhaseNotNil()) + predicates = append(predicates, apiexposure.StatusPhaseNotNil()) } if i.StatusMessage != nil { - predicates = append(predicates, apisubscription.StatusMessageEQ(*i.StatusMessage)) + predicates = append(predicates, apiexposure.StatusMessageEQ(*i.StatusMessage)) } if i.StatusMessageNEQ != nil { - predicates = append(predicates, apisubscription.StatusMessageNEQ(*i.StatusMessageNEQ)) + predicates = append(predicates, apiexposure.StatusMessageNEQ(*i.StatusMessageNEQ)) } if len(i.StatusMessageIn) > 0 { - predicates = append(predicates, apisubscription.StatusMessageIn(i.StatusMessageIn...)) + predicates = append(predicates, apiexposure.StatusMessageIn(i.StatusMessageIn...)) } if len(i.StatusMessageNotIn) > 0 { - predicates = append(predicates, apisubscription.StatusMessageNotIn(i.StatusMessageNotIn...)) + predicates = append(predicates, apiexposure.StatusMessageNotIn(i.StatusMessageNotIn...)) } if i.StatusMessageGT != nil { - predicates = append(predicates, apisubscription.StatusMessageGT(*i.StatusMessageGT)) + predicates = append(predicates, apiexposure.StatusMessageGT(*i.StatusMessageGT)) } if i.StatusMessageGTE != nil { - predicates = append(predicates, apisubscription.StatusMessageGTE(*i.StatusMessageGTE)) + predicates = append(predicates, apiexposure.StatusMessageGTE(*i.StatusMessageGTE)) } if i.StatusMessageLT != nil { - predicates = append(predicates, apisubscription.StatusMessageLT(*i.StatusMessageLT)) + predicates = append(predicates, apiexposure.StatusMessageLT(*i.StatusMessageLT)) } if i.StatusMessageLTE != nil { - predicates = append(predicates, apisubscription.StatusMessageLTE(*i.StatusMessageLTE)) + predicates = append(predicates, apiexposure.StatusMessageLTE(*i.StatusMessageLTE)) } if i.StatusMessageContains != nil { - predicates = append(predicates, apisubscription.StatusMessageContains(*i.StatusMessageContains)) + predicates = append(predicates, apiexposure.StatusMessageContains(*i.StatusMessageContains)) } if i.StatusMessageHasPrefix != nil { - predicates = append(predicates, apisubscription.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) + predicates = append(predicates, apiexposure.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) } if i.StatusMessageHasSuffix != nil { - predicates = append(predicates, apisubscription.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) + predicates = append(predicates, apiexposure.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) } if i.StatusMessageIsNil { - predicates = append(predicates, apisubscription.StatusMessageIsNil()) + predicates = append(predicates, apiexposure.StatusMessageIsNil()) } if i.StatusMessageNotNil { - predicates = append(predicates, apisubscription.StatusMessageNotNil()) + predicates = append(predicates, apiexposure.StatusMessageNotNil()) } if i.StatusMessageEqualFold != nil { - predicates = append(predicates, apisubscription.StatusMessageEqualFold(*i.StatusMessageEqualFold)) + predicates = append(predicates, apiexposure.StatusMessageEqualFold(*i.StatusMessageEqualFold)) } if i.StatusMessageContainsFold != nil { - predicates = append(predicates, apisubscription.StatusMessageContainsFold(*i.StatusMessageContainsFold)) + predicates = append(predicates, apiexposure.StatusMessageContainsFold(*i.StatusMessageContainsFold)) } if i.Environment != nil { - predicates = append(predicates, apisubscription.EnvironmentEQ(*i.Environment)) + predicates = append(predicates, apiexposure.EnvironmentEQ(*i.Environment)) } if i.EnvironmentNEQ != nil { - predicates = append(predicates, apisubscription.EnvironmentNEQ(*i.EnvironmentNEQ)) + predicates = append(predicates, apiexposure.EnvironmentNEQ(*i.EnvironmentNEQ)) } if len(i.EnvironmentIn) > 0 { - predicates = append(predicates, apisubscription.EnvironmentIn(i.EnvironmentIn...)) + predicates = append(predicates, apiexposure.EnvironmentIn(i.EnvironmentIn...)) } if len(i.EnvironmentNotIn) > 0 { - predicates = append(predicates, apisubscription.EnvironmentNotIn(i.EnvironmentNotIn...)) + predicates = append(predicates, apiexposure.EnvironmentNotIn(i.EnvironmentNotIn...)) } if i.EnvironmentGT != nil { - predicates = append(predicates, apisubscription.EnvironmentGT(*i.EnvironmentGT)) + predicates = append(predicates, apiexposure.EnvironmentGT(*i.EnvironmentGT)) } if i.EnvironmentGTE != nil { - predicates = append(predicates, apisubscription.EnvironmentGTE(*i.EnvironmentGTE)) + predicates = append(predicates, apiexposure.EnvironmentGTE(*i.EnvironmentGTE)) } if i.EnvironmentLT != nil { - predicates = append(predicates, apisubscription.EnvironmentLT(*i.EnvironmentLT)) + predicates = append(predicates, apiexposure.EnvironmentLT(*i.EnvironmentLT)) } if i.EnvironmentLTE != nil { - predicates = append(predicates, apisubscription.EnvironmentLTE(*i.EnvironmentLTE)) + predicates = append(predicates, apiexposure.EnvironmentLTE(*i.EnvironmentLTE)) } if i.EnvironmentContains != nil { - predicates = append(predicates, apisubscription.EnvironmentContains(*i.EnvironmentContains)) + predicates = append(predicates, apiexposure.EnvironmentContains(*i.EnvironmentContains)) } if i.EnvironmentHasPrefix != nil { - predicates = append(predicates, apisubscription.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + predicates = append(predicates, apiexposure.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) } if i.EnvironmentHasSuffix != nil { - predicates = append(predicates, apisubscription.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + predicates = append(predicates, apiexposure.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) } if i.EnvironmentIsNil { - predicates = append(predicates, apisubscription.EnvironmentIsNil()) + predicates = append(predicates, apiexposure.EnvironmentIsNil()) } if i.EnvironmentNotNil { - predicates = append(predicates, apisubscription.EnvironmentNotNil()) + predicates = append(predicates, apiexposure.EnvironmentNotNil()) } if i.EnvironmentEqualFold != nil { - predicates = append(predicates, apisubscription.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + predicates = append(predicates, apiexposure.EnvironmentEqualFold(*i.EnvironmentEqualFold)) } if i.EnvironmentContainsFold != nil { - predicates = append(predicates, apisubscription.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + predicates = append(predicates, apiexposure.EnvironmentContainsFold(*i.EnvironmentContainsFold)) } if i.Namespace != nil { - predicates = append(predicates, apisubscription.NamespaceEQ(*i.Namespace)) + predicates = append(predicates, apiexposure.NamespaceEQ(*i.Namespace)) } if i.NamespaceNEQ != nil { - predicates = append(predicates, apisubscription.NamespaceNEQ(*i.NamespaceNEQ)) + predicates = append(predicates, apiexposure.NamespaceNEQ(*i.NamespaceNEQ)) } if len(i.NamespaceIn) > 0 { - predicates = append(predicates, apisubscription.NamespaceIn(i.NamespaceIn...)) + predicates = append(predicates, apiexposure.NamespaceIn(i.NamespaceIn...)) } if len(i.NamespaceNotIn) > 0 { - predicates = append(predicates, apisubscription.NamespaceNotIn(i.NamespaceNotIn...)) + predicates = append(predicates, apiexposure.NamespaceNotIn(i.NamespaceNotIn...)) } if i.NamespaceGT != nil { - predicates = append(predicates, apisubscription.NamespaceGT(*i.NamespaceGT)) + predicates = append(predicates, apiexposure.NamespaceGT(*i.NamespaceGT)) } if i.NamespaceGTE != nil { - predicates = append(predicates, apisubscription.NamespaceGTE(*i.NamespaceGTE)) + predicates = append(predicates, apiexposure.NamespaceGTE(*i.NamespaceGTE)) } if i.NamespaceLT != nil { - predicates = append(predicates, apisubscription.NamespaceLT(*i.NamespaceLT)) + predicates = append(predicates, apiexposure.NamespaceLT(*i.NamespaceLT)) } if i.NamespaceLTE != nil { - predicates = append(predicates, apisubscription.NamespaceLTE(*i.NamespaceLTE)) + predicates = append(predicates, apiexposure.NamespaceLTE(*i.NamespaceLTE)) } if i.NamespaceContains != nil { - predicates = append(predicates, apisubscription.NamespaceContains(*i.NamespaceContains)) + predicates = append(predicates, apiexposure.NamespaceContains(*i.NamespaceContains)) } if i.NamespaceHasPrefix != nil { - predicates = append(predicates, apisubscription.NamespaceHasPrefix(*i.NamespaceHasPrefix)) + predicates = append(predicates, apiexposure.NamespaceHasPrefix(*i.NamespaceHasPrefix)) } if i.NamespaceHasSuffix != nil { - predicates = append(predicates, apisubscription.NamespaceHasSuffix(*i.NamespaceHasSuffix)) + predicates = append(predicates, apiexposure.NamespaceHasSuffix(*i.NamespaceHasSuffix)) } if i.NamespaceEqualFold != nil { - predicates = append(predicates, apisubscription.NamespaceEqualFold(*i.NamespaceEqualFold)) + predicates = append(predicates, apiexposure.NamespaceEqualFold(*i.NamespaceEqualFold)) } if i.NamespaceContainsFold != nil { - predicates = append(predicates, apisubscription.NamespaceContainsFold(*i.NamespaceContainsFold)) - } - if i.Name != nil { - predicates = append(predicates, apisubscription.NameEQ(*i.Name)) - } - if i.NameNEQ != nil { - predicates = append(predicates, apisubscription.NameNEQ(*i.NameNEQ)) - } - if len(i.NameIn) > 0 { - predicates = append(predicates, apisubscription.NameIn(i.NameIn...)) - } - if len(i.NameNotIn) > 0 { - predicates = append(predicates, apisubscription.NameNotIn(i.NameNotIn...)) - } - if i.NameGT != nil { - predicates = append(predicates, apisubscription.NameGT(*i.NameGT)) - } - if i.NameGTE != nil { - predicates = append(predicates, apisubscription.NameGTE(*i.NameGTE)) - } - if i.NameLT != nil { - predicates = append(predicates, apisubscription.NameLT(*i.NameLT)) - } - if i.NameLTE != nil { - predicates = append(predicates, apisubscription.NameLTE(*i.NameLTE)) - } - if i.NameContains != nil { - predicates = append(predicates, apisubscription.NameContains(*i.NameContains)) - } - if i.NameHasPrefix != nil { - predicates = append(predicates, apisubscription.NameHasPrefix(*i.NameHasPrefix)) - } - if i.NameHasSuffix != nil { - predicates = append(predicates, apisubscription.NameHasSuffix(*i.NameHasSuffix)) - } - if i.NameEqualFold != nil { - predicates = append(predicates, apisubscription.NameEqualFold(*i.NameEqualFold)) - } - if i.NameContainsFold != nil { - predicates = append(predicates, apisubscription.NameContainsFold(*i.NameContainsFold)) + predicates = append(predicates, apiexposure.NamespaceContainsFold(*i.NamespaceContainsFold)) } if i.BasePath != nil { - predicates = append(predicates, apisubscription.BasePathEQ(*i.BasePath)) + predicates = append(predicates, apiexposure.BasePathEQ(*i.BasePath)) } if i.BasePathNEQ != nil { - predicates = append(predicates, apisubscription.BasePathNEQ(*i.BasePathNEQ)) + predicates = append(predicates, apiexposure.BasePathNEQ(*i.BasePathNEQ)) } if len(i.BasePathIn) > 0 { - predicates = append(predicates, apisubscription.BasePathIn(i.BasePathIn...)) + predicates = append(predicates, apiexposure.BasePathIn(i.BasePathIn...)) } if len(i.BasePathNotIn) > 0 { - predicates = append(predicates, apisubscription.BasePathNotIn(i.BasePathNotIn...)) + predicates = append(predicates, apiexposure.BasePathNotIn(i.BasePathNotIn...)) } if i.BasePathGT != nil { - predicates = append(predicates, apisubscription.BasePathGT(*i.BasePathGT)) + predicates = append(predicates, apiexposure.BasePathGT(*i.BasePathGT)) } if i.BasePathGTE != nil { - predicates = append(predicates, apisubscription.BasePathGTE(*i.BasePathGTE)) + predicates = append(predicates, apiexposure.BasePathGTE(*i.BasePathGTE)) } if i.BasePathLT != nil { - predicates = append(predicates, apisubscription.BasePathLT(*i.BasePathLT)) + predicates = append(predicates, apiexposure.BasePathLT(*i.BasePathLT)) } if i.BasePathLTE != nil { - predicates = append(predicates, apisubscription.BasePathLTE(*i.BasePathLTE)) + predicates = append(predicates, apiexposure.BasePathLTE(*i.BasePathLTE)) } if i.BasePathContains != nil { - predicates = append(predicates, apisubscription.BasePathContains(*i.BasePathContains)) + predicates = append(predicates, apiexposure.BasePathContains(*i.BasePathContains)) } if i.BasePathHasPrefix != nil { - predicates = append(predicates, apisubscription.BasePathHasPrefix(*i.BasePathHasPrefix)) + predicates = append(predicates, apiexposure.BasePathHasPrefix(*i.BasePathHasPrefix)) } if i.BasePathHasSuffix != nil { - predicates = append(predicates, apisubscription.BasePathHasSuffix(*i.BasePathHasSuffix)) + predicates = append(predicates, apiexposure.BasePathHasSuffix(*i.BasePathHasSuffix)) } if i.BasePathEqualFold != nil { - predicates = append(predicates, apisubscription.BasePathEqualFold(*i.BasePathEqualFold)) + predicates = append(predicates, apiexposure.BasePathEqualFold(*i.BasePathEqualFold)) } if i.BasePathContainsFold != nil { - predicates = append(predicates, apisubscription.BasePathContainsFold(*i.BasePathContainsFold)) + predicates = append(predicates, apiexposure.BasePathContainsFold(*i.BasePathContainsFold)) } - if i.M2mAuthMethod != nil { - predicates = append(predicates, apisubscription.M2mAuthMethodEQ(*i.M2mAuthMethod)) + if i.Visibility != nil { + predicates = append(predicates, apiexposure.VisibilityEQ(*i.Visibility)) } - if i.M2mAuthMethodNEQ != nil { - predicates = append(predicates, apisubscription.M2mAuthMethodNEQ(*i.M2mAuthMethodNEQ)) + if i.VisibilityNEQ != nil { + predicates = append(predicates, apiexposure.VisibilityNEQ(*i.VisibilityNEQ)) } - if len(i.M2mAuthMethodIn) > 0 { - predicates = append(predicates, apisubscription.M2mAuthMethodIn(i.M2mAuthMethodIn...)) + if len(i.VisibilityIn) > 0 { + predicates = append(predicates, apiexposure.VisibilityIn(i.VisibilityIn...)) } - if len(i.M2mAuthMethodNotIn) > 0 { - predicates = append(predicates, apisubscription.M2mAuthMethodNotIn(i.M2mAuthMethodNotIn...)) + if len(i.VisibilityNotIn) > 0 { + predicates = append(predicates, apiexposure.VisibilityNotIn(i.VisibilityNotIn...)) + } + if i.Active != nil { + predicates = append(predicates, apiexposure.ActiveEQ(*i.Active)) + } + if i.ActiveNEQ != nil { + predicates = append(predicates, apiexposure.ActiveNEQ(*i.ActiveNEQ)) + } + if i.ActiveIsNil { + predicates = append(predicates, apiexposure.ActiveIsNil()) + } + if i.ActiveNotNil { + predicates = append(predicates, apiexposure.ActiveNotNil()) + } + if i.APIVersion != nil { + predicates = append(predicates, apiexposure.APIVersionEQ(*i.APIVersion)) + } + if i.APIVersionNEQ != nil { + predicates = append(predicates, apiexposure.APIVersionNEQ(*i.APIVersionNEQ)) + } + if len(i.APIVersionIn) > 0 { + predicates = append(predicates, apiexposure.APIVersionIn(i.APIVersionIn...)) + } + if len(i.APIVersionNotIn) > 0 { + predicates = append(predicates, apiexposure.APIVersionNotIn(i.APIVersionNotIn...)) + } + if i.APIVersionGT != nil { + predicates = append(predicates, apiexposure.APIVersionGT(*i.APIVersionGT)) + } + if i.APIVersionGTE != nil { + predicates = append(predicates, apiexposure.APIVersionGTE(*i.APIVersionGTE)) + } + if i.APIVersionLT != nil { + predicates = append(predicates, apiexposure.APIVersionLT(*i.APIVersionLT)) + } + if i.APIVersionLTE != nil { + predicates = append(predicates, apiexposure.APIVersionLTE(*i.APIVersionLTE)) + } + if i.APIVersionContains != nil { + predicates = append(predicates, apiexposure.APIVersionContains(*i.APIVersionContains)) + } + if i.APIVersionHasPrefix != nil { + predicates = append(predicates, apiexposure.APIVersionHasPrefix(*i.APIVersionHasPrefix)) + } + if i.APIVersionHasSuffix != nil { + predicates = append(predicates, apiexposure.APIVersionHasSuffix(*i.APIVersionHasSuffix)) + } + if i.APIVersionIsNil { + predicates = append(predicates, apiexposure.APIVersionIsNil()) + } + if i.APIVersionNotNil { + predicates = append(predicates, apiexposure.APIVersionNotNil()) + } + if i.APIVersionEqualFold != nil { + predicates = append(predicates, apiexposure.APIVersionEqualFold(*i.APIVersionEqualFold)) + } + if i.APIVersionContainsFold != nil { + predicates = append(predicates, apiexposure.APIVersionContainsFold(*i.APIVersionContainsFold)) } if i.HasOwner != nil { - p := apisubscription.HasOwner() + p := apiexposure.HasOwner() if !*i.HasOwner { - p = apisubscription.Not(p) + p = apiexposure.Not(p) } predicates = append(predicates, p) } @@ -1164,96 +1222,60 @@ func (i *ApiSubscriptionWhereInput) P() (predicate.ApiSubscription, error) { } with = append(with, p) } - predicates = append(predicates, apisubscription.HasOwnerWith(with...)) + predicates = append(predicates, apiexposure.HasOwnerWith(with...)) } - if i.HasTarget != nil { - p := apisubscription.HasTarget() - if !*i.HasTarget { - p = apisubscription.Not(p) + if i.HasAPI != nil { + p := apiexposure.HasAPI() + if !*i.HasAPI { + p = apiexposure.Not(p) } predicates = append(predicates, p) } - if len(i.HasTargetWith) > 0 { - with := make([]predicate.ApiExposure, 0, len(i.HasTargetWith)) - for _, w := range i.HasTargetWith { + if len(i.HasAPIWith) > 0 { + with := make([]predicate.Api, 0, len(i.HasAPIWith)) + for _, w := range i.HasAPIWith { p, err := w.P() if err != nil { - return nil, fmt.Errorf("%w: field 'HasTargetWith'", err) + return nil, fmt.Errorf("%w: field 'HasAPIWith'", err) } with = append(with, p) } - predicates = append(predicates, apisubscription.HasTargetWith(with...)) + predicates = append(predicates, apiexposure.HasAPIWith(with...)) } - if i.HasFailoverZones != nil { - p := apisubscription.HasFailoverZones() - if !*i.HasFailoverZones { - p = apisubscription.Not(p) + if i.HasSubscriptions != nil { + p := apiexposure.HasSubscriptions() + if !*i.HasSubscriptions { + p = apiexposure.Not(p) } predicates = append(predicates, p) } - if len(i.HasFailoverZonesWith) > 0 { - with := make([]predicate.Zone, 0, len(i.HasFailoverZonesWith)) - for _, w := range i.HasFailoverZonesWith { + if len(i.HasSubscriptionsWith) > 0 { + with := make([]predicate.ApiSubscription, 0, len(i.HasSubscriptionsWith)) + for _, w := range i.HasSubscriptionsWith { p, err := w.P() if err != nil { - return nil, fmt.Errorf("%w: field 'HasFailoverZonesWith'", err) + return nil, fmt.Errorf("%w: field 'HasSubscriptionsWith'", err) } with = append(with, p) } - predicates = append(predicates, apisubscription.HasFailoverZonesWith(with...)) - } - if i.HasApproval != nil { - p := apisubscription.HasApproval() - if !*i.HasApproval { - p = apisubscription.Not(p) - } - predicates = append(predicates, p) + predicates = append(predicates, apiexposure.HasSubscriptionsWith(with...)) } - 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, apisubscription.HasApprovalWith(with...)) - } - if i.HasApprovalRequests != nil { - p := apisubscription.HasApprovalRequests() - if !*i.HasApprovalRequests { - p = apisubscription.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, apisubscription.HasApprovalRequestsWith(with...)) - } - switch len(predicates) { - case 0: - return nil, ErrEmptyApiSubscriptionWhereInput - case 1: - return predicates[0], nil - default: - return apisubscription.And(predicates...), nil + switch len(predicates) { + case 0: + return nil, ErrEmptyApiExposureWhereInput + case 1: + return predicates[0], nil + default: + return apiexposure.And(predicates...), nil } } -// ApplicationWhereInput represents a where input for filtering Application queries. -type ApplicationWhereInput struct { - Predicates []predicate.Application `json:"-"` - Not *ApplicationWhereInput `json:"not,omitempty"` - Or []*ApplicationWhereInput `json:"or,omitempty"` - And []*ApplicationWhereInput `json:"and,omitempty"` +// ApiSubscriptionWhereInput represents a where input for filtering ApiSubscription queries. +type ApiSubscriptionWhereInput struct { + Predicates []predicate.ApiSubscription `json:"-"` + Not *ApiSubscriptionWhereInput `json:"not,omitempty"` + Or []*ApiSubscriptionWhereInput `json:"or,omitempty"` + And []*ApiSubscriptionWhereInput `json:"and,omitempty"` // "id" field predicates. ID *int `json:"id,omitempty"` @@ -1286,12 +1308,12 @@ type ApplicationWhereInput struct { LastModifiedAtLTE *time.Time `json:"lastModifiedAtLTE,omitempty"` // "status_phase" field predicates. - StatusPhase *application.StatusPhase `json:"statusPhase,omitempty"` - StatusPhaseNEQ *application.StatusPhase `json:"statusPhaseNEQ,omitempty"` - StatusPhaseIn []application.StatusPhase `json:"statusPhaseIn,omitempty"` - StatusPhaseNotIn []application.StatusPhase `json:"statusPhaseNotIn,omitempty"` - StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` - StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` + StatusPhase *apisubscription.StatusPhase `json:"statusPhase,omitempty"` + StatusPhaseNEQ *apisubscription.StatusPhase `json:"statusPhaseNEQ,omitempty"` + StatusPhaseIn []apisubscription.StatusPhase `json:"statusPhaseIn,omitempty"` + StatusPhaseNotIn []apisubscription.StatusPhase `json:"statusPhaseNotIn,omitempty"` + StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` + StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` // "status_message" field predicates. StatusMessage *string `json:"statusMessage,omitempty"` @@ -1357,108 +1379,61 @@ type ApplicationWhereInput struct { NameEqualFold *string `json:"nameEqualFold,omitempty"` NameContainsFold *string `json:"nameContainsFold,omitempty"` - // "client_id" field predicates. - ClientID *string `json:"clientID,omitempty"` - ClientIDNEQ *string `json:"clientIDNEQ,omitempty"` - ClientIDIn []string `json:"clientIDIn,omitempty"` - ClientIDNotIn []string `json:"clientIDNotIn,omitempty"` - ClientIDGT *string `json:"clientIDGT,omitempty"` - ClientIDGTE *string `json:"clientIDGTE,omitempty"` - ClientIDLT *string `json:"clientIDLT,omitempty"` - ClientIDLTE *string `json:"clientIDLTE,omitempty"` - ClientIDContains *string `json:"clientIDContains,omitempty"` - ClientIDHasPrefix *string `json:"clientIDHasPrefix,omitempty"` - ClientIDHasSuffix *string `json:"clientIDHasSuffix,omitempty"` - ClientIDIsNil bool `json:"clientIDIsNil,omitempty"` - ClientIDNotNil bool `json:"clientIDNotNil,omitempty"` - ClientIDEqualFold *string `json:"clientIDEqualFold,omitempty"` - ClientIDContainsFold *string `json:"clientIDContainsFold,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"` + // "base_path" field predicates. + BasePath *string `json:"basePath,omitempty"` + BasePathNEQ *string `json:"basePathNEQ,omitempty"` + BasePathIn []string `json:"basePathIn,omitempty"` + BasePathNotIn []string `json:"basePathNotIn,omitempty"` + BasePathGT *string `json:"basePathGT,omitempty"` + BasePathGTE *string `json:"basePathGTE,omitempty"` + BasePathLT *string `json:"basePathLT,omitempty"` + BasePathLTE *string `json:"basePathLTE,omitempty"` + BasePathContains *string `json:"basePathContains,omitempty"` + BasePathHasPrefix *string `json:"basePathHasPrefix,omitempty"` + BasePathHasSuffix *string `json:"basePathHasSuffix,omitempty"` + BasePathEqualFold *string `json:"basePathEqualFold,omitempty"` + BasePathContainsFold *string `json:"basePathContainsFold,omitempty"` - // "zone" edge predicates. - HasZone *bool `json:"hasZone,omitempty"` - HasZoneWith []*ZoneWhereInput `json:"hasZoneWith,omitempty"` + // "m2m_auth_method" field predicates. + M2mAuthMethod *apisubscription.M2mAuthMethod `json:"m2mAuthMethod,omitempty"` + M2mAuthMethodNEQ *apisubscription.M2mAuthMethod `json:"m2mAuthMethodNEQ,omitempty"` + M2mAuthMethodIn []apisubscription.M2mAuthMethod `json:"m2mAuthMethodIn,omitempty"` + M2mAuthMethodNotIn []apisubscription.M2mAuthMethod `json:"m2mAuthMethodNotIn,omitempty"` - // "owner_team" edge predicates. - HasOwnerTeam *bool `json:"hasOwnerTeam,omitempty"` - HasOwnerTeamWith []*TeamWhereInput `json:"hasOwnerTeamWith,omitempty"` + // "owner" edge predicates. + HasOwner *bool `json:"hasOwner,omitempty"` + HasOwnerWith []*ApplicationWhereInput `json:"hasOwnerWith,omitempty"` - // "exposed_apis" edge predicates. - HasExposedApis *bool `json:"hasExposedApis,omitempty"` - HasExposedApisWith []*ApiExposureWhereInput `json:"hasExposedApisWith,omitempty"` + // "target" edge predicates. + HasTarget *bool `json:"hasTarget,omitempty"` + HasTargetWith []*ApiExposureWhereInput `json:"hasTargetWith,omitempty"` - // "subscribed_apis" edge predicates. - HasSubscribedApis *bool `json:"hasSubscribedApis,omitempty"` - HasSubscribedApisWith []*ApiSubscriptionWhereInput `json:"hasSubscribedApisWith,omitempty"` + // "failover_zones" edge predicates. + HasFailoverZones *bool `json:"hasFailoverZones,omitempty"` + HasFailoverZonesWith []*ZoneWhereInput `json:"hasFailoverZonesWith,omitempty"` - // "exposed_events" edge predicates. - HasExposedEvents *bool `json:"hasExposedEvents,omitempty"` - HasExposedEventsWith []*EventExposureWhereInput `json:"hasExposedEventsWith,omitempty"` + // "approval" edge predicates. + HasApproval *bool `json:"hasApproval,omitempty"` + HasApprovalWith []*ApprovalWhereInput `json:"hasApprovalWith,omitempty"` - // "subscribed_events" edge predicates. - HasSubscribedEvents *bool `json:"hasSubscribedEvents,omitempty"` - HasSubscribedEventsWith []*EventSubscriptionWhereInput `json:"hasSubscribedEventsWith,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 *ApplicationWhereInput) AddPredicates(predicates ...predicate.Application) { +func (i *ApiSubscriptionWhereInput) AddPredicates(predicates ...predicate.ApiSubscription) { i.Predicates = append(i.Predicates, predicates...) } -// Filter applies the ApplicationWhereInput filter on the ApplicationQuery builder. -func (i *ApplicationWhereInput) Filter(q *ApplicationQuery) (*ApplicationQuery, error) { +// Filter applies the ApiSubscriptionWhereInput filter on the ApiSubscriptionQuery builder. +func (i *ApiSubscriptionWhereInput) Filter(q *ApiSubscriptionQuery) (*ApiSubscriptionQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { - if err == ErrEmptyApplicationWhereInput { + if err == ErrEmptyApiSubscriptionWhereInput { return q, nil } return nil, err @@ -1466,19 +1441,19 @@ func (i *ApplicationWhereInput) Filter(q *ApplicationQuery) (*ApplicationQuery, return q.Where(p), nil } -// ErrEmptyApplicationWhereInput is returned in case the ApplicationWhereInput is empty. -var ErrEmptyApplicationWhereInput = errors.New("ent: empty predicate ApplicationWhereInput") +// ErrEmptyApiSubscriptionWhereInput is returned in case the ApiSubscriptionWhereInput is empty. +var ErrEmptyApiSubscriptionWhereInput = errors.New("ent: empty predicate ApiSubscriptionWhereInput") -// P returns a predicate for filtering applications. +// P returns a predicate for filtering apisubscriptions. // An error is returned if the input is empty or invalid. -func (i *ApplicationWhereInput) P() (predicate.Application, error) { - var predicates []predicate.Application +func (i *ApiSubscriptionWhereInput) P() (predicate.ApiSubscription, error) { + var predicates []predicate.ApiSubscription if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } - predicates = append(predicates, application.Not(p)) + predicates = append(predicates, apisubscription.Not(p)) } switch n := len(i.Or); { case n == 1: @@ -1488,7 +1463,7 @@ func (i *ApplicationWhereInput) P() (predicate.Application, error) { } predicates = append(predicates, p) case n > 1: - or := make([]predicate.Application, 0, n) + or := make([]predicate.ApiSubscription, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { @@ -1496,7 +1471,7 @@ func (i *ApplicationWhereInput) P() (predicate.Application, error) { } or = append(or, p) } - predicates = append(predicates, application.Or(or...)) + predicates = append(predicates, apisubscription.Or(or...)) } switch n := len(i.And); { case n == 1: @@ -1506,7 +1481,7 @@ func (i *ApplicationWhereInput) P() (predicate.Application, error) { } predicates = append(predicates, p) case n > 1: - and := make([]predicate.Application, 0, n) + and := make([]predicate.ApiSubscription, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { @@ -1514,554 +1489,1871 @@ func (i *ApplicationWhereInput) P() (predicate.Application, error) { } and = append(and, p) } - predicates = append(predicates, application.And(and...)) + predicates = append(predicates, apisubscription.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { - predicates = append(predicates, application.IDEQ(*i.ID)) + predicates = append(predicates, apisubscription.IDEQ(*i.ID)) } if i.IDNEQ != nil { - predicates = append(predicates, application.IDNEQ(*i.IDNEQ)) + predicates = append(predicates, apisubscription.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { - predicates = append(predicates, application.IDIn(i.IDIn...)) + predicates = append(predicates, apisubscription.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { - predicates = append(predicates, application.IDNotIn(i.IDNotIn...)) + predicates = append(predicates, apisubscription.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { - predicates = append(predicates, application.IDGT(*i.IDGT)) + predicates = append(predicates, apisubscription.IDGT(*i.IDGT)) } if i.IDGTE != nil { - predicates = append(predicates, application.IDGTE(*i.IDGTE)) + predicates = append(predicates, apisubscription.IDGTE(*i.IDGTE)) } if i.IDLT != nil { - predicates = append(predicates, application.IDLT(*i.IDLT)) + predicates = append(predicates, apisubscription.IDLT(*i.IDLT)) } if i.IDLTE != nil { - predicates = append(predicates, application.IDLTE(*i.IDLTE)) + predicates = append(predicates, apisubscription.IDLTE(*i.IDLTE)) } if i.CreatedAt != nil { - predicates = append(predicates, application.CreatedAtEQ(*i.CreatedAt)) + predicates = append(predicates, apisubscription.CreatedAtEQ(*i.CreatedAt)) } if i.CreatedAtNEQ != nil { - predicates = append(predicates, application.CreatedAtNEQ(*i.CreatedAtNEQ)) + predicates = append(predicates, apisubscription.CreatedAtNEQ(*i.CreatedAtNEQ)) } if len(i.CreatedAtIn) > 0 { - predicates = append(predicates, application.CreatedAtIn(i.CreatedAtIn...)) + predicates = append(predicates, apisubscription.CreatedAtIn(i.CreatedAtIn...)) } if len(i.CreatedAtNotIn) > 0 { - predicates = append(predicates, application.CreatedAtNotIn(i.CreatedAtNotIn...)) + predicates = append(predicates, apisubscription.CreatedAtNotIn(i.CreatedAtNotIn...)) } if i.CreatedAtGT != nil { - predicates = append(predicates, application.CreatedAtGT(*i.CreatedAtGT)) + predicates = append(predicates, apisubscription.CreatedAtGT(*i.CreatedAtGT)) } if i.CreatedAtGTE != nil { - predicates = append(predicates, application.CreatedAtGTE(*i.CreatedAtGTE)) + predicates = append(predicates, apisubscription.CreatedAtGTE(*i.CreatedAtGTE)) } if i.CreatedAtLT != nil { - predicates = append(predicates, application.CreatedAtLT(*i.CreatedAtLT)) + predicates = append(predicates, apisubscription.CreatedAtLT(*i.CreatedAtLT)) } if i.CreatedAtLTE != nil { - predicates = append(predicates, application.CreatedAtLTE(*i.CreatedAtLTE)) + predicates = append(predicates, apisubscription.CreatedAtLTE(*i.CreatedAtLTE)) } if i.LastModifiedAt != nil { - predicates = append(predicates, application.LastModifiedAtEQ(*i.LastModifiedAt)) + predicates = append(predicates, apisubscription.LastModifiedAtEQ(*i.LastModifiedAt)) } if i.LastModifiedAtNEQ != nil { - predicates = append(predicates, application.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + predicates = append(predicates, apisubscription.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) } if len(i.LastModifiedAtIn) > 0 { - predicates = append(predicates, application.LastModifiedAtIn(i.LastModifiedAtIn...)) + predicates = append(predicates, apisubscription.LastModifiedAtIn(i.LastModifiedAtIn...)) } if len(i.LastModifiedAtNotIn) > 0 { - predicates = append(predicates, application.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + predicates = append(predicates, apisubscription.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) } if i.LastModifiedAtGT != nil { - predicates = append(predicates, application.LastModifiedAtGT(*i.LastModifiedAtGT)) + predicates = append(predicates, apisubscription.LastModifiedAtGT(*i.LastModifiedAtGT)) } if i.LastModifiedAtGTE != nil { - predicates = append(predicates, application.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + predicates = append(predicates, apisubscription.LastModifiedAtGTE(*i.LastModifiedAtGTE)) } if i.LastModifiedAtLT != nil { - predicates = append(predicates, application.LastModifiedAtLT(*i.LastModifiedAtLT)) + predicates = append(predicates, apisubscription.LastModifiedAtLT(*i.LastModifiedAtLT)) } if i.LastModifiedAtLTE != nil { - predicates = append(predicates, application.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + predicates = append(predicates, apisubscription.LastModifiedAtLTE(*i.LastModifiedAtLTE)) } if i.StatusPhase != nil { - predicates = append(predicates, application.StatusPhaseEQ(*i.StatusPhase)) + predicates = append(predicates, apisubscription.StatusPhaseEQ(*i.StatusPhase)) } if i.StatusPhaseNEQ != nil { - predicates = append(predicates, application.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + predicates = append(predicates, apisubscription.StatusPhaseNEQ(*i.StatusPhaseNEQ)) } if len(i.StatusPhaseIn) > 0 { - predicates = append(predicates, application.StatusPhaseIn(i.StatusPhaseIn...)) + predicates = append(predicates, apisubscription.StatusPhaseIn(i.StatusPhaseIn...)) } if len(i.StatusPhaseNotIn) > 0 { - predicates = append(predicates, application.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + predicates = append(predicates, apisubscription.StatusPhaseNotIn(i.StatusPhaseNotIn...)) } if i.StatusPhaseIsNil { - predicates = append(predicates, application.StatusPhaseIsNil()) + predicates = append(predicates, apisubscription.StatusPhaseIsNil()) } if i.StatusPhaseNotNil { - predicates = append(predicates, application.StatusPhaseNotNil()) + predicates = append(predicates, apisubscription.StatusPhaseNotNil()) } if i.StatusMessage != nil { - predicates = append(predicates, application.StatusMessageEQ(*i.StatusMessage)) + predicates = append(predicates, apisubscription.StatusMessageEQ(*i.StatusMessage)) } if i.StatusMessageNEQ != nil { - predicates = append(predicates, application.StatusMessageNEQ(*i.StatusMessageNEQ)) + predicates = append(predicates, apisubscription.StatusMessageNEQ(*i.StatusMessageNEQ)) } if len(i.StatusMessageIn) > 0 { - predicates = append(predicates, application.StatusMessageIn(i.StatusMessageIn...)) + predicates = append(predicates, apisubscription.StatusMessageIn(i.StatusMessageIn...)) } if len(i.StatusMessageNotIn) > 0 { - predicates = append(predicates, application.StatusMessageNotIn(i.StatusMessageNotIn...)) + predicates = append(predicates, apisubscription.StatusMessageNotIn(i.StatusMessageNotIn...)) } if i.StatusMessageGT != nil { - predicates = append(predicates, application.StatusMessageGT(*i.StatusMessageGT)) + predicates = append(predicates, apisubscription.StatusMessageGT(*i.StatusMessageGT)) } if i.StatusMessageGTE != nil { - predicates = append(predicates, application.StatusMessageGTE(*i.StatusMessageGTE)) + predicates = append(predicates, apisubscription.StatusMessageGTE(*i.StatusMessageGTE)) } if i.StatusMessageLT != nil { - predicates = append(predicates, application.StatusMessageLT(*i.StatusMessageLT)) + predicates = append(predicates, apisubscription.StatusMessageLT(*i.StatusMessageLT)) } if i.StatusMessageLTE != nil { - predicates = append(predicates, application.StatusMessageLTE(*i.StatusMessageLTE)) + predicates = append(predicates, apisubscription.StatusMessageLTE(*i.StatusMessageLTE)) } if i.StatusMessageContains != nil { - predicates = append(predicates, application.StatusMessageContains(*i.StatusMessageContains)) + predicates = append(predicates, apisubscription.StatusMessageContains(*i.StatusMessageContains)) } if i.StatusMessageHasPrefix != nil { - predicates = append(predicates, application.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) + predicates = append(predicates, apisubscription.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) } if i.StatusMessageHasSuffix != nil { - predicates = append(predicates, application.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) + predicates = append(predicates, apisubscription.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) } if i.StatusMessageIsNil { - predicates = append(predicates, application.StatusMessageIsNil()) + predicates = append(predicates, apisubscription.StatusMessageIsNil()) } if i.StatusMessageNotNil { - predicates = append(predicates, application.StatusMessageNotNil()) + predicates = append(predicates, apisubscription.StatusMessageNotNil()) } if i.StatusMessageEqualFold != nil { - predicates = append(predicates, application.StatusMessageEqualFold(*i.StatusMessageEqualFold)) + predicates = append(predicates, apisubscription.StatusMessageEqualFold(*i.StatusMessageEqualFold)) } if i.StatusMessageContainsFold != nil { - predicates = append(predicates, application.StatusMessageContainsFold(*i.StatusMessageContainsFold)) + predicates = append(predicates, apisubscription.StatusMessageContainsFold(*i.StatusMessageContainsFold)) } if i.Environment != nil { - predicates = append(predicates, application.EnvironmentEQ(*i.Environment)) + predicates = append(predicates, apisubscription.EnvironmentEQ(*i.Environment)) } if i.EnvironmentNEQ != nil { - predicates = append(predicates, application.EnvironmentNEQ(*i.EnvironmentNEQ)) + predicates = append(predicates, apisubscription.EnvironmentNEQ(*i.EnvironmentNEQ)) } if len(i.EnvironmentIn) > 0 { - predicates = append(predicates, application.EnvironmentIn(i.EnvironmentIn...)) + predicates = append(predicates, apisubscription.EnvironmentIn(i.EnvironmentIn...)) } if len(i.EnvironmentNotIn) > 0 { - predicates = append(predicates, application.EnvironmentNotIn(i.EnvironmentNotIn...)) + predicates = append(predicates, apisubscription.EnvironmentNotIn(i.EnvironmentNotIn...)) } if i.EnvironmentGT != nil { - predicates = append(predicates, application.EnvironmentGT(*i.EnvironmentGT)) + predicates = append(predicates, apisubscription.EnvironmentGT(*i.EnvironmentGT)) } if i.EnvironmentGTE != nil { - predicates = append(predicates, application.EnvironmentGTE(*i.EnvironmentGTE)) + predicates = append(predicates, apisubscription.EnvironmentGTE(*i.EnvironmentGTE)) } if i.EnvironmentLT != nil { - predicates = append(predicates, application.EnvironmentLT(*i.EnvironmentLT)) + predicates = append(predicates, apisubscription.EnvironmentLT(*i.EnvironmentLT)) } if i.EnvironmentLTE != nil { - predicates = append(predicates, application.EnvironmentLTE(*i.EnvironmentLTE)) + predicates = append(predicates, apisubscription.EnvironmentLTE(*i.EnvironmentLTE)) } if i.EnvironmentContains != nil { - predicates = append(predicates, application.EnvironmentContains(*i.EnvironmentContains)) + predicates = append(predicates, apisubscription.EnvironmentContains(*i.EnvironmentContains)) } if i.EnvironmentHasPrefix != nil { - predicates = append(predicates, application.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + predicates = append(predicates, apisubscription.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) } if i.EnvironmentHasSuffix != nil { - predicates = append(predicates, application.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + predicates = append(predicates, apisubscription.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) } if i.EnvironmentIsNil { - predicates = append(predicates, application.EnvironmentIsNil()) + predicates = append(predicates, apisubscription.EnvironmentIsNil()) } if i.EnvironmentNotNil { - predicates = append(predicates, application.EnvironmentNotNil()) + predicates = append(predicates, apisubscription.EnvironmentNotNil()) } if i.EnvironmentEqualFold != nil { - predicates = append(predicates, application.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + predicates = append(predicates, apisubscription.EnvironmentEqualFold(*i.EnvironmentEqualFold)) } if i.EnvironmentContainsFold != nil { - predicates = append(predicates, application.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + predicates = append(predicates, apisubscription.EnvironmentContainsFold(*i.EnvironmentContainsFold)) } if i.Namespace != nil { - predicates = append(predicates, application.NamespaceEQ(*i.Namespace)) + predicates = append(predicates, apisubscription.NamespaceEQ(*i.Namespace)) } if i.NamespaceNEQ != nil { - predicates = append(predicates, application.NamespaceNEQ(*i.NamespaceNEQ)) + predicates = append(predicates, apisubscription.NamespaceNEQ(*i.NamespaceNEQ)) } if len(i.NamespaceIn) > 0 { - predicates = append(predicates, application.NamespaceIn(i.NamespaceIn...)) + predicates = append(predicates, apisubscription.NamespaceIn(i.NamespaceIn...)) } if len(i.NamespaceNotIn) > 0 { - predicates = append(predicates, application.NamespaceNotIn(i.NamespaceNotIn...)) + predicates = append(predicates, apisubscription.NamespaceNotIn(i.NamespaceNotIn...)) } if i.NamespaceGT != nil { - predicates = append(predicates, application.NamespaceGT(*i.NamespaceGT)) + predicates = append(predicates, apisubscription.NamespaceGT(*i.NamespaceGT)) } if i.NamespaceGTE != nil { - predicates = append(predicates, application.NamespaceGTE(*i.NamespaceGTE)) + predicates = append(predicates, apisubscription.NamespaceGTE(*i.NamespaceGTE)) } if i.NamespaceLT != nil { - predicates = append(predicates, application.NamespaceLT(*i.NamespaceLT)) + predicates = append(predicates, apisubscription.NamespaceLT(*i.NamespaceLT)) } if i.NamespaceLTE != nil { - predicates = append(predicates, application.NamespaceLTE(*i.NamespaceLTE)) + predicates = append(predicates, apisubscription.NamespaceLTE(*i.NamespaceLTE)) } if i.NamespaceContains != nil { - predicates = append(predicates, application.NamespaceContains(*i.NamespaceContains)) + predicates = append(predicates, apisubscription.NamespaceContains(*i.NamespaceContains)) } if i.NamespaceHasPrefix != nil { - predicates = append(predicates, application.NamespaceHasPrefix(*i.NamespaceHasPrefix)) + predicates = append(predicates, apisubscription.NamespaceHasPrefix(*i.NamespaceHasPrefix)) } if i.NamespaceHasSuffix != nil { - predicates = append(predicates, application.NamespaceHasSuffix(*i.NamespaceHasSuffix)) + predicates = append(predicates, apisubscription.NamespaceHasSuffix(*i.NamespaceHasSuffix)) } if i.NamespaceEqualFold != nil { - predicates = append(predicates, application.NamespaceEqualFold(*i.NamespaceEqualFold)) + predicates = append(predicates, apisubscription.NamespaceEqualFold(*i.NamespaceEqualFold)) } if i.NamespaceContainsFold != nil { - predicates = append(predicates, application.NamespaceContainsFold(*i.NamespaceContainsFold)) + predicates = append(predicates, apisubscription.NamespaceContainsFold(*i.NamespaceContainsFold)) } if i.Name != nil { - predicates = append(predicates, application.NameEQ(*i.Name)) + predicates = append(predicates, apisubscription.NameEQ(*i.Name)) } if i.NameNEQ != nil { - predicates = append(predicates, application.NameNEQ(*i.NameNEQ)) + predicates = append(predicates, apisubscription.NameNEQ(*i.NameNEQ)) } if len(i.NameIn) > 0 { - predicates = append(predicates, application.NameIn(i.NameIn...)) + predicates = append(predicates, apisubscription.NameIn(i.NameIn...)) } if len(i.NameNotIn) > 0 { - predicates = append(predicates, application.NameNotIn(i.NameNotIn...)) + predicates = append(predicates, apisubscription.NameNotIn(i.NameNotIn...)) } if i.NameGT != nil { - predicates = append(predicates, application.NameGT(*i.NameGT)) + predicates = append(predicates, apisubscription.NameGT(*i.NameGT)) } if i.NameGTE != nil { - predicates = append(predicates, application.NameGTE(*i.NameGTE)) + predicates = append(predicates, apisubscription.NameGTE(*i.NameGTE)) } if i.NameLT != nil { - predicates = append(predicates, application.NameLT(*i.NameLT)) + predicates = append(predicates, apisubscription.NameLT(*i.NameLT)) } if i.NameLTE != nil { - predicates = append(predicates, application.NameLTE(*i.NameLTE)) + predicates = append(predicates, apisubscription.NameLTE(*i.NameLTE)) } if i.NameContains != nil { - predicates = append(predicates, application.NameContains(*i.NameContains)) + predicates = append(predicates, apisubscription.NameContains(*i.NameContains)) } if i.NameHasPrefix != nil { - predicates = append(predicates, application.NameHasPrefix(*i.NameHasPrefix)) + predicates = append(predicates, apisubscription.NameHasPrefix(*i.NameHasPrefix)) } if i.NameHasSuffix != nil { - predicates = append(predicates, application.NameHasSuffix(*i.NameHasSuffix)) + predicates = append(predicates, apisubscription.NameHasSuffix(*i.NameHasSuffix)) } if i.NameEqualFold != nil { - predicates = append(predicates, application.NameEqualFold(*i.NameEqualFold)) + predicates = append(predicates, apisubscription.NameEqualFold(*i.NameEqualFold)) } if i.NameContainsFold != nil { - predicates = append(predicates, application.NameContainsFold(*i.NameContainsFold)) + predicates = append(predicates, apisubscription.NameContainsFold(*i.NameContainsFold)) } - if i.ClientID != nil { - predicates = append(predicates, application.ClientIDEQ(*i.ClientID)) + if i.BasePath != nil { + predicates = append(predicates, apisubscription.BasePathEQ(*i.BasePath)) } - if i.ClientIDNEQ != nil { - predicates = append(predicates, application.ClientIDNEQ(*i.ClientIDNEQ)) + if i.BasePathNEQ != nil { + predicates = append(predicates, apisubscription.BasePathNEQ(*i.BasePathNEQ)) } - if len(i.ClientIDIn) > 0 { - predicates = append(predicates, application.ClientIDIn(i.ClientIDIn...)) + if len(i.BasePathIn) > 0 { + predicates = append(predicates, apisubscription.BasePathIn(i.BasePathIn...)) } - if len(i.ClientIDNotIn) > 0 { - predicates = append(predicates, application.ClientIDNotIn(i.ClientIDNotIn...)) + if len(i.BasePathNotIn) > 0 { + predicates = append(predicates, apisubscription.BasePathNotIn(i.BasePathNotIn...)) } - if i.ClientIDGT != nil { - predicates = append(predicates, application.ClientIDGT(*i.ClientIDGT)) + if i.BasePathGT != nil { + predicates = append(predicates, apisubscription.BasePathGT(*i.BasePathGT)) } - if i.ClientIDGTE != nil { - predicates = append(predicates, application.ClientIDGTE(*i.ClientIDGTE)) + if i.BasePathGTE != nil { + predicates = append(predicates, apisubscription.BasePathGTE(*i.BasePathGTE)) } - if i.ClientIDLT != nil { - predicates = append(predicates, application.ClientIDLT(*i.ClientIDLT)) + if i.BasePathLT != nil { + predicates = append(predicates, apisubscription.BasePathLT(*i.BasePathLT)) } - if i.ClientIDLTE != nil { - predicates = append(predicates, application.ClientIDLTE(*i.ClientIDLTE)) + if i.BasePathLTE != nil { + predicates = append(predicates, apisubscription.BasePathLTE(*i.BasePathLTE)) } - if i.ClientIDContains != nil { - predicates = append(predicates, application.ClientIDContains(*i.ClientIDContains)) + if i.BasePathContains != nil { + predicates = append(predicates, apisubscription.BasePathContains(*i.BasePathContains)) } - if i.ClientIDHasPrefix != nil { - predicates = append(predicates, application.ClientIDHasPrefix(*i.ClientIDHasPrefix)) + if i.BasePathHasPrefix != nil { + predicates = append(predicates, apisubscription.BasePathHasPrefix(*i.BasePathHasPrefix)) } - if i.ClientIDHasSuffix != nil { - predicates = append(predicates, application.ClientIDHasSuffix(*i.ClientIDHasSuffix)) + if i.BasePathHasSuffix != nil { + predicates = append(predicates, apisubscription.BasePathHasSuffix(*i.BasePathHasSuffix)) } - if i.ClientIDIsNil { - predicates = append(predicates, application.ClientIDIsNil()) + if i.BasePathEqualFold != nil { + predicates = append(predicates, apisubscription.BasePathEqualFold(*i.BasePathEqualFold)) } - if i.ClientIDNotNil { - predicates = append(predicates, application.ClientIDNotNil()) + if i.BasePathContainsFold != nil { + predicates = append(predicates, apisubscription.BasePathContainsFold(*i.BasePathContainsFold)) } - if i.ClientIDEqualFold != nil { - predicates = append(predicates, application.ClientIDEqualFold(*i.ClientIDEqualFold)) + if i.M2mAuthMethod != nil { + predicates = append(predicates, apisubscription.M2mAuthMethodEQ(*i.M2mAuthMethod)) } - if i.ClientIDContainsFold != nil { - predicates = append(predicates, application.ClientIDContainsFold(*i.ClientIDContainsFold)) + if i.M2mAuthMethodNEQ != nil { + predicates = append(predicates, apisubscription.M2mAuthMethodNEQ(*i.M2mAuthMethodNEQ)) } - if i.RotatedExpiresAt != nil { - predicates = append(predicates, application.RotatedExpiresAtEQ(*i.RotatedExpiresAt)) + if len(i.M2mAuthMethodIn) > 0 { + predicates = append(predicates, apisubscription.M2mAuthMethodIn(i.M2mAuthMethodIn...)) } - if i.RotatedExpiresAtNEQ != nil { - predicates = append(predicates, application.RotatedExpiresAtNEQ(*i.RotatedExpiresAtNEQ)) + if len(i.M2mAuthMethodNotIn) > 0 { + predicates = append(predicates, apisubscription.M2mAuthMethodNotIn(i.M2mAuthMethodNotIn...)) } - if len(i.RotatedExpiresAtIn) > 0 { - predicates = append(predicates, application.RotatedExpiresAtIn(i.RotatedExpiresAtIn...)) + + if i.HasOwner != nil { + p := apisubscription.HasOwner() + if !*i.HasOwner { + p = apisubscription.Not(p) + } + predicates = append(predicates, p) } - if len(i.RotatedExpiresAtNotIn) > 0 { - predicates = append(predicates, application.RotatedExpiresAtNotIn(i.RotatedExpiresAtNotIn...)) + 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, apisubscription.HasOwnerWith(with...)) } - if i.RotatedExpiresAtGT != nil { - predicates = append(predicates, application.RotatedExpiresAtGT(*i.RotatedExpiresAtGT)) + if i.HasTarget != nil { + p := apisubscription.HasTarget() + if !*i.HasTarget { + p = apisubscription.Not(p) + } + predicates = append(predicates, p) } - if i.RotatedExpiresAtGTE != nil { - predicates = append(predicates, application.RotatedExpiresAtGTE(*i.RotatedExpiresAtGTE)) + if len(i.HasTargetWith) > 0 { + with := make([]predicate.ApiExposure, 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, apisubscription.HasTargetWith(with...)) } - if i.RotatedExpiresAtLT != nil { - predicates = append(predicates, application.RotatedExpiresAtLT(*i.RotatedExpiresAtLT)) + if i.HasFailoverZones != nil { + p := apisubscription.HasFailoverZones() + if !*i.HasFailoverZones { + p = apisubscription.Not(p) + } + predicates = append(predicates, p) } - if i.RotatedExpiresAtLTE != nil { - predicates = append(predicates, application.RotatedExpiresAtLTE(*i.RotatedExpiresAtLTE)) + if len(i.HasFailoverZonesWith) > 0 { + with := make([]predicate.Zone, 0, len(i.HasFailoverZonesWith)) + for _, w := range i.HasFailoverZonesWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasFailoverZonesWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, apisubscription.HasFailoverZonesWith(with...)) } - if i.RotatedExpiresAtIsNil { - predicates = append(predicates, application.RotatedExpiresAtIsNil()) + if i.HasApproval != nil { + p := apisubscription.HasApproval() + if !*i.HasApproval { + p = apisubscription.Not(p) + } + predicates = append(predicates, p) } - if i.RotatedExpiresAtNotNil { - predicates = append(predicates, application.RotatedExpiresAtNotNil()) + 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, apisubscription.HasApprovalWith(with...)) } - if i.CurrentExpiresAt != nil { - predicates = append(predicates, application.CurrentExpiresAtEQ(*i.CurrentExpiresAt)) + if i.HasApprovalRequests != nil { + p := apisubscription.HasApprovalRequests() + if !*i.HasApprovalRequests { + p = apisubscription.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, apisubscription.HasApprovalRequestsWith(with...)) + } + switch len(predicates) { + case 0: + return nil, ErrEmptyApiSubscriptionWhereInput + case 1: + return predicates[0], nil + default: + return apisubscription.And(predicates...), nil + } +} + +// ApplicationWhereInput represents a where input for filtering Application queries. +type ApplicationWhereInput struct { + Predicates []predicate.Application `json:"-"` + Not *ApplicationWhereInput `json:"not,omitempty"` + Or []*ApplicationWhereInput `json:"or,omitempty"` + And []*ApplicationWhereInput `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 *application.StatusPhase `json:"statusPhase,omitempty"` + StatusPhaseNEQ *application.StatusPhase `json:"statusPhaseNEQ,omitempty"` + StatusPhaseIn []application.StatusPhase `json:"statusPhaseIn,omitempty"` + StatusPhaseNotIn []application.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"` + + // "client_id" field predicates. + ClientID *string `json:"clientID,omitempty"` + ClientIDNEQ *string `json:"clientIDNEQ,omitempty"` + ClientIDIn []string `json:"clientIDIn,omitempty"` + ClientIDNotIn []string `json:"clientIDNotIn,omitempty"` + ClientIDGT *string `json:"clientIDGT,omitempty"` + ClientIDGTE *string `json:"clientIDGTE,omitempty"` + ClientIDLT *string `json:"clientIDLT,omitempty"` + ClientIDLTE *string `json:"clientIDLTE,omitempty"` + ClientIDContains *string `json:"clientIDContains,omitempty"` + ClientIDHasPrefix *string `json:"clientIDHasPrefix,omitempty"` + ClientIDHasSuffix *string `json:"clientIDHasSuffix,omitempty"` + ClientIDIsNil bool `json:"clientIDIsNil,omitempty"` + ClientIDNotNil bool `json:"clientIDNotNil,omitempty"` + ClientIDEqualFold *string `json:"clientIDEqualFold,omitempty"` + ClientIDContainsFold *string `json:"clientIDContainsFold,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"` + HasZoneWith []*ZoneWhereInput `json:"hasZoneWith,omitempty"` + + // "owner_team" edge predicates. + HasOwnerTeam *bool `json:"hasOwnerTeam,omitempty"` + HasOwnerTeamWith []*TeamWhereInput `json:"hasOwnerTeamWith,omitempty"` + + // "exposed_apis" edge predicates. + HasExposedApis *bool `json:"hasExposedApis,omitempty"` + HasExposedApisWith []*ApiExposureWhereInput `json:"hasExposedApisWith,omitempty"` + + // "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. +func (i *ApplicationWhereInput) AddPredicates(predicates ...predicate.Application) { + i.Predicates = append(i.Predicates, predicates...) +} + +// Filter applies the ApplicationWhereInput filter on the ApplicationQuery builder. +func (i *ApplicationWhereInput) Filter(q *ApplicationQuery) (*ApplicationQuery, error) { + if i == nil { + return q, nil + } + p, err := i.P() + if err != nil { + if err == ErrEmptyApplicationWhereInput { + return q, nil + } + return nil, err + } + return q.Where(p), nil +} + +// ErrEmptyApplicationWhereInput is returned in case the ApplicationWhereInput is empty. +var ErrEmptyApplicationWhereInput = errors.New("ent: empty predicate ApplicationWhereInput") + +// P returns a predicate for filtering applications. +// An error is returned if the input is empty or invalid. +func (i *ApplicationWhereInput) P() (predicate.Application, error) { + var predicates []predicate.Application + if i.Not != nil { + p, err := i.Not.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'not'", err) + } + predicates = append(predicates, application.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.Application, 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, application.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.Application, 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, application.And(and...)) + } + predicates = append(predicates, i.Predicates...) + if i.ID != nil { + predicates = append(predicates, application.IDEQ(*i.ID)) + } + if i.IDNEQ != nil { + predicates = append(predicates, application.IDNEQ(*i.IDNEQ)) + } + if len(i.IDIn) > 0 { + predicates = append(predicates, application.IDIn(i.IDIn...)) + } + if len(i.IDNotIn) > 0 { + predicates = append(predicates, application.IDNotIn(i.IDNotIn...)) + } + if i.IDGT != nil { + predicates = append(predicates, application.IDGT(*i.IDGT)) + } + if i.IDGTE != nil { + predicates = append(predicates, application.IDGTE(*i.IDGTE)) + } + if i.IDLT != nil { + predicates = append(predicates, application.IDLT(*i.IDLT)) + } + if i.IDLTE != nil { + predicates = append(predicates, application.IDLTE(*i.IDLTE)) + } + if i.CreatedAt != nil { + predicates = append(predicates, application.CreatedAtEQ(*i.CreatedAt)) + } + if i.CreatedAtNEQ != nil { + predicates = append(predicates, application.CreatedAtNEQ(*i.CreatedAtNEQ)) + } + if len(i.CreatedAtIn) > 0 { + predicates = append(predicates, application.CreatedAtIn(i.CreatedAtIn...)) + } + if len(i.CreatedAtNotIn) > 0 { + predicates = append(predicates, application.CreatedAtNotIn(i.CreatedAtNotIn...)) + } + if i.CreatedAtGT != nil { + predicates = append(predicates, application.CreatedAtGT(*i.CreatedAtGT)) + } + if i.CreatedAtGTE != nil { + predicates = append(predicates, application.CreatedAtGTE(*i.CreatedAtGTE)) + } + if i.CreatedAtLT != nil { + predicates = append(predicates, application.CreatedAtLT(*i.CreatedAtLT)) + } + if i.CreatedAtLTE != nil { + predicates = append(predicates, application.CreatedAtLTE(*i.CreatedAtLTE)) + } + if i.LastModifiedAt != nil { + predicates = append(predicates, application.LastModifiedAtEQ(*i.LastModifiedAt)) + } + if i.LastModifiedAtNEQ != nil { + predicates = append(predicates, application.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + } + if len(i.LastModifiedAtIn) > 0 { + predicates = append(predicates, application.LastModifiedAtIn(i.LastModifiedAtIn...)) + } + if len(i.LastModifiedAtNotIn) > 0 { + predicates = append(predicates, application.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + } + if i.LastModifiedAtGT != nil { + predicates = append(predicates, application.LastModifiedAtGT(*i.LastModifiedAtGT)) + } + if i.LastModifiedAtGTE != nil { + predicates = append(predicates, application.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + } + if i.LastModifiedAtLT != nil { + predicates = append(predicates, application.LastModifiedAtLT(*i.LastModifiedAtLT)) + } + if i.LastModifiedAtLTE != nil { + predicates = append(predicates, application.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + } + if i.StatusPhase != nil { + predicates = append(predicates, application.StatusPhaseEQ(*i.StatusPhase)) + } + if i.StatusPhaseNEQ != nil { + predicates = append(predicates, application.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + } + if len(i.StatusPhaseIn) > 0 { + predicates = append(predicates, application.StatusPhaseIn(i.StatusPhaseIn...)) + } + if len(i.StatusPhaseNotIn) > 0 { + predicates = append(predicates, application.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + } + if i.StatusPhaseIsNil { + predicates = append(predicates, application.StatusPhaseIsNil()) + } + if i.StatusPhaseNotNil { + predicates = append(predicates, application.StatusPhaseNotNil()) + } + if i.StatusMessage != nil { + predicates = append(predicates, application.StatusMessageEQ(*i.StatusMessage)) + } + if i.StatusMessageNEQ != nil { + predicates = append(predicates, application.StatusMessageNEQ(*i.StatusMessageNEQ)) + } + if len(i.StatusMessageIn) > 0 { + predicates = append(predicates, application.StatusMessageIn(i.StatusMessageIn...)) + } + if len(i.StatusMessageNotIn) > 0 { + predicates = append(predicates, application.StatusMessageNotIn(i.StatusMessageNotIn...)) + } + if i.StatusMessageGT != nil { + predicates = append(predicates, application.StatusMessageGT(*i.StatusMessageGT)) + } + if i.StatusMessageGTE != nil { + predicates = append(predicates, application.StatusMessageGTE(*i.StatusMessageGTE)) + } + if i.StatusMessageLT != nil { + predicates = append(predicates, application.StatusMessageLT(*i.StatusMessageLT)) + } + if i.StatusMessageLTE != nil { + predicates = append(predicates, application.StatusMessageLTE(*i.StatusMessageLTE)) + } + if i.StatusMessageContains != nil { + predicates = append(predicates, application.StatusMessageContains(*i.StatusMessageContains)) + } + if i.StatusMessageHasPrefix != nil { + predicates = append(predicates, application.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) + } + if i.StatusMessageHasSuffix != nil { + predicates = append(predicates, application.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) + } + if i.StatusMessageIsNil { + predicates = append(predicates, application.StatusMessageIsNil()) + } + if i.StatusMessageNotNil { + predicates = append(predicates, application.StatusMessageNotNil()) + } + if i.StatusMessageEqualFold != nil { + predicates = append(predicates, application.StatusMessageEqualFold(*i.StatusMessageEqualFold)) + } + if i.StatusMessageContainsFold != nil { + predicates = append(predicates, application.StatusMessageContainsFold(*i.StatusMessageContainsFold)) + } + if i.Environment != nil { + predicates = append(predicates, application.EnvironmentEQ(*i.Environment)) + } + if i.EnvironmentNEQ != nil { + predicates = append(predicates, application.EnvironmentNEQ(*i.EnvironmentNEQ)) + } + if len(i.EnvironmentIn) > 0 { + predicates = append(predicates, application.EnvironmentIn(i.EnvironmentIn...)) + } + if len(i.EnvironmentNotIn) > 0 { + predicates = append(predicates, application.EnvironmentNotIn(i.EnvironmentNotIn...)) + } + if i.EnvironmentGT != nil { + predicates = append(predicates, application.EnvironmentGT(*i.EnvironmentGT)) + } + if i.EnvironmentGTE != nil { + predicates = append(predicates, application.EnvironmentGTE(*i.EnvironmentGTE)) + } + if i.EnvironmentLT != nil { + predicates = append(predicates, application.EnvironmentLT(*i.EnvironmentLT)) + } + if i.EnvironmentLTE != nil { + predicates = append(predicates, application.EnvironmentLTE(*i.EnvironmentLTE)) + } + if i.EnvironmentContains != nil { + predicates = append(predicates, application.EnvironmentContains(*i.EnvironmentContains)) + } + if i.EnvironmentHasPrefix != nil { + predicates = append(predicates, application.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + } + if i.EnvironmentHasSuffix != nil { + predicates = append(predicates, application.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + } + if i.EnvironmentIsNil { + predicates = append(predicates, application.EnvironmentIsNil()) + } + if i.EnvironmentNotNil { + predicates = append(predicates, application.EnvironmentNotNil()) + } + if i.EnvironmentEqualFold != nil { + predicates = append(predicates, application.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + } + if i.EnvironmentContainsFold != nil { + predicates = append(predicates, application.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + } + if i.Namespace != nil { + predicates = append(predicates, application.NamespaceEQ(*i.Namespace)) + } + if i.NamespaceNEQ != nil { + predicates = append(predicates, application.NamespaceNEQ(*i.NamespaceNEQ)) + } + if len(i.NamespaceIn) > 0 { + predicates = append(predicates, application.NamespaceIn(i.NamespaceIn...)) + } + if len(i.NamespaceNotIn) > 0 { + predicates = append(predicates, application.NamespaceNotIn(i.NamespaceNotIn...)) + } + if i.NamespaceGT != nil { + predicates = append(predicates, application.NamespaceGT(*i.NamespaceGT)) + } + if i.NamespaceGTE != nil { + predicates = append(predicates, application.NamespaceGTE(*i.NamespaceGTE)) + } + if i.NamespaceLT != nil { + predicates = append(predicates, application.NamespaceLT(*i.NamespaceLT)) + } + if i.NamespaceLTE != nil { + predicates = append(predicates, application.NamespaceLTE(*i.NamespaceLTE)) + } + if i.NamespaceContains != nil { + predicates = append(predicates, application.NamespaceContains(*i.NamespaceContains)) + } + if i.NamespaceHasPrefix != nil { + predicates = append(predicates, application.NamespaceHasPrefix(*i.NamespaceHasPrefix)) + } + if i.NamespaceHasSuffix != nil { + predicates = append(predicates, application.NamespaceHasSuffix(*i.NamespaceHasSuffix)) + } + if i.NamespaceEqualFold != nil { + predicates = append(predicates, application.NamespaceEqualFold(*i.NamespaceEqualFold)) + } + if i.NamespaceContainsFold != nil { + predicates = append(predicates, application.NamespaceContainsFold(*i.NamespaceContainsFold)) + } + if i.Name != nil { + predicates = append(predicates, application.NameEQ(*i.Name)) + } + if i.NameNEQ != nil { + predicates = append(predicates, application.NameNEQ(*i.NameNEQ)) + } + if len(i.NameIn) > 0 { + predicates = append(predicates, application.NameIn(i.NameIn...)) + } + if len(i.NameNotIn) > 0 { + predicates = append(predicates, application.NameNotIn(i.NameNotIn...)) + } + if i.NameGT != nil { + predicates = append(predicates, application.NameGT(*i.NameGT)) + } + if i.NameGTE != nil { + predicates = append(predicates, application.NameGTE(*i.NameGTE)) + } + if i.NameLT != nil { + predicates = append(predicates, application.NameLT(*i.NameLT)) + } + if i.NameLTE != nil { + predicates = append(predicates, application.NameLTE(*i.NameLTE)) + } + if i.NameContains != nil { + predicates = append(predicates, application.NameContains(*i.NameContains)) + } + if i.NameHasPrefix != nil { + predicates = append(predicates, application.NameHasPrefix(*i.NameHasPrefix)) + } + if i.NameHasSuffix != nil { + predicates = append(predicates, application.NameHasSuffix(*i.NameHasSuffix)) + } + if i.NameEqualFold != nil { + predicates = append(predicates, application.NameEqualFold(*i.NameEqualFold)) + } + if i.NameContainsFold != nil { + predicates = append(predicates, application.NameContainsFold(*i.NameContainsFold)) + } + if i.ClientID != nil { + predicates = append(predicates, application.ClientIDEQ(*i.ClientID)) + } + if i.ClientIDNEQ != nil { + predicates = append(predicates, application.ClientIDNEQ(*i.ClientIDNEQ)) + } + if len(i.ClientIDIn) > 0 { + predicates = append(predicates, application.ClientIDIn(i.ClientIDIn...)) + } + if len(i.ClientIDNotIn) > 0 { + predicates = append(predicates, application.ClientIDNotIn(i.ClientIDNotIn...)) + } + if i.ClientIDGT != nil { + predicates = append(predicates, application.ClientIDGT(*i.ClientIDGT)) + } + if i.ClientIDGTE != nil { + predicates = append(predicates, application.ClientIDGTE(*i.ClientIDGTE)) + } + if i.ClientIDLT != nil { + predicates = append(predicates, application.ClientIDLT(*i.ClientIDLT)) + } + if i.ClientIDLTE != nil { + predicates = append(predicates, application.ClientIDLTE(*i.ClientIDLTE)) + } + if i.ClientIDContains != nil { + predicates = append(predicates, application.ClientIDContains(*i.ClientIDContains)) + } + if i.ClientIDHasPrefix != nil { + predicates = append(predicates, application.ClientIDHasPrefix(*i.ClientIDHasPrefix)) + } + if i.ClientIDHasSuffix != nil { + predicates = append(predicates, application.ClientIDHasSuffix(*i.ClientIDHasSuffix)) + } + if i.ClientIDIsNil { + predicates = append(predicates, application.ClientIDIsNil()) + } + if i.ClientIDNotNil { + predicates = append(predicates, application.ClientIDNotNil()) + } + if i.ClientIDEqualFold != nil { + predicates = append(predicates, application.ClientIDEqualFold(*i.ClientIDEqualFold)) + } + if i.ClientIDContainsFold != nil { + predicates = append(predicates, application.ClientIDContainsFold(*i.ClientIDContainsFold)) + } + if i.RotatedExpiresAt != nil { + predicates = append(predicates, application.RotatedExpiresAtEQ(*i.RotatedExpiresAt)) + } + if i.RotatedExpiresAtNEQ != nil { + predicates = append(predicates, application.RotatedExpiresAtNEQ(*i.RotatedExpiresAtNEQ)) + } + if len(i.RotatedExpiresAtIn) > 0 { + predicates = append(predicates, application.RotatedExpiresAtIn(i.RotatedExpiresAtIn...)) + } + if len(i.RotatedExpiresAtNotIn) > 0 { + predicates = append(predicates, application.RotatedExpiresAtNotIn(i.RotatedExpiresAtNotIn...)) + } + if i.RotatedExpiresAtGT != nil { + predicates = append(predicates, application.RotatedExpiresAtGT(*i.RotatedExpiresAtGT)) + } + if i.RotatedExpiresAtGTE != nil { + predicates = append(predicates, application.RotatedExpiresAtGTE(*i.RotatedExpiresAtGTE)) + } + if i.RotatedExpiresAtLT != nil { + predicates = append(predicates, application.RotatedExpiresAtLT(*i.RotatedExpiresAtLT)) + } + if i.RotatedExpiresAtLTE != nil { + predicates = append(predicates, application.RotatedExpiresAtLTE(*i.RotatedExpiresAtLTE)) + } + if i.RotatedExpiresAtIsNil { + predicates = append(predicates, application.RotatedExpiresAtIsNil()) + } + if i.RotatedExpiresAtNotNil { + predicates = append(predicates, application.RotatedExpiresAtNotNil()) + } + if i.CurrentExpiresAt != nil { + predicates = append(predicates, application.CurrentExpiresAtEQ(*i.CurrentExpiresAt)) + } + if i.CurrentExpiresAtNEQ != nil { + predicates = append(predicates, application.CurrentExpiresAtNEQ(*i.CurrentExpiresAtNEQ)) + } + if len(i.CurrentExpiresAtIn) > 0 { + predicates = append(predicates, application.CurrentExpiresAtIn(i.CurrentExpiresAtIn...)) + } + if len(i.CurrentExpiresAtNotIn) > 0 { + predicates = append(predicates, application.CurrentExpiresAtNotIn(i.CurrentExpiresAtNotIn...)) + } + if i.CurrentExpiresAtGT != nil { + predicates = append(predicates, application.CurrentExpiresAtGT(*i.CurrentExpiresAtGT)) + } + if i.CurrentExpiresAtGTE != nil { + predicates = append(predicates, application.CurrentExpiresAtGTE(*i.CurrentExpiresAtGTE)) + } + if i.CurrentExpiresAtLT != nil { + predicates = append(predicates, application.CurrentExpiresAtLT(*i.CurrentExpiresAtLT)) + } + if i.CurrentExpiresAtLTE != nil { + predicates = append(predicates, application.CurrentExpiresAtLTE(*i.CurrentExpiresAtLTE)) + } + if i.CurrentExpiresAtIsNil { + predicates = append(predicates, application.CurrentExpiresAtIsNil()) + } + if i.CurrentExpiresAtNotNil { + predicates = append(predicates, application.CurrentExpiresAtNotNil()) + } + if i.SecretRotationPhase != nil { + predicates = append(predicates, application.SecretRotationPhaseEQ(*i.SecretRotationPhase)) + } + if i.SecretRotationPhaseNEQ != nil { + predicates = append(predicates, application.SecretRotationPhaseNEQ(*i.SecretRotationPhaseNEQ)) + } + if len(i.SecretRotationPhaseIn) > 0 { + predicates = append(predicates, application.SecretRotationPhaseIn(i.SecretRotationPhaseIn...)) + } + if len(i.SecretRotationPhaseNotIn) > 0 { + predicates = append(predicates, application.SecretRotationPhaseNotIn(i.SecretRotationPhaseNotIn...)) + } + if i.SecretRotationMessage != nil { + predicates = append(predicates, application.SecretRotationMessageEQ(*i.SecretRotationMessage)) + } + if i.SecretRotationMessageNEQ != nil { + predicates = append(predicates, application.SecretRotationMessageNEQ(*i.SecretRotationMessageNEQ)) + } + if len(i.SecretRotationMessageIn) > 0 { + predicates = append(predicates, application.SecretRotationMessageIn(i.SecretRotationMessageIn...)) + } + if len(i.SecretRotationMessageNotIn) > 0 { + predicates = append(predicates, application.SecretRotationMessageNotIn(i.SecretRotationMessageNotIn...)) + } + if i.SecretRotationMessageGT != nil { + predicates = append(predicates, application.SecretRotationMessageGT(*i.SecretRotationMessageGT)) + } + 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 { + p := application.HasZone() + if !*i.HasZone { + p = application.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasZoneWith) > 0 { + with := make([]predicate.Zone, 0, len(i.HasZoneWith)) + for _, w := range i.HasZoneWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasZoneWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, application.HasZoneWith(with...)) + } + if i.HasOwnerTeam != nil { + p := application.HasOwnerTeam() + if !*i.HasOwnerTeam { + p = application.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasOwnerTeamWith) > 0 { + with := make([]predicate.Team, 0, len(i.HasOwnerTeamWith)) + for _, w := range i.HasOwnerTeamWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasOwnerTeamWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, application.HasOwnerTeamWith(with...)) + } + if i.HasExposedApis != nil { + p := application.HasExposedApis() + if !*i.HasExposedApis { + p = application.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasExposedApisWith) > 0 { + with := make([]predicate.ApiExposure, 0, len(i.HasExposedApisWith)) + for _, w := range i.HasExposedApisWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasExposedApisWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, application.HasExposedApisWith(with...)) + } + if i.HasSubscribedApis != nil { + p := application.HasSubscribedApis() + if !*i.HasSubscribedApis { + p = application.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasSubscribedApisWith) > 0 { + with := make([]predicate.ApiSubscription, 0, len(i.HasSubscribedApisWith)) + for _, w := range i.HasSubscribedApisWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasSubscribedApisWith'", err) + } + with = append(with, p) + } + 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 + case 1: + return predicates[0], nil + default: + return application.And(predicates...), nil + } +} + +// ApprovalWhereInput represents a where input for filtering Approval queries. +type ApprovalWhereInput struct { + Predicates []predicate.Approval `json:"-"` + Not *ApprovalWhereInput `json:"not,omitempty"` + Or []*ApprovalWhereInput `json:"or,omitempty"` + And []*ApprovalWhereInput `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 *approval.StatusPhase `json:"statusPhase,omitempty"` + StatusPhaseNEQ *approval.StatusPhase `json:"statusPhaseNEQ,omitempty"` + StatusPhaseIn []approval.StatusPhase `json:"statusPhaseIn,omitempty"` + StatusPhaseNotIn []approval.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"` + + // "action" field predicates. + Action *string `json:"action,omitempty"` + ActionNEQ *string `json:"actionNEQ,omitempty"` + ActionIn []string `json:"actionIn,omitempty"` + ActionNotIn []string `json:"actionNotIn,omitempty"` + ActionGT *string `json:"actionGT,omitempty"` + ActionGTE *string `json:"actionGTE,omitempty"` + ActionLT *string `json:"actionLT,omitempty"` + ActionLTE *string `json:"actionLTE,omitempty"` + ActionContains *string `json:"actionContains,omitempty"` + ActionHasPrefix *string `json:"actionHasPrefix,omitempty"` + ActionHasSuffix *string `json:"actionHasSuffix,omitempty"` + ActionEqualFold *string `json:"actionEqualFold,omitempty"` + ActionContainsFold *string `json:"actionContainsFold,omitempty"` + + // "strategy" field predicates. + Strategy *approval.Strategy `json:"strategy,omitempty"` + StrategyNEQ *approval.Strategy `json:"strategyNEQ,omitempty"` + StrategyIn []approval.Strategy `json:"strategyIn,omitempty"` + StrategyNotIn []approval.Strategy `json:"strategyNotIn,omitempty"` + + // "decider_team_name" field predicates. + DeciderTeamName *string `json:"deciderTeamName,omitempty"` + DeciderTeamNameNEQ *string `json:"deciderTeamNameNEQ,omitempty"` + DeciderTeamNameIn []string `json:"deciderTeamNameIn,omitempty"` + DeciderTeamNameNotIn []string `json:"deciderTeamNameNotIn,omitempty"` + DeciderTeamNameGT *string `json:"deciderTeamNameGT,omitempty"` + DeciderTeamNameGTE *string `json:"deciderTeamNameGTE,omitempty"` + DeciderTeamNameLT *string `json:"deciderTeamNameLT,omitempty"` + DeciderTeamNameLTE *string `json:"deciderTeamNameLTE,omitempty"` + DeciderTeamNameContains *string `json:"deciderTeamNameContains,omitempty"` + DeciderTeamNameHasPrefix *string `json:"deciderTeamNameHasPrefix,omitempty"` + DeciderTeamNameHasSuffix *string `json:"deciderTeamNameHasSuffix,omitempty"` + DeciderTeamNameEqualFold *string `json:"deciderTeamNameEqualFold,omitempty"` + DeciderTeamNameContainsFold *string `json:"deciderTeamNameContainsFold,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"` + + // "state" field predicates. + State *approval.State `json:"state,omitempty"` + StateNEQ *approval.State `json:"stateNEQ,omitempty"` + StateIn []approval.State `json:"stateIn,omitempty"` + StateNotIn []approval.State `json:"stateNotIn,omitempty"` + + // "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. +func (i *ApprovalWhereInput) AddPredicates(predicates ...predicate.Approval) { + i.Predicates = append(i.Predicates, predicates...) +} + +// Filter applies the ApprovalWhereInput filter on the ApprovalQuery builder. +func (i *ApprovalWhereInput) Filter(q *ApprovalQuery) (*ApprovalQuery, error) { + if i == nil { + return q, nil + } + p, err := i.P() + if err != nil { + if err == ErrEmptyApprovalWhereInput { + return q, nil + } + return nil, err + } + return q.Where(p), nil +} + +// ErrEmptyApprovalWhereInput is returned in case the ApprovalWhereInput is empty. +var ErrEmptyApprovalWhereInput = errors.New("ent: empty predicate ApprovalWhereInput") + +// P returns a predicate for filtering approvals. +// An error is returned if the input is empty or invalid. +func (i *ApprovalWhereInput) P() (predicate.Approval, error) { + var predicates []predicate.Approval + if i.Not != nil { + p, err := i.Not.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'not'", err) + } + predicates = append(predicates, approval.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.Approval, 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, approval.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.Approval, 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, approval.And(and...)) + } + predicates = append(predicates, i.Predicates...) + if i.ID != nil { + predicates = append(predicates, approval.IDEQ(*i.ID)) + } + if i.IDNEQ != nil { + predicates = append(predicates, approval.IDNEQ(*i.IDNEQ)) + } + if len(i.IDIn) > 0 { + predicates = append(predicates, approval.IDIn(i.IDIn...)) + } + if len(i.IDNotIn) > 0 { + predicates = append(predicates, approval.IDNotIn(i.IDNotIn...)) + } + if i.IDGT != nil { + predicates = append(predicates, approval.IDGT(*i.IDGT)) + } + if i.IDGTE != nil { + predicates = append(predicates, approval.IDGTE(*i.IDGTE)) + } + if i.IDLT != nil { + predicates = append(predicates, approval.IDLT(*i.IDLT)) + } + if i.IDLTE != nil { + predicates = append(predicates, approval.IDLTE(*i.IDLTE)) + } + if i.CreatedAt != nil { + predicates = append(predicates, approval.CreatedAtEQ(*i.CreatedAt)) + } + if i.CreatedAtNEQ != nil { + predicates = append(predicates, approval.CreatedAtNEQ(*i.CreatedAtNEQ)) + } + if len(i.CreatedAtIn) > 0 { + predicates = append(predicates, approval.CreatedAtIn(i.CreatedAtIn...)) + } + if len(i.CreatedAtNotIn) > 0 { + predicates = append(predicates, approval.CreatedAtNotIn(i.CreatedAtNotIn...)) + } + if i.CreatedAtGT != nil { + predicates = append(predicates, approval.CreatedAtGT(*i.CreatedAtGT)) + } + if i.CreatedAtGTE != nil { + predicates = append(predicates, approval.CreatedAtGTE(*i.CreatedAtGTE)) + } + if i.CreatedAtLT != nil { + predicates = append(predicates, approval.CreatedAtLT(*i.CreatedAtLT)) + } + if i.CreatedAtLTE != nil { + predicates = append(predicates, approval.CreatedAtLTE(*i.CreatedAtLTE)) + } + if i.LastModifiedAt != nil { + predicates = append(predicates, approval.LastModifiedAtEQ(*i.LastModifiedAt)) + } + if i.LastModifiedAtNEQ != nil { + predicates = append(predicates, approval.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + } + if len(i.LastModifiedAtIn) > 0 { + predicates = append(predicates, approval.LastModifiedAtIn(i.LastModifiedAtIn...)) + } + if len(i.LastModifiedAtNotIn) > 0 { + predicates = append(predicates, approval.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + } + if i.LastModifiedAtGT != nil { + predicates = append(predicates, approval.LastModifiedAtGT(*i.LastModifiedAtGT)) + } + if i.LastModifiedAtGTE != nil { + predicates = append(predicates, approval.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + } + if i.LastModifiedAtLT != nil { + predicates = append(predicates, approval.LastModifiedAtLT(*i.LastModifiedAtLT)) + } + if i.LastModifiedAtLTE != nil { + predicates = append(predicates, approval.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + } + if i.StatusPhase != nil { + predicates = append(predicates, approval.StatusPhaseEQ(*i.StatusPhase)) + } + if i.StatusPhaseNEQ != nil { + predicates = append(predicates, approval.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + } + if len(i.StatusPhaseIn) > 0 { + predicates = append(predicates, approval.StatusPhaseIn(i.StatusPhaseIn...)) + } + if len(i.StatusPhaseNotIn) > 0 { + predicates = append(predicates, approval.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + } + if i.StatusPhaseIsNil { + predicates = append(predicates, approval.StatusPhaseIsNil()) + } + if i.StatusPhaseNotNil { + predicates = append(predicates, approval.StatusPhaseNotNil()) + } + if i.StatusMessage != nil { + predicates = append(predicates, approval.StatusMessageEQ(*i.StatusMessage)) + } + if i.StatusMessageNEQ != nil { + predicates = append(predicates, approval.StatusMessageNEQ(*i.StatusMessageNEQ)) + } + if len(i.StatusMessageIn) > 0 { + predicates = append(predicates, approval.StatusMessageIn(i.StatusMessageIn...)) + } + if len(i.StatusMessageNotIn) > 0 { + predicates = append(predicates, approval.StatusMessageNotIn(i.StatusMessageNotIn...)) + } + if i.StatusMessageGT != nil { + predicates = append(predicates, approval.StatusMessageGT(*i.StatusMessageGT)) + } + if i.StatusMessageGTE != nil { + predicates = append(predicates, approval.StatusMessageGTE(*i.StatusMessageGTE)) + } + if i.StatusMessageLT != nil { + predicates = append(predicates, approval.StatusMessageLT(*i.StatusMessageLT)) + } + if i.StatusMessageLTE != nil { + predicates = append(predicates, approval.StatusMessageLTE(*i.StatusMessageLTE)) + } + if i.StatusMessageContains != nil { + predicates = append(predicates, approval.StatusMessageContains(*i.StatusMessageContains)) + } + if i.StatusMessageHasPrefix != nil { + predicates = append(predicates, approval.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) + } + if i.StatusMessageHasSuffix != nil { + predicates = append(predicates, approval.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) + } + if i.StatusMessageIsNil { + predicates = append(predicates, approval.StatusMessageIsNil()) + } + if i.StatusMessageNotNil { + predicates = append(predicates, approval.StatusMessageNotNil()) + } + if i.StatusMessageEqualFold != nil { + predicates = append(predicates, approval.StatusMessageEqualFold(*i.StatusMessageEqualFold)) + } + if i.StatusMessageContainsFold != nil { + predicates = append(predicates, approval.StatusMessageContainsFold(*i.StatusMessageContainsFold)) + } + if i.Environment != nil { + predicates = append(predicates, approval.EnvironmentEQ(*i.Environment)) + } + if i.EnvironmentNEQ != nil { + predicates = append(predicates, approval.EnvironmentNEQ(*i.EnvironmentNEQ)) + } + if len(i.EnvironmentIn) > 0 { + predicates = append(predicates, approval.EnvironmentIn(i.EnvironmentIn...)) + } + if len(i.EnvironmentNotIn) > 0 { + predicates = append(predicates, approval.EnvironmentNotIn(i.EnvironmentNotIn...)) + } + if i.EnvironmentGT != nil { + predicates = append(predicates, approval.EnvironmentGT(*i.EnvironmentGT)) + } + if i.EnvironmentGTE != nil { + predicates = append(predicates, approval.EnvironmentGTE(*i.EnvironmentGTE)) } - if i.CurrentExpiresAtNEQ != nil { - predicates = append(predicates, application.CurrentExpiresAtNEQ(*i.CurrentExpiresAtNEQ)) + if i.EnvironmentLT != nil { + predicates = append(predicates, approval.EnvironmentLT(*i.EnvironmentLT)) } - if len(i.CurrentExpiresAtIn) > 0 { - predicates = append(predicates, application.CurrentExpiresAtIn(i.CurrentExpiresAtIn...)) + if i.EnvironmentLTE != nil { + predicates = append(predicates, approval.EnvironmentLTE(*i.EnvironmentLTE)) } - if len(i.CurrentExpiresAtNotIn) > 0 { - predicates = append(predicates, application.CurrentExpiresAtNotIn(i.CurrentExpiresAtNotIn...)) + if i.EnvironmentContains != nil { + predicates = append(predicates, approval.EnvironmentContains(*i.EnvironmentContains)) } - if i.CurrentExpiresAtGT != nil { - predicates = append(predicates, application.CurrentExpiresAtGT(*i.CurrentExpiresAtGT)) + if i.EnvironmentHasPrefix != nil { + predicates = append(predicates, approval.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) } - if i.CurrentExpiresAtGTE != nil { - predicates = append(predicates, application.CurrentExpiresAtGTE(*i.CurrentExpiresAtGTE)) + if i.EnvironmentHasSuffix != nil { + predicates = append(predicates, approval.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) } - if i.CurrentExpiresAtLT != nil { - predicates = append(predicates, application.CurrentExpiresAtLT(*i.CurrentExpiresAtLT)) + if i.EnvironmentIsNil { + predicates = append(predicates, approval.EnvironmentIsNil()) } - if i.CurrentExpiresAtLTE != nil { - predicates = append(predicates, application.CurrentExpiresAtLTE(*i.CurrentExpiresAtLTE)) + if i.EnvironmentNotNil { + predicates = append(predicates, approval.EnvironmentNotNil()) } - if i.CurrentExpiresAtIsNil { - predicates = append(predicates, application.CurrentExpiresAtIsNil()) + if i.EnvironmentEqualFold != nil { + predicates = append(predicates, approval.EnvironmentEqualFold(*i.EnvironmentEqualFold)) } - if i.CurrentExpiresAtNotNil { - predicates = append(predicates, application.CurrentExpiresAtNotNil()) + if i.EnvironmentContainsFold != nil { + predicates = append(predicates, approval.EnvironmentContainsFold(*i.EnvironmentContainsFold)) } - if i.SecretRotationPhase != nil { - predicates = append(predicates, application.SecretRotationPhaseEQ(*i.SecretRotationPhase)) + if i.Namespace != nil { + predicates = append(predicates, approval.NamespaceEQ(*i.Namespace)) } - if i.SecretRotationPhaseNEQ != nil { - predicates = append(predicates, application.SecretRotationPhaseNEQ(*i.SecretRotationPhaseNEQ)) + if i.NamespaceNEQ != nil { + predicates = append(predicates, approval.NamespaceNEQ(*i.NamespaceNEQ)) } - if len(i.SecretRotationPhaseIn) > 0 { - predicates = append(predicates, application.SecretRotationPhaseIn(i.SecretRotationPhaseIn...)) + if len(i.NamespaceIn) > 0 { + predicates = append(predicates, approval.NamespaceIn(i.NamespaceIn...)) } - if len(i.SecretRotationPhaseNotIn) > 0 { - predicates = append(predicates, application.SecretRotationPhaseNotIn(i.SecretRotationPhaseNotIn...)) + if len(i.NamespaceNotIn) > 0 { + predicates = append(predicates, approval.NamespaceNotIn(i.NamespaceNotIn...)) } - if i.SecretRotationMessage != nil { - predicates = append(predicates, application.SecretRotationMessageEQ(*i.SecretRotationMessage)) + if i.NamespaceGT != nil { + predicates = append(predicates, approval.NamespaceGT(*i.NamespaceGT)) } - if i.SecretRotationMessageNEQ != nil { - predicates = append(predicates, application.SecretRotationMessageNEQ(*i.SecretRotationMessageNEQ)) + if i.NamespaceGTE != nil { + predicates = append(predicates, approval.NamespaceGTE(*i.NamespaceGTE)) } - if len(i.SecretRotationMessageIn) > 0 { - predicates = append(predicates, application.SecretRotationMessageIn(i.SecretRotationMessageIn...)) + if i.NamespaceLT != nil { + predicates = append(predicates, approval.NamespaceLT(*i.NamespaceLT)) } - if len(i.SecretRotationMessageNotIn) > 0 { - predicates = append(predicates, application.SecretRotationMessageNotIn(i.SecretRotationMessageNotIn...)) + if i.NamespaceLTE != nil { + predicates = append(predicates, approval.NamespaceLTE(*i.NamespaceLTE)) } - if i.SecretRotationMessageGT != nil { - predicates = append(predicates, application.SecretRotationMessageGT(*i.SecretRotationMessageGT)) + if i.NamespaceContains != nil { + predicates = append(predicates, approval.NamespaceContains(*i.NamespaceContains)) } - if i.SecretRotationMessageGTE != nil { - predicates = append(predicates, application.SecretRotationMessageGTE(*i.SecretRotationMessageGTE)) + if i.NamespaceHasPrefix != nil { + predicates = append(predicates, approval.NamespaceHasPrefix(*i.NamespaceHasPrefix)) } - if i.SecretRotationMessageLT != nil { - predicates = append(predicates, application.SecretRotationMessageLT(*i.SecretRotationMessageLT)) + if i.NamespaceHasSuffix != nil { + predicates = append(predicates, approval.NamespaceHasSuffix(*i.NamespaceHasSuffix)) } - if i.SecretRotationMessageLTE != nil { - predicates = append(predicates, application.SecretRotationMessageLTE(*i.SecretRotationMessageLTE)) + if i.NamespaceEqualFold != nil { + predicates = append(predicates, approval.NamespaceEqualFold(*i.NamespaceEqualFold)) } - if i.SecretRotationMessageContains != nil { - predicates = append(predicates, application.SecretRotationMessageContains(*i.SecretRotationMessageContains)) + if i.NamespaceContainsFold != nil { + predicates = append(predicates, approval.NamespaceContainsFold(*i.NamespaceContainsFold)) } - if i.SecretRotationMessageHasPrefix != nil { - predicates = append(predicates, application.SecretRotationMessageHasPrefix(*i.SecretRotationMessageHasPrefix)) + if i.Action != nil { + predicates = append(predicates, approval.ActionEQ(*i.Action)) } - if i.SecretRotationMessageHasSuffix != nil { - predicates = append(predicates, application.SecretRotationMessageHasSuffix(*i.SecretRotationMessageHasSuffix)) + if i.ActionNEQ != nil { + predicates = append(predicates, approval.ActionNEQ(*i.ActionNEQ)) } - if i.SecretRotationMessageIsNil { - predicates = append(predicates, application.SecretRotationMessageIsNil()) + if len(i.ActionIn) > 0 { + predicates = append(predicates, approval.ActionIn(i.ActionIn...)) } - if i.SecretRotationMessageNotNil { - predicates = append(predicates, application.SecretRotationMessageNotNil()) + if len(i.ActionNotIn) > 0 { + predicates = append(predicates, approval.ActionNotIn(i.ActionNotIn...)) } - if i.SecretRotationMessageEqualFold != nil { - predicates = append(predicates, application.SecretRotationMessageEqualFold(*i.SecretRotationMessageEqualFold)) + if i.ActionGT != nil { + predicates = append(predicates, approval.ActionGT(*i.ActionGT)) } - if i.SecretRotationMessageContainsFold != nil { - predicates = append(predicates, application.SecretRotationMessageContainsFold(*i.SecretRotationMessageContainsFold)) + if i.ActionGTE != nil { + predicates = append(predicates, approval.ActionGTE(*i.ActionGTE)) } - - if i.HasZone != nil { - p := application.HasZone() - if !*i.HasZone { - p = application.Not(p) - } - predicates = append(predicates, p) + if i.ActionLT != nil { + predicates = append(predicates, approval.ActionLT(*i.ActionLT)) } - if len(i.HasZoneWith) > 0 { - with := make([]predicate.Zone, 0, len(i.HasZoneWith)) - for _, w := range i.HasZoneWith { - p, err := w.P() - if err != nil { - return nil, fmt.Errorf("%w: field 'HasZoneWith'", err) - } - with = append(with, p) - } - predicates = append(predicates, application.HasZoneWith(with...)) + if i.ActionLTE != nil { + predicates = append(predicates, approval.ActionLTE(*i.ActionLTE)) } - if i.HasOwnerTeam != nil { - p := application.HasOwnerTeam() - if !*i.HasOwnerTeam { - p = application.Not(p) - } - predicates = append(predicates, p) + if i.ActionContains != nil { + predicates = append(predicates, approval.ActionContains(*i.ActionContains)) } - if len(i.HasOwnerTeamWith) > 0 { - with := make([]predicate.Team, 0, len(i.HasOwnerTeamWith)) - for _, w := range i.HasOwnerTeamWith { - p, err := w.P() - if err != nil { - return nil, fmt.Errorf("%w: field 'HasOwnerTeamWith'", err) - } - with = append(with, p) - } - predicates = append(predicates, application.HasOwnerTeamWith(with...)) + if i.ActionHasPrefix != nil { + predicates = append(predicates, approval.ActionHasPrefix(*i.ActionHasPrefix)) } - if i.HasExposedApis != nil { - p := application.HasExposedApis() - if !*i.HasExposedApis { - p = application.Not(p) - } - predicates = append(predicates, p) + if i.ActionHasSuffix != nil { + predicates = append(predicates, approval.ActionHasSuffix(*i.ActionHasSuffix)) + } + if i.ActionEqualFold != nil { + predicates = append(predicates, approval.ActionEqualFold(*i.ActionEqualFold)) + } + if i.ActionContainsFold != nil { + predicates = append(predicates, approval.ActionContainsFold(*i.ActionContainsFold)) + } + if i.Strategy != nil { + predicates = append(predicates, approval.StrategyEQ(*i.Strategy)) + } + if i.StrategyNEQ != nil { + predicates = append(predicates, approval.StrategyNEQ(*i.StrategyNEQ)) + } + if len(i.StrategyIn) > 0 { + predicates = append(predicates, approval.StrategyIn(i.StrategyIn...)) + } + if len(i.StrategyNotIn) > 0 { + predicates = append(predicates, approval.StrategyNotIn(i.StrategyNotIn...)) + } + if i.DeciderTeamName != nil { + predicates = append(predicates, approval.DeciderTeamNameEQ(*i.DeciderTeamName)) + } + if i.DeciderTeamNameNEQ != nil { + predicates = append(predicates, approval.DeciderTeamNameNEQ(*i.DeciderTeamNameNEQ)) + } + if len(i.DeciderTeamNameIn) > 0 { + predicates = append(predicates, approval.DeciderTeamNameIn(i.DeciderTeamNameIn...)) + } + if len(i.DeciderTeamNameNotIn) > 0 { + predicates = append(predicates, approval.DeciderTeamNameNotIn(i.DeciderTeamNameNotIn...)) + } + if i.DeciderTeamNameGT != nil { + predicates = append(predicates, approval.DeciderTeamNameGT(*i.DeciderTeamNameGT)) + } + if i.DeciderTeamNameGTE != nil { + predicates = append(predicates, approval.DeciderTeamNameGTE(*i.DeciderTeamNameGTE)) + } + if i.DeciderTeamNameLT != nil { + predicates = append(predicates, approval.DeciderTeamNameLT(*i.DeciderTeamNameLT)) + } + if i.DeciderTeamNameLTE != nil { + predicates = append(predicates, approval.DeciderTeamNameLTE(*i.DeciderTeamNameLTE)) + } + if i.DeciderTeamNameContains != nil { + predicates = append(predicates, approval.DeciderTeamNameContains(*i.DeciderTeamNameContains)) + } + if i.DeciderTeamNameHasPrefix != nil { + predicates = append(predicates, approval.DeciderTeamNameHasPrefix(*i.DeciderTeamNameHasPrefix)) + } + if i.DeciderTeamNameHasSuffix != nil { + predicates = append(predicates, approval.DeciderTeamNameHasSuffix(*i.DeciderTeamNameHasSuffix)) + } + if i.DeciderTeamNameEqualFold != nil { + predicates = append(predicates, approval.DeciderTeamNameEqualFold(*i.DeciderTeamNameEqualFold)) + } + if i.DeciderTeamNameContainsFold != nil { + predicates = append(predicates, approval.DeciderTeamNameContainsFold(*i.DeciderTeamNameContainsFold)) + } + if i.Name != nil { + predicates = append(predicates, approval.NameEQ(*i.Name)) + } + if i.NameNEQ != nil { + predicates = append(predicates, approval.NameNEQ(*i.NameNEQ)) + } + if len(i.NameIn) > 0 { + predicates = append(predicates, approval.NameIn(i.NameIn...)) + } + if len(i.NameNotIn) > 0 { + predicates = append(predicates, approval.NameNotIn(i.NameNotIn...)) + } + if i.NameGT != nil { + predicates = append(predicates, approval.NameGT(*i.NameGT)) + } + if i.NameGTE != nil { + predicates = append(predicates, approval.NameGTE(*i.NameGTE)) + } + if i.NameLT != nil { + predicates = append(predicates, approval.NameLT(*i.NameLT)) + } + if i.NameLTE != nil { + predicates = append(predicates, approval.NameLTE(*i.NameLTE)) + } + if i.NameContains != nil { + predicates = append(predicates, approval.NameContains(*i.NameContains)) + } + if i.NameHasPrefix != nil { + predicates = append(predicates, approval.NameHasPrefix(*i.NameHasPrefix)) + } + if i.NameHasSuffix != nil { + predicates = append(predicates, approval.NameHasSuffix(*i.NameHasSuffix)) + } + if i.NameEqualFold != nil { + predicates = append(predicates, approval.NameEqualFold(*i.NameEqualFold)) + } + if i.NameContainsFold != nil { + predicates = append(predicates, approval.NameContainsFold(*i.NameContainsFold)) } - if len(i.HasExposedApisWith) > 0 { - with := make([]predicate.ApiExposure, 0, len(i.HasExposedApisWith)) - for _, w := range i.HasExposedApisWith { - p, err := w.P() - if err != nil { - return nil, fmt.Errorf("%w: field 'HasExposedApisWith'", err) - } - with = append(with, p) - } - predicates = append(predicates, application.HasExposedApisWith(with...)) + if i.State != nil { + predicates = append(predicates, approval.StateEQ(*i.State)) } - if i.HasSubscribedApis != nil { - p := application.HasSubscribedApis() - if !*i.HasSubscribedApis { - p = application.Not(p) - } - predicates = append(predicates, p) + if i.StateNEQ != nil { + predicates = append(predicates, approval.StateNEQ(*i.StateNEQ)) } - if len(i.HasSubscribedApisWith) > 0 { - with := make([]predicate.ApiSubscription, 0, len(i.HasSubscribedApisWith)) - for _, w := range i.HasSubscribedApisWith { - p, err := w.P() - if err != nil { - return nil, fmt.Errorf("%w: field 'HasSubscribedApisWith'", err) - } - with = append(with, p) - } - predicates = append(predicates, application.HasSubscribedApisWith(with...)) + if len(i.StateIn) > 0 { + predicates = append(predicates, approval.StateIn(i.StateIn...)) } - if i.HasExposedEvents != nil { - p := application.HasExposedEvents() - if !*i.HasExposedEvents { - p = application.Not(p) + if len(i.StateNotIn) > 0 { + predicates = append(predicates, approval.StateNotIn(i.StateNotIn...)) + } + + if i.HasAPISubscription != nil { + p := approval.HasAPISubscription() + if !*i.HasAPISubscription { + p = approval.Not(p) } predicates = append(predicates, p) } - if len(i.HasExposedEventsWith) > 0 { - with := make([]predicate.EventExposure, 0, len(i.HasExposedEventsWith)) - for _, w := range i.HasExposedEventsWith { + if len(i.HasAPISubscriptionWith) > 0 { + with := make([]predicate.ApiSubscription, 0, len(i.HasAPISubscriptionWith)) + for _, w := range i.HasAPISubscriptionWith { p, err := w.P() if err != nil { - return nil, fmt.Errorf("%w: field 'HasExposedEventsWith'", err) + return nil, fmt.Errorf("%w: field 'HasAPISubscriptionWith'", err) } with = append(with, p) } - predicates = append(predicates, application.HasExposedEventsWith(with...)) + predicates = append(predicates, approval.HasAPISubscriptionWith(with...)) } - if i.HasSubscribedEvents != nil { - p := application.HasSubscribedEvents() - if !*i.HasSubscribedEvents { - p = application.Not(p) + if i.HasEventSubscription != nil { + p := approval.HasEventSubscription() + if !*i.HasEventSubscription { + p = approval.Not(p) } predicates = append(predicates, p) } - if len(i.HasSubscribedEventsWith) > 0 { - with := make([]predicate.EventSubscription, 0, len(i.HasSubscribedEventsWith)) - for _, w := range i.HasSubscribedEventsWith { + 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 'HasSubscribedEventsWith'", err) + return nil, fmt.Errorf("%w: field 'HasEventSubscriptionWith'", err) } with = append(with, p) } - predicates = append(predicates, application.HasSubscribedEventsWith(with...)) + predicates = append(predicates, approval.HasEventSubscriptionWith(with...)) } switch len(predicates) { case 0: - return nil, ErrEmptyApplicationWhereInput + return nil, ErrEmptyApprovalWhereInput case 1: return predicates[0], nil default: - return application.And(predicates...), nil + return approval.And(predicates...), nil } } -// ApprovalWhereInput represents a where input for filtering Approval queries. -type ApprovalWhereInput struct { - Predicates []predicate.Approval `json:"-"` - Not *ApprovalWhereInput `json:"not,omitempty"` - Or []*ApprovalWhereInput `json:"or,omitempty"` - And []*ApprovalWhereInput `json:"and,omitempty"` +// ApprovalRequestWhereInput represents a where input for filtering ApprovalRequest queries. +type ApprovalRequestWhereInput struct { + Predicates []predicate.ApprovalRequest `json:"-"` + Not *ApprovalRequestWhereInput `json:"not,omitempty"` + Or []*ApprovalRequestWhereInput `json:"or,omitempty"` + And []*ApprovalRequestWhereInput `json:"and,omitempty"` // "id" field predicates. ID *int `json:"id,omitempty"` @@ -2094,12 +3386,12 @@ type ApprovalWhereInput struct { LastModifiedAtLTE *time.Time `json:"lastModifiedAtLTE,omitempty"` // "status_phase" field predicates. - StatusPhase *approval.StatusPhase `json:"statusPhase,omitempty"` - StatusPhaseNEQ *approval.StatusPhase `json:"statusPhaseNEQ,omitempty"` - StatusPhaseIn []approval.StatusPhase `json:"statusPhaseIn,omitempty"` - StatusPhaseNotIn []approval.StatusPhase `json:"statusPhaseNotIn,omitempty"` - StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` - StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` + StatusPhase *approvalrequest.StatusPhase `json:"statusPhase,omitempty"` + StatusPhaseNEQ *approvalrequest.StatusPhase `json:"statusPhaseNEQ,omitempty"` + StatusPhaseIn []approvalrequest.StatusPhase `json:"statusPhaseIn,omitempty"` + StatusPhaseNotIn []approvalrequest.StatusPhase `json:"statusPhaseNotIn,omitempty"` + StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` + StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` // "status_message" field predicates. StatusMessage *string `json:"statusMessage,omitempty"` @@ -2166,10 +3458,10 @@ type ApprovalWhereInput struct { ActionContainsFold *string `json:"actionContainsFold,omitempty"` // "strategy" field predicates. - Strategy *approval.Strategy `json:"strategy,omitempty"` - StrategyNEQ *approval.Strategy `json:"strategyNEQ,omitempty"` - StrategyIn []approval.Strategy `json:"strategyIn,omitempty"` - StrategyNotIn []approval.Strategy `json:"strategyNotIn,omitempty"` + Strategy *approvalrequest.Strategy `json:"strategy,omitempty"` + StrategyNEQ *approvalrequest.Strategy `json:"strategyNEQ,omitempty"` + StrategyIn []approvalrequest.Strategy `json:"strategyIn,omitempty"` + StrategyNotIn []approvalrequest.Strategy `json:"strategyNotIn,omitempty"` // "decider_team_name" field predicates. DeciderTeamName *string `json:"deciderTeamName,omitempty"` @@ -2202,10 +3494,10 @@ type ApprovalWhereInput struct { NameContainsFold *string `json:"nameContainsFold,omitempty"` // "state" field predicates. - State *approval.State `json:"state,omitempty"` - StateNEQ *approval.State `json:"stateNEQ,omitempty"` - StateIn []approval.State `json:"stateIn,omitempty"` - StateNotIn []approval.State `json:"stateNotIn,omitempty"` + State *approvalrequest.State `json:"state,omitempty"` + StateNEQ *approvalrequest.State `json:"stateNEQ,omitempty"` + StateIn []approvalrequest.State `json:"stateIn,omitempty"` + StateNotIn []approvalrequest.State `json:"stateNotIn,omitempty"` // "api_subscription" edge predicates. HasAPISubscription *bool `json:"hasAPISubscription,omitempty"` @@ -2217,18 +3509,18 @@ type ApprovalWhereInput struct { } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. -func (i *ApprovalWhereInput) AddPredicates(predicates ...predicate.Approval) { +func (i *ApprovalRequestWhereInput) AddPredicates(predicates ...predicate.ApprovalRequest) { i.Predicates = append(i.Predicates, predicates...) } -// Filter applies the ApprovalWhereInput filter on the ApprovalQuery builder. -func (i *ApprovalWhereInput) Filter(q *ApprovalQuery) (*ApprovalQuery, error) { +// Filter applies the ApprovalRequestWhereInput filter on the ApprovalRequestQuery builder. +func (i *ApprovalRequestWhereInput) Filter(q *ApprovalRequestQuery) (*ApprovalRequestQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { - if err == ErrEmptyApprovalWhereInput { + if err == ErrEmptyApprovalRequestWhereInput { return q, nil } return nil, err @@ -2236,19 +3528,19 @@ func (i *ApprovalWhereInput) Filter(q *ApprovalQuery) (*ApprovalQuery, error) { return q.Where(p), nil } -// ErrEmptyApprovalWhereInput is returned in case the ApprovalWhereInput is empty. -var ErrEmptyApprovalWhereInput = errors.New("ent: empty predicate ApprovalWhereInput") +// ErrEmptyApprovalRequestWhereInput is returned in case the ApprovalRequestWhereInput is empty. +var ErrEmptyApprovalRequestWhereInput = errors.New("ent: empty predicate ApprovalRequestWhereInput") -// P returns a predicate for filtering approvals. +// P returns a predicate for filtering approvalrequests. // An error is returned if the input is empty or invalid. -func (i *ApprovalWhereInput) P() (predicate.Approval, error) { - var predicates []predicate.Approval +func (i *ApprovalRequestWhereInput) P() (predicate.ApprovalRequest, error) { + var predicates []predicate.ApprovalRequest if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } - predicates = append(predicates, approval.Not(p)) + predicates = append(predicates, approvalrequest.Not(p)) } switch n := len(i.Or); { case n == 1: @@ -2258,7 +3550,7 @@ func (i *ApprovalWhereInput) P() (predicate.Approval, error) { } predicates = append(predicates, p) case n > 1: - or := make([]predicate.Approval, 0, n) + or := make([]predicate.ApprovalRequest, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { @@ -2266,7 +3558,7 @@ func (i *ApprovalWhereInput) P() (predicate.Approval, error) { } or = append(or, p) } - predicates = append(predicates, approval.Or(or...)) + predicates = append(predicates, approvalrequest.Or(or...)) } switch n := len(i.And); { case n == 1: @@ -2276,7 +3568,7 @@ func (i *ApprovalWhereInput) P() (predicate.Approval, error) { } predicates = append(predicates, p) case n > 1: - and := make([]predicate.Approval, 0, n) + and := make([]predicate.ApprovalRequest, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { @@ -2284,374 +3576,374 @@ func (i *ApprovalWhereInput) P() (predicate.Approval, error) { } and = append(and, p) } - predicates = append(predicates, approval.And(and...)) + predicates = append(predicates, approvalrequest.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { - predicates = append(predicates, approval.IDEQ(*i.ID)) + predicates = append(predicates, approvalrequest.IDEQ(*i.ID)) } if i.IDNEQ != nil { - predicates = append(predicates, approval.IDNEQ(*i.IDNEQ)) + predicates = append(predicates, approvalrequest.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { - predicates = append(predicates, approval.IDIn(i.IDIn...)) + predicates = append(predicates, approvalrequest.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { - predicates = append(predicates, approval.IDNotIn(i.IDNotIn...)) + predicates = append(predicates, approvalrequest.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { - predicates = append(predicates, approval.IDGT(*i.IDGT)) + predicates = append(predicates, approvalrequest.IDGT(*i.IDGT)) } if i.IDGTE != nil { - predicates = append(predicates, approval.IDGTE(*i.IDGTE)) + predicates = append(predicates, approvalrequest.IDGTE(*i.IDGTE)) } if i.IDLT != nil { - predicates = append(predicates, approval.IDLT(*i.IDLT)) + predicates = append(predicates, approvalrequest.IDLT(*i.IDLT)) } if i.IDLTE != nil { - predicates = append(predicates, approval.IDLTE(*i.IDLTE)) + predicates = append(predicates, approvalrequest.IDLTE(*i.IDLTE)) } if i.CreatedAt != nil { - predicates = append(predicates, approval.CreatedAtEQ(*i.CreatedAt)) + predicates = append(predicates, approvalrequest.CreatedAtEQ(*i.CreatedAt)) } if i.CreatedAtNEQ != nil { - predicates = append(predicates, approval.CreatedAtNEQ(*i.CreatedAtNEQ)) + predicates = append(predicates, approvalrequest.CreatedAtNEQ(*i.CreatedAtNEQ)) } if len(i.CreatedAtIn) > 0 { - predicates = append(predicates, approval.CreatedAtIn(i.CreatedAtIn...)) + predicates = append(predicates, approvalrequest.CreatedAtIn(i.CreatedAtIn...)) } if len(i.CreatedAtNotIn) > 0 { - predicates = append(predicates, approval.CreatedAtNotIn(i.CreatedAtNotIn...)) + predicates = append(predicates, approvalrequest.CreatedAtNotIn(i.CreatedAtNotIn...)) } if i.CreatedAtGT != nil { - predicates = append(predicates, approval.CreatedAtGT(*i.CreatedAtGT)) + predicates = append(predicates, approvalrequest.CreatedAtGT(*i.CreatedAtGT)) } if i.CreatedAtGTE != nil { - predicates = append(predicates, approval.CreatedAtGTE(*i.CreatedAtGTE)) + predicates = append(predicates, approvalrequest.CreatedAtGTE(*i.CreatedAtGTE)) } if i.CreatedAtLT != nil { - predicates = append(predicates, approval.CreatedAtLT(*i.CreatedAtLT)) + predicates = append(predicates, approvalrequest.CreatedAtLT(*i.CreatedAtLT)) } if i.CreatedAtLTE != nil { - predicates = append(predicates, approval.CreatedAtLTE(*i.CreatedAtLTE)) + predicates = append(predicates, approvalrequest.CreatedAtLTE(*i.CreatedAtLTE)) } if i.LastModifiedAt != nil { - predicates = append(predicates, approval.LastModifiedAtEQ(*i.LastModifiedAt)) + predicates = append(predicates, approvalrequest.LastModifiedAtEQ(*i.LastModifiedAt)) } if i.LastModifiedAtNEQ != nil { - predicates = append(predicates, approval.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + predicates = append(predicates, approvalrequest.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) } if len(i.LastModifiedAtIn) > 0 { - predicates = append(predicates, approval.LastModifiedAtIn(i.LastModifiedAtIn...)) + predicates = append(predicates, approvalrequest.LastModifiedAtIn(i.LastModifiedAtIn...)) } if len(i.LastModifiedAtNotIn) > 0 { - predicates = append(predicates, approval.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + predicates = append(predicates, approvalrequest.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) } if i.LastModifiedAtGT != nil { - predicates = append(predicates, approval.LastModifiedAtGT(*i.LastModifiedAtGT)) + predicates = append(predicates, approvalrequest.LastModifiedAtGT(*i.LastModifiedAtGT)) } if i.LastModifiedAtGTE != nil { - predicates = append(predicates, approval.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + predicates = append(predicates, approvalrequest.LastModifiedAtGTE(*i.LastModifiedAtGTE)) } if i.LastModifiedAtLT != nil { - predicates = append(predicates, approval.LastModifiedAtLT(*i.LastModifiedAtLT)) + predicates = append(predicates, approvalrequest.LastModifiedAtLT(*i.LastModifiedAtLT)) } if i.LastModifiedAtLTE != nil { - predicates = append(predicates, approval.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + predicates = append(predicates, approvalrequest.LastModifiedAtLTE(*i.LastModifiedAtLTE)) } if i.StatusPhase != nil { - predicates = append(predicates, approval.StatusPhaseEQ(*i.StatusPhase)) + predicates = append(predicates, approvalrequest.StatusPhaseEQ(*i.StatusPhase)) } if i.StatusPhaseNEQ != nil { - predicates = append(predicates, approval.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + predicates = append(predicates, approvalrequest.StatusPhaseNEQ(*i.StatusPhaseNEQ)) } if len(i.StatusPhaseIn) > 0 { - predicates = append(predicates, approval.StatusPhaseIn(i.StatusPhaseIn...)) + predicates = append(predicates, approvalrequest.StatusPhaseIn(i.StatusPhaseIn...)) } if len(i.StatusPhaseNotIn) > 0 { - predicates = append(predicates, approval.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + predicates = append(predicates, approvalrequest.StatusPhaseNotIn(i.StatusPhaseNotIn...)) } if i.StatusPhaseIsNil { - predicates = append(predicates, approval.StatusPhaseIsNil()) + predicates = append(predicates, approvalrequest.StatusPhaseIsNil()) } if i.StatusPhaseNotNil { - predicates = append(predicates, approval.StatusPhaseNotNil()) + predicates = append(predicates, approvalrequest.StatusPhaseNotNil()) } if i.StatusMessage != nil { - predicates = append(predicates, approval.StatusMessageEQ(*i.StatusMessage)) + predicates = append(predicates, approvalrequest.StatusMessageEQ(*i.StatusMessage)) } if i.StatusMessageNEQ != nil { - predicates = append(predicates, approval.StatusMessageNEQ(*i.StatusMessageNEQ)) + predicates = append(predicates, approvalrequest.StatusMessageNEQ(*i.StatusMessageNEQ)) } if len(i.StatusMessageIn) > 0 { - predicates = append(predicates, approval.StatusMessageIn(i.StatusMessageIn...)) + predicates = append(predicates, approvalrequest.StatusMessageIn(i.StatusMessageIn...)) } if len(i.StatusMessageNotIn) > 0 { - predicates = append(predicates, approval.StatusMessageNotIn(i.StatusMessageNotIn...)) + predicates = append(predicates, approvalrequest.StatusMessageNotIn(i.StatusMessageNotIn...)) } if i.StatusMessageGT != nil { - predicates = append(predicates, approval.StatusMessageGT(*i.StatusMessageGT)) + predicates = append(predicates, approvalrequest.StatusMessageGT(*i.StatusMessageGT)) } if i.StatusMessageGTE != nil { - predicates = append(predicates, approval.StatusMessageGTE(*i.StatusMessageGTE)) + predicates = append(predicates, approvalrequest.StatusMessageGTE(*i.StatusMessageGTE)) } if i.StatusMessageLT != nil { - predicates = append(predicates, approval.StatusMessageLT(*i.StatusMessageLT)) + predicates = append(predicates, approvalrequest.StatusMessageLT(*i.StatusMessageLT)) } if i.StatusMessageLTE != nil { - predicates = append(predicates, approval.StatusMessageLTE(*i.StatusMessageLTE)) + predicates = append(predicates, approvalrequest.StatusMessageLTE(*i.StatusMessageLTE)) } if i.StatusMessageContains != nil { - predicates = append(predicates, approval.StatusMessageContains(*i.StatusMessageContains)) + predicates = append(predicates, approvalrequest.StatusMessageContains(*i.StatusMessageContains)) } if i.StatusMessageHasPrefix != nil { - predicates = append(predicates, approval.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) + predicates = append(predicates, approvalrequest.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) } if i.StatusMessageHasSuffix != nil { - predicates = append(predicates, approval.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) + predicates = append(predicates, approvalrequest.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) } if i.StatusMessageIsNil { - predicates = append(predicates, approval.StatusMessageIsNil()) + predicates = append(predicates, approvalrequest.StatusMessageIsNil()) } if i.StatusMessageNotNil { - predicates = append(predicates, approval.StatusMessageNotNil()) + predicates = append(predicates, approvalrequest.StatusMessageNotNil()) } if i.StatusMessageEqualFold != nil { - predicates = append(predicates, approval.StatusMessageEqualFold(*i.StatusMessageEqualFold)) + predicates = append(predicates, approvalrequest.StatusMessageEqualFold(*i.StatusMessageEqualFold)) } if i.StatusMessageContainsFold != nil { - predicates = append(predicates, approval.StatusMessageContainsFold(*i.StatusMessageContainsFold)) + predicates = append(predicates, approvalrequest.StatusMessageContainsFold(*i.StatusMessageContainsFold)) } if i.Environment != nil { - predicates = append(predicates, approval.EnvironmentEQ(*i.Environment)) + predicates = append(predicates, approvalrequest.EnvironmentEQ(*i.Environment)) } if i.EnvironmentNEQ != nil { - predicates = append(predicates, approval.EnvironmentNEQ(*i.EnvironmentNEQ)) + predicates = append(predicates, approvalrequest.EnvironmentNEQ(*i.EnvironmentNEQ)) } if len(i.EnvironmentIn) > 0 { - predicates = append(predicates, approval.EnvironmentIn(i.EnvironmentIn...)) + predicates = append(predicates, approvalrequest.EnvironmentIn(i.EnvironmentIn...)) } if len(i.EnvironmentNotIn) > 0 { - predicates = append(predicates, approval.EnvironmentNotIn(i.EnvironmentNotIn...)) + predicates = append(predicates, approvalrequest.EnvironmentNotIn(i.EnvironmentNotIn...)) } if i.EnvironmentGT != nil { - predicates = append(predicates, approval.EnvironmentGT(*i.EnvironmentGT)) + predicates = append(predicates, approvalrequest.EnvironmentGT(*i.EnvironmentGT)) } if i.EnvironmentGTE != nil { - predicates = append(predicates, approval.EnvironmentGTE(*i.EnvironmentGTE)) + predicates = append(predicates, approvalrequest.EnvironmentGTE(*i.EnvironmentGTE)) } if i.EnvironmentLT != nil { - predicates = append(predicates, approval.EnvironmentLT(*i.EnvironmentLT)) + predicates = append(predicates, approvalrequest.EnvironmentLT(*i.EnvironmentLT)) } if i.EnvironmentLTE != nil { - predicates = append(predicates, approval.EnvironmentLTE(*i.EnvironmentLTE)) + predicates = append(predicates, approvalrequest.EnvironmentLTE(*i.EnvironmentLTE)) } if i.EnvironmentContains != nil { - predicates = append(predicates, approval.EnvironmentContains(*i.EnvironmentContains)) + predicates = append(predicates, approvalrequest.EnvironmentContains(*i.EnvironmentContains)) } if i.EnvironmentHasPrefix != nil { - predicates = append(predicates, approval.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + predicates = append(predicates, approvalrequest.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) } if i.EnvironmentHasSuffix != nil { - predicates = append(predicates, approval.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + predicates = append(predicates, approvalrequest.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) } if i.EnvironmentIsNil { - predicates = append(predicates, approval.EnvironmentIsNil()) + predicates = append(predicates, approvalrequest.EnvironmentIsNil()) } if i.EnvironmentNotNil { - predicates = append(predicates, approval.EnvironmentNotNil()) + predicates = append(predicates, approvalrequest.EnvironmentNotNil()) } if i.EnvironmentEqualFold != nil { - predicates = append(predicates, approval.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + predicates = append(predicates, approvalrequest.EnvironmentEqualFold(*i.EnvironmentEqualFold)) } if i.EnvironmentContainsFold != nil { - predicates = append(predicates, approval.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + predicates = append(predicates, approvalrequest.EnvironmentContainsFold(*i.EnvironmentContainsFold)) } if i.Namespace != nil { - predicates = append(predicates, approval.NamespaceEQ(*i.Namespace)) + predicates = append(predicates, approvalrequest.NamespaceEQ(*i.Namespace)) } if i.NamespaceNEQ != nil { - predicates = append(predicates, approval.NamespaceNEQ(*i.NamespaceNEQ)) + predicates = append(predicates, approvalrequest.NamespaceNEQ(*i.NamespaceNEQ)) } if len(i.NamespaceIn) > 0 { - predicates = append(predicates, approval.NamespaceIn(i.NamespaceIn...)) + predicates = append(predicates, approvalrequest.NamespaceIn(i.NamespaceIn...)) } if len(i.NamespaceNotIn) > 0 { - predicates = append(predicates, approval.NamespaceNotIn(i.NamespaceNotIn...)) + predicates = append(predicates, approvalrequest.NamespaceNotIn(i.NamespaceNotIn...)) } if i.NamespaceGT != nil { - predicates = append(predicates, approval.NamespaceGT(*i.NamespaceGT)) + predicates = append(predicates, approvalrequest.NamespaceGT(*i.NamespaceGT)) } if i.NamespaceGTE != nil { - predicates = append(predicates, approval.NamespaceGTE(*i.NamespaceGTE)) + predicates = append(predicates, approvalrequest.NamespaceGTE(*i.NamespaceGTE)) } if i.NamespaceLT != nil { - predicates = append(predicates, approval.NamespaceLT(*i.NamespaceLT)) + predicates = append(predicates, approvalrequest.NamespaceLT(*i.NamespaceLT)) } if i.NamespaceLTE != nil { - predicates = append(predicates, approval.NamespaceLTE(*i.NamespaceLTE)) + predicates = append(predicates, approvalrequest.NamespaceLTE(*i.NamespaceLTE)) } if i.NamespaceContains != nil { - predicates = append(predicates, approval.NamespaceContains(*i.NamespaceContains)) + predicates = append(predicates, approvalrequest.NamespaceContains(*i.NamespaceContains)) } if i.NamespaceHasPrefix != nil { - predicates = append(predicates, approval.NamespaceHasPrefix(*i.NamespaceHasPrefix)) + predicates = append(predicates, approvalrequest.NamespaceHasPrefix(*i.NamespaceHasPrefix)) } if i.NamespaceHasSuffix != nil { - predicates = append(predicates, approval.NamespaceHasSuffix(*i.NamespaceHasSuffix)) + predicates = append(predicates, approvalrequest.NamespaceHasSuffix(*i.NamespaceHasSuffix)) } if i.NamespaceEqualFold != nil { - predicates = append(predicates, approval.NamespaceEqualFold(*i.NamespaceEqualFold)) + predicates = append(predicates, approvalrequest.NamespaceEqualFold(*i.NamespaceEqualFold)) } if i.NamespaceContainsFold != nil { - predicates = append(predicates, approval.NamespaceContainsFold(*i.NamespaceContainsFold)) + predicates = append(predicates, approvalrequest.NamespaceContainsFold(*i.NamespaceContainsFold)) } if i.Action != nil { - predicates = append(predicates, approval.ActionEQ(*i.Action)) + predicates = append(predicates, approvalrequest.ActionEQ(*i.Action)) } if i.ActionNEQ != nil { - predicates = append(predicates, approval.ActionNEQ(*i.ActionNEQ)) + predicates = append(predicates, approvalrequest.ActionNEQ(*i.ActionNEQ)) } if len(i.ActionIn) > 0 { - predicates = append(predicates, approval.ActionIn(i.ActionIn...)) + predicates = append(predicates, approvalrequest.ActionIn(i.ActionIn...)) } if len(i.ActionNotIn) > 0 { - predicates = append(predicates, approval.ActionNotIn(i.ActionNotIn...)) + predicates = append(predicates, approvalrequest.ActionNotIn(i.ActionNotIn...)) } if i.ActionGT != nil { - predicates = append(predicates, approval.ActionGT(*i.ActionGT)) + predicates = append(predicates, approvalrequest.ActionGT(*i.ActionGT)) } if i.ActionGTE != nil { - predicates = append(predicates, approval.ActionGTE(*i.ActionGTE)) + predicates = append(predicates, approvalrequest.ActionGTE(*i.ActionGTE)) } if i.ActionLT != nil { - predicates = append(predicates, approval.ActionLT(*i.ActionLT)) + predicates = append(predicates, approvalrequest.ActionLT(*i.ActionLT)) } if i.ActionLTE != nil { - predicates = append(predicates, approval.ActionLTE(*i.ActionLTE)) + predicates = append(predicates, approvalrequest.ActionLTE(*i.ActionLTE)) } if i.ActionContains != nil { - predicates = append(predicates, approval.ActionContains(*i.ActionContains)) + predicates = append(predicates, approvalrequest.ActionContains(*i.ActionContains)) } if i.ActionHasPrefix != nil { - predicates = append(predicates, approval.ActionHasPrefix(*i.ActionHasPrefix)) + predicates = append(predicates, approvalrequest.ActionHasPrefix(*i.ActionHasPrefix)) } if i.ActionHasSuffix != nil { - predicates = append(predicates, approval.ActionHasSuffix(*i.ActionHasSuffix)) + predicates = append(predicates, approvalrequest.ActionHasSuffix(*i.ActionHasSuffix)) } if i.ActionEqualFold != nil { - predicates = append(predicates, approval.ActionEqualFold(*i.ActionEqualFold)) + predicates = append(predicates, approvalrequest.ActionEqualFold(*i.ActionEqualFold)) } if i.ActionContainsFold != nil { - predicates = append(predicates, approval.ActionContainsFold(*i.ActionContainsFold)) + predicates = append(predicates, approvalrequest.ActionContainsFold(*i.ActionContainsFold)) } if i.Strategy != nil { - predicates = append(predicates, approval.StrategyEQ(*i.Strategy)) + predicates = append(predicates, approvalrequest.StrategyEQ(*i.Strategy)) } if i.StrategyNEQ != nil { - predicates = append(predicates, approval.StrategyNEQ(*i.StrategyNEQ)) + predicates = append(predicates, approvalrequest.StrategyNEQ(*i.StrategyNEQ)) } if len(i.StrategyIn) > 0 { - predicates = append(predicates, approval.StrategyIn(i.StrategyIn...)) + predicates = append(predicates, approvalrequest.StrategyIn(i.StrategyIn...)) } if len(i.StrategyNotIn) > 0 { - predicates = append(predicates, approval.StrategyNotIn(i.StrategyNotIn...)) + predicates = append(predicates, approvalrequest.StrategyNotIn(i.StrategyNotIn...)) } if i.DeciderTeamName != nil { - predicates = append(predicates, approval.DeciderTeamNameEQ(*i.DeciderTeamName)) + predicates = append(predicates, approvalrequest.DeciderTeamNameEQ(*i.DeciderTeamName)) } if i.DeciderTeamNameNEQ != nil { - predicates = append(predicates, approval.DeciderTeamNameNEQ(*i.DeciderTeamNameNEQ)) + predicates = append(predicates, approvalrequest.DeciderTeamNameNEQ(*i.DeciderTeamNameNEQ)) } if len(i.DeciderTeamNameIn) > 0 { - predicates = append(predicates, approval.DeciderTeamNameIn(i.DeciderTeamNameIn...)) + predicates = append(predicates, approvalrequest.DeciderTeamNameIn(i.DeciderTeamNameIn...)) } if len(i.DeciderTeamNameNotIn) > 0 { - predicates = append(predicates, approval.DeciderTeamNameNotIn(i.DeciderTeamNameNotIn...)) + predicates = append(predicates, approvalrequest.DeciderTeamNameNotIn(i.DeciderTeamNameNotIn...)) } if i.DeciderTeamNameGT != nil { - predicates = append(predicates, approval.DeciderTeamNameGT(*i.DeciderTeamNameGT)) + predicates = append(predicates, approvalrequest.DeciderTeamNameGT(*i.DeciderTeamNameGT)) } if i.DeciderTeamNameGTE != nil { - predicates = append(predicates, approval.DeciderTeamNameGTE(*i.DeciderTeamNameGTE)) + predicates = append(predicates, approvalrequest.DeciderTeamNameGTE(*i.DeciderTeamNameGTE)) } if i.DeciderTeamNameLT != nil { - predicates = append(predicates, approval.DeciderTeamNameLT(*i.DeciderTeamNameLT)) + predicates = append(predicates, approvalrequest.DeciderTeamNameLT(*i.DeciderTeamNameLT)) } if i.DeciderTeamNameLTE != nil { - predicates = append(predicates, approval.DeciderTeamNameLTE(*i.DeciderTeamNameLTE)) + predicates = append(predicates, approvalrequest.DeciderTeamNameLTE(*i.DeciderTeamNameLTE)) } if i.DeciderTeamNameContains != nil { - predicates = append(predicates, approval.DeciderTeamNameContains(*i.DeciderTeamNameContains)) + predicates = append(predicates, approvalrequest.DeciderTeamNameContains(*i.DeciderTeamNameContains)) } if i.DeciderTeamNameHasPrefix != nil { - predicates = append(predicates, approval.DeciderTeamNameHasPrefix(*i.DeciderTeamNameHasPrefix)) + predicates = append(predicates, approvalrequest.DeciderTeamNameHasPrefix(*i.DeciderTeamNameHasPrefix)) } if i.DeciderTeamNameHasSuffix != nil { - predicates = append(predicates, approval.DeciderTeamNameHasSuffix(*i.DeciderTeamNameHasSuffix)) + predicates = append(predicates, approvalrequest.DeciderTeamNameHasSuffix(*i.DeciderTeamNameHasSuffix)) } if i.DeciderTeamNameEqualFold != nil { - predicates = append(predicates, approval.DeciderTeamNameEqualFold(*i.DeciderTeamNameEqualFold)) + predicates = append(predicates, approvalrequest.DeciderTeamNameEqualFold(*i.DeciderTeamNameEqualFold)) } if i.DeciderTeamNameContainsFold != nil { - predicates = append(predicates, approval.DeciderTeamNameContainsFold(*i.DeciderTeamNameContainsFold)) + predicates = append(predicates, approvalrequest.DeciderTeamNameContainsFold(*i.DeciderTeamNameContainsFold)) } if i.Name != nil { - predicates = append(predicates, approval.NameEQ(*i.Name)) + predicates = append(predicates, approvalrequest.NameEQ(*i.Name)) } if i.NameNEQ != nil { - predicates = append(predicates, approval.NameNEQ(*i.NameNEQ)) + predicates = append(predicates, approvalrequest.NameNEQ(*i.NameNEQ)) } if len(i.NameIn) > 0 { - predicates = append(predicates, approval.NameIn(i.NameIn...)) + predicates = append(predicates, approvalrequest.NameIn(i.NameIn...)) } if len(i.NameNotIn) > 0 { - predicates = append(predicates, approval.NameNotIn(i.NameNotIn...)) + predicates = append(predicates, approvalrequest.NameNotIn(i.NameNotIn...)) } if i.NameGT != nil { - predicates = append(predicates, approval.NameGT(*i.NameGT)) + predicates = append(predicates, approvalrequest.NameGT(*i.NameGT)) } if i.NameGTE != nil { - predicates = append(predicates, approval.NameGTE(*i.NameGTE)) + predicates = append(predicates, approvalrequest.NameGTE(*i.NameGTE)) } if i.NameLT != nil { - predicates = append(predicates, approval.NameLT(*i.NameLT)) + predicates = append(predicates, approvalrequest.NameLT(*i.NameLT)) } if i.NameLTE != nil { - predicates = append(predicates, approval.NameLTE(*i.NameLTE)) + predicates = append(predicates, approvalrequest.NameLTE(*i.NameLTE)) } if i.NameContains != nil { - predicates = append(predicates, approval.NameContains(*i.NameContains)) + predicates = append(predicates, approvalrequest.NameContains(*i.NameContains)) } if i.NameHasPrefix != nil { - predicates = append(predicates, approval.NameHasPrefix(*i.NameHasPrefix)) + predicates = append(predicates, approvalrequest.NameHasPrefix(*i.NameHasPrefix)) } if i.NameHasSuffix != nil { - predicates = append(predicates, approval.NameHasSuffix(*i.NameHasSuffix)) + predicates = append(predicates, approvalrequest.NameHasSuffix(*i.NameHasSuffix)) } if i.NameEqualFold != nil { - predicates = append(predicates, approval.NameEqualFold(*i.NameEqualFold)) + predicates = append(predicates, approvalrequest.NameEqualFold(*i.NameEqualFold)) } if i.NameContainsFold != nil { - predicates = append(predicates, approval.NameContainsFold(*i.NameContainsFold)) + predicates = append(predicates, approvalrequest.NameContainsFold(*i.NameContainsFold)) } if i.State != nil { - predicates = append(predicates, approval.StateEQ(*i.State)) + predicates = append(predicates, approvalrequest.StateEQ(*i.State)) } if i.StateNEQ != nil { - predicates = append(predicates, approval.StateNEQ(*i.StateNEQ)) + predicates = append(predicates, approvalrequest.StateNEQ(*i.StateNEQ)) } if len(i.StateIn) > 0 { - predicates = append(predicates, approval.StateIn(i.StateIn...)) + predicates = append(predicates, approvalrequest.StateIn(i.StateIn...)) } if len(i.StateNotIn) > 0 { - predicates = append(predicates, approval.StateNotIn(i.StateNotIn...)) + predicates = append(predicates, approvalrequest.StateNotIn(i.StateNotIn...)) } if i.HasAPISubscription != nil { - p := approval.HasAPISubscription() + p := approvalrequest.HasAPISubscription() if !*i.HasAPISubscription { - p = approval.Not(p) + p = approvalrequest.Not(p) } predicates = append(predicates, p) } @@ -2664,12 +3956,12 @@ func (i *ApprovalWhereInput) P() (predicate.Approval, error) { } with = append(with, p) } - predicates = append(predicates, approval.HasAPISubscriptionWith(with...)) + predicates = append(predicates, approvalrequest.HasAPISubscriptionWith(with...)) } if i.HasEventSubscription != nil { - p := approval.HasEventSubscription() + p := approvalrequest.HasEventSubscription() if !*i.HasEventSubscription { - p = approval.Not(p) + p = approvalrequest.Not(p) } predicates = append(predicates, p) } @@ -2682,24 +3974,24 @@ func (i *ApprovalWhereInput) P() (predicate.Approval, error) { } with = append(with, p) } - predicates = append(predicates, approval.HasEventSubscriptionWith(with...)) + predicates = append(predicates, approvalrequest.HasEventSubscriptionWith(with...)) } switch len(predicates) { case 0: - return nil, ErrEmptyApprovalWhereInput + return nil, ErrEmptyApprovalRequestWhereInput case 1: return predicates[0], nil default: - return approval.And(predicates...), nil + return approvalrequest.And(predicates...), nil } } -// ApprovalRequestWhereInput represents a where input for filtering ApprovalRequest queries. -type ApprovalRequestWhereInput struct { - Predicates []predicate.ApprovalRequest `json:"-"` - Not *ApprovalRequestWhereInput `json:"not,omitempty"` - Or []*ApprovalRequestWhereInput `json:"or,omitempty"` - And []*ApprovalRequestWhereInput `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"` @@ -2732,12 +4024,12 @@ type ApprovalRequestWhereInput struct { LastModifiedAtLTE *time.Time `json:"lastModifiedAtLTE,omitempty"` // "status_phase" field predicates. - StatusPhase *approvalrequest.StatusPhase `json:"statusPhase,omitempty"` - StatusPhaseNEQ *approvalrequest.StatusPhase `json:"statusPhaseNEQ,omitempty"` - StatusPhaseIn []approvalrequest.StatusPhase `json:"statusPhaseIn,omitempty"` - StatusPhaseNotIn []approvalrequest.StatusPhase `json:"statusPhaseNotIn,omitempty"` - StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` - StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` + 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"` @@ -2788,85 +4080,59 @@ type ApprovalRequestWhereInput struct { NamespaceEqualFold *string `json:"namespaceEqualFold,omitempty"` NamespaceContainsFold *string `json:"namespaceContainsFold,omitempty"` - // "action" field predicates. - Action *string `json:"action,omitempty"` - ActionNEQ *string `json:"actionNEQ,omitempty"` - ActionIn []string `json:"actionIn,omitempty"` - ActionNotIn []string `json:"actionNotIn,omitempty"` - ActionGT *string `json:"actionGT,omitempty"` - ActionGTE *string `json:"actionGTE,omitempty"` - ActionLT *string `json:"actionLT,omitempty"` - ActionLTE *string `json:"actionLTE,omitempty"` - ActionContains *string `json:"actionContains,omitempty"` - ActionHasPrefix *string `json:"actionHasPrefix,omitempty"` - ActionHasSuffix *string `json:"actionHasSuffix,omitempty"` - ActionEqualFold *string `json:"actionEqualFold,omitempty"` - ActionContainsFold *string `json:"actionContainsFold,omitempty"` - - // "strategy" field predicates. - Strategy *approvalrequest.Strategy `json:"strategy,omitempty"` - StrategyNEQ *approvalrequest.Strategy `json:"strategyNEQ,omitempty"` - StrategyIn []approvalrequest.Strategy `json:"strategyIn,omitempty"` - StrategyNotIn []approvalrequest.Strategy `json:"strategyNotIn,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"` - // "decider_team_name" field predicates. - DeciderTeamName *string `json:"deciderTeamName,omitempty"` - DeciderTeamNameNEQ *string `json:"deciderTeamNameNEQ,omitempty"` - DeciderTeamNameIn []string `json:"deciderTeamNameIn,omitempty"` - DeciderTeamNameNotIn []string `json:"deciderTeamNameNotIn,omitempty"` - DeciderTeamNameGT *string `json:"deciderTeamNameGT,omitempty"` - DeciderTeamNameGTE *string `json:"deciderTeamNameGTE,omitempty"` - DeciderTeamNameLT *string `json:"deciderTeamNameLT,omitempty"` - DeciderTeamNameLTE *string `json:"deciderTeamNameLTE,omitempty"` - DeciderTeamNameContains *string `json:"deciderTeamNameContains,omitempty"` - DeciderTeamNameHasPrefix *string `json:"deciderTeamNameHasPrefix,omitempty"` - DeciderTeamNameHasSuffix *string `json:"deciderTeamNameHasSuffix,omitempty"` - DeciderTeamNameEqualFold *string `json:"deciderTeamNameEqualFold,omitempty"` - DeciderTeamNameContainsFold *string `json:"deciderTeamNameContainsFold,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"` - // "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"` + // "active" field predicates. + Active *bool `json:"active,omitempty"` + ActiveNEQ *bool `json:"activeNEQ,omitempty"` + ActiveIsNil bool `json:"activeIsNil,omitempty"` + ActiveNotNil bool `json:"activeNotNil,omitempty"` - // "state" field predicates. - State *approvalrequest.State `json:"state,omitempty"` - StateNEQ *approvalrequest.State `json:"stateNEQ,omitempty"` - StateIn []approvalrequest.State `json:"stateIn,omitempty"` - StateNotIn []approvalrequest.State `json:"stateNotIn,omitempty"` + // "owner" edge predicates. + HasOwner *bool `json:"hasOwner,omitempty"` + HasOwnerWith []*ApplicationWhereInput `json:"hasOwnerWith,omitempty"` - // "api_subscription" edge predicates. - HasAPISubscription *bool `json:"hasAPISubscription,omitempty"` - HasAPISubscriptionWith []*ApiSubscriptionWhereInput `json:"hasAPISubscriptionWith,omitempty"` + // "event_type_def" edge predicates. + HasEventTypeDef *bool `json:"hasEventTypeDef,omitempty"` + HasEventTypeDefWith []*EventTypeWhereInput `json:"hasEventTypeDefWith,omitempty"` - // "event_subscription" edge predicates. - HasEventSubscription *bool `json:"hasEventSubscription,omitempty"` - HasEventSubscriptionWith []*EventSubscriptionWhereInput `json:"hasEventSubscriptionWith,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 *ApprovalRequestWhereInput) AddPredicates(predicates ...predicate.ApprovalRequest) { +func (i *EventExposureWhereInput) AddPredicates(predicates ...predicate.EventExposure) { i.Predicates = append(i.Predicates, predicates...) } -// Filter applies the ApprovalRequestWhereInput filter on the ApprovalRequestQuery builder. -func (i *ApprovalRequestWhereInput) Filter(q *ApprovalRequestQuery) (*ApprovalRequestQuery, 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 == ErrEmptyApprovalRequestWhereInput { + if err == ErrEmptyEventExposureWhereInput { return q, nil } return nil, err @@ -2874,19 +4140,19 @@ func (i *ApprovalRequestWhereInput) Filter(q *ApprovalRequestQuery) (*ApprovalRe return q.Where(p), nil } -// ErrEmptyApprovalRequestWhereInput is returned in case the ApprovalRequestWhereInput is empty. -var ErrEmptyApprovalRequestWhereInput = errors.New("ent: empty predicate ApprovalRequestWhereInput") +// ErrEmptyEventExposureWhereInput is returned in case the EventExposureWhereInput is empty. +var ErrEmptyEventExposureWhereInput = errors.New("ent: empty predicate EventExposureWhereInput") -// P returns a predicate for filtering approvalrequests. +// P returns a predicate for filtering eventexposures. // An error is returned if the input is empty or invalid. -func (i *ApprovalRequestWhereInput) P() (predicate.ApprovalRequest, error) { - var predicates []predicate.ApprovalRequest +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, approvalrequest.Not(p)) + predicates = append(predicates, eventexposure.Not(p)) } switch n := len(i.Or); { case n == 1: @@ -2896,7 +4162,7 @@ func (i *ApprovalRequestWhereInput) P() (predicate.ApprovalRequest, error) { } predicates = append(predicates, p) case n > 1: - or := make([]predicate.ApprovalRequest, 0, n) + or := make([]predicate.EventExposure, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { @@ -2904,7 +4170,7 @@ func (i *ApprovalRequestWhereInput) P() (predicate.ApprovalRequest, error) { } or = append(or, p) } - predicates = append(predicates, approvalrequest.Or(or...)) + predicates = append(predicates, eventexposure.Or(or...)) } switch n := len(i.And); { case n == 1: @@ -2914,7 +4180,7 @@ func (i *ApprovalRequestWhereInput) P() (predicate.ApprovalRequest, error) { } predicates = append(predicates, p) case n > 1: - and := make([]predicate.ApprovalRequest, 0, n) + and := make([]predicate.EventExposure, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { @@ -2922,422 +4188,362 @@ func (i *ApprovalRequestWhereInput) P() (predicate.ApprovalRequest, error) { } and = append(and, p) } - predicates = append(predicates, approvalrequest.And(and...)) + predicates = append(predicates, eventexposure.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { - predicates = append(predicates, approvalrequest.IDEQ(*i.ID)) + predicates = append(predicates, eventexposure.IDEQ(*i.ID)) } if i.IDNEQ != nil { - predicates = append(predicates, approvalrequest.IDNEQ(*i.IDNEQ)) + predicates = append(predicates, eventexposure.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { - predicates = append(predicates, approvalrequest.IDIn(i.IDIn...)) + predicates = append(predicates, eventexposure.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { - predicates = append(predicates, approvalrequest.IDNotIn(i.IDNotIn...)) + predicates = append(predicates, eventexposure.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { - predicates = append(predicates, approvalrequest.IDGT(*i.IDGT)) + predicates = append(predicates, eventexposure.IDGT(*i.IDGT)) } if i.IDGTE != nil { - predicates = append(predicates, approvalrequest.IDGTE(*i.IDGTE)) + predicates = append(predicates, eventexposure.IDGTE(*i.IDGTE)) } if i.IDLT != nil { - predicates = append(predicates, approvalrequest.IDLT(*i.IDLT)) + predicates = append(predicates, eventexposure.IDLT(*i.IDLT)) } if i.IDLTE != nil { - predicates = append(predicates, approvalrequest.IDLTE(*i.IDLTE)) + predicates = append(predicates, eventexposure.IDLTE(*i.IDLTE)) } if i.CreatedAt != nil { - predicates = append(predicates, approvalrequest.CreatedAtEQ(*i.CreatedAt)) + predicates = append(predicates, eventexposure.CreatedAtEQ(*i.CreatedAt)) } if i.CreatedAtNEQ != nil { - predicates = append(predicates, approvalrequest.CreatedAtNEQ(*i.CreatedAtNEQ)) + predicates = append(predicates, eventexposure.CreatedAtNEQ(*i.CreatedAtNEQ)) } if len(i.CreatedAtIn) > 0 { - predicates = append(predicates, approvalrequest.CreatedAtIn(i.CreatedAtIn...)) + predicates = append(predicates, eventexposure.CreatedAtIn(i.CreatedAtIn...)) } if len(i.CreatedAtNotIn) > 0 { - predicates = append(predicates, approvalrequest.CreatedAtNotIn(i.CreatedAtNotIn...)) + predicates = append(predicates, eventexposure.CreatedAtNotIn(i.CreatedAtNotIn...)) } if i.CreatedAtGT != nil { - predicates = append(predicates, approvalrequest.CreatedAtGT(*i.CreatedAtGT)) + predicates = append(predicates, eventexposure.CreatedAtGT(*i.CreatedAtGT)) } if i.CreatedAtGTE != nil { - predicates = append(predicates, approvalrequest.CreatedAtGTE(*i.CreatedAtGTE)) + predicates = append(predicates, eventexposure.CreatedAtGTE(*i.CreatedAtGTE)) } if i.CreatedAtLT != nil { - predicates = append(predicates, approvalrequest.CreatedAtLT(*i.CreatedAtLT)) + predicates = append(predicates, eventexposure.CreatedAtLT(*i.CreatedAtLT)) } if i.CreatedAtLTE != nil { - predicates = append(predicates, approvalrequest.CreatedAtLTE(*i.CreatedAtLTE)) + predicates = append(predicates, eventexposure.CreatedAtLTE(*i.CreatedAtLTE)) } if i.LastModifiedAt != nil { - predicates = append(predicates, approvalrequest.LastModifiedAtEQ(*i.LastModifiedAt)) + predicates = append(predicates, eventexposure.LastModifiedAtEQ(*i.LastModifiedAt)) } if i.LastModifiedAtNEQ != nil { - predicates = append(predicates, approvalrequest.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + predicates = append(predicates, eventexposure.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) } if len(i.LastModifiedAtIn) > 0 { - predicates = append(predicates, approvalrequest.LastModifiedAtIn(i.LastModifiedAtIn...)) + predicates = append(predicates, eventexposure.LastModifiedAtIn(i.LastModifiedAtIn...)) } if len(i.LastModifiedAtNotIn) > 0 { - predicates = append(predicates, approvalrequest.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + predicates = append(predicates, eventexposure.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) } if i.LastModifiedAtGT != nil { - predicates = append(predicates, approvalrequest.LastModifiedAtGT(*i.LastModifiedAtGT)) + predicates = append(predicates, eventexposure.LastModifiedAtGT(*i.LastModifiedAtGT)) } if i.LastModifiedAtGTE != nil { - predicates = append(predicates, approvalrequest.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + predicates = append(predicates, eventexposure.LastModifiedAtGTE(*i.LastModifiedAtGTE)) } if i.LastModifiedAtLT != nil { - predicates = append(predicates, approvalrequest.LastModifiedAtLT(*i.LastModifiedAtLT)) + predicates = append(predicates, eventexposure.LastModifiedAtLT(*i.LastModifiedAtLT)) } if i.LastModifiedAtLTE != nil { - predicates = append(predicates, approvalrequest.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + predicates = append(predicates, eventexposure.LastModifiedAtLTE(*i.LastModifiedAtLTE)) } if i.StatusPhase != nil { - predicates = append(predicates, approvalrequest.StatusPhaseEQ(*i.StatusPhase)) + predicates = append(predicates, eventexposure.StatusPhaseEQ(*i.StatusPhase)) } if i.StatusPhaseNEQ != nil { - predicates = append(predicates, approvalrequest.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + predicates = append(predicates, eventexposure.StatusPhaseNEQ(*i.StatusPhaseNEQ)) } if len(i.StatusPhaseIn) > 0 { - predicates = append(predicates, approvalrequest.StatusPhaseIn(i.StatusPhaseIn...)) + predicates = append(predicates, eventexposure.StatusPhaseIn(i.StatusPhaseIn...)) } if len(i.StatusPhaseNotIn) > 0 { - predicates = append(predicates, approvalrequest.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + predicates = append(predicates, eventexposure.StatusPhaseNotIn(i.StatusPhaseNotIn...)) } if i.StatusPhaseIsNil { - predicates = append(predicates, approvalrequest.StatusPhaseIsNil()) + predicates = append(predicates, eventexposure.StatusPhaseIsNil()) } if i.StatusPhaseNotNil { - predicates = append(predicates, approvalrequest.StatusPhaseNotNil()) + predicates = append(predicates, eventexposure.StatusPhaseNotNil()) } if i.StatusMessage != nil { - predicates = append(predicates, approvalrequest.StatusMessageEQ(*i.StatusMessage)) + predicates = append(predicates, eventexposure.StatusMessageEQ(*i.StatusMessage)) } if i.StatusMessageNEQ != nil { - predicates = append(predicates, approvalrequest.StatusMessageNEQ(*i.StatusMessageNEQ)) + predicates = append(predicates, eventexposure.StatusMessageNEQ(*i.StatusMessageNEQ)) } if len(i.StatusMessageIn) > 0 { - predicates = append(predicates, approvalrequest.StatusMessageIn(i.StatusMessageIn...)) + predicates = append(predicates, eventexposure.StatusMessageIn(i.StatusMessageIn...)) } if len(i.StatusMessageNotIn) > 0 { - predicates = append(predicates, approvalrequest.StatusMessageNotIn(i.StatusMessageNotIn...)) + predicates = append(predicates, eventexposure.StatusMessageNotIn(i.StatusMessageNotIn...)) } if i.StatusMessageGT != nil { - predicates = append(predicates, approvalrequest.StatusMessageGT(*i.StatusMessageGT)) + predicates = append(predicates, eventexposure.StatusMessageGT(*i.StatusMessageGT)) } if i.StatusMessageGTE != nil { - predicates = append(predicates, approvalrequest.StatusMessageGTE(*i.StatusMessageGTE)) + predicates = append(predicates, eventexposure.StatusMessageGTE(*i.StatusMessageGTE)) } if i.StatusMessageLT != nil { - predicates = append(predicates, approvalrequest.StatusMessageLT(*i.StatusMessageLT)) + predicates = append(predicates, eventexposure.StatusMessageLT(*i.StatusMessageLT)) } if i.StatusMessageLTE != nil { - predicates = append(predicates, approvalrequest.StatusMessageLTE(*i.StatusMessageLTE)) + predicates = append(predicates, eventexposure.StatusMessageLTE(*i.StatusMessageLTE)) } if i.StatusMessageContains != nil { - predicates = append(predicates, approvalrequest.StatusMessageContains(*i.StatusMessageContains)) + predicates = append(predicates, eventexposure.StatusMessageContains(*i.StatusMessageContains)) } if i.StatusMessageHasPrefix != nil { - predicates = append(predicates, approvalrequest.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) + predicates = append(predicates, eventexposure.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) } if i.StatusMessageHasSuffix != nil { - predicates = append(predicates, approvalrequest.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) + predicates = append(predicates, eventexposure.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) } if i.StatusMessageIsNil { - predicates = append(predicates, approvalrequest.StatusMessageIsNil()) + predicates = append(predicates, eventexposure.StatusMessageIsNil()) } if i.StatusMessageNotNil { - predicates = append(predicates, approvalrequest.StatusMessageNotNil()) + predicates = append(predicates, eventexposure.StatusMessageNotNil()) } if i.StatusMessageEqualFold != nil { - predicates = append(predicates, approvalrequest.StatusMessageEqualFold(*i.StatusMessageEqualFold)) + predicates = append(predicates, eventexposure.StatusMessageEqualFold(*i.StatusMessageEqualFold)) } if i.StatusMessageContainsFold != nil { - predicates = append(predicates, approvalrequest.StatusMessageContainsFold(*i.StatusMessageContainsFold)) + predicates = append(predicates, eventexposure.StatusMessageContainsFold(*i.StatusMessageContainsFold)) } if i.Environment != nil { - predicates = append(predicates, approvalrequest.EnvironmentEQ(*i.Environment)) + predicates = append(predicates, eventexposure.EnvironmentEQ(*i.Environment)) } if i.EnvironmentNEQ != nil { - predicates = append(predicates, approvalrequest.EnvironmentNEQ(*i.EnvironmentNEQ)) + predicates = append(predicates, eventexposure.EnvironmentNEQ(*i.EnvironmentNEQ)) } if len(i.EnvironmentIn) > 0 { - predicates = append(predicates, approvalrequest.EnvironmentIn(i.EnvironmentIn...)) + predicates = append(predicates, eventexposure.EnvironmentIn(i.EnvironmentIn...)) } if len(i.EnvironmentNotIn) > 0 { - predicates = append(predicates, approvalrequest.EnvironmentNotIn(i.EnvironmentNotIn...)) + predicates = append(predicates, eventexposure.EnvironmentNotIn(i.EnvironmentNotIn...)) } if i.EnvironmentGT != nil { - predicates = append(predicates, approvalrequest.EnvironmentGT(*i.EnvironmentGT)) + predicates = append(predicates, eventexposure.EnvironmentGT(*i.EnvironmentGT)) } if i.EnvironmentGTE != nil { - predicates = append(predicates, approvalrequest.EnvironmentGTE(*i.EnvironmentGTE)) + predicates = append(predicates, eventexposure.EnvironmentGTE(*i.EnvironmentGTE)) } if i.EnvironmentLT != nil { - predicates = append(predicates, approvalrequest.EnvironmentLT(*i.EnvironmentLT)) + predicates = append(predicates, eventexposure.EnvironmentLT(*i.EnvironmentLT)) } if i.EnvironmentLTE != nil { - predicates = append(predicates, approvalrequest.EnvironmentLTE(*i.EnvironmentLTE)) + predicates = append(predicates, eventexposure.EnvironmentLTE(*i.EnvironmentLTE)) } if i.EnvironmentContains != nil { - predicates = append(predicates, approvalrequest.EnvironmentContains(*i.EnvironmentContains)) + predicates = append(predicates, eventexposure.EnvironmentContains(*i.EnvironmentContains)) } if i.EnvironmentHasPrefix != nil { - predicates = append(predicates, approvalrequest.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + predicates = append(predicates, eventexposure.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) } if i.EnvironmentHasSuffix != nil { - predicates = append(predicates, approvalrequest.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + predicates = append(predicates, eventexposure.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) } if i.EnvironmentIsNil { - predicates = append(predicates, approvalrequest.EnvironmentIsNil()) + predicates = append(predicates, eventexposure.EnvironmentIsNil()) } if i.EnvironmentNotNil { - predicates = append(predicates, approvalrequest.EnvironmentNotNil()) + predicates = append(predicates, eventexposure.EnvironmentNotNil()) } if i.EnvironmentEqualFold != nil { - predicates = append(predicates, approvalrequest.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + predicates = append(predicates, eventexposure.EnvironmentEqualFold(*i.EnvironmentEqualFold)) } if i.EnvironmentContainsFold != nil { - predicates = append(predicates, approvalrequest.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + predicates = append(predicates, eventexposure.EnvironmentContainsFold(*i.EnvironmentContainsFold)) } if i.Namespace != nil { - predicates = append(predicates, approvalrequest.NamespaceEQ(*i.Namespace)) + predicates = append(predicates, eventexposure.NamespaceEQ(*i.Namespace)) } if i.NamespaceNEQ != nil { - predicates = append(predicates, approvalrequest.NamespaceNEQ(*i.NamespaceNEQ)) + predicates = append(predicates, eventexposure.NamespaceNEQ(*i.NamespaceNEQ)) } if len(i.NamespaceIn) > 0 { - predicates = append(predicates, approvalrequest.NamespaceIn(i.NamespaceIn...)) + predicates = append(predicates, eventexposure.NamespaceIn(i.NamespaceIn...)) } if len(i.NamespaceNotIn) > 0 { - predicates = append(predicates, approvalrequest.NamespaceNotIn(i.NamespaceNotIn...)) + predicates = append(predicates, eventexposure.NamespaceNotIn(i.NamespaceNotIn...)) } if i.NamespaceGT != nil { - predicates = append(predicates, approvalrequest.NamespaceGT(*i.NamespaceGT)) + predicates = append(predicates, eventexposure.NamespaceGT(*i.NamespaceGT)) } if i.NamespaceGTE != nil { - predicates = append(predicates, approvalrequest.NamespaceGTE(*i.NamespaceGTE)) + predicates = append(predicates, eventexposure.NamespaceGTE(*i.NamespaceGTE)) } if i.NamespaceLT != nil { - predicates = append(predicates, approvalrequest.NamespaceLT(*i.NamespaceLT)) + predicates = append(predicates, eventexposure.NamespaceLT(*i.NamespaceLT)) } if i.NamespaceLTE != nil { - predicates = append(predicates, approvalrequest.NamespaceLTE(*i.NamespaceLTE)) + predicates = append(predicates, eventexposure.NamespaceLTE(*i.NamespaceLTE)) } if i.NamespaceContains != nil { - predicates = append(predicates, approvalrequest.NamespaceContains(*i.NamespaceContains)) + predicates = append(predicates, eventexposure.NamespaceContains(*i.NamespaceContains)) } if i.NamespaceHasPrefix != nil { - predicates = append(predicates, approvalrequest.NamespaceHasPrefix(*i.NamespaceHasPrefix)) + predicates = append(predicates, eventexposure.NamespaceHasPrefix(*i.NamespaceHasPrefix)) } if i.NamespaceHasSuffix != nil { - predicates = append(predicates, approvalrequest.NamespaceHasSuffix(*i.NamespaceHasSuffix)) + predicates = append(predicates, eventexposure.NamespaceHasSuffix(*i.NamespaceHasSuffix)) } if i.NamespaceEqualFold != nil { - predicates = append(predicates, approvalrequest.NamespaceEqualFold(*i.NamespaceEqualFold)) + predicates = append(predicates, eventexposure.NamespaceEqualFold(*i.NamespaceEqualFold)) } if i.NamespaceContainsFold != nil { - predicates = append(predicates, approvalrequest.NamespaceContainsFold(*i.NamespaceContainsFold)) - } - if i.Action != nil { - predicates = append(predicates, approvalrequest.ActionEQ(*i.Action)) - } - if i.ActionNEQ != nil { - predicates = append(predicates, approvalrequest.ActionNEQ(*i.ActionNEQ)) - } - if len(i.ActionIn) > 0 { - predicates = append(predicates, approvalrequest.ActionIn(i.ActionIn...)) - } - if len(i.ActionNotIn) > 0 { - predicates = append(predicates, approvalrequest.ActionNotIn(i.ActionNotIn...)) - } - if i.ActionGT != nil { - predicates = append(predicates, approvalrequest.ActionGT(*i.ActionGT)) - } - if i.ActionGTE != nil { - predicates = append(predicates, approvalrequest.ActionGTE(*i.ActionGTE)) - } - if i.ActionLT != nil { - predicates = append(predicates, approvalrequest.ActionLT(*i.ActionLT)) - } - if i.ActionLTE != nil { - predicates = append(predicates, approvalrequest.ActionLTE(*i.ActionLTE)) - } - if i.ActionContains != nil { - predicates = append(predicates, approvalrequest.ActionContains(*i.ActionContains)) - } - if i.ActionHasPrefix != nil { - predicates = append(predicates, approvalrequest.ActionHasPrefix(*i.ActionHasPrefix)) - } - if i.ActionHasSuffix != nil { - predicates = append(predicates, approvalrequest.ActionHasSuffix(*i.ActionHasSuffix)) - } - if i.ActionEqualFold != nil { - predicates = append(predicates, approvalrequest.ActionEqualFold(*i.ActionEqualFold)) - } - if i.ActionContainsFold != nil { - predicates = append(predicates, approvalrequest.ActionContainsFold(*i.ActionContainsFold)) - } - if i.Strategy != nil { - predicates = append(predicates, approvalrequest.StrategyEQ(*i.Strategy)) - } - if i.StrategyNEQ != nil { - predicates = append(predicates, approvalrequest.StrategyNEQ(*i.StrategyNEQ)) - } - if len(i.StrategyIn) > 0 { - predicates = append(predicates, approvalrequest.StrategyIn(i.StrategyIn...)) - } - if len(i.StrategyNotIn) > 0 { - predicates = append(predicates, approvalrequest.StrategyNotIn(i.StrategyNotIn...)) - } - if i.DeciderTeamName != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameEQ(*i.DeciderTeamName)) - } - if i.DeciderTeamNameNEQ != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameNEQ(*i.DeciderTeamNameNEQ)) - } - if len(i.DeciderTeamNameIn) > 0 { - predicates = append(predicates, approvalrequest.DeciderTeamNameIn(i.DeciderTeamNameIn...)) - } - if len(i.DeciderTeamNameNotIn) > 0 { - predicates = append(predicates, approvalrequest.DeciderTeamNameNotIn(i.DeciderTeamNameNotIn...)) - } - if i.DeciderTeamNameGT != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameGT(*i.DeciderTeamNameGT)) - } - if i.DeciderTeamNameGTE != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameGTE(*i.DeciderTeamNameGTE)) - } - if i.DeciderTeamNameLT != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameLT(*i.DeciderTeamNameLT)) - } - if i.DeciderTeamNameLTE != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameLTE(*i.DeciderTeamNameLTE)) - } - if i.DeciderTeamNameContains != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameContains(*i.DeciderTeamNameContains)) + predicates = append(predicates, eventexposure.NamespaceContainsFold(*i.NamespaceContainsFold)) } - if i.DeciderTeamNameHasPrefix != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameHasPrefix(*i.DeciderTeamNameHasPrefix)) + if i.EventType != nil { + predicates = append(predicates, eventexposure.EventTypeEQ(*i.EventType)) } - if i.DeciderTeamNameHasSuffix != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameHasSuffix(*i.DeciderTeamNameHasSuffix)) + if i.EventTypeNEQ != nil { + predicates = append(predicates, eventexposure.EventTypeNEQ(*i.EventTypeNEQ)) } - if i.DeciderTeamNameEqualFold != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameEqualFold(*i.DeciderTeamNameEqualFold)) + if len(i.EventTypeIn) > 0 { + predicates = append(predicates, eventexposure.EventTypeIn(i.EventTypeIn...)) } - if i.DeciderTeamNameContainsFold != nil { - predicates = append(predicates, approvalrequest.DeciderTeamNameContainsFold(*i.DeciderTeamNameContainsFold)) + if len(i.EventTypeNotIn) > 0 { + predicates = append(predicates, eventexposure.EventTypeNotIn(i.EventTypeNotIn...)) } - if i.Name != nil { - predicates = append(predicates, approvalrequest.NameEQ(*i.Name)) + if i.EventTypeGT != nil { + predicates = append(predicates, eventexposure.EventTypeGT(*i.EventTypeGT)) } - if i.NameNEQ != nil { - predicates = append(predicates, approvalrequest.NameNEQ(*i.NameNEQ)) + if i.EventTypeGTE != nil { + predicates = append(predicates, eventexposure.EventTypeGTE(*i.EventTypeGTE)) } - if len(i.NameIn) > 0 { - predicates = append(predicates, approvalrequest.NameIn(i.NameIn...)) + if i.EventTypeLT != nil { + predicates = append(predicates, eventexposure.EventTypeLT(*i.EventTypeLT)) } - if len(i.NameNotIn) > 0 { - predicates = append(predicates, approvalrequest.NameNotIn(i.NameNotIn...)) + if i.EventTypeLTE != nil { + predicates = append(predicates, eventexposure.EventTypeLTE(*i.EventTypeLTE)) } - if i.NameGT != nil { - predicates = append(predicates, approvalrequest.NameGT(*i.NameGT)) + if i.EventTypeContains != nil { + predicates = append(predicates, eventexposure.EventTypeContains(*i.EventTypeContains)) } - if i.NameGTE != nil { - predicates = append(predicates, approvalrequest.NameGTE(*i.NameGTE)) + if i.EventTypeHasPrefix != nil { + predicates = append(predicates, eventexposure.EventTypeHasPrefix(*i.EventTypeHasPrefix)) } - if i.NameLT != nil { - predicates = append(predicates, approvalrequest.NameLT(*i.NameLT)) + if i.EventTypeHasSuffix != nil { + predicates = append(predicates, eventexposure.EventTypeHasSuffix(*i.EventTypeHasSuffix)) } - if i.NameLTE != nil { - predicates = append(predicates, approvalrequest.NameLTE(*i.NameLTE)) + if i.EventTypeEqualFold != nil { + predicates = append(predicates, eventexposure.EventTypeEqualFold(*i.EventTypeEqualFold)) } - if i.NameContains != nil { - predicates = append(predicates, approvalrequest.NameContains(*i.NameContains)) + if i.EventTypeContainsFold != nil { + predicates = append(predicates, eventexposure.EventTypeContainsFold(*i.EventTypeContainsFold)) } - if i.NameHasPrefix != nil { - predicates = append(predicates, approvalrequest.NameHasPrefix(*i.NameHasPrefix)) + if i.Visibility != nil { + predicates = append(predicates, eventexposure.VisibilityEQ(*i.Visibility)) } - if i.NameHasSuffix != nil { - predicates = append(predicates, approvalrequest.NameHasSuffix(*i.NameHasSuffix)) + if i.VisibilityNEQ != nil { + predicates = append(predicates, eventexposure.VisibilityNEQ(*i.VisibilityNEQ)) } - if i.NameEqualFold != nil { - predicates = append(predicates, approvalrequest.NameEqualFold(*i.NameEqualFold)) + if len(i.VisibilityIn) > 0 { + predicates = append(predicates, eventexposure.VisibilityIn(i.VisibilityIn...)) } - if i.NameContainsFold != nil { - predicates = append(predicates, approvalrequest.NameContainsFold(*i.NameContainsFold)) + if len(i.VisibilityNotIn) > 0 { + predicates = append(predicates, eventexposure.VisibilityNotIn(i.VisibilityNotIn...)) } - if i.State != nil { - predicates = append(predicates, approvalrequest.StateEQ(*i.State)) + if i.Active != nil { + predicates = append(predicates, eventexposure.ActiveEQ(*i.Active)) } - if i.StateNEQ != nil { - predicates = append(predicates, approvalrequest.StateNEQ(*i.StateNEQ)) + if i.ActiveNEQ != nil { + predicates = append(predicates, eventexposure.ActiveNEQ(*i.ActiveNEQ)) } - if len(i.StateIn) > 0 { - predicates = append(predicates, approvalrequest.StateIn(i.StateIn...)) + if i.ActiveIsNil { + predicates = append(predicates, eventexposure.ActiveIsNil()) } - if len(i.StateNotIn) > 0 { - predicates = append(predicates, approvalrequest.StateNotIn(i.StateNotIn...)) + if i.ActiveNotNil { + predicates = append(predicates, eventexposure.ActiveNotNil()) } - if i.HasAPISubscription != nil { - p := approvalrequest.HasAPISubscription() - if !*i.HasAPISubscription { - p = approvalrequest.Not(p) + if i.HasOwner != nil { + p := eventexposure.HasOwner() + if !*i.HasOwner { + p = eventexposure.Not(p) } predicates = append(predicates, p) } - if len(i.HasAPISubscriptionWith) > 0 { - with := make([]predicate.ApiSubscription, 0, len(i.HasAPISubscriptionWith)) - for _, w := range i.HasAPISubscriptionWith { + 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 'HasAPISubscriptionWith'", err) + return nil, fmt.Errorf("%w: field 'HasOwnerWith'", err) } with = append(with, p) } - predicates = append(predicates, approvalrequest.HasAPISubscriptionWith(with...)) + predicates = append(predicates, eventexposure.HasOwnerWith(with...)) } - if i.HasEventSubscription != nil { - p := approvalrequest.HasEventSubscription() - if !*i.HasEventSubscription { - p = approvalrequest.Not(p) + if i.HasEventTypeDef != nil { + p := eventexposure.HasEventTypeDef() + if !*i.HasEventTypeDef { + p = eventexposure.Not(p) } predicates = append(predicates, p) } - if len(i.HasEventSubscriptionWith) > 0 { - with := make([]predicate.EventSubscription, 0, len(i.HasEventSubscriptionWith)) - for _, w := range i.HasEventSubscriptionWith { + if len(i.HasEventTypeDefWith) > 0 { + with := make([]predicate.EventType, 0, len(i.HasEventTypeDefWith)) + for _, w := range i.HasEventTypeDefWith { p, err := w.P() if err != nil { - return nil, fmt.Errorf("%w: field 'HasEventSubscriptionWith'", err) + return nil, fmt.Errorf("%w: field 'HasEventTypeDefWith'", err) } with = append(with, p) } - predicates = append(predicates, approvalrequest.HasEventSubscriptionWith(with...)) + predicates = append(predicates, eventexposure.HasEventTypeDefWith(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, ErrEmptyApprovalRequestWhereInput + return nil, ErrEmptyEventExposureWhereInput case 1: return predicates[0], nil default: - return approvalrequest.And(predicates...), nil + return eventexposure.And(predicates...), nil } } -// 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"` +// 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"` @@ -3370,12 +4576,12 @@ type EventExposureWhereInput struct { 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"` + 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"` @@ -3426,6 +4632,21 @@ type EventExposureWhereInput 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"` @@ -3441,40 +4662,59 @@ type EventExposureWhereInput struct { EventTypeEqualFold *string `json:"eventTypeEqualFold,omitempty"` EventTypeContainsFold *string `json:"eventTypeContainsFold,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"` + // "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"` - // "active" field predicates. - Active *bool `json:"active,omitempty"` - ActiveNEQ *bool `json:"activeNEQ,omitempty"` - ActiveIsNil bool `json:"activeIsNil,omitempty"` - ActiveNotNil bool `json:"activeNotNil,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"` - // "subscriptions" edge predicates. - HasSubscriptions *bool `json:"hasSubscriptions,omitempty"` - HasSubscriptionsWith []*EventSubscriptionWhereInput `json:"hasSubscriptionsWith,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 *EventExposureWhereInput) AddPredicates(predicates ...predicate.EventExposure) { +func (i *EventSubscriptionWhereInput) AddPredicates(predicates ...predicate.EventSubscription) { i.Predicates = append(i.Predicates, predicates...) } -// Filter applies the EventExposureWhereInput filter on the EventExposureQuery builder. -func (i *EventExposureWhereInput) Filter(q *EventExposureQuery) (*EventExposureQuery, error) { +// 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 == ErrEmptyEventExposureWhereInput { + if err == ErrEmptyEventSubscriptionWhereInput { return q, nil } return nil, err @@ -3482,19 +4722,19 @@ func (i *EventExposureWhereInput) Filter(q *EventExposureQuery) (*EventExposureQ return q.Where(p), nil } -// ErrEmptyEventExposureWhereInput is returned in case the EventExposureWhereInput is empty. -var ErrEmptyEventExposureWhereInput = errors.New("ent: empty predicate EventExposureWhereInput") +// ErrEmptyEventSubscriptionWhereInput is returned in case the EventSubscriptionWhereInput is empty. +var ErrEmptyEventSubscriptionWhereInput = errors.New("ent: empty predicate EventSubscriptionWhereInput") -// P returns a predicate for filtering eventexposures. +// P returns a predicate for filtering eventsubscriptions. // An error is returned if the input is empty or invalid. -func (i *EventExposureWhereInput) P() (predicate.EventExposure, error) { - var predicates []predicate.EventExposure +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, eventexposure.Not(p)) + predicates = append(predicates, eventsubscription.Not(p)) } switch n := len(i.Or); { case n == 1: @@ -3504,7 +4744,7 @@ func (i *EventExposureWhereInput) P() (predicate.EventExposure, error) { } predicates = append(predicates, p) case n > 1: - or := make([]predicate.EventExposure, 0, n) + or := make([]predicate.EventSubscription, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { @@ -3512,7 +4752,7 @@ func (i *EventExposureWhereInput) P() (predicate.EventExposure, error) { } or = append(or, p) } - predicates = append(predicates, eventexposure.Or(or...)) + predicates = append(predicates, eventsubscription.Or(or...)) } switch n := len(i.And); { case n == 1: @@ -3522,7 +4762,7 @@ func (i *EventExposureWhereInput) P() (predicate.EventExposure, error) { } predicates = append(predicates, p) case n > 1: - and := make([]predicate.EventExposure, 0, n) + and := make([]predicate.EventSubscription, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { @@ -3530,296 +4770,368 @@ func (i *EventExposureWhereInput) P() (predicate.EventExposure, error) { } and = append(and, p) } - predicates = append(predicates, eventexposure.And(and...)) + predicates = append(predicates, eventsubscription.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { - predicates = append(predicates, eventexposure.IDEQ(*i.ID)) + predicates = append(predicates, eventsubscription.IDEQ(*i.ID)) } if i.IDNEQ != nil { - predicates = append(predicates, eventexposure.IDNEQ(*i.IDNEQ)) + predicates = append(predicates, eventsubscription.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { - predicates = append(predicates, eventexposure.IDIn(i.IDIn...)) + predicates = append(predicates, eventsubscription.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { - predicates = append(predicates, eventexposure.IDNotIn(i.IDNotIn...)) + predicates = append(predicates, eventsubscription.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { - predicates = append(predicates, eventexposure.IDGT(*i.IDGT)) + predicates = append(predicates, eventsubscription.IDGT(*i.IDGT)) } if i.IDGTE != nil { - predicates = append(predicates, eventexposure.IDGTE(*i.IDGTE)) + predicates = append(predicates, eventsubscription.IDGTE(*i.IDGTE)) } if i.IDLT != nil { - predicates = append(predicates, eventexposure.IDLT(*i.IDLT)) + predicates = append(predicates, eventsubscription.IDLT(*i.IDLT)) } if i.IDLTE != nil { - predicates = append(predicates, eventexposure.IDLTE(*i.IDLTE)) + predicates = append(predicates, eventsubscription.IDLTE(*i.IDLTE)) } if i.CreatedAt != nil { - predicates = append(predicates, eventexposure.CreatedAtEQ(*i.CreatedAt)) + predicates = append(predicates, eventsubscription.CreatedAtEQ(*i.CreatedAt)) } if i.CreatedAtNEQ != nil { - predicates = append(predicates, eventexposure.CreatedAtNEQ(*i.CreatedAtNEQ)) + predicates = append(predicates, eventsubscription.CreatedAtNEQ(*i.CreatedAtNEQ)) } if len(i.CreatedAtIn) > 0 { - predicates = append(predicates, eventexposure.CreatedAtIn(i.CreatedAtIn...)) + predicates = append(predicates, eventsubscription.CreatedAtIn(i.CreatedAtIn...)) } if len(i.CreatedAtNotIn) > 0 { - predicates = append(predicates, eventexposure.CreatedAtNotIn(i.CreatedAtNotIn...)) + predicates = append(predicates, eventsubscription.CreatedAtNotIn(i.CreatedAtNotIn...)) } if i.CreatedAtGT != nil { - predicates = append(predicates, eventexposure.CreatedAtGT(*i.CreatedAtGT)) + predicates = append(predicates, eventsubscription.CreatedAtGT(*i.CreatedAtGT)) } if i.CreatedAtGTE != nil { - predicates = append(predicates, eventexposure.CreatedAtGTE(*i.CreatedAtGTE)) + predicates = append(predicates, eventsubscription.CreatedAtGTE(*i.CreatedAtGTE)) } if i.CreatedAtLT != nil { - predicates = append(predicates, eventexposure.CreatedAtLT(*i.CreatedAtLT)) + predicates = append(predicates, eventsubscription.CreatedAtLT(*i.CreatedAtLT)) } if i.CreatedAtLTE != nil { - predicates = append(predicates, eventexposure.CreatedAtLTE(*i.CreatedAtLTE)) + predicates = append(predicates, eventsubscription.CreatedAtLTE(*i.CreatedAtLTE)) } if i.LastModifiedAt != nil { - predicates = append(predicates, eventexposure.LastModifiedAtEQ(*i.LastModifiedAt)) + predicates = append(predicates, eventsubscription.LastModifiedAtEQ(*i.LastModifiedAt)) } if i.LastModifiedAtNEQ != nil { - predicates = append(predicates, eventexposure.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + predicates = append(predicates, eventsubscription.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) } if len(i.LastModifiedAtIn) > 0 { - predicates = append(predicates, eventexposure.LastModifiedAtIn(i.LastModifiedAtIn...)) + predicates = append(predicates, eventsubscription.LastModifiedAtIn(i.LastModifiedAtIn...)) } if len(i.LastModifiedAtNotIn) > 0 { - predicates = append(predicates, eventexposure.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + predicates = append(predicates, eventsubscription.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) } if i.LastModifiedAtGT != nil { - predicates = append(predicates, eventexposure.LastModifiedAtGT(*i.LastModifiedAtGT)) + predicates = append(predicates, eventsubscription.LastModifiedAtGT(*i.LastModifiedAtGT)) } if i.LastModifiedAtGTE != nil { - predicates = append(predicates, eventexposure.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + predicates = append(predicates, eventsubscription.LastModifiedAtGTE(*i.LastModifiedAtGTE)) } if i.LastModifiedAtLT != nil { - predicates = append(predicates, eventexposure.LastModifiedAtLT(*i.LastModifiedAtLT)) + predicates = append(predicates, eventsubscription.LastModifiedAtLT(*i.LastModifiedAtLT)) } if i.LastModifiedAtLTE != nil { - predicates = append(predicates, eventexposure.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + predicates = append(predicates, eventsubscription.LastModifiedAtLTE(*i.LastModifiedAtLTE)) } if i.StatusPhase != nil { - predicates = append(predicates, eventexposure.StatusPhaseEQ(*i.StatusPhase)) + predicates = append(predicates, eventsubscription.StatusPhaseEQ(*i.StatusPhase)) } if i.StatusPhaseNEQ != nil { - predicates = append(predicates, eventexposure.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + predicates = append(predicates, eventsubscription.StatusPhaseNEQ(*i.StatusPhaseNEQ)) } if len(i.StatusPhaseIn) > 0 { - predicates = append(predicates, eventexposure.StatusPhaseIn(i.StatusPhaseIn...)) + predicates = append(predicates, eventsubscription.StatusPhaseIn(i.StatusPhaseIn...)) } if len(i.StatusPhaseNotIn) > 0 { - predicates = append(predicates, eventexposure.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + predicates = append(predicates, eventsubscription.StatusPhaseNotIn(i.StatusPhaseNotIn...)) } if i.StatusPhaseIsNil { - predicates = append(predicates, eventexposure.StatusPhaseIsNil()) + predicates = append(predicates, eventsubscription.StatusPhaseIsNil()) } if i.StatusPhaseNotNil { - predicates = append(predicates, eventexposure.StatusPhaseNotNil()) + predicates = append(predicates, eventsubscription.StatusPhaseNotNil()) } if i.StatusMessage != nil { - predicates = append(predicates, eventexposure.StatusMessageEQ(*i.StatusMessage)) + predicates = append(predicates, eventsubscription.StatusMessageEQ(*i.StatusMessage)) } if i.StatusMessageNEQ != nil { - predicates = append(predicates, eventexposure.StatusMessageNEQ(*i.StatusMessageNEQ)) + predicates = append(predicates, eventsubscription.StatusMessageNEQ(*i.StatusMessageNEQ)) } if len(i.StatusMessageIn) > 0 { - predicates = append(predicates, eventexposure.StatusMessageIn(i.StatusMessageIn...)) + predicates = append(predicates, eventsubscription.StatusMessageIn(i.StatusMessageIn...)) } if len(i.StatusMessageNotIn) > 0 { - predicates = append(predicates, eventexposure.StatusMessageNotIn(i.StatusMessageNotIn...)) + predicates = append(predicates, eventsubscription.StatusMessageNotIn(i.StatusMessageNotIn...)) } if i.StatusMessageGT != nil { - predicates = append(predicates, eventexposure.StatusMessageGT(*i.StatusMessageGT)) + predicates = append(predicates, eventsubscription.StatusMessageGT(*i.StatusMessageGT)) } if i.StatusMessageGTE != nil { - predicates = append(predicates, eventexposure.StatusMessageGTE(*i.StatusMessageGTE)) + predicates = append(predicates, eventsubscription.StatusMessageGTE(*i.StatusMessageGTE)) } if i.StatusMessageLT != nil { - predicates = append(predicates, eventexposure.StatusMessageLT(*i.StatusMessageLT)) + predicates = append(predicates, eventsubscription.StatusMessageLT(*i.StatusMessageLT)) } if i.StatusMessageLTE != nil { - predicates = append(predicates, eventexposure.StatusMessageLTE(*i.StatusMessageLTE)) + predicates = append(predicates, eventsubscription.StatusMessageLTE(*i.StatusMessageLTE)) } if i.StatusMessageContains != nil { - predicates = append(predicates, eventexposure.StatusMessageContains(*i.StatusMessageContains)) + predicates = append(predicates, eventsubscription.StatusMessageContains(*i.StatusMessageContains)) } if i.StatusMessageHasPrefix != nil { - predicates = append(predicates, eventexposure.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) + predicates = append(predicates, eventsubscription.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) } if i.StatusMessageHasSuffix != nil { - predicates = append(predicates, eventexposure.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) + predicates = append(predicates, eventsubscription.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) } if i.StatusMessageIsNil { - predicates = append(predicates, eventexposure.StatusMessageIsNil()) + predicates = append(predicates, eventsubscription.StatusMessageIsNil()) } if i.StatusMessageNotNil { - predicates = append(predicates, eventexposure.StatusMessageNotNil()) + predicates = append(predicates, eventsubscription.StatusMessageNotNil()) } if i.StatusMessageEqualFold != nil { - predicates = append(predicates, eventexposure.StatusMessageEqualFold(*i.StatusMessageEqualFold)) + predicates = append(predicates, eventsubscription.StatusMessageEqualFold(*i.StatusMessageEqualFold)) } if i.StatusMessageContainsFold != nil { - predicates = append(predicates, eventexposure.StatusMessageContainsFold(*i.StatusMessageContainsFold)) + predicates = append(predicates, eventsubscription.StatusMessageContainsFold(*i.StatusMessageContainsFold)) } if i.Environment != nil { - predicates = append(predicates, eventexposure.EnvironmentEQ(*i.Environment)) + predicates = append(predicates, eventsubscription.EnvironmentEQ(*i.Environment)) } if i.EnvironmentNEQ != nil { - predicates = append(predicates, eventexposure.EnvironmentNEQ(*i.EnvironmentNEQ)) + predicates = append(predicates, eventsubscription.EnvironmentNEQ(*i.EnvironmentNEQ)) } if len(i.EnvironmentIn) > 0 { - predicates = append(predicates, eventexposure.EnvironmentIn(i.EnvironmentIn...)) + predicates = append(predicates, eventsubscription.EnvironmentIn(i.EnvironmentIn...)) } if len(i.EnvironmentNotIn) > 0 { - predicates = append(predicates, eventexposure.EnvironmentNotIn(i.EnvironmentNotIn...)) + predicates = append(predicates, eventsubscription.EnvironmentNotIn(i.EnvironmentNotIn...)) } if i.EnvironmentGT != nil { - predicates = append(predicates, eventexposure.EnvironmentGT(*i.EnvironmentGT)) + predicates = append(predicates, eventsubscription.EnvironmentGT(*i.EnvironmentGT)) } if i.EnvironmentGTE != nil { - predicates = append(predicates, eventexposure.EnvironmentGTE(*i.EnvironmentGTE)) + predicates = append(predicates, eventsubscription.EnvironmentGTE(*i.EnvironmentGTE)) } if i.EnvironmentLT != nil { - predicates = append(predicates, eventexposure.EnvironmentLT(*i.EnvironmentLT)) + predicates = append(predicates, eventsubscription.EnvironmentLT(*i.EnvironmentLT)) } if i.EnvironmentLTE != nil { - predicates = append(predicates, eventexposure.EnvironmentLTE(*i.EnvironmentLTE)) + predicates = append(predicates, eventsubscription.EnvironmentLTE(*i.EnvironmentLTE)) } if i.EnvironmentContains != nil { - predicates = append(predicates, eventexposure.EnvironmentContains(*i.EnvironmentContains)) + predicates = append(predicates, eventsubscription.EnvironmentContains(*i.EnvironmentContains)) } if i.EnvironmentHasPrefix != nil { - predicates = append(predicates, eventexposure.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + predicates = append(predicates, eventsubscription.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) } if i.EnvironmentHasSuffix != nil { - predicates = append(predicates, eventexposure.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + predicates = append(predicates, eventsubscription.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) } if i.EnvironmentIsNil { - predicates = append(predicates, eventexposure.EnvironmentIsNil()) + predicates = append(predicates, eventsubscription.EnvironmentIsNil()) } if i.EnvironmentNotNil { - predicates = append(predicates, eventexposure.EnvironmentNotNil()) + predicates = append(predicates, eventsubscription.EnvironmentNotNil()) } if i.EnvironmentEqualFold != nil { - predicates = append(predicates, eventexposure.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + predicates = append(predicates, eventsubscription.EnvironmentEqualFold(*i.EnvironmentEqualFold)) } if i.EnvironmentContainsFold != nil { - predicates = append(predicates, eventexposure.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + predicates = append(predicates, eventsubscription.EnvironmentContainsFold(*i.EnvironmentContainsFold)) } if i.Namespace != nil { - predicates = append(predicates, eventexposure.NamespaceEQ(*i.Namespace)) + predicates = append(predicates, eventsubscription.NamespaceEQ(*i.Namespace)) } if i.NamespaceNEQ != nil { - predicates = append(predicates, eventexposure.NamespaceNEQ(*i.NamespaceNEQ)) + predicates = append(predicates, eventsubscription.NamespaceNEQ(*i.NamespaceNEQ)) } if len(i.NamespaceIn) > 0 { - predicates = append(predicates, eventexposure.NamespaceIn(i.NamespaceIn...)) + predicates = append(predicates, eventsubscription.NamespaceIn(i.NamespaceIn...)) } if len(i.NamespaceNotIn) > 0 { - predicates = append(predicates, eventexposure.NamespaceNotIn(i.NamespaceNotIn...)) + predicates = append(predicates, eventsubscription.NamespaceNotIn(i.NamespaceNotIn...)) } if i.NamespaceGT != nil { - predicates = append(predicates, eventexposure.NamespaceGT(*i.NamespaceGT)) + predicates = append(predicates, eventsubscription.NamespaceGT(*i.NamespaceGT)) } if i.NamespaceGTE != nil { - predicates = append(predicates, eventexposure.NamespaceGTE(*i.NamespaceGTE)) + predicates = append(predicates, eventsubscription.NamespaceGTE(*i.NamespaceGTE)) } if i.NamespaceLT != nil { - predicates = append(predicates, eventexposure.NamespaceLT(*i.NamespaceLT)) + predicates = append(predicates, eventsubscription.NamespaceLT(*i.NamespaceLT)) } if i.NamespaceLTE != nil { - predicates = append(predicates, eventexposure.NamespaceLTE(*i.NamespaceLTE)) + predicates = append(predicates, eventsubscription.NamespaceLTE(*i.NamespaceLTE)) } if i.NamespaceContains != nil { - predicates = append(predicates, eventexposure.NamespaceContains(*i.NamespaceContains)) + predicates = append(predicates, eventsubscription.NamespaceContains(*i.NamespaceContains)) } if i.NamespaceHasPrefix != nil { - predicates = append(predicates, eventexposure.NamespaceHasPrefix(*i.NamespaceHasPrefix)) + predicates = append(predicates, eventsubscription.NamespaceHasPrefix(*i.NamespaceHasPrefix)) } if i.NamespaceHasSuffix != nil { - predicates = append(predicates, eventexposure.NamespaceHasSuffix(*i.NamespaceHasSuffix)) + predicates = append(predicates, eventsubscription.NamespaceHasSuffix(*i.NamespaceHasSuffix)) } if i.NamespaceEqualFold != nil { - predicates = append(predicates, eventexposure.NamespaceEqualFold(*i.NamespaceEqualFold)) + predicates = append(predicates, eventsubscription.NamespaceEqualFold(*i.NamespaceEqualFold)) } if i.NamespaceContainsFold != nil { - predicates = append(predicates, eventexposure.NamespaceContainsFold(*i.NamespaceContainsFold)) + 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, eventexposure.EventTypeEQ(*i.EventType)) + predicates = append(predicates, eventsubscription.EventTypeEQ(*i.EventType)) } if i.EventTypeNEQ != nil { - predicates = append(predicates, eventexposure.EventTypeNEQ(*i.EventTypeNEQ)) + predicates = append(predicates, eventsubscription.EventTypeNEQ(*i.EventTypeNEQ)) } if len(i.EventTypeIn) > 0 { - predicates = append(predicates, eventexposure.EventTypeIn(i.EventTypeIn...)) + predicates = append(predicates, eventsubscription.EventTypeIn(i.EventTypeIn...)) } if len(i.EventTypeNotIn) > 0 { - predicates = append(predicates, eventexposure.EventTypeNotIn(i.EventTypeNotIn...)) + predicates = append(predicates, eventsubscription.EventTypeNotIn(i.EventTypeNotIn...)) } if i.EventTypeGT != nil { - predicates = append(predicates, eventexposure.EventTypeGT(*i.EventTypeGT)) + predicates = append(predicates, eventsubscription.EventTypeGT(*i.EventTypeGT)) } if i.EventTypeGTE != nil { - predicates = append(predicates, eventexposure.EventTypeGTE(*i.EventTypeGTE)) + predicates = append(predicates, eventsubscription.EventTypeGTE(*i.EventTypeGTE)) } if i.EventTypeLT != nil { - predicates = append(predicates, eventexposure.EventTypeLT(*i.EventTypeLT)) + predicates = append(predicates, eventsubscription.EventTypeLT(*i.EventTypeLT)) } if i.EventTypeLTE != nil { - predicates = append(predicates, eventexposure.EventTypeLTE(*i.EventTypeLTE)) + predicates = append(predicates, eventsubscription.EventTypeLTE(*i.EventTypeLTE)) } if i.EventTypeContains != nil { - predicates = append(predicates, eventexposure.EventTypeContains(*i.EventTypeContains)) + predicates = append(predicates, eventsubscription.EventTypeContains(*i.EventTypeContains)) } if i.EventTypeHasPrefix != nil { - predicates = append(predicates, eventexposure.EventTypeHasPrefix(*i.EventTypeHasPrefix)) + predicates = append(predicates, eventsubscription.EventTypeHasPrefix(*i.EventTypeHasPrefix)) } if i.EventTypeHasSuffix != nil { - predicates = append(predicates, eventexposure.EventTypeHasSuffix(*i.EventTypeHasSuffix)) + predicates = append(predicates, eventsubscription.EventTypeHasSuffix(*i.EventTypeHasSuffix)) } if i.EventTypeEqualFold != nil { - predicates = append(predicates, eventexposure.EventTypeEqualFold(*i.EventTypeEqualFold)) + predicates = append(predicates, eventsubscription.EventTypeEqualFold(*i.EventTypeEqualFold)) } if i.EventTypeContainsFold != nil { - predicates = append(predicates, eventexposure.EventTypeContainsFold(*i.EventTypeContainsFold)) + predicates = append(predicates, eventsubscription.EventTypeContainsFold(*i.EventTypeContainsFold)) } - if i.Visibility != nil { - predicates = append(predicates, eventexposure.VisibilityEQ(*i.Visibility)) + if i.DeliveryType != nil { + predicates = append(predicates, eventsubscription.DeliveryTypeEQ(*i.DeliveryType)) } - if i.VisibilityNEQ != nil { - predicates = append(predicates, eventexposure.VisibilityNEQ(*i.VisibilityNEQ)) + if i.DeliveryTypeNEQ != nil { + predicates = append(predicates, eventsubscription.DeliveryTypeNEQ(*i.DeliveryTypeNEQ)) } - if len(i.VisibilityIn) > 0 { - predicates = append(predicates, eventexposure.VisibilityIn(i.VisibilityIn...)) + if len(i.DeliveryTypeIn) > 0 { + predicates = append(predicates, eventsubscription.DeliveryTypeIn(i.DeliveryTypeIn...)) } - if len(i.VisibilityNotIn) > 0 { - predicates = append(predicates, eventexposure.VisibilityNotIn(i.VisibilityNotIn...)) + if len(i.DeliveryTypeNotIn) > 0 { + predicates = append(predicates, eventsubscription.DeliveryTypeNotIn(i.DeliveryTypeNotIn...)) } - if i.Active != nil { - predicates = append(predicates, eventexposure.ActiveEQ(*i.Active)) + if i.CallbackURL != nil { + predicates = append(predicates, eventsubscription.CallbackURLEQ(*i.CallbackURL)) } - if i.ActiveNEQ != nil { - predicates = append(predicates, eventexposure.ActiveNEQ(*i.ActiveNEQ)) + 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.ActiveIsNil { - predicates = append(predicates, eventexposure.ActiveIsNil()) + if i.CallbackURLEqualFold != nil { + predicates = append(predicates, eventsubscription.CallbackURLEqualFold(*i.CallbackURLEqualFold)) } - if i.ActiveNotNil { - predicates = append(predicates, eventexposure.ActiveNotNil()) + if i.CallbackURLContainsFold != nil { + predicates = append(predicates, eventsubscription.CallbackURLContainsFold(*i.CallbackURLContainsFold)) } if i.HasOwner != nil { - p := eventexposure.HasOwner() + p := eventsubscription.HasOwner() if !*i.HasOwner { - p = eventexposure.Not(p) + p = eventsubscription.Not(p) } predicates = append(predicates, p) } @@ -3832,42 +5144,78 @@ func (i *EventExposureWhereInput) P() (predicate.EventExposure, error) { } with = append(with, p) } - predicates = append(predicates, eventexposure.HasOwnerWith(with...)) + predicates = append(predicates, eventsubscription.HasOwnerWith(with...)) } - if i.HasSubscriptions != nil { - p := eventexposure.HasSubscriptions() - if !*i.HasSubscriptions { - p = eventexposure.Not(p) + if i.HasTarget != nil { + p := eventsubscription.HasTarget() + if !*i.HasTarget { + p = eventsubscription.Not(p) } predicates = append(predicates, p) } - if len(i.HasSubscriptionsWith) > 0 { - with := make([]predicate.EventSubscription, 0, len(i.HasSubscriptionsWith)) - for _, w := range i.HasSubscriptionsWith { + 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 'HasSubscriptionsWith'", err) + return nil, fmt.Errorf("%w: field 'HasTargetWith'", err) } with = append(with, p) } - predicates = append(predicates, eventexposure.HasSubscriptionsWith(with...)) + 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, ErrEmptyEventExposureWhereInput + return nil, ErrEmptyEventSubscriptionWhereInput case 1: return predicates[0], nil default: - return eventexposure.And(predicates...), nil + return eventsubscription.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"` +// EventTypeWhereInput represents a where input for filtering EventType queries. +type EventTypeWhereInput struct { + Predicates []predicate.EventType `json:"-"` + Not *EventTypeWhereInput `json:"not,omitempty"` + Or []*EventTypeWhereInput `json:"or,omitempty"` + And []*EventTypeWhereInput `json:"and,omitempty"` // "id" field predicates. ID *int `json:"id,omitempty"` @@ -3900,12 +5248,12 @@ type EventSubscriptionWhereInput struct { 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"` + StatusPhase *eventtype.StatusPhase `json:"statusPhase,omitempty"` + StatusPhaseNEQ *eventtype.StatusPhase `json:"statusPhaseNEQ,omitempty"` + StatusPhaseIn []eventtype.StatusPhase `json:"statusPhaseIn,omitempty"` + StatusPhaseNotIn []eventtype.StatusPhase `json:"statusPhaseNotIn,omitempty"` + StatusPhaseIsNil bool `json:"statusPhaseIsNil,omitempty"` + StatusPhaseNotNil bool `json:"statusPhaseNotNil,omitempty"` // "status_message" field predicates. StatusMessage *string `json:"statusMessage,omitempty"` @@ -3924,23 +5272,6 @@ type EventSubscriptionWhereInput struct { 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"` @@ -3956,21 +5287,6 @@ type EventSubscriptionWhereInput 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"` @@ -3986,59 +5302,81 @@ type EventSubscriptionWhereInput struct { 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"` + // "version" field predicates. + Version *string `json:"version,omitempty"` + VersionNEQ *string `json:"versionNEQ,omitempty"` + VersionIn []string `json:"versionIn,omitempty"` + VersionNotIn []string `json:"versionNotIn,omitempty"` + VersionGT *string `json:"versionGT,omitempty"` + VersionGTE *string `json:"versionGTE,omitempty"` + VersionLT *string `json:"versionLT,omitempty"` + VersionLTE *string `json:"versionLTE,omitempty"` + VersionContains *string `json:"versionContains,omitempty"` + VersionHasPrefix *string `json:"versionHasPrefix,omitempty"` + VersionHasSuffix *string `json:"versionHasSuffix,omitempty"` + VersionEqualFold *string `json:"versionEqualFold,omitempty"` + VersionContainsFold *string `json:"versionContainsFold,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"` + // "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"` + DescriptionIsNil bool `json:"descriptionIsNil,omitempty"` + DescriptionNotNil bool `json:"descriptionNotNil,omitempty"` + DescriptionEqualFold *string `json:"descriptionEqualFold,omitempty"` + DescriptionContainsFold *string `json:"descriptionContainsFold,omitempty"` - // "owner" edge predicates. - HasOwner *bool `json:"hasOwner,omitempty"` - HasOwnerWith []*ApplicationWhereInput `json:"hasOwnerWith,omitempty"` + // "specification" field predicates. + Specification *string `json:"specification,omitempty"` + SpecificationNEQ *string `json:"specificationNEQ,omitempty"` + SpecificationIn []string `json:"specificationIn,omitempty"` + SpecificationNotIn []string `json:"specificationNotIn,omitempty"` + SpecificationGT *string `json:"specificationGT,omitempty"` + SpecificationGTE *string `json:"specificationGTE,omitempty"` + SpecificationLT *string `json:"specificationLT,omitempty"` + SpecificationLTE *string `json:"specificationLTE,omitempty"` + SpecificationContains *string `json:"specificationContains,omitempty"` + SpecificationHasPrefix *string `json:"specificationHasPrefix,omitempty"` + SpecificationHasSuffix *string `json:"specificationHasSuffix,omitempty"` + SpecificationIsNil bool `json:"specificationIsNil,omitempty"` + SpecificationNotNil bool `json:"specificationNotNil,omitempty"` + SpecificationEqualFold *string `json:"specificationEqualFold,omitempty"` + SpecificationContainsFold *string `json:"specificationContainsFold,omitempty"` - // "target" edge predicates. - HasTarget *bool `json:"hasTarget,omitempty"` - HasTargetWith []*EventExposureWhereInput `json:"hasTargetWith,omitempty"` + // "active" field predicates. + Active *bool `json:"active,omitempty"` + ActiveNEQ *bool `json:"activeNEQ,omitempty"` - // "approval" edge predicates. - HasApproval *bool `json:"hasApproval,omitempty"` - HasApprovalWith []*ApprovalWhereInput `json:"hasApprovalWith,omitempty"` + // "owner" edge predicates. + HasOwner *bool `json:"hasOwner,omitempty"` + HasOwnerWith []*TeamWhereInput `json:"hasOwnerWith,omitempty"` - // "approval_requests" edge predicates. - HasApprovalRequests *bool `json:"hasApprovalRequests,omitempty"` - HasApprovalRequestsWith []*ApprovalRequestWhereInput `json:"hasApprovalRequestsWith,omitempty"` + // "exposures" edge predicates. + HasExposures *bool `json:"hasExposures,omitempty"` + HasExposuresWith []*EventExposureWhereInput `json:"hasExposuresWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. -func (i *EventSubscriptionWhereInput) AddPredicates(predicates ...predicate.EventSubscription) { +func (i *EventTypeWhereInput) AddPredicates(predicates ...predicate.EventType) { i.Predicates = append(i.Predicates, predicates...) } -// Filter applies the EventSubscriptionWhereInput filter on the EventSubscriptionQuery builder. -func (i *EventSubscriptionWhereInput) Filter(q *EventSubscriptionQuery) (*EventSubscriptionQuery, error) { +// Filter applies the EventTypeWhereInput filter on the EventTypeQuery builder. +func (i *EventTypeWhereInput) Filter(q *EventTypeQuery) (*EventTypeQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { - if err == ErrEmptyEventSubscriptionWhereInput { + if err == ErrEmptyEventTypeWhereInput { return q, nil } return nil, err @@ -4046,19 +5384,19 @@ func (i *EventSubscriptionWhereInput) Filter(q *EventSubscriptionQuery) (*EventS return q.Where(p), nil } -// ErrEmptyEventSubscriptionWhereInput is returned in case the EventSubscriptionWhereInput is empty. -var ErrEmptyEventSubscriptionWhereInput = errors.New("ent: empty predicate EventSubscriptionWhereInput") +// ErrEmptyEventTypeWhereInput is returned in case the EventTypeWhereInput is empty. +var ErrEmptyEventTypeWhereInput = errors.New("ent: empty predicate EventTypeWhereInput") -// P returns a predicate for filtering eventsubscriptions. +// P returns a predicate for filtering eventtypes. // An error is returned if the input is empty or invalid. -func (i *EventSubscriptionWhereInput) P() (predicate.EventSubscription, error) { - var predicates []predicate.EventSubscription +func (i *EventTypeWhereInput) P() (predicate.EventType, error) { + var predicates []predicate.EventType 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)) + predicates = append(predicates, eventtype.Not(p)) } switch n := len(i.Or); { case n == 1: @@ -4068,7 +5406,7 @@ func (i *EventSubscriptionWhereInput) P() (predicate.EventSubscription, error) { } predicates = append(predicates, p) case n > 1: - or := make([]predicate.EventSubscription, 0, n) + or := make([]predicate.EventType, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { @@ -4076,7 +5414,7 @@ func (i *EventSubscriptionWhereInput) P() (predicate.EventSubscription, error) { } or = append(or, p) } - predicates = append(predicates, eventsubscription.Or(or...)) + predicates = append(predicates, eventtype.Or(or...)) } switch n := len(i.And); { case n == 1: @@ -4086,7 +5424,7 @@ func (i *EventSubscriptionWhereInput) P() (predicate.EventSubscription, error) { } predicates = append(predicates, p) case n > 1: - and := make([]predicate.EventSubscription, 0, n) + and := make([]predicate.EventType, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { @@ -4094,373 +5432,367 @@ func (i *EventSubscriptionWhereInput) P() (predicate.EventSubscription, error) { } and = append(and, p) } - predicates = append(predicates, eventsubscription.And(and...)) + predicates = append(predicates, eventtype.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { - predicates = append(predicates, eventsubscription.IDEQ(*i.ID)) + predicates = append(predicates, eventtype.IDEQ(*i.ID)) } if i.IDNEQ != nil { - predicates = append(predicates, eventsubscription.IDNEQ(*i.IDNEQ)) + predicates = append(predicates, eventtype.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { - predicates = append(predicates, eventsubscription.IDIn(i.IDIn...)) + predicates = append(predicates, eventtype.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { - predicates = append(predicates, eventsubscription.IDNotIn(i.IDNotIn...)) + predicates = append(predicates, eventtype.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { - predicates = append(predicates, eventsubscription.IDGT(*i.IDGT)) + predicates = append(predicates, eventtype.IDGT(*i.IDGT)) } if i.IDGTE != nil { - predicates = append(predicates, eventsubscription.IDGTE(*i.IDGTE)) + predicates = append(predicates, eventtype.IDGTE(*i.IDGTE)) } if i.IDLT != nil { - predicates = append(predicates, eventsubscription.IDLT(*i.IDLT)) + predicates = append(predicates, eventtype.IDLT(*i.IDLT)) } if i.IDLTE != nil { - predicates = append(predicates, eventsubscription.IDLTE(*i.IDLTE)) + predicates = append(predicates, eventtype.IDLTE(*i.IDLTE)) } if i.CreatedAt != nil { - predicates = append(predicates, eventsubscription.CreatedAtEQ(*i.CreatedAt)) + predicates = append(predicates, eventtype.CreatedAtEQ(*i.CreatedAt)) } if i.CreatedAtNEQ != nil { - predicates = append(predicates, eventsubscription.CreatedAtNEQ(*i.CreatedAtNEQ)) + predicates = append(predicates, eventtype.CreatedAtNEQ(*i.CreatedAtNEQ)) } if len(i.CreatedAtIn) > 0 { - predicates = append(predicates, eventsubscription.CreatedAtIn(i.CreatedAtIn...)) + predicates = append(predicates, eventtype.CreatedAtIn(i.CreatedAtIn...)) } if len(i.CreatedAtNotIn) > 0 { - predicates = append(predicates, eventsubscription.CreatedAtNotIn(i.CreatedAtNotIn...)) + predicates = append(predicates, eventtype.CreatedAtNotIn(i.CreatedAtNotIn...)) } if i.CreatedAtGT != nil { - predicates = append(predicates, eventsubscription.CreatedAtGT(*i.CreatedAtGT)) + predicates = append(predicates, eventtype.CreatedAtGT(*i.CreatedAtGT)) } if i.CreatedAtGTE != nil { - predicates = append(predicates, eventsubscription.CreatedAtGTE(*i.CreatedAtGTE)) + predicates = append(predicates, eventtype.CreatedAtGTE(*i.CreatedAtGTE)) } if i.CreatedAtLT != nil { - predicates = append(predicates, eventsubscription.CreatedAtLT(*i.CreatedAtLT)) + predicates = append(predicates, eventtype.CreatedAtLT(*i.CreatedAtLT)) } if i.CreatedAtLTE != nil { - predicates = append(predicates, eventsubscription.CreatedAtLTE(*i.CreatedAtLTE)) + predicates = append(predicates, eventtype.CreatedAtLTE(*i.CreatedAtLTE)) } if i.LastModifiedAt != nil { - predicates = append(predicates, eventsubscription.LastModifiedAtEQ(*i.LastModifiedAt)) + predicates = append(predicates, eventtype.LastModifiedAtEQ(*i.LastModifiedAt)) } if i.LastModifiedAtNEQ != nil { - predicates = append(predicates, eventsubscription.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + predicates = append(predicates, eventtype.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) } if len(i.LastModifiedAtIn) > 0 { - predicates = append(predicates, eventsubscription.LastModifiedAtIn(i.LastModifiedAtIn...)) + predicates = append(predicates, eventtype.LastModifiedAtIn(i.LastModifiedAtIn...)) } if len(i.LastModifiedAtNotIn) > 0 { - predicates = append(predicates, eventsubscription.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + predicates = append(predicates, eventtype.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) } if i.LastModifiedAtGT != nil { - predicates = append(predicates, eventsubscription.LastModifiedAtGT(*i.LastModifiedAtGT)) + predicates = append(predicates, eventtype.LastModifiedAtGT(*i.LastModifiedAtGT)) } if i.LastModifiedAtGTE != nil { - predicates = append(predicates, eventsubscription.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + predicates = append(predicates, eventtype.LastModifiedAtGTE(*i.LastModifiedAtGTE)) } if i.LastModifiedAtLT != nil { - predicates = append(predicates, eventsubscription.LastModifiedAtLT(*i.LastModifiedAtLT)) + predicates = append(predicates, eventtype.LastModifiedAtLT(*i.LastModifiedAtLT)) } if i.LastModifiedAtLTE != nil { - predicates = append(predicates, eventsubscription.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + predicates = append(predicates, eventtype.LastModifiedAtLTE(*i.LastModifiedAtLTE)) } if i.StatusPhase != nil { - predicates = append(predicates, eventsubscription.StatusPhaseEQ(*i.StatusPhase)) + predicates = append(predicates, eventtype.StatusPhaseEQ(*i.StatusPhase)) } if i.StatusPhaseNEQ != nil { - predicates = append(predicates, eventsubscription.StatusPhaseNEQ(*i.StatusPhaseNEQ)) + predicates = append(predicates, eventtype.StatusPhaseNEQ(*i.StatusPhaseNEQ)) } if len(i.StatusPhaseIn) > 0 { - predicates = append(predicates, eventsubscription.StatusPhaseIn(i.StatusPhaseIn...)) + predicates = append(predicates, eventtype.StatusPhaseIn(i.StatusPhaseIn...)) } if len(i.StatusPhaseNotIn) > 0 { - predicates = append(predicates, eventsubscription.StatusPhaseNotIn(i.StatusPhaseNotIn...)) + predicates = append(predicates, eventtype.StatusPhaseNotIn(i.StatusPhaseNotIn...)) } if i.StatusPhaseIsNil { - predicates = append(predicates, eventsubscription.StatusPhaseIsNil()) + predicates = append(predicates, eventtype.StatusPhaseIsNil()) } if i.StatusPhaseNotNil { - predicates = append(predicates, eventsubscription.StatusPhaseNotNil()) + predicates = append(predicates, eventtype.StatusPhaseNotNil()) } if i.StatusMessage != nil { - predicates = append(predicates, eventsubscription.StatusMessageEQ(*i.StatusMessage)) + predicates = append(predicates, eventtype.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)) + predicates = append(predicates, eventtype.StatusMessageNEQ(*i.StatusMessageNEQ)) } - if len(i.EnvironmentIn) > 0 { - predicates = append(predicates, eventsubscription.EnvironmentIn(i.EnvironmentIn...)) + if len(i.StatusMessageIn) > 0 { + predicates = append(predicates, eventtype.StatusMessageIn(i.StatusMessageIn...)) } - if len(i.EnvironmentNotIn) > 0 { - predicates = append(predicates, eventsubscription.EnvironmentNotIn(i.EnvironmentNotIn...)) + if len(i.StatusMessageNotIn) > 0 { + predicates = append(predicates, eventtype.StatusMessageNotIn(i.StatusMessageNotIn...)) } - if i.EnvironmentGT != nil { - predicates = append(predicates, eventsubscription.EnvironmentGT(*i.EnvironmentGT)) + if i.StatusMessageGT != nil { + predicates = append(predicates, eventtype.StatusMessageGT(*i.StatusMessageGT)) } - if i.EnvironmentGTE != nil { - predicates = append(predicates, eventsubscription.EnvironmentGTE(*i.EnvironmentGTE)) + if i.StatusMessageGTE != nil { + predicates = append(predicates, eventtype.StatusMessageGTE(*i.StatusMessageGTE)) } - if i.EnvironmentLT != nil { - predicates = append(predicates, eventsubscription.EnvironmentLT(*i.EnvironmentLT)) + if i.StatusMessageLT != nil { + predicates = append(predicates, eventtype.StatusMessageLT(*i.StatusMessageLT)) } - if i.EnvironmentLTE != nil { - predicates = append(predicates, eventsubscription.EnvironmentLTE(*i.EnvironmentLTE)) + if i.StatusMessageLTE != nil { + predicates = append(predicates, eventtype.StatusMessageLTE(*i.StatusMessageLTE)) } - if i.EnvironmentContains != nil { - predicates = append(predicates, eventsubscription.EnvironmentContains(*i.EnvironmentContains)) + if i.StatusMessageContains != nil { + predicates = append(predicates, eventtype.StatusMessageContains(*i.StatusMessageContains)) } - if i.EnvironmentHasPrefix != nil { - predicates = append(predicates, eventsubscription.EnvironmentHasPrefix(*i.EnvironmentHasPrefix)) + if i.StatusMessageHasPrefix != nil { + predicates = append(predicates, eventtype.StatusMessageHasPrefix(*i.StatusMessageHasPrefix)) } - if i.EnvironmentHasSuffix != nil { - predicates = append(predicates, eventsubscription.EnvironmentHasSuffix(*i.EnvironmentHasSuffix)) + if i.StatusMessageHasSuffix != nil { + predicates = append(predicates, eventtype.StatusMessageHasSuffix(*i.StatusMessageHasSuffix)) } - if i.EnvironmentIsNil { - predicates = append(predicates, eventsubscription.EnvironmentIsNil()) + if i.StatusMessageIsNil { + predicates = append(predicates, eventtype.StatusMessageIsNil()) } - if i.EnvironmentNotNil { - predicates = append(predicates, eventsubscription.EnvironmentNotNil()) + if i.StatusMessageNotNil { + predicates = append(predicates, eventtype.StatusMessageNotNil()) } - if i.EnvironmentEqualFold != nil { - predicates = append(predicates, eventsubscription.EnvironmentEqualFold(*i.EnvironmentEqualFold)) + if i.StatusMessageEqualFold != nil { + predicates = append(predicates, eventtype.StatusMessageEqualFold(*i.StatusMessageEqualFold)) } - if i.EnvironmentContainsFold != nil { - predicates = append(predicates, eventsubscription.EnvironmentContainsFold(*i.EnvironmentContainsFold)) + if i.StatusMessageContainsFold != nil { + predicates = append(predicates, eventtype.StatusMessageContainsFold(*i.StatusMessageContainsFold)) } if i.Namespace != nil { - predicates = append(predicates, eventsubscription.NamespaceEQ(*i.Namespace)) + predicates = append(predicates, eventtype.NamespaceEQ(*i.Namespace)) } if i.NamespaceNEQ != nil { - predicates = append(predicates, eventsubscription.NamespaceNEQ(*i.NamespaceNEQ)) + predicates = append(predicates, eventtype.NamespaceNEQ(*i.NamespaceNEQ)) } if len(i.NamespaceIn) > 0 { - predicates = append(predicates, eventsubscription.NamespaceIn(i.NamespaceIn...)) + predicates = append(predicates, eventtype.NamespaceIn(i.NamespaceIn...)) } if len(i.NamespaceNotIn) > 0 { - predicates = append(predicates, eventsubscription.NamespaceNotIn(i.NamespaceNotIn...)) + predicates = append(predicates, eventtype.NamespaceNotIn(i.NamespaceNotIn...)) } if i.NamespaceGT != nil { - predicates = append(predicates, eventsubscription.NamespaceGT(*i.NamespaceGT)) + predicates = append(predicates, eventtype.NamespaceGT(*i.NamespaceGT)) } if i.NamespaceGTE != nil { - predicates = append(predicates, eventsubscription.NamespaceGTE(*i.NamespaceGTE)) + predicates = append(predicates, eventtype.NamespaceGTE(*i.NamespaceGTE)) } if i.NamespaceLT != nil { - predicates = append(predicates, eventsubscription.NamespaceLT(*i.NamespaceLT)) + predicates = append(predicates, eventtype.NamespaceLT(*i.NamespaceLT)) } if i.NamespaceLTE != nil { - predicates = append(predicates, eventsubscription.NamespaceLTE(*i.NamespaceLTE)) + predicates = append(predicates, eventtype.NamespaceLTE(*i.NamespaceLTE)) } if i.NamespaceContains != nil { - predicates = append(predicates, eventsubscription.NamespaceContains(*i.NamespaceContains)) + predicates = append(predicates, eventtype.NamespaceContains(*i.NamespaceContains)) } if i.NamespaceHasPrefix != nil { - predicates = append(predicates, eventsubscription.NamespaceHasPrefix(*i.NamespaceHasPrefix)) + predicates = append(predicates, eventtype.NamespaceHasPrefix(*i.NamespaceHasPrefix)) } if i.NamespaceHasSuffix != nil { - predicates = append(predicates, eventsubscription.NamespaceHasSuffix(*i.NamespaceHasSuffix)) + predicates = append(predicates, eventtype.NamespaceHasSuffix(*i.NamespaceHasSuffix)) } if i.NamespaceEqualFold != nil { - predicates = append(predicates, eventsubscription.NamespaceEqualFold(*i.NamespaceEqualFold)) + predicates = append(predicates, eventtype.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)) + predicates = append(predicates, eventtype.NamespaceContainsFold(*i.NamespaceContainsFold)) } if i.EventType != nil { - predicates = append(predicates, eventsubscription.EventTypeEQ(*i.EventType)) + predicates = append(predicates, eventtype.EventTypeEQ(*i.EventType)) } if i.EventTypeNEQ != nil { - predicates = append(predicates, eventsubscription.EventTypeNEQ(*i.EventTypeNEQ)) + predicates = append(predicates, eventtype.EventTypeNEQ(*i.EventTypeNEQ)) } if len(i.EventTypeIn) > 0 { - predicates = append(predicates, eventsubscription.EventTypeIn(i.EventTypeIn...)) + predicates = append(predicates, eventtype.EventTypeIn(i.EventTypeIn...)) } if len(i.EventTypeNotIn) > 0 { - predicates = append(predicates, eventsubscription.EventTypeNotIn(i.EventTypeNotIn...)) + predicates = append(predicates, eventtype.EventTypeNotIn(i.EventTypeNotIn...)) } if i.EventTypeGT != nil { - predicates = append(predicates, eventsubscription.EventTypeGT(*i.EventTypeGT)) + predicates = append(predicates, eventtype.EventTypeGT(*i.EventTypeGT)) } if i.EventTypeGTE != nil { - predicates = append(predicates, eventsubscription.EventTypeGTE(*i.EventTypeGTE)) + predicates = append(predicates, eventtype.EventTypeGTE(*i.EventTypeGTE)) } if i.EventTypeLT != nil { - predicates = append(predicates, eventsubscription.EventTypeLT(*i.EventTypeLT)) + predicates = append(predicates, eventtype.EventTypeLT(*i.EventTypeLT)) } if i.EventTypeLTE != nil { - predicates = append(predicates, eventsubscription.EventTypeLTE(*i.EventTypeLTE)) + predicates = append(predicates, eventtype.EventTypeLTE(*i.EventTypeLTE)) } if i.EventTypeContains != nil { - predicates = append(predicates, eventsubscription.EventTypeContains(*i.EventTypeContains)) + predicates = append(predicates, eventtype.EventTypeContains(*i.EventTypeContains)) } if i.EventTypeHasPrefix != nil { - predicates = append(predicates, eventsubscription.EventTypeHasPrefix(*i.EventTypeHasPrefix)) + predicates = append(predicates, eventtype.EventTypeHasPrefix(*i.EventTypeHasPrefix)) } if i.EventTypeHasSuffix != nil { - predicates = append(predicates, eventsubscription.EventTypeHasSuffix(*i.EventTypeHasSuffix)) + predicates = append(predicates, eventtype.EventTypeHasSuffix(*i.EventTypeHasSuffix)) } if i.EventTypeEqualFold != nil { - predicates = append(predicates, eventsubscription.EventTypeEqualFold(*i.EventTypeEqualFold)) + predicates = append(predicates, eventtype.EventTypeEqualFold(*i.EventTypeEqualFold)) } if i.EventTypeContainsFold != nil { - predicates = append(predicates, eventsubscription.EventTypeContainsFold(*i.EventTypeContainsFold)) + predicates = append(predicates, eventtype.EventTypeContainsFold(*i.EventTypeContainsFold)) } - if i.DeliveryType != nil { - predicates = append(predicates, eventsubscription.DeliveryTypeEQ(*i.DeliveryType)) + if i.Version != nil { + predicates = append(predicates, eventtype.VersionEQ(*i.Version)) } - if i.DeliveryTypeNEQ != nil { - predicates = append(predicates, eventsubscription.DeliveryTypeNEQ(*i.DeliveryTypeNEQ)) + if i.VersionNEQ != nil { + predicates = append(predicates, eventtype.VersionNEQ(*i.VersionNEQ)) } - if len(i.DeliveryTypeIn) > 0 { - predicates = append(predicates, eventsubscription.DeliveryTypeIn(i.DeliveryTypeIn...)) + if len(i.VersionIn) > 0 { + predicates = append(predicates, eventtype.VersionIn(i.VersionIn...)) } - if len(i.DeliveryTypeNotIn) > 0 { - predicates = append(predicates, eventsubscription.DeliveryTypeNotIn(i.DeliveryTypeNotIn...)) + if len(i.VersionNotIn) > 0 { + predicates = append(predicates, eventtype.VersionNotIn(i.VersionNotIn...)) } - if i.CallbackURL != nil { - predicates = append(predicates, eventsubscription.CallbackURLEQ(*i.CallbackURL)) + if i.VersionGT != nil { + predicates = append(predicates, eventtype.VersionGT(*i.VersionGT)) } - if i.CallbackURLNEQ != nil { - predicates = append(predicates, eventsubscription.CallbackURLNEQ(*i.CallbackURLNEQ)) + if i.VersionGTE != nil { + predicates = append(predicates, eventtype.VersionGTE(*i.VersionGTE)) } - if len(i.CallbackURLIn) > 0 { - predicates = append(predicates, eventsubscription.CallbackURLIn(i.CallbackURLIn...)) + if i.VersionLT != nil { + predicates = append(predicates, eventtype.VersionLT(*i.VersionLT)) } - if len(i.CallbackURLNotIn) > 0 { - predicates = append(predicates, eventsubscription.CallbackURLNotIn(i.CallbackURLNotIn...)) + if i.VersionLTE != nil { + predicates = append(predicates, eventtype.VersionLTE(*i.VersionLTE)) } - if i.CallbackURLGT != nil { - predicates = append(predicates, eventsubscription.CallbackURLGT(*i.CallbackURLGT)) + if i.VersionContains != nil { + predicates = append(predicates, eventtype.VersionContains(*i.VersionContains)) } - if i.CallbackURLGTE != nil { - predicates = append(predicates, eventsubscription.CallbackURLGTE(*i.CallbackURLGTE)) + if i.VersionHasPrefix != nil { + predicates = append(predicates, eventtype.VersionHasPrefix(*i.VersionHasPrefix)) } - if i.CallbackURLLT != nil { - predicates = append(predicates, eventsubscription.CallbackURLLT(*i.CallbackURLLT)) + if i.VersionHasSuffix != nil { + predicates = append(predicates, eventtype.VersionHasSuffix(*i.VersionHasSuffix)) } - if i.CallbackURLLTE != nil { - predicates = append(predicates, eventsubscription.CallbackURLLTE(*i.CallbackURLLTE)) + if i.VersionEqualFold != nil { + predicates = append(predicates, eventtype.VersionEqualFold(*i.VersionEqualFold)) } - if i.CallbackURLContains != nil { - predicates = append(predicates, eventsubscription.CallbackURLContains(*i.CallbackURLContains)) + if i.VersionContainsFold != nil { + predicates = append(predicates, eventtype.VersionContainsFold(*i.VersionContainsFold)) } - if i.CallbackURLHasPrefix != nil { - predicates = append(predicates, eventsubscription.CallbackURLHasPrefix(*i.CallbackURLHasPrefix)) + if i.Description != nil { + predicates = append(predicates, eventtype.DescriptionEQ(*i.Description)) } - if i.CallbackURLHasSuffix != nil { - predicates = append(predicates, eventsubscription.CallbackURLHasSuffix(*i.CallbackURLHasSuffix)) + if i.DescriptionNEQ != nil { + predicates = append(predicates, eventtype.DescriptionNEQ(*i.DescriptionNEQ)) } - if i.CallbackURLIsNil { - predicates = append(predicates, eventsubscription.CallbackURLIsNil()) + if len(i.DescriptionIn) > 0 { + predicates = append(predicates, eventtype.DescriptionIn(i.DescriptionIn...)) } - if i.CallbackURLNotNil { - predicates = append(predicates, eventsubscription.CallbackURLNotNil()) + if len(i.DescriptionNotIn) > 0 { + predicates = append(predicates, eventtype.DescriptionNotIn(i.DescriptionNotIn...)) } - if i.CallbackURLEqualFold != nil { - predicates = append(predicates, eventsubscription.CallbackURLEqualFold(*i.CallbackURLEqualFold)) + if i.DescriptionGT != nil { + predicates = append(predicates, eventtype.DescriptionGT(*i.DescriptionGT)) } - if i.CallbackURLContainsFold != nil { - predicates = append(predicates, eventsubscription.CallbackURLContainsFold(*i.CallbackURLContainsFold)) + if i.DescriptionGTE != nil { + predicates = append(predicates, eventtype.DescriptionGTE(*i.DescriptionGTE)) + } + if i.DescriptionLT != nil { + predicates = append(predicates, eventtype.DescriptionLT(*i.DescriptionLT)) + } + if i.DescriptionLTE != nil { + predicates = append(predicates, eventtype.DescriptionLTE(*i.DescriptionLTE)) + } + if i.DescriptionContains != nil { + predicates = append(predicates, eventtype.DescriptionContains(*i.DescriptionContains)) + } + if i.DescriptionHasPrefix != nil { + predicates = append(predicates, eventtype.DescriptionHasPrefix(*i.DescriptionHasPrefix)) + } + if i.DescriptionHasSuffix != nil { + predicates = append(predicates, eventtype.DescriptionHasSuffix(*i.DescriptionHasSuffix)) + } + if i.DescriptionIsNil { + predicates = append(predicates, eventtype.DescriptionIsNil()) + } + if i.DescriptionNotNil { + predicates = append(predicates, eventtype.DescriptionNotNil()) + } + if i.DescriptionEqualFold != nil { + predicates = append(predicates, eventtype.DescriptionEqualFold(*i.DescriptionEqualFold)) + } + if i.DescriptionContainsFold != nil { + predicates = append(predicates, eventtype.DescriptionContainsFold(*i.DescriptionContainsFold)) + } + if i.Specification != nil { + predicates = append(predicates, eventtype.SpecificationEQ(*i.Specification)) + } + if i.SpecificationNEQ != nil { + predicates = append(predicates, eventtype.SpecificationNEQ(*i.SpecificationNEQ)) + } + if len(i.SpecificationIn) > 0 { + predicates = append(predicates, eventtype.SpecificationIn(i.SpecificationIn...)) + } + if len(i.SpecificationNotIn) > 0 { + predicates = append(predicates, eventtype.SpecificationNotIn(i.SpecificationNotIn...)) + } + if i.SpecificationGT != nil { + predicates = append(predicates, eventtype.SpecificationGT(*i.SpecificationGT)) + } + if i.SpecificationGTE != nil { + predicates = append(predicates, eventtype.SpecificationGTE(*i.SpecificationGTE)) + } + if i.SpecificationLT != nil { + predicates = append(predicates, eventtype.SpecificationLT(*i.SpecificationLT)) + } + if i.SpecificationLTE != nil { + predicates = append(predicates, eventtype.SpecificationLTE(*i.SpecificationLTE)) + } + if i.SpecificationContains != nil { + predicates = append(predicates, eventtype.SpecificationContains(*i.SpecificationContains)) + } + if i.SpecificationHasPrefix != nil { + predicates = append(predicates, eventtype.SpecificationHasPrefix(*i.SpecificationHasPrefix)) + } + if i.SpecificationHasSuffix != nil { + predicates = append(predicates, eventtype.SpecificationHasSuffix(*i.SpecificationHasSuffix)) + } + if i.SpecificationIsNil { + predicates = append(predicates, eventtype.SpecificationIsNil()) + } + if i.SpecificationNotNil { + predicates = append(predicates, eventtype.SpecificationNotNil()) + } + if i.SpecificationEqualFold != nil { + predicates = append(predicates, eventtype.SpecificationEqualFold(*i.SpecificationEqualFold)) + } + if i.SpecificationContainsFold != nil { + predicates = append(predicates, eventtype.SpecificationContainsFold(*i.SpecificationContainsFold)) + } + if i.Active != nil { + predicates = append(predicates, eventtype.ActiveEQ(*i.Active)) + } + if i.ActiveNEQ != nil { + predicates = append(predicates, eventtype.ActiveNEQ(*i.ActiveNEQ)) } if i.HasOwner != nil { - p := eventsubscription.HasOwner() + p := eventtype.HasOwner() if !*i.HasOwner { - p = eventsubscription.Not(p) + p = eventtype.Not(p) } predicates = append(predicates, p) } if len(i.HasOwnerWith) > 0 { - with := make([]predicate.Application, 0, len(i.HasOwnerWith)) + with := make([]predicate.Team, 0, len(i.HasOwnerWith)) for _, w := range i.HasOwnerWith { p, err := w.P() if err != nil { @@ -4468,69 +5800,33 @@ func (i *EventSubscriptionWhereInput) P() (predicate.EventSubscription, error) { } 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...)) + predicates = append(predicates, eventtype.HasOwnerWith(with...)) } - if i.HasApprovalRequests != nil { - p := eventsubscription.HasApprovalRequests() - if !*i.HasApprovalRequests { - p = eventsubscription.Not(p) + if i.HasExposures != nil { + p := eventtype.HasExposures() + if !*i.HasExposures { + p = eventtype.Not(p) } predicates = append(predicates, p) } - if len(i.HasApprovalRequestsWith) > 0 { - with := make([]predicate.ApprovalRequest, 0, len(i.HasApprovalRequestsWith)) - for _, w := range i.HasApprovalRequestsWith { + if len(i.HasExposuresWith) > 0 { + with := make([]predicate.EventExposure, 0, len(i.HasExposuresWith)) + for _, w := range i.HasExposuresWith { p, err := w.P() if err != nil { - return nil, fmt.Errorf("%w: field 'HasApprovalRequestsWith'", err) + return nil, fmt.Errorf("%w: field 'HasExposuresWith'", err) } with = append(with, p) } - predicates = append(predicates, eventsubscription.HasApprovalRequestsWith(with...)) + predicates = append(predicates, eventtype.HasExposuresWith(with...)) } switch len(predicates) { case 0: - return nil, ErrEmptyEventSubscriptionWhereInput + return nil, ErrEmptyEventTypeWhereInput case 1: return predicates[0], nil default: - return eventsubscription.And(predicates...), nil + return eventtype.And(predicates...), nil } } @@ -5432,6 +6728,14 @@ type TeamWhereInput struct { // "applications" edge predicates. HasApplications *bool `json:"hasApplications,omitempty"` HasApplicationsWith []*ApplicationWhereInput `json:"hasApplicationsWith,omitempty"` + + // "apis" edge predicates. + HasApis *bool `json:"hasApis,omitempty"` + HasApisWith []*ApiWhereInput `json:"hasApisWith,omitempty"` + + // "event_types" edge predicates. + HasEventTypes *bool `json:"hasEventTypes,omitempty"` + HasEventTypesWith []*EventTypeWhereInput `json:"hasEventTypesWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. @@ -5914,6 +7218,42 @@ func (i *TeamWhereInput) P() (predicate.Team, error) { } predicates = append(predicates, team.HasApplicationsWith(with...)) } + if i.HasApis != nil { + p := team.HasApis() + if !*i.HasApis { + p = team.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasApisWith) > 0 { + with := make([]predicate.Api, 0, len(i.HasApisWith)) + for _, w := range i.HasApisWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasApisWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, team.HasApisWith(with...)) + } + if i.HasEventTypes != nil { + p := team.HasEventTypes() + if !*i.HasEventTypes { + p = team.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasEventTypesWith) > 0 { + with := make([]predicate.EventType, 0, len(i.HasEventTypesWith)) + for _, w := range i.HasEventTypesWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasEventTypesWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, team.HasEventTypesWith(with...)) + } switch len(predicates) { case 0: return nil, ErrEmptyTeamWhereInput diff --git a/controlplane-api/ent/hook/hook.go b/controlplane-api/ent/hook/hook.go index 885b28a60..8889a8eff 100644 --- a/controlplane-api/ent/hook/hook.go +++ b/controlplane-api/ent/hook/hook.go @@ -12,6 +12,18 @@ import ( "github.com/telekom/controlplane/controlplane-api/ent" ) +// The ApiFunc type is an adapter to allow the use of ordinary +// function as Api mutator. +type ApiFunc func(context.Context, *ent.APIMutation) (ent.Value, error) + +// Mutate calls f(ctx, m). +func (f ApiFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if mv, ok := m.(*ent.APIMutation); ok { + return f(ctx, mv) + } + return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.APIMutation", m) +} + // The ApiExposureFunc type is an adapter to allow the use of ordinary // function as ApiExposure mutator. type ApiExposureFunc func(context.Context, *ent.ApiExposureMutation) (ent.Value, error) @@ -96,6 +108,18 @@ func (f EventSubscriptionFunc) Mutate(ctx context.Context, m ent.Mutation) (ent. return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EventSubscriptionMutation", m) } +// The EventTypeFunc type is an adapter to allow the use of ordinary +// function as EventType mutator. +type EventTypeFunc func(context.Context, *ent.EventTypeMutation) (ent.Value, error) + +// Mutate calls f(ctx, m). +func (f EventTypeFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if mv, ok := m.(*ent.EventTypeMutation); ok { + return f(ctx, mv) + } + return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EventTypeMutation", 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/migrate/schema.go b/controlplane-api/ent/migrate/schema.go index 745bdd896..14e43aad5 100644 --- a/controlplane-api/ent/migrate/schema.go +++ b/controlplane-api/ent/migrate/schema.go @@ -11,6 +11,44 @@ import ( ) var ( + // ApisColumns holds the columns for the "apis" table. + ApisColumns = []*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: "namespace", Type: field.TypeString, Size: 2147483647}, + {Name: "base_path", Type: field.TypeString, Size: 2147483647}, + {Name: "version", Type: field.TypeString, Size: 2147483647}, + {Name: "category", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "oauth2_scopes", Type: field.TypeJSON, Nullable: true}, + {Name: "x_vendor", Type: field.TypeBool, Default: false}, + {Name: "specification", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "active", Type: field.TypeBool, Default: false}, + {Name: "team_apis", Type: field.TypeInt}, + } + // ApisTable holds the schema information for the "apis" table. + ApisTable = &schema.Table{ + Name: "apis", + Columns: ApisColumns, + PrimaryKey: []*schema.Column{ApisColumns[0]}, + ForeignKeys: []*schema.ForeignKey{ + { + Symbol: "apis_teams_apis", + Columns: []*schema.Column{ApisColumns[13]}, + RefColumns: []*schema.Column{TeamsColumns[0]}, + OnDelete: schema.NoAction, + }, + }, + Indexes: []*schema.Index{ + { + Name: "api_base_path_team_apis", + Unique: true, + Columns: []*schema.Column{ApisColumns[6], ApisColumns[13]}, + }, + }, + } // APIExposuresColumns holds the columns for the "api_exposures" table. APIExposuresColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, @@ -27,6 +65,7 @@ var ( {Name: "upstreams", Type: field.TypeJSON}, {Name: "approval_config", Type: field.TypeJSON}, {Name: "api_version", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "api_exposures", Type: field.TypeInt, Nullable: true}, {Name: "application_exposed_apis", Type: field.TypeInt}, } // APIExposuresTable holds the schema information for the "api_exposures" table. @@ -36,8 +75,14 @@ var ( PrimaryKey: []*schema.Column{APIExposuresColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { - Symbol: "api_exposures_applications_exposed_apis", + Symbol: "api_exposures_apis_exposures", Columns: []*schema.Column{APIExposuresColumns[14]}, + RefColumns: []*schema.Column{ApisColumns[0]}, + OnDelete: schema.SetNull, + }, + { + Symbol: "api_exposures_applications_exposed_apis", + Columns: []*schema.Column{APIExposuresColumns[15]}, RefColumns: []*schema.Column{ApplicationsColumns[0]}, OnDelete: schema.NoAction, }, @@ -46,7 +91,7 @@ var ( { Name: "apiexposure_base_path_application_exposed_apis", Unique: true, - Columns: []*schema.Column{APIExposuresColumns[7], APIExposuresColumns[14]}, + Columns: []*schema.Column{APIExposuresColumns[7], APIExposuresColumns[15]}, }, }, } @@ -255,6 +300,7 @@ var ( {Name: "active", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "approval_config", Type: field.TypeJSON}, {Name: "application_exposed_events", Type: field.TypeInt}, + {Name: "event_type_exposures", Type: field.TypeInt, Nullable: true}, } // EventExposuresTable holds the schema information for the "event_exposures" table. EventExposuresTable = &schema.Table{ @@ -268,6 +314,12 @@ var ( RefColumns: []*schema.Column{ApplicationsColumns[0]}, OnDelete: schema.NoAction, }, + { + Symbol: "event_exposures_event_types_exposures", + Columns: []*schema.Column{EventExposuresColumns[12]}, + RefColumns: []*schema.Column{EventTypesColumns[0]}, + OnDelete: schema.SetNull, + }, }, Indexes: []*schema.Index{ { @@ -325,6 +377,42 @@ var ( }, }, } + // EventTypesColumns holds the columns for the "event_types" table. + EventTypesColumns = []*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: "namespace", Type: field.TypeString, Size: 2147483647}, + {Name: "event_type", Type: field.TypeString, Size: 2147483647}, + {Name: "version", Type: field.TypeString, Size: 2147483647}, + {Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "specification", Type: field.TypeString, Nullable: true, Size: 2147483647}, + {Name: "active", Type: field.TypeBool, Default: false}, + {Name: "team_event_types", Type: field.TypeInt}, + } + // EventTypesTable holds the schema information for the "event_types" table. + EventTypesTable = &schema.Table{ + Name: "event_types", + Columns: EventTypesColumns, + PrimaryKey: []*schema.Column{EventTypesColumns[0]}, + ForeignKeys: []*schema.ForeignKey{ + { + Symbol: "event_types_teams_event_types", + Columns: []*schema.Column{EventTypesColumns[11]}, + RefColumns: []*schema.Column{TeamsColumns[0]}, + OnDelete: schema.NoAction, + }, + }, + Indexes: []*schema.Index{ + { + Name: "eventtype_event_type_team_event_types", + Unique: true, + Columns: []*schema.Column{EventTypesColumns[6], EventTypesColumns[11]}, + }, + }, + } // GroupsColumns holds the columns for the "groups" table. GroupsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, @@ -429,6 +517,7 @@ var ( } // Tables holds all the tables in the schema. Tables = []*schema.Table{ + ApisTable, APIExposuresTable, APISubscriptionsTable, ApplicationsTable, @@ -436,6 +525,7 @@ var ( ApprovalRequestsTable, EventExposuresTable, EventSubscriptionsTable, + EventTypesTable, GroupsTable, MembersTable, TeamsTable, @@ -444,7 +534,9 @@ var ( ) func init() { - APIExposuresTable.ForeignKeys[0].RefTable = ApplicationsTable + ApisTable.ForeignKeys[0].RefTable = TeamsTable + APIExposuresTable.ForeignKeys[0].RefTable = ApisTable + APIExposuresTable.ForeignKeys[1].RefTable = ApplicationsTable APISubscriptionsTable.ForeignKeys[0].RefTable = APIExposuresTable APISubscriptionsTable.ForeignKeys[1].RefTable = ApplicationsTable ApplicationsTable.ForeignKeys[0].RefTable = TeamsTable @@ -454,8 +546,10 @@ func init() { ApprovalRequestsTable.ForeignKeys[0].RefTable = APISubscriptionsTable ApprovalRequestsTable.ForeignKeys[1].RefTable = EventSubscriptionsTable EventExposuresTable.ForeignKeys[0].RefTable = ApplicationsTable + EventExposuresTable.ForeignKeys[1].RefTable = EventTypesTable EventSubscriptionsTable.ForeignKeys[0].RefTable = ApplicationsTable EventSubscriptionsTable.ForeignKeys[1].RefTable = EventExposuresTable + EventTypesTable.ForeignKeys[0].RefTable = TeamsTable 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 c6ae324a6..ba6c56b9c 100644 --- a/controlplane-api/ent/mutation.go +++ b/controlplane-api/ent/mutation.go @@ -14,6 +14,7 @@ import ( "entgo.io/ent" "entgo.io/ent/dialect/sql" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -21,6 +22,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/predicate" @@ -38,6 +40,7 @@ const ( OpUpdateOne = ent.OpUpdateOne // Node types. + TypeAPI = "Api" TypeApiExposure = "ApiExposure" TypeApiSubscription = "ApiSubscription" TypeApplication = "Application" @@ -45,55 +48,54 @@ const ( TypeApprovalRequest = "ApprovalRequest" TypeEventExposure = "EventExposure" TypeEventSubscription = "EventSubscription" + TypeEventType = "EventType" TypeGroup = "Group" TypeMember = "Member" TypeTeam = "Team" TypeZone = "Zone" ) -// ApiExposureMutation represents an operation that mutates the ApiExposure nodes in the graph. -type ApiExposureMutation struct { +// APIMutation represents an operation that mutates the Api nodes in the graph. +type APIMutation struct { config - op Op - typ string - id *int - created_at *time.Time - last_modified_at *time.Time - status_phase *apiexposure.StatusPhase - status_message *string - environment *string - namespace *string - base_path *string - visibility *apiexposure.Visibility - active *bool - features *[]string - appendfeatures []string - upstreams *[]model.Upstream - appendupstreams []model.Upstream - approval_config *model.ApprovalConfig - api_version *string - clearedFields map[string]struct{} - owner *int - clearedowner bool - subscriptions map[int]struct{} - removedsubscriptions map[int]struct{} - clearedsubscriptions bool - done bool - oldValue func(context.Context) (*ApiExposure, error) - predicates []predicate.ApiExposure + op Op + typ string + id *int + created_at *time.Time + last_modified_at *time.Time + status_phase *api.StatusPhase + status_message *string + namespace *string + base_path *string + version *string + category *string + oauth2_scopes *[]string + appendoauth2_scopes []string + x_vendor *bool + specification *string + active *bool + clearedFields map[string]struct{} + owner *int + clearedowner bool + exposures map[int]struct{} + removedexposures map[int]struct{} + clearedexposures bool + done bool + oldValue func(context.Context) (*Api, error) + predicates []predicate.Api } -var _ ent.Mutation = (*ApiExposureMutation)(nil) +var _ ent.Mutation = (*APIMutation)(nil) -// apiexposureOption allows management of the mutation configuration using functional options. -type apiexposureOption func(*ApiExposureMutation) +// apiOption allows management of the mutation configuration using functional options. +type apiOption func(*APIMutation) -// newApiExposureMutation creates new mutation for the ApiExposure entity. -func newApiExposureMutation(c config, op Op, opts ...apiexposureOption) *ApiExposureMutation { - m := &ApiExposureMutation{ +// newAPIMutation creates new mutation for the Api entity. +func newAPIMutation(c config, op Op, opts ...apiOption) *APIMutation { + m := &APIMutation{ config: c, op: op, - typ: TypeApiExposure, + typ: TypeAPI, clearedFields: make(map[string]struct{}), } for _, opt := range opts { @@ -102,20 +104,20 @@ func newApiExposureMutation(c config, op Op, opts ...apiexposureOption) *ApiExpo return m } -// withApiExposureID sets the ID field of the mutation. -func withApiExposureID(id int) apiexposureOption { - return func(m *ApiExposureMutation) { +// withApiID sets the ID field of the mutation. +func withApiID(id int) apiOption { + return func(m *APIMutation) { var ( err error once sync.Once - value *ApiExposure + value *Api ) - m.oldValue = func(ctx context.Context) (*ApiExposure, error) { + m.oldValue = func(ctx context.Context) (*Api, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { - value, err = m.Client().ApiExposure.Get(ctx, id) + value, err = m.Client().Api.Get(ctx, id) } }) return value, err @@ -124,10 +126,10 @@ func withApiExposureID(id int) apiexposureOption { } } -// withApiExposure sets the old ApiExposure of the mutation. -func withApiExposure(node *ApiExposure) apiexposureOption { - return func(m *ApiExposureMutation) { - m.oldValue = func(context.Context) (*ApiExposure, error) { +// withApi sets the old Api of the mutation. +func withApi(node *Api) apiOption { + return func(m *APIMutation) { + m.oldValue = func(context.Context) (*Api, error) { return node, nil } m.id = &node.ID @@ -136,7 +138,7 @@ func withApiExposure(node *ApiExposure) apiexposureOption { // 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 ApiExposureMutation) Client() *Client { +func (m APIMutation) Client() *Client { client := &Client{config: m.config} client.init() return client @@ -144,7 +146,7 @@ func (m ApiExposureMutation) Client() *Client { // Tx returns an `ent.Tx` for mutations that were executed in transactions; // it returns an error otherwise. -func (m ApiExposureMutation) Tx() (*Tx, error) { +func (m APIMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("ent: mutation is not running in a transaction") } @@ -155,7 +157,7 @@ func (m ApiExposureMutation) Tx() (*Tx, error) { // 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 *ApiExposureMutation) ID() (id int, exists bool) { +func (m *APIMutation) ID() (id int, exists bool) { if m.id == nil { return } @@ -166,7 +168,7 @@ func (m *ApiExposureMutation) ID() (id int, exists bool) { // 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 *ApiExposureMutation) IDs(ctx context.Context) ([]int, error) { +func (m *APIMutation) IDs(ctx context.Context) ([]int, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() @@ -175,19 +177,19 @@ func (m *ApiExposureMutation) IDs(ctx context.Context) ([]int, error) { } fallthrough case m.op.Is(OpUpdate | OpDelete): - return m.Client().ApiExposure.Query().Where(m.predicates...).IDs(ctx) + return m.Client().Api.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 *ApiExposureMutation) SetCreatedAt(t time.Time) { +func (m *APIMutation) SetCreatedAt(t time.Time) { m.created_at = &t } // CreatedAt returns the value of the "created_at" field in the mutation. -func (m *ApiExposureMutation) CreatedAt() (r time.Time, exists bool) { +func (m *APIMutation) CreatedAt() (r time.Time, exists bool) { v := m.created_at if v == nil { return @@ -195,10 +197,10 @@ func (m *ApiExposureMutation) CreatedAt() (r time.Time, exists bool) { return *v, true } -// OldCreatedAt returns the old "created_at" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldCreatedAt returns the old "created_at" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { +func (m *APIMutation) 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") } @@ -213,17 +215,17 @@ func (m *ApiExposureMutation) OldCreatedAt(ctx context.Context) (v time.Time, er } // ResetCreatedAt resets all changes to the "created_at" field. -func (m *ApiExposureMutation) ResetCreatedAt() { +func (m *APIMutation) ResetCreatedAt() { m.created_at = nil } // SetLastModifiedAt sets the "last_modified_at" field. -func (m *ApiExposureMutation) SetLastModifiedAt(t time.Time) { +func (m *APIMutation) SetLastModifiedAt(t time.Time) { m.last_modified_at = &t } // LastModifiedAt returns the value of the "last_modified_at" field in the mutation. -func (m *ApiExposureMutation) LastModifiedAt() (r time.Time, exists bool) { +func (m *APIMutation) LastModifiedAt() (r time.Time, exists bool) { v := m.last_modified_at if v == nil { return @@ -231,10 +233,10 @@ func (m *ApiExposureMutation) LastModifiedAt() (r time.Time, exists bool) { return *v, true } -// OldLastModifiedAt returns the old "last_modified_at" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldLastModifiedAt returns the old "last_modified_at" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldLastModifiedAt(ctx context.Context) (v time.Time, err error) { +func (m *APIMutation) 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") } @@ -249,17 +251,17 @@ func (m *ApiExposureMutation) OldLastModifiedAt(ctx context.Context) (v time.Tim } // ResetLastModifiedAt resets all changes to the "last_modified_at" field. -func (m *ApiExposureMutation) ResetLastModifiedAt() { +func (m *APIMutation) ResetLastModifiedAt() { m.last_modified_at = nil } // SetStatusPhase sets the "status_phase" field. -func (m *ApiExposureMutation) SetStatusPhase(ap apiexposure.StatusPhase) { +func (m *APIMutation) SetStatusPhase(ap api.StatusPhase) { m.status_phase = &ap } // StatusPhase returns the value of the "status_phase" field in the mutation. -func (m *ApiExposureMutation) StatusPhase() (r apiexposure.StatusPhase, exists bool) { +func (m *APIMutation) StatusPhase() (r api.StatusPhase, exists bool) { v := m.status_phase if v == nil { return @@ -267,10 +269,10 @@ func (m *ApiExposureMutation) StatusPhase() (r apiexposure.StatusPhase, exists b return *v, true } -// OldStatusPhase returns the old "status_phase" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldStatusPhase returns the old "status_phase" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldStatusPhase(ctx context.Context) (v *apiexposure.StatusPhase, err error) { +func (m *APIMutation) OldStatusPhase(ctx context.Context) (v *api.StatusPhase, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStatusPhase is only allowed on UpdateOne operations") } @@ -285,30 +287,30 @@ func (m *ApiExposureMutation) OldStatusPhase(ctx context.Context) (v *apiexposur } // ClearStatusPhase clears the value of the "status_phase" field. -func (m *ApiExposureMutation) ClearStatusPhase() { +func (m *APIMutation) ClearStatusPhase() { m.status_phase = nil - m.clearedFields[apiexposure.FieldStatusPhase] = struct{}{} + m.clearedFields[api.FieldStatusPhase] = struct{}{} } // StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. -func (m *ApiExposureMutation) StatusPhaseCleared() bool { - _, ok := m.clearedFields[apiexposure.FieldStatusPhase] +func (m *APIMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[api.FieldStatusPhase] return ok } // ResetStatusPhase resets all changes to the "status_phase" field. -func (m *ApiExposureMutation) ResetStatusPhase() { +func (m *APIMutation) ResetStatusPhase() { m.status_phase = nil - delete(m.clearedFields, apiexposure.FieldStatusPhase) + delete(m.clearedFields, api.FieldStatusPhase) } // SetStatusMessage sets the "status_message" field. -func (m *ApiExposureMutation) SetStatusMessage(s string) { +func (m *APIMutation) SetStatusMessage(s string) { m.status_message = &s } // StatusMessage returns the value of the "status_message" field in the mutation. -func (m *ApiExposureMutation) StatusMessage() (r string, exists bool) { +func (m *APIMutation) StatusMessage() (r string, exists bool) { v := m.status_message if v == nil { return @@ -316,10 +318,10 @@ func (m *ApiExposureMutation) StatusMessage() (r string, exists bool) { return *v, true } -// OldStatusMessage returns the old "status_message" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldStatusMessage returns the old "status_message" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { +func (m *APIMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStatusMessage is only allowed on UpdateOne operations") } @@ -334,79 +336,30 @@ func (m *ApiExposureMutation) OldStatusMessage(ctx context.Context) (v *string, } // ClearStatusMessage clears the value of the "status_message" field. -func (m *ApiExposureMutation) ClearStatusMessage() { +func (m *APIMutation) ClearStatusMessage() { m.status_message = nil - m.clearedFields[apiexposure.FieldStatusMessage] = struct{}{} + m.clearedFields[api.FieldStatusMessage] = struct{}{} } // StatusMessageCleared returns if the "status_message" field was cleared in this mutation. -func (m *ApiExposureMutation) StatusMessageCleared() bool { - _, ok := m.clearedFields[apiexposure.FieldStatusMessage] +func (m *APIMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[api.FieldStatusMessage] return ok } // ResetStatusMessage resets all changes to the "status_message" field. -func (m *ApiExposureMutation) ResetStatusMessage() { +func (m *APIMutation) ResetStatusMessage() { m.status_message = nil - delete(m.clearedFields, apiexposure.FieldStatusMessage) -} - -// SetEnvironment sets the "environment" field. -func (m *ApiExposureMutation) SetEnvironment(s string) { - m.environment = &s -} - -// Environment returns the value of the "environment" field in the mutation. -func (m *ApiExposureMutation) 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 ApiExposure entity. -// If the ApiExposure 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 *ApiExposureMutation) 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 *ApiExposureMutation) ClearEnvironment() { - m.environment = nil - m.clearedFields[apiexposure.FieldEnvironment] = struct{}{} -} - -// EnvironmentCleared returns if the "environment" field was cleared in this mutation. -func (m *ApiExposureMutation) EnvironmentCleared() bool { - _, ok := m.clearedFields[apiexposure.FieldEnvironment] - return ok -} - -// ResetEnvironment resets all changes to the "environment" field. -func (m *ApiExposureMutation) ResetEnvironment() { - m.environment = nil - delete(m.clearedFields, apiexposure.FieldEnvironment) + delete(m.clearedFields, api.FieldStatusMessage) } // SetNamespace sets the "namespace" field. -func (m *ApiExposureMutation) SetNamespace(s string) { +func (m *APIMutation) SetNamespace(s string) { m.namespace = &s } // Namespace returns the value of the "namespace" field in the mutation. -func (m *ApiExposureMutation) Namespace() (r string, exists bool) { +func (m *APIMutation) Namespace() (r string, exists bool) { v := m.namespace if v == nil { return @@ -414,10 +367,10 @@ func (m *ApiExposureMutation) Namespace() (r string, exists bool) { return *v, true } -// OldNamespace returns the old "namespace" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldNamespace returns the old "namespace" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldNamespace(ctx context.Context) (v string, err error) { +func (m *APIMutation) OldNamespace(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldNamespace is only allowed on UpdateOne operations") } @@ -432,17 +385,17 @@ func (m *ApiExposureMutation) OldNamespace(ctx context.Context) (v string, err e } // ResetNamespace resets all changes to the "namespace" field. -func (m *ApiExposureMutation) ResetNamespace() { +func (m *APIMutation) ResetNamespace() { m.namespace = nil } // SetBasePath sets the "base_path" field. -func (m *ApiExposureMutation) SetBasePath(s string) { +func (m *APIMutation) SetBasePath(s string) { m.base_path = &s } // BasePath returns the value of the "base_path" field in the mutation. -func (m *ApiExposureMutation) BasePath() (r string, exists bool) { +func (m *APIMutation) BasePath() (r string, exists bool) { v := m.base_path if v == nil { return @@ -450,10 +403,10 @@ func (m *ApiExposureMutation) BasePath() (r string, exists bool) { return *v, true } -// OldBasePath returns the old "base_path" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldBasePath returns the old "base_path" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldBasePath(ctx context.Context) (v string, err error) { +func (m *APIMutation) OldBasePath(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldBasePath is only allowed on UpdateOne operations") } @@ -468,299 +421,298 @@ func (m *ApiExposureMutation) OldBasePath(ctx context.Context) (v string, err er } // ResetBasePath resets all changes to the "base_path" field. -func (m *ApiExposureMutation) ResetBasePath() { +func (m *APIMutation) ResetBasePath() { m.base_path = nil } -// SetVisibility sets the "visibility" field. -func (m *ApiExposureMutation) SetVisibility(a apiexposure.Visibility) { - m.visibility = &a +// SetVersion sets the "version" field. +func (m *APIMutation) SetVersion(s string) { + m.version = &s } -// Visibility returns the value of the "visibility" field in the mutation. -func (m *ApiExposureMutation) Visibility() (r apiexposure.Visibility, exists bool) { - v := m.visibility +// Version returns the value of the "version" field in the mutation. +func (m *APIMutation) Version() (r string, exists bool) { + v := m.version if v == nil { return } return *v, true } -// OldVisibility returns the old "visibility" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldVersion returns the old "version" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldVisibility(ctx context.Context) (v apiexposure.Visibility, err error) { +func (m *APIMutation) OldVersion(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldVisibility is only allowed on UpdateOne operations") + return v, errors.New("OldVersion 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") + return v, errors.New("OldVersion 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 v, fmt.Errorf("querying old value for OldVersion: %w", err) } - return oldValue.Visibility, nil + return oldValue.Version, nil } -// ResetVisibility resets all changes to the "visibility" field. -func (m *ApiExposureMutation) ResetVisibility() { - m.visibility = nil +// ResetVersion resets all changes to the "version" field. +func (m *APIMutation) ResetVersion() { + m.version = nil } -// SetActive sets the "active" field. -func (m *ApiExposureMutation) SetActive(b bool) { - m.active = &b +// SetCategory sets the "category" field. +func (m *APIMutation) SetCategory(s string) { + m.category = &s } -// Active returns the value of the "active" field in the mutation. -func (m *ApiExposureMutation) Active() (r bool, exists bool) { - v := m.active +// Category returns the value of the "category" field in the mutation. +func (m *APIMutation) Category() (r string, exists bool) { + v := m.category if v == nil { return } return *v, true } -// OldActive returns the old "active" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldCategory returns the old "category" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldActive(ctx context.Context) (v *bool, err error) { +func (m *APIMutation) OldCategory(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldActive is only allowed on UpdateOne operations") + return v, errors.New("OldCategory 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") + return v, errors.New("OldCategory 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 v, fmt.Errorf("querying old value for OldCategory: %w", err) } - return oldValue.Active, nil + return oldValue.Category, nil } -// ClearActive clears the value of the "active" field. -func (m *ApiExposureMutation) ClearActive() { - m.active = nil - m.clearedFields[apiexposure.FieldActive] = struct{}{} +// ClearCategory clears the value of the "category" field. +func (m *APIMutation) ClearCategory() { + m.category = nil + m.clearedFields[api.FieldCategory] = struct{}{} } -// ActiveCleared returns if the "active" field was cleared in this mutation. -func (m *ApiExposureMutation) ActiveCleared() bool { - _, ok := m.clearedFields[apiexposure.FieldActive] +// CategoryCleared returns if the "category" field was cleared in this mutation. +func (m *APIMutation) CategoryCleared() bool { + _, ok := m.clearedFields[api.FieldCategory] return ok } -// ResetActive resets all changes to the "active" field. -func (m *ApiExposureMutation) ResetActive() { - m.active = nil - delete(m.clearedFields, apiexposure.FieldActive) +// ResetCategory resets all changes to the "category" field. +func (m *APIMutation) ResetCategory() { + m.category = nil + delete(m.clearedFields, api.FieldCategory) } -// SetFeatures sets the "features" field. -func (m *ApiExposureMutation) SetFeatures(s []string) { - m.features = &s - m.appendfeatures = nil +// SetOauth2Scopes sets the "oauth2_scopes" field. +func (m *APIMutation) SetOauth2Scopes(s []string) { + m.oauth2_scopes = &s + m.appendoauth2_scopes = nil } -// Features returns the value of the "features" field in the mutation. -func (m *ApiExposureMutation) Features() (r []string, exists bool) { - v := m.features +// Oauth2Scopes returns the value of the "oauth2_scopes" field in the mutation. +func (m *APIMutation) Oauth2Scopes() (r []string, exists bool) { + v := m.oauth2_scopes if v == nil { return } return *v, true } -// OldFeatures returns the old "features" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldOauth2Scopes returns the old "oauth2_scopes" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldFeatures(ctx context.Context) (v []string, err error) { +func (m *APIMutation) OldOauth2Scopes(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldFeatures is only allowed on UpdateOne operations") + return v, errors.New("OldOauth2Scopes is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldFeatures requires an ID field in the mutation") + return v, errors.New("OldOauth2Scopes requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldFeatures: %w", err) + return v, fmt.Errorf("querying old value for OldOauth2Scopes: %w", err) } - return oldValue.Features, nil + return oldValue.Oauth2Scopes, nil } -// AppendFeatures adds s to the "features" field. -func (m *ApiExposureMutation) AppendFeatures(s []string) { - m.appendfeatures = append(m.appendfeatures, s...) +// AppendOauth2Scopes adds s to the "oauth2_scopes" field. +func (m *APIMutation) AppendOauth2Scopes(s []string) { + m.appendoauth2_scopes = append(m.appendoauth2_scopes, s...) } -// AppendedFeatures returns the list of values that were appended to the "features" field in this mutation. -func (m *ApiExposureMutation) AppendedFeatures() ([]string, bool) { - if len(m.appendfeatures) == 0 { +// AppendedOauth2Scopes returns the list of values that were appended to the "oauth2_scopes" field in this mutation. +func (m *APIMutation) AppendedOauth2Scopes() ([]string, bool) { + if len(m.appendoauth2_scopes) == 0 { return nil, false } - return m.appendfeatures, true + return m.appendoauth2_scopes, true } -// ResetFeatures resets all changes to the "features" field. -func (m *ApiExposureMutation) ResetFeatures() { - m.features = nil - m.appendfeatures = nil +// ClearOauth2Scopes clears the value of the "oauth2_scopes" field. +func (m *APIMutation) ClearOauth2Scopes() { + m.oauth2_scopes = nil + m.appendoauth2_scopes = nil + m.clearedFields[api.FieldOauth2Scopes] = struct{}{} } -// SetUpstreams sets the "upstreams" field. -func (m *ApiExposureMutation) SetUpstreams(value []model.Upstream) { - m.upstreams = &value - m.appendupstreams = nil +// Oauth2ScopesCleared returns if the "oauth2_scopes" field was cleared in this mutation. +func (m *APIMutation) Oauth2ScopesCleared() bool { + _, ok := m.clearedFields[api.FieldOauth2Scopes] + return ok } -// Upstreams returns the value of the "upstreams" field in the mutation. -func (m *ApiExposureMutation) Upstreams() (r []model.Upstream, exists bool) { - v := m.upstreams +// ResetOauth2Scopes resets all changes to the "oauth2_scopes" field. +func (m *APIMutation) ResetOauth2Scopes() { + m.oauth2_scopes = nil + m.appendoauth2_scopes = nil + delete(m.clearedFields, api.FieldOauth2Scopes) +} + +// SetXVendor sets the "x_vendor" field. +func (m *APIMutation) SetXVendor(b bool) { + m.x_vendor = &b +} + +// XVendor returns the value of the "x_vendor" field in the mutation. +func (m *APIMutation) XVendor() (r bool, exists bool) { + v := m.x_vendor if v == nil { return } return *v, true } -// OldUpstreams returns the old "upstreams" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldXVendor returns the old "x_vendor" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldUpstreams(ctx context.Context) (v []model.Upstream, err error) { +func (m *APIMutation) OldXVendor(ctx context.Context) (v bool, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldUpstreams is only allowed on UpdateOne operations") + return v, errors.New("OldXVendor is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldUpstreams requires an ID field in the mutation") + return v, errors.New("OldXVendor requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldUpstreams: %w", err) + return v, fmt.Errorf("querying old value for OldXVendor: %w", err) } - return oldValue.Upstreams, nil + return oldValue.XVendor, nil } -// AppendUpstreams adds value to the "upstreams" field. -func (m *ApiExposureMutation) AppendUpstreams(value []model.Upstream) { - m.appendupstreams = append(m.appendupstreams, value...) +// ResetXVendor resets all changes to the "x_vendor" field. +func (m *APIMutation) ResetXVendor() { + m.x_vendor = nil } -// AppendedUpstreams returns the list of values that were appended to the "upstreams" field in this mutation. -func (m *ApiExposureMutation) AppendedUpstreams() ([]model.Upstream, bool) { - if len(m.appendupstreams) == 0 { - return nil, false - } - return m.appendupstreams, true -} - -// ResetUpstreams resets all changes to the "upstreams" field. -func (m *ApiExposureMutation) ResetUpstreams() { - m.upstreams = nil - m.appendupstreams = nil +// SetSpecification sets the "specification" field. +func (m *APIMutation) SetSpecification(s string) { + m.specification = &s } -// SetApprovalConfig sets the "approval_config" field. -func (m *ApiExposureMutation) SetApprovalConfig(mc model.ApprovalConfig) { - m.approval_config = &mc -} - -// ApprovalConfig returns the value of the "approval_config" field in the mutation. -func (m *ApiExposureMutation) ApprovalConfig() (r model.ApprovalConfig, exists bool) { - v := m.approval_config +// Specification returns the value of the "specification" field in the mutation. +func (m *APIMutation) Specification() (r string, exists bool) { + v := m.specification if v == nil { return } return *v, true } -// OldApprovalConfig returns the old "approval_config" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldSpecification returns the old "specification" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldApprovalConfig(ctx context.Context) (v model.ApprovalConfig, err error) { +func (m *APIMutation) OldSpecification(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldApprovalConfig is only allowed on UpdateOne operations") + return v, errors.New("OldSpecification 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") + return v, errors.New("OldSpecification 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 v, fmt.Errorf("querying old value for OldSpecification: %w", err) } - return oldValue.ApprovalConfig, nil + return oldValue.Specification, nil } -// ResetApprovalConfig resets all changes to the "approval_config" field. -func (m *ApiExposureMutation) ResetApprovalConfig() { - m.approval_config = nil +// ClearSpecification clears the value of the "specification" field. +func (m *APIMutation) ClearSpecification() { + m.specification = nil + m.clearedFields[api.FieldSpecification] = struct{}{} } -// SetAPIVersion sets the "api_version" field. -func (m *ApiExposureMutation) SetAPIVersion(s string) { - m.api_version = &s +// SpecificationCleared returns if the "specification" field was cleared in this mutation. +func (m *APIMutation) SpecificationCleared() bool { + _, ok := m.clearedFields[api.FieldSpecification] + return ok } -// APIVersion returns the value of the "api_version" field in the mutation. -func (m *ApiExposureMutation) APIVersion() (r string, exists bool) { - v := m.api_version +// ResetSpecification resets all changes to the "specification" field. +func (m *APIMutation) ResetSpecification() { + m.specification = nil + delete(m.clearedFields, api.FieldSpecification) +} + +// SetActive sets the "active" field. +func (m *APIMutation) SetActive(b bool) { + m.active = &b +} + +// Active returns the value of the "active" field in the mutation. +func (m *APIMutation) Active() (r bool, exists bool) { + v := m.active if v == nil { return } return *v, true } -// OldAPIVersion returns the old "api_version" field's value of the ApiExposure entity. -// If the ApiExposure object wasn't provided to the builder, the object is fetched from the database. +// OldActive returns the old "active" field's value of the Api entity. +// If the Api 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 *ApiExposureMutation) OldAPIVersion(ctx context.Context) (v *string, err error) { +func (m *APIMutation) OldActive(ctx context.Context) (v bool, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldAPIVersion is only allowed on UpdateOne operations") + return v, errors.New("OldActive is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldAPIVersion requires an ID field in the mutation") + 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 OldAPIVersion: %w", err) + return v, fmt.Errorf("querying old value for OldActive: %w", err) } - return oldValue.APIVersion, nil -} - -// ClearAPIVersion clears the value of the "api_version" field. -func (m *ApiExposureMutation) ClearAPIVersion() { - m.api_version = nil - m.clearedFields[apiexposure.FieldAPIVersion] = struct{}{} -} - -// APIVersionCleared returns if the "api_version" field was cleared in this mutation. -func (m *ApiExposureMutation) APIVersionCleared() bool { - _, ok := m.clearedFields[apiexposure.FieldAPIVersion] - return ok + return oldValue.Active, nil } -// ResetAPIVersion resets all changes to the "api_version" field. -func (m *ApiExposureMutation) ResetAPIVersion() { - m.api_version = nil - delete(m.clearedFields, apiexposure.FieldAPIVersion) +// ResetActive resets all changes to the "active" field. +func (m *APIMutation) ResetActive() { + m.active = nil } -// SetOwnerID sets the "owner" edge to the Application entity by id. -func (m *ApiExposureMutation) SetOwnerID(id int) { +// SetOwnerID sets the "owner" edge to the Team entity by id. +func (m *APIMutation) SetOwnerID(id int) { m.owner = &id } -// ClearOwner clears the "owner" edge to the Application entity. -func (m *ApiExposureMutation) ClearOwner() { +// ClearOwner clears the "owner" edge to the Team entity. +func (m *APIMutation) ClearOwner() { m.clearedowner = true } -// OwnerCleared reports if the "owner" edge to the Application entity was cleared. -func (m *ApiExposureMutation) OwnerCleared() bool { +// OwnerCleared reports if the "owner" edge to the Team entity was cleared. +func (m *APIMutation) OwnerCleared() bool { return m.clearedowner } // OwnerID returns the "owner" edge ID in the mutation. -func (m *ApiExposureMutation) OwnerID() (id int, exists bool) { +func (m *APIMutation) OwnerID() (id int, exists bool) { if m.owner != nil { return *m.owner, true } @@ -770,7 +722,7 @@ func (m *ApiExposureMutation) OwnerID() (id int, exists bool) { // 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 *ApiExposureMutation) OwnerIDs() (ids []int) { +func (m *APIMutation) OwnerIDs() (ids []int) { if id := m.owner; id != nil { ids = append(ids, *id) } @@ -778,74 +730,74 @@ func (m *ApiExposureMutation) OwnerIDs() (ids []int) { } // ResetOwner resets all changes to the "owner" edge. -func (m *ApiExposureMutation) ResetOwner() { +func (m *APIMutation) ResetOwner() { m.owner = nil m.clearedowner = false } -// AddSubscriptionIDs adds the "subscriptions" edge to the ApiSubscription entity by ids. -func (m *ApiExposureMutation) AddSubscriptionIDs(ids ...int) { - if m.subscriptions == nil { - m.subscriptions = make(map[int]struct{}) +// AddExposureIDs adds the "exposures" edge to the ApiExposure entity by ids. +func (m *APIMutation) AddExposureIDs(ids ...int) { + if m.exposures == nil { + m.exposures = make(map[int]struct{}) } for i := range ids { - m.subscriptions[ids[i]] = struct{}{} + m.exposures[ids[i]] = struct{}{} } } -// ClearSubscriptions clears the "subscriptions" edge to the ApiSubscription entity. -func (m *ApiExposureMutation) ClearSubscriptions() { - m.clearedsubscriptions = true +// ClearExposures clears the "exposures" edge to the ApiExposure entity. +func (m *APIMutation) ClearExposures() { + m.clearedexposures = true } -// SubscriptionsCleared reports if the "subscriptions" edge to the ApiSubscription entity was cleared. -func (m *ApiExposureMutation) SubscriptionsCleared() bool { - return m.clearedsubscriptions +// ExposuresCleared reports if the "exposures" edge to the ApiExposure entity was cleared. +func (m *APIMutation) ExposuresCleared() bool { + return m.clearedexposures } -// RemoveSubscriptionIDs removes the "subscriptions" edge to the ApiSubscription entity by IDs. -func (m *ApiExposureMutation) RemoveSubscriptionIDs(ids ...int) { - if m.removedsubscriptions == nil { - m.removedsubscriptions = make(map[int]struct{}) +// RemoveExposureIDs removes the "exposures" edge to the ApiExposure entity by IDs. +func (m *APIMutation) RemoveExposureIDs(ids ...int) { + if m.removedexposures == nil { + m.removedexposures = make(map[int]struct{}) } for i := range ids { - delete(m.subscriptions, ids[i]) - m.removedsubscriptions[ids[i]] = struct{}{} + delete(m.exposures, ids[i]) + m.removedexposures[ids[i]] = struct{}{} } } -// RemovedSubscriptions returns the removed IDs of the "subscriptions" edge to the ApiSubscription entity. -func (m *ApiExposureMutation) RemovedSubscriptionsIDs() (ids []int) { - for id := range m.removedsubscriptions { +// RemovedExposures returns the removed IDs of the "exposures" edge to the ApiExposure entity. +func (m *APIMutation) RemovedExposuresIDs() (ids []int) { + for id := range m.removedexposures { ids = append(ids, id) } return } -// SubscriptionsIDs returns the "subscriptions" edge IDs in the mutation. -func (m *ApiExposureMutation) SubscriptionsIDs() (ids []int) { - for id := range m.subscriptions { +// ExposuresIDs returns the "exposures" edge IDs in the mutation. +func (m *APIMutation) ExposuresIDs() (ids []int) { + for id := range m.exposures { ids = append(ids, id) } return } -// ResetSubscriptions resets all changes to the "subscriptions" edge. -func (m *ApiExposureMutation) ResetSubscriptions() { - m.subscriptions = nil - m.clearedsubscriptions = false - m.removedsubscriptions = nil +// ResetExposures resets all changes to the "exposures" edge. +func (m *APIMutation) ResetExposures() { + m.exposures = nil + m.clearedexposures = false + m.removedexposures = nil } -// Where appends a list predicates to the ApiExposureMutation builder. -func (m *ApiExposureMutation) Where(ps ...predicate.ApiExposure) { +// Where appends a list predicates to the APIMutation builder. +func (m *APIMutation) Where(ps ...predicate.Api) { m.predicates = append(m.predicates, ps...) } -// WhereP appends storage-level predicates to the ApiExposureMutation builder. Using this method, +// WhereP appends storage-level predicates to the APIMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. -func (m *ApiExposureMutation) WhereP(ps ...func(*sql.Selector)) { - p := make([]predicate.ApiExposure, len(ps)) +func (m *APIMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.Api, len(ps)) for i := range ps { p[i] = ps[i] } @@ -853,63 +805,60 @@ func (m *ApiExposureMutation) WhereP(ps ...func(*sql.Selector)) { } // Op returns the operation name. -func (m *ApiExposureMutation) Op() Op { +func (m *APIMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. -func (m *ApiExposureMutation) SetOp(op Op) { +func (m *APIMutation) SetOp(op Op) { m.op = op } -// Type returns the node type of this mutation (ApiExposure). -func (m *ApiExposureMutation) Type() string { +// Type returns the node type of this mutation (Api). +func (m *APIMutation) 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 *ApiExposureMutation) Fields() []string { - fields := make([]string, 0, 13) +func (m *APIMutation) Fields() []string { + fields := make([]string, 0, 12) if m.created_at != nil { - fields = append(fields, apiexposure.FieldCreatedAt) + fields = append(fields, api.FieldCreatedAt) } if m.last_modified_at != nil { - fields = append(fields, apiexposure.FieldLastModifiedAt) + fields = append(fields, api.FieldLastModifiedAt) } if m.status_phase != nil { - fields = append(fields, apiexposure.FieldStatusPhase) + fields = append(fields, api.FieldStatusPhase) } if m.status_message != nil { - fields = append(fields, apiexposure.FieldStatusMessage) - } - if m.environment != nil { - fields = append(fields, apiexposure.FieldEnvironment) + fields = append(fields, api.FieldStatusMessage) } if m.namespace != nil { - fields = append(fields, apiexposure.FieldNamespace) + fields = append(fields, api.FieldNamespace) } if m.base_path != nil { - fields = append(fields, apiexposure.FieldBasePath) + fields = append(fields, api.FieldBasePath) } - if m.visibility != nil { - fields = append(fields, apiexposure.FieldVisibility) + if m.version != nil { + fields = append(fields, api.FieldVersion) } - if m.active != nil { - fields = append(fields, apiexposure.FieldActive) + if m.category != nil { + fields = append(fields, api.FieldCategory) } - if m.features != nil { - fields = append(fields, apiexposure.FieldFeatures) + if m.oauth2_scopes != nil { + fields = append(fields, api.FieldOauth2Scopes) } - if m.upstreams != nil { - fields = append(fields, apiexposure.FieldUpstreams) + if m.x_vendor != nil { + fields = append(fields, api.FieldXVendor) } - if m.approval_config != nil { - fields = append(fields, apiexposure.FieldApprovalConfig) + if m.specification != nil { + fields = append(fields, api.FieldSpecification) } - if m.api_version != nil { - fields = append(fields, apiexposure.FieldAPIVersion) + if m.active != nil { + fields = append(fields, api.FieldActive) } return fields } @@ -917,34 +866,32 @@ func (m *ApiExposureMutation) Fields() []string { // 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 *ApiExposureMutation) Field(name string) (ent.Value, bool) { +func (m *APIMutation) Field(name string) (ent.Value, bool) { switch name { - case apiexposure.FieldCreatedAt: + case api.FieldCreatedAt: return m.CreatedAt() - case apiexposure.FieldLastModifiedAt: + case api.FieldLastModifiedAt: return m.LastModifiedAt() - case apiexposure.FieldStatusPhase: + case api.FieldStatusPhase: return m.StatusPhase() - case apiexposure.FieldStatusMessage: + case api.FieldStatusMessage: return m.StatusMessage() - case apiexposure.FieldEnvironment: - return m.Environment() - case apiexposure.FieldNamespace: + case api.FieldNamespace: return m.Namespace() - case apiexposure.FieldBasePath: + case api.FieldBasePath: return m.BasePath() - case apiexposure.FieldVisibility: - return m.Visibility() - case apiexposure.FieldActive: + case api.FieldVersion: + return m.Version() + case api.FieldCategory: + return m.Category() + case api.FieldOauth2Scopes: + return m.Oauth2Scopes() + case api.FieldXVendor: + return m.XVendor() + case api.FieldSpecification: + return m.Specification() + case api.FieldActive: return m.Active() - case apiexposure.FieldFeatures: - return m.Features() - case apiexposure.FieldUpstreams: - return m.Upstreams() - case apiexposure.FieldApprovalConfig: - return m.ApprovalConfig() - case apiexposure.FieldAPIVersion: - return m.APIVersion() } return nil, false } @@ -952,282 +899,270 @@ func (m *ApiExposureMutation) Field(name string) (ent.Value, bool) { // 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 *ApiExposureMutation) OldField(ctx context.Context, name string) (ent.Value, error) { +func (m *APIMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { - case apiexposure.FieldCreatedAt: + case api.FieldCreatedAt: return m.OldCreatedAt(ctx) - case apiexposure.FieldLastModifiedAt: + case api.FieldLastModifiedAt: return m.OldLastModifiedAt(ctx) - case apiexposure.FieldStatusPhase: + case api.FieldStatusPhase: return m.OldStatusPhase(ctx) - case apiexposure.FieldStatusMessage: + case api.FieldStatusMessage: return m.OldStatusMessage(ctx) - case apiexposure.FieldEnvironment: - return m.OldEnvironment(ctx) - case apiexposure.FieldNamespace: + case api.FieldNamespace: return m.OldNamespace(ctx) - case apiexposure.FieldBasePath: + case api.FieldBasePath: return m.OldBasePath(ctx) - case apiexposure.FieldVisibility: - return m.OldVisibility(ctx) - case apiexposure.FieldActive: + case api.FieldVersion: + return m.OldVersion(ctx) + case api.FieldCategory: + return m.OldCategory(ctx) + case api.FieldOauth2Scopes: + return m.OldOauth2Scopes(ctx) + case api.FieldXVendor: + return m.OldXVendor(ctx) + case api.FieldSpecification: + return m.OldSpecification(ctx) + case api.FieldActive: return m.OldActive(ctx) - case apiexposure.FieldFeatures: - return m.OldFeatures(ctx) - case apiexposure.FieldUpstreams: - return m.OldUpstreams(ctx) - case apiexposure.FieldApprovalConfig: - return m.OldApprovalConfig(ctx) - case apiexposure.FieldAPIVersion: - return m.OldAPIVersion(ctx) } - return nil, fmt.Errorf("unknown ApiExposure field %s", name) + return nil, fmt.Errorf("unknown Api 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 *ApiExposureMutation) SetField(name string, value ent.Value) error { +func (m *APIMutation) SetField(name string, value ent.Value) error { switch name { - case apiexposure.FieldCreatedAt: + case api.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 apiexposure.FieldLastModifiedAt: + case api.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 apiexposure.FieldStatusPhase: - v, ok := value.(apiexposure.StatusPhase) + case api.FieldStatusPhase: + v, ok := value.(api.StatusPhase) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetStatusPhase(v) return nil - case apiexposure.FieldStatusMessage: + case api.FieldStatusMessage: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetStatusMessage(v) return nil - case apiexposure.FieldEnvironment: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetEnvironment(v) - return nil - case apiexposure.FieldNamespace: + case api.FieldNamespace: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetNamespace(v) return nil - case apiexposure.FieldBasePath: + case api.FieldBasePath: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetBasePath(v) return nil - case apiexposure.FieldVisibility: - v, ok := value.(apiexposure.Visibility) + case api.FieldVersion: + v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetVisibility(v) + m.SetVersion(v) return nil - case apiexposure.FieldActive: - v, ok := value.(bool) + case api.FieldCategory: + v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetActive(v) + m.SetCategory(v) return nil - case apiexposure.FieldFeatures: + case api.FieldOauth2Scopes: v, ok := value.([]string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetFeatures(v) + m.SetOauth2Scopes(v) return nil - case apiexposure.FieldUpstreams: - v, ok := value.([]model.Upstream) + case api.FieldXVendor: + v, ok := value.(bool) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetUpstreams(v) + m.SetXVendor(v) return nil - case apiexposure.FieldApprovalConfig: - v, ok := value.(model.ApprovalConfig) + case api.FieldSpecification: + v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetApprovalConfig(v) + m.SetSpecification(v) return nil - case apiexposure.FieldAPIVersion: - v, ok := value.(string) + case api.FieldActive: + v, ok := value.(bool) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetAPIVersion(v) + m.SetActive(v) return nil } - return fmt.Errorf("unknown ApiExposure field %s", name) + return fmt.Errorf("unknown Api field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. -func (m *ApiExposureMutation) AddedFields() []string { +func (m *APIMutation) 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 *ApiExposureMutation) AddedField(name string) (ent.Value, bool) { +func (m *APIMutation) 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 *ApiExposureMutation) AddField(name string, value ent.Value) error { +func (m *APIMutation) AddField(name string, value ent.Value) error { switch name { } - return fmt.Errorf("unknown ApiExposure numeric field %s", name) + return fmt.Errorf("unknown Api numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. -func (m *ApiExposureMutation) ClearedFields() []string { +func (m *APIMutation) ClearedFields() []string { var fields []string - if m.FieldCleared(apiexposure.FieldStatusPhase) { - fields = append(fields, apiexposure.FieldStatusPhase) + if m.FieldCleared(api.FieldStatusPhase) { + fields = append(fields, api.FieldStatusPhase) } - if m.FieldCleared(apiexposure.FieldStatusMessage) { - fields = append(fields, apiexposure.FieldStatusMessage) + if m.FieldCleared(api.FieldStatusMessage) { + fields = append(fields, api.FieldStatusMessage) } - if m.FieldCleared(apiexposure.FieldEnvironment) { - fields = append(fields, apiexposure.FieldEnvironment) + if m.FieldCleared(api.FieldCategory) { + fields = append(fields, api.FieldCategory) } - if m.FieldCleared(apiexposure.FieldActive) { - fields = append(fields, apiexposure.FieldActive) + if m.FieldCleared(api.FieldOauth2Scopes) { + fields = append(fields, api.FieldOauth2Scopes) } - if m.FieldCleared(apiexposure.FieldAPIVersion) { - fields = append(fields, apiexposure.FieldAPIVersion) + if m.FieldCleared(api.FieldSpecification) { + fields = append(fields, api.FieldSpecification) } return fields } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. -func (m *ApiExposureMutation) FieldCleared(name string) bool { +func (m *APIMutation) 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 *ApiExposureMutation) ClearField(name string) error { +func (m *APIMutation) ClearField(name string) error { switch name { - case apiexposure.FieldStatusPhase: + case api.FieldStatusPhase: m.ClearStatusPhase() return nil - case apiexposure.FieldStatusMessage: + case api.FieldStatusMessage: m.ClearStatusMessage() return nil - case apiexposure.FieldEnvironment: - m.ClearEnvironment() + case api.FieldCategory: + m.ClearCategory() return nil - case apiexposure.FieldActive: - m.ClearActive() + case api.FieldOauth2Scopes: + m.ClearOauth2Scopes() return nil - case apiexposure.FieldAPIVersion: - m.ClearAPIVersion() + case api.FieldSpecification: + m.ClearSpecification() return nil } - return fmt.Errorf("unknown ApiExposure nullable field %s", name) + return fmt.Errorf("unknown Api 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 *ApiExposureMutation) ResetField(name string) error { +func (m *APIMutation) ResetField(name string) error { switch name { - case apiexposure.FieldCreatedAt: + case api.FieldCreatedAt: m.ResetCreatedAt() return nil - case apiexposure.FieldLastModifiedAt: + case api.FieldLastModifiedAt: m.ResetLastModifiedAt() return nil - case apiexposure.FieldStatusPhase: + case api.FieldStatusPhase: m.ResetStatusPhase() return nil - case apiexposure.FieldStatusMessage: + case api.FieldStatusMessage: m.ResetStatusMessage() return nil - case apiexposure.FieldEnvironment: - m.ResetEnvironment() - return nil - case apiexposure.FieldNamespace: + case api.FieldNamespace: m.ResetNamespace() return nil - case apiexposure.FieldBasePath: + case api.FieldBasePath: m.ResetBasePath() return nil - case apiexposure.FieldVisibility: - m.ResetVisibility() + case api.FieldVersion: + m.ResetVersion() return nil - case apiexposure.FieldActive: - m.ResetActive() + case api.FieldCategory: + m.ResetCategory() return nil - case apiexposure.FieldFeatures: - m.ResetFeatures() + case api.FieldOauth2Scopes: + m.ResetOauth2Scopes() return nil - case apiexposure.FieldUpstreams: - m.ResetUpstreams() + case api.FieldXVendor: + m.ResetXVendor() return nil - case apiexposure.FieldApprovalConfig: - m.ResetApprovalConfig() + case api.FieldSpecification: + m.ResetSpecification() return nil - case apiexposure.FieldAPIVersion: - m.ResetAPIVersion() + case api.FieldActive: + m.ResetActive() return nil } - return fmt.Errorf("unknown ApiExposure field %s", name) + return fmt.Errorf("unknown Api field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. -func (m *ApiExposureMutation) AddedEdges() []string { +func (m *APIMutation) AddedEdges() []string { edges := make([]string, 0, 2) if m.owner != nil { - edges = append(edges, apiexposure.EdgeOwner) + edges = append(edges, api.EdgeOwner) } - if m.subscriptions != nil { - edges = append(edges, apiexposure.EdgeSubscriptions) + if m.exposures != nil { + edges = append(edges, api.EdgeExposures) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. -func (m *ApiExposureMutation) AddedIDs(name string) []ent.Value { +func (m *APIMutation) AddedIDs(name string) []ent.Value { switch name { - case apiexposure.EdgeOwner: + case api.EdgeOwner: if id := m.owner; id != nil { return []ent.Value{*id} } - case apiexposure.EdgeSubscriptions: - ids := make([]ent.Value, 0, len(m.subscriptions)) - for id := range m.subscriptions { + case api.EdgeExposures: + ids := make([]ent.Value, 0, len(m.exposures)) + for id := range m.exposures { ids = append(ids, id) } return ids @@ -1236,21 +1171,21 @@ func (m *ApiExposureMutation) AddedIDs(name string) []ent.Value { } // RemovedEdges returns all edge names that were removed in this mutation. -func (m *ApiExposureMutation) RemovedEdges() []string { +func (m *APIMutation) RemovedEdges() []string { edges := make([]string, 0, 2) - if m.removedsubscriptions != nil { - edges = append(edges, apiexposure.EdgeSubscriptions) + if m.removedexposures != nil { + edges = append(edges, api.EdgeExposures) } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. -func (m *ApiExposureMutation) RemovedIDs(name string) []ent.Value { +func (m *APIMutation) RemovedIDs(name string) []ent.Value { switch name { - case apiexposure.EdgeSubscriptions: - ids := make([]ent.Value, 0, len(m.removedsubscriptions)) - for id := range m.removedsubscriptions { + case api.EdgeExposures: + ids := make([]ent.Value, 0, len(m.removedexposures)) + for id := range m.removedexposures { ids = append(ids, id) } return ids @@ -1259,100 +1194,99 @@ func (m *ApiExposureMutation) RemovedIDs(name string) []ent.Value { } // ClearedEdges returns all edge names that were cleared in this mutation. -func (m *ApiExposureMutation) ClearedEdges() []string { +func (m *APIMutation) ClearedEdges() []string { edges := make([]string, 0, 2) if m.clearedowner { - edges = append(edges, apiexposure.EdgeOwner) + edges = append(edges, api.EdgeOwner) } - if m.clearedsubscriptions { - edges = append(edges, apiexposure.EdgeSubscriptions) + if m.clearedexposures { + edges = append(edges, api.EdgeExposures) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. -func (m *ApiExposureMutation) EdgeCleared(name string) bool { +func (m *APIMutation) EdgeCleared(name string) bool { switch name { - case apiexposure.EdgeOwner: + case api.EdgeOwner: return m.clearedowner - case apiexposure.EdgeSubscriptions: - return m.clearedsubscriptions + case api.EdgeExposures: + return m.clearedexposures } 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 *ApiExposureMutation) ClearEdge(name string) error { +func (m *APIMutation) ClearEdge(name string) error { switch name { - case apiexposure.EdgeOwner: + case api.EdgeOwner: m.ClearOwner() return nil } - return fmt.Errorf("unknown ApiExposure unique edge %s", name) + return fmt.Errorf("unknown Api 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 *ApiExposureMutation) ResetEdge(name string) error { +func (m *APIMutation) ResetEdge(name string) error { switch name { - case apiexposure.EdgeOwner: + case api.EdgeOwner: m.ResetOwner() return nil - case apiexposure.EdgeSubscriptions: - m.ResetSubscriptions() + case api.EdgeExposures: + m.ResetExposures() return nil } - return fmt.Errorf("unknown ApiExposure edge %s", name) + return fmt.Errorf("unknown Api edge %s", name) } -// ApiSubscriptionMutation represents an operation that mutates the ApiSubscription nodes in the graph. -type ApiSubscriptionMutation struct { +// ApiExposureMutation represents an operation that mutates the ApiExposure nodes in the graph. +type ApiExposureMutation struct { config - op Op - typ string - id *int - created_at *time.Time - last_modified_at *time.Time - status_phase *apisubscription.StatusPhase - status_message *string - environment *string - namespace *string - name *string - base_path *string - m2m_auth_method *apisubscription.M2mAuthMethod - approved_scopes *[]string - appendapproved_scopes []string - clearedFields map[string]struct{} - owner *int - clearedowner bool - target *int - clearedtarget bool - failover_zones map[int]struct{} - removedfailover_zones map[int]struct{} - clearedfailover_zones bool - approval *int - clearedapproval bool - approval_requests map[int]struct{} - removedapproval_requests map[int]struct{} - clearedapproval_requests bool - done bool - oldValue func(context.Context) (*ApiSubscription, error) - predicates []predicate.ApiSubscription + op Op + typ string + id *int + created_at *time.Time + last_modified_at *time.Time + status_phase *apiexposure.StatusPhase + status_message *string + environment *string + namespace *string + base_path *string + visibility *apiexposure.Visibility + active *bool + features *[]string + appendfeatures []string + upstreams *[]model.Upstream + appendupstreams []model.Upstream + approval_config *model.ApprovalConfig + api_version *string + clearedFields map[string]struct{} + owner *int + clearedowner bool + api *int + clearedapi bool + subscriptions map[int]struct{} + removedsubscriptions map[int]struct{} + clearedsubscriptions bool + done bool + oldValue func(context.Context) (*ApiExposure, error) + predicates []predicate.ApiExposure } -var _ ent.Mutation = (*ApiSubscriptionMutation)(nil) +var _ ent.Mutation = (*ApiExposureMutation)(nil) -// apisubscriptionOption allows management of the mutation configuration using functional options. -type apisubscriptionOption func(*ApiSubscriptionMutation) +// apiexposureOption allows management of the mutation configuration using functional options. +type apiexposureOption func(*ApiExposureMutation) -// newApiSubscriptionMutation creates new mutation for the ApiSubscription entity. -func newApiSubscriptionMutation(c config, op Op, opts ...apisubscriptionOption) *ApiSubscriptionMutation { - m := &ApiSubscriptionMutation{ +// newApiExposureMutation creates new mutation for the ApiExposure entity. +func newApiExposureMutation(c config, op Op, opts ...apiexposureOption) *ApiExposureMutation { + m := &ApiExposureMutation{ config: c, op: op, - typ: TypeApiSubscription, + typ: TypeApiExposure, clearedFields: make(map[string]struct{}), } for _, opt := range opts { @@ -1361,20 +1295,20 @@ func newApiSubscriptionMutation(c config, op Op, opts ...apisubscriptionOption) return m } -// withApiSubscriptionID sets the ID field of the mutation. -func withApiSubscriptionID(id int) apisubscriptionOption { - return func(m *ApiSubscriptionMutation) { +// withApiExposureID sets the ID field of the mutation. +func withApiExposureID(id int) apiexposureOption { + return func(m *ApiExposureMutation) { var ( err error once sync.Once - value *ApiSubscription + value *ApiExposure ) - m.oldValue = func(ctx context.Context) (*ApiSubscription, error) { + m.oldValue = func(ctx context.Context) (*ApiExposure, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { - value, err = m.Client().ApiSubscription.Get(ctx, id) + value, err = m.Client().ApiExposure.Get(ctx, id) } }) return value, err @@ -1383,10 +1317,10 @@ func withApiSubscriptionID(id int) apisubscriptionOption { } } -// withApiSubscription sets the old ApiSubscription of the mutation. -func withApiSubscription(node *ApiSubscription) apisubscriptionOption { - return func(m *ApiSubscriptionMutation) { - m.oldValue = func(context.Context) (*ApiSubscription, error) { +// withApiExposure sets the old ApiExposure of the mutation. +func withApiExposure(node *ApiExposure) apiexposureOption { + return func(m *ApiExposureMutation) { + m.oldValue = func(context.Context) (*ApiExposure, error) { return node, nil } m.id = &node.ID @@ -1395,7 +1329,7 @@ func withApiSubscription(node *ApiSubscription) apisubscriptionOption { // 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 ApiSubscriptionMutation) Client() *Client { +func (m ApiExposureMutation) Client() *Client { client := &Client{config: m.config} client.init() return client @@ -1403,7 +1337,7 @@ func (m ApiSubscriptionMutation) Client() *Client { // Tx returns an `ent.Tx` for mutations that were executed in transactions; // it returns an error otherwise. -func (m ApiSubscriptionMutation) Tx() (*Tx, error) { +func (m ApiExposureMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("ent: mutation is not running in a transaction") } @@ -1414,7 +1348,7 @@ func (m ApiSubscriptionMutation) Tx() (*Tx, error) { // 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 *ApiSubscriptionMutation) ID() (id int, exists bool) { +func (m *ApiExposureMutation) ID() (id int, exists bool) { if m.id == nil { return } @@ -1425,7 +1359,7 @@ func (m *ApiSubscriptionMutation) ID() (id int, exists bool) { // 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 *ApiSubscriptionMutation) IDs(ctx context.Context) ([]int, error) { +func (m *ApiExposureMutation) IDs(ctx context.Context) ([]int, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() @@ -1434,19 +1368,19 @@ func (m *ApiSubscriptionMutation) IDs(ctx context.Context) ([]int, error) { } fallthrough case m.op.Is(OpUpdate | OpDelete): - return m.Client().ApiSubscription.Query().Where(m.predicates...).IDs(ctx) + return m.Client().ApiExposure.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 *ApiSubscriptionMutation) SetCreatedAt(t time.Time) { +func (m *ApiExposureMutation) SetCreatedAt(t time.Time) { m.created_at = &t } // CreatedAt returns the value of the "created_at" field in the mutation. -func (m *ApiSubscriptionMutation) CreatedAt() (r time.Time, exists bool) { +func (m *ApiExposureMutation) CreatedAt() (r time.Time, exists bool) { v := m.created_at if v == nil { return @@ -1454,10 +1388,10 @@ func (m *ApiSubscriptionMutation) CreatedAt() (r time.Time, exists bool) { return *v, true } -// OldCreatedAt returns the old "created_at" field's value of the ApiSubscription entity. -// If the ApiSubscription object wasn't provided to the builder, the object is fetched from the database. +// OldCreatedAt returns the old "created_at" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiSubscriptionMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { +func (m *ApiExposureMutation) 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") } @@ -1472,17 +1406,17 @@ func (m *ApiSubscriptionMutation) OldCreatedAt(ctx context.Context) (v time.Time } // ResetCreatedAt resets all changes to the "created_at" field. -func (m *ApiSubscriptionMutation) ResetCreatedAt() { +func (m *ApiExposureMutation) ResetCreatedAt() { m.created_at = nil } // SetLastModifiedAt sets the "last_modified_at" field. -func (m *ApiSubscriptionMutation) SetLastModifiedAt(t time.Time) { +func (m *ApiExposureMutation) SetLastModifiedAt(t time.Time) { m.last_modified_at = &t } // LastModifiedAt returns the value of the "last_modified_at" field in the mutation. -func (m *ApiSubscriptionMutation) LastModifiedAt() (r time.Time, exists bool) { +func (m *ApiExposureMutation) LastModifiedAt() (r time.Time, exists bool) { v := m.last_modified_at if v == nil { return @@ -1490,10 +1424,10 @@ func (m *ApiSubscriptionMutation) LastModifiedAt() (r time.Time, exists bool) { return *v, true } -// OldLastModifiedAt returns the old "last_modified_at" field's value of the ApiSubscription entity. -// If the ApiSubscription object wasn't provided to the builder, the object is fetched from the database. +// OldLastModifiedAt returns the old "last_modified_at" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiSubscriptionMutation) OldLastModifiedAt(ctx context.Context) (v time.Time, err error) { +func (m *ApiExposureMutation) 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") } @@ -1508,17 +1442,17 @@ func (m *ApiSubscriptionMutation) OldLastModifiedAt(ctx context.Context) (v time } // ResetLastModifiedAt resets all changes to the "last_modified_at" field. -func (m *ApiSubscriptionMutation) ResetLastModifiedAt() { +func (m *ApiExposureMutation) ResetLastModifiedAt() { m.last_modified_at = nil } // SetStatusPhase sets the "status_phase" field. -func (m *ApiSubscriptionMutation) SetStatusPhase(ap apisubscription.StatusPhase) { +func (m *ApiExposureMutation) SetStatusPhase(ap apiexposure.StatusPhase) { m.status_phase = &ap } // StatusPhase returns the value of the "status_phase" field in the mutation. -func (m *ApiSubscriptionMutation) StatusPhase() (r apisubscription.StatusPhase, exists bool) { +func (m *ApiExposureMutation) StatusPhase() (r apiexposure.StatusPhase, exists bool) { v := m.status_phase if v == nil { return @@ -1526,10 +1460,10 @@ func (m *ApiSubscriptionMutation) StatusPhase() (r apisubscription.StatusPhase, return *v, true } -// OldStatusPhase returns the old "status_phase" field's value of the ApiSubscription entity. -// If the ApiSubscription object wasn't provided to the builder, the object is fetched from the database. +// OldStatusPhase returns the old "status_phase" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiSubscriptionMutation) OldStatusPhase(ctx context.Context) (v *apisubscription.StatusPhase, err error) { +func (m *ApiExposureMutation) OldStatusPhase(ctx context.Context) (v *apiexposure.StatusPhase, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStatusPhase is only allowed on UpdateOne operations") } @@ -1544,30 +1478,30 @@ func (m *ApiSubscriptionMutation) OldStatusPhase(ctx context.Context) (v *apisub } // ClearStatusPhase clears the value of the "status_phase" field. -func (m *ApiSubscriptionMutation) ClearStatusPhase() { +func (m *ApiExposureMutation) ClearStatusPhase() { m.status_phase = nil - m.clearedFields[apisubscription.FieldStatusPhase] = struct{}{} + m.clearedFields[apiexposure.FieldStatusPhase] = struct{}{} } // StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. -func (m *ApiSubscriptionMutation) StatusPhaseCleared() bool { - _, ok := m.clearedFields[apisubscription.FieldStatusPhase] +func (m *ApiExposureMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[apiexposure.FieldStatusPhase] return ok } // ResetStatusPhase resets all changes to the "status_phase" field. -func (m *ApiSubscriptionMutation) ResetStatusPhase() { +func (m *ApiExposureMutation) ResetStatusPhase() { m.status_phase = nil - delete(m.clearedFields, apisubscription.FieldStatusPhase) + delete(m.clearedFields, apiexposure.FieldStatusPhase) } // SetStatusMessage sets the "status_message" field. -func (m *ApiSubscriptionMutation) SetStatusMessage(s string) { +func (m *ApiExposureMutation) SetStatusMessage(s string) { m.status_message = &s } // StatusMessage returns the value of the "status_message" field in the mutation. -func (m *ApiSubscriptionMutation) StatusMessage() (r string, exists bool) { +func (m *ApiExposureMutation) StatusMessage() (r string, exists bool) { v := m.status_message if v == nil { return @@ -1575,10 +1509,10 @@ func (m *ApiSubscriptionMutation) StatusMessage() (r string, exists bool) { return *v, true } -// OldStatusMessage returns the old "status_message" field's value of the ApiSubscription entity. -// If the ApiSubscription object wasn't provided to the builder, the object is fetched from the database. +// OldStatusMessage returns the old "status_message" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiSubscriptionMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { +func (m *ApiExposureMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStatusMessage is only allowed on UpdateOne operations") } @@ -1593,30 +1527,30 @@ func (m *ApiSubscriptionMutation) OldStatusMessage(ctx context.Context) (v *stri } // ClearStatusMessage clears the value of the "status_message" field. -func (m *ApiSubscriptionMutation) ClearStatusMessage() { +func (m *ApiExposureMutation) ClearStatusMessage() { m.status_message = nil - m.clearedFields[apisubscription.FieldStatusMessage] = struct{}{} + m.clearedFields[apiexposure.FieldStatusMessage] = struct{}{} } // StatusMessageCleared returns if the "status_message" field was cleared in this mutation. -func (m *ApiSubscriptionMutation) StatusMessageCleared() bool { - _, ok := m.clearedFields[apisubscription.FieldStatusMessage] +func (m *ApiExposureMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[apiexposure.FieldStatusMessage] return ok } // ResetStatusMessage resets all changes to the "status_message" field. -func (m *ApiSubscriptionMutation) ResetStatusMessage() { +func (m *ApiExposureMutation) ResetStatusMessage() { m.status_message = nil - delete(m.clearedFields, apisubscription.FieldStatusMessage) + delete(m.clearedFields, apiexposure.FieldStatusMessage) } // SetEnvironment sets the "environment" field. -func (m *ApiSubscriptionMutation) SetEnvironment(s string) { +func (m *ApiExposureMutation) SetEnvironment(s string) { m.environment = &s } // Environment returns the value of the "environment" field in the mutation. -func (m *ApiSubscriptionMutation) Environment() (r string, exists bool) { +func (m *ApiExposureMutation) Environment() (r string, exists bool) { v := m.environment if v == nil { return @@ -1624,10 +1558,10 @@ func (m *ApiSubscriptionMutation) Environment() (r string, exists bool) { return *v, true } -// OldEnvironment returns the old "environment" field's value of the ApiSubscription entity. -// If the ApiSubscription object wasn't provided to the builder, the object is fetched from the database. +// OldEnvironment returns the old "environment" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiSubscriptionMutation) OldEnvironment(ctx context.Context) (v *string, err error) { +func (m *ApiExposureMutation) OldEnvironment(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldEnvironment is only allowed on UpdateOne operations") } @@ -1642,30 +1576,30 @@ func (m *ApiSubscriptionMutation) OldEnvironment(ctx context.Context) (v *string } // ClearEnvironment clears the value of the "environment" field. -func (m *ApiSubscriptionMutation) ClearEnvironment() { +func (m *ApiExposureMutation) ClearEnvironment() { m.environment = nil - m.clearedFields[apisubscription.FieldEnvironment] = struct{}{} + m.clearedFields[apiexposure.FieldEnvironment] = struct{}{} } // EnvironmentCleared returns if the "environment" field was cleared in this mutation. -func (m *ApiSubscriptionMutation) EnvironmentCleared() bool { - _, ok := m.clearedFields[apisubscription.FieldEnvironment] +func (m *ApiExposureMutation) EnvironmentCleared() bool { + _, ok := m.clearedFields[apiexposure.FieldEnvironment] return ok } // ResetEnvironment resets all changes to the "environment" field. -func (m *ApiSubscriptionMutation) ResetEnvironment() { +func (m *ApiExposureMutation) ResetEnvironment() { m.environment = nil - delete(m.clearedFields, apisubscription.FieldEnvironment) + delete(m.clearedFields, apiexposure.FieldEnvironment) } // SetNamespace sets the "namespace" field. -func (m *ApiSubscriptionMutation) SetNamespace(s string) { +func (m *ApiExposureMutation) SetNamespace(s string) { m.namespace = &s } // Namespace returns the value of the "namespace" field in the mutation. -func (m *ApiSubscriptionMutation) Namespace() (r string, exists bool) { +func (m *ApiExposureMutation) Namespace() (r string, exists bool) { v := m.namespace if v == nil { return @@ -1673,10 +1607,10 @@ func (m *ApiSubscriptionMutation) Namespace() (r string, exists bool) { return *v, true } -// OldNamespace returns the old "namespace" field's value of the ApiSubscription entity. -// If the ApiSubscription object wasn't provided to the builder, the object is fetched from the database. +// OldNamespace returns the old "namespace" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiSubscriptionMutation) OldNamespace(ctx context.Context) (v string, err error) { +func (m *ApiExposureMutation) OldNamespace(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldNamespace is only allowed on UpdateOne operations") } @@ -1691,403 +1625,459 @@ func (m *ApiSubscriptionMutation) OldNamespace(ctx context.Context) (v string, e } // ResetNamespace resets all changes to the "namespace" field. -func (m *ApiSubscriptionMutation) ResetNamespace() { +func (m *ApiExposureMutation) ResetNamespace() { m.namespace = nil } -// SetName sets the "name" field. -func (m *ApiSubscriptionMutation) SetName(s string) { - m.name = &s +// SetBasePath sets the "base_path" field. +func (m *ApiExposureMutation) SetBasePath(s string) { + m.base_path = &s } -// Name returns the value of the "name" field in the mutation. -func (m *ApiSubscriptionMutation) Name() (r string, exists bool) { - v := m.name +// BasePath returns the value of the "base_path" field in the mutation. +func (m *ApiExposureMutation) BasePath() (r string, exists bool) { + v := m.base_path if v == nil { return } return *v, true } -// OldName returns the old "name" field's value of the ApiSubscription entity. -// If the ApiSubscription object wasn't provided to the builder, the object is fetched from the database. +// OldBasePath returns the old "base_path" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiSubscriptionMutation) OldName(ctx context.Context) (v string, err error) { +func (m *ApiExposureMutation) OldBasePath(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldName is only allowed on UpdateOne operations") + return v, errors.New("OldBasePath 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") + return v, errors.New("OldBasePath 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 v, fmt.Errorf("querying old value for OldBasePath: %w", err) } - return oldValue.Name, nil + return oldValue.BasePath, nil } -// ResetName resets all changes to the "name" field. -func (m *ApiSubscriptionMutation) ResetName() { - m.name = nil +// ResetBasePath resets all changes to the "base_path" field. +func (m *ApiExposureMutation) ResetBasePath() { + m.base_path = nil } -// SetBasePath sets the "base_path" field. -func (m *ApiSubscriptionMutation) SetBasePath(s string) { - m.base_path = &s +// SetVisibility sets the "visibility" field. +func (m *ApiExposureMutation) SetVisibility(a apiexposure.Visibility) { + m.visibility = &a } -// BasePath returns the value of the "base_path" field in the mutation. -func (m *ApiSubscriptionMutation) BasePath() (r string, exists bool) { - v := m.base_path +// Visibility returns the value of the "visibility" field in the mutation. +func (m *ApiExposureMutation) Visibility() (r apiexposure.Visibility, exists bool) { + v := m.visibility if v == nil { return } return *v, true } -// OldBasePath returns the old "base_path" field's value of the ApiSubscription entity. -// If the ApiSubscription object wasn't provided to the builder, the object is fetched from the database. +// OldVisibility returns the old "visibility" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiSubscriptionMutation) OldBasePath(ctx context.Context) (v string, err error) { +func (m *ApiExposureMutation) OldVisibility(ctx context.Context) (v apiexposure.Visibility, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldBasePath is only allowed on UpdateOne operations") + return v, errors.New("OldVisibility is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldBasePath requires an ID field in the mutation") + 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 OldBasePath: %w", err) + return v, fmt.Errorf("querying old value for OldVisibility: %w", err) } - return oldValue.BasePath, nil + return oldValue.Visibility, nil } -// ResetBasePath resets all changes to the "base_path" field. -func (m *ApiSubscriptionMutation) ResetBasePath() { - m.base_path = nil +// ResetVisibility resets all changes to the "visibility" field. +func (m *ApiExposureMutation) ResetVisibility() { + m.visibility = nil } -// SetM2mAuthMethod sets the "m2m_auth_method" field. -func (m *ApiSubscriptionMutation) SetM2mAuthMethod(aam apisubscription.M2mAuthMethod) { - m.m2m_auth_method = &aam +// SetActive sets the "active" field. +func (m *ApiExposureMutation) SetActive(b bool) { + m.active = &b } -// M2mAuthMethod returns the value of the "m2m_auth_method" field in the mutation. -func (m *ApiSubscriptionMutation) M2mAuthMethod() (r apisubscription.M2mAuthMethod, exists bool) { - v := m.m2m_auth_method +// Active returns the value of the "active" field in the mutation. +func (m *ApiExposureMutation) Active() (r bool, exists bool) { + v := m.active if v == nil { return } return *v, true } -// OldM2mAuthMethod returns the old "m2m_auth_method" field's value of the ApiSubscription entity. -// If the ApiSubscription object wasn't provided to the builder, the object is fetched from the database. +// OldActive returns the old "active" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiSubscriptionMutation) OldM2mAuthMethod(ctx context.Context) (v apisubscription.M2mAuthMethod, err error) { +func (m *ApiExposureMutation) OldActive(ctx context.Context) (v *bool, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldM2mAuthMethod is only allowed on UpdateOne operations") + return v, errors.New("OldActive is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldM2mAuthMethod requires an ID field in the mutation") + 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 OldM2mAuthMethod: %w", err) + return v, fmt.Errorf("querying old value for OldActive: %w", err) } - return oldValue.M2mAuthMethod, nil + return oldValue.Active, nil } -// ResetM2mAuthMethod resets all changes to the "m2m_auth_method" field. -func (m *ApiSubscriptionMutation) ResetM2mAuthMethod() { - m.m2m_auth_method = nil +// ClearActive clears the value of the "active" field. +func (m *ApiExposureMutation) ClearActive() { + m.active = nil + m.clearedFields[apiexposure.FieldActive] = struct{}{} } -// SetApprovedScopes sets the "approved_scopes" field. -func (m *ApiSubscriptionMutation) SetApprovedScopes(s []string) { - m.approved_scopes = &s - m.appendapproved_scopes = nil +// ActiveCleared returns if the "active" field was cleared in this mutation. +func (m *ApiExposureMutation) ActiveCleared() bool { + _, ok := m.clearedFields[apiexposure.FieldActive] + return ok } -// ApprovedScopes returns the value of the "approved_scopes" field in the mutation. -func (m *ApiSubscriptionMutation) ApprovedScopes() (r []string, exists bool) { - v := m.approved_scopes +// ResetActive resets all changes to the "active" field. +func (m *ApiExposureMutation) ResetActive() { + m.active = nil + delete(m.clearedFields, apiexposure.FieldActive) +} + +// SetFeatures sets the "features" field. +func (m *ApiExposureMutation) SetFeatures(s []string) { + m.features = &s + m.appendfeatures = nil +} + +// Features returns the value of the "features" field in the mutation. +func (m *ApiExposureMutation) Features() (r []string, exists bool) { + v := m.features if v == nil { return } return *v, true } -// OldApprovedScopes returns the old "approved_scopes" field's value of the ApiSubscription entity. -// If the ApiSubscription object wasn't provided to the builder, the object is fetched from the database. +// OldFeatures returns the old "features" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiSubscriptionMutation) OldApprovedScopes(ctx context.Context) (v []string, err error) { +func (m *ApiExposureMutation) OldFeatures(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldApprovedScopes is only allowed on UpdateOne operations") + return v, errors.New("OldFeatures is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldApprovedScopes requires an ID field in the mutation") + return v, errors.New("OldFeatures requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldApprovedScopes: %w", err) + return v, fmt.Errorf("querying old value for OldFeatures: %w", err) } - return oldValue.ApprovedScopes, nil + return oldValue.Features, nil } -// AppendApprovedScopes adds s to the "approved_scopes" field. -func (m *ApiSubscriptionMutation) AppendApprovedScopes(s []string) { - m.appendapproved_scopes = append(m.appendapproved_scopes, s...) +// AppendFeatures adds s to the "features" field. +func (m *ApiExposureMutation) AppendFeatures(s []string) { + m.appendfeatures = append(m.appendfeatures, s...) } -// AppendedApprovedScopes returns the list of values that were appended to the "approved_scopes" field in this mutation. -func (m *ApiSubscriptionMutation) AppendedApprovedScopes() ([]string, bool) { - if len(m.appendapproved_scopes) == 0 { +// AppendedFeatures returns the list of values that were appended to the "features" field in this mutation. +func (m *ApiExposureMutation) AppendedFeatures() ([]string, bool) { + if len(m.appendfeatures) == 0 { return nil, false } - return m.appendapproved_scopes, true -} - -// ResetApprovedScopes resets all changes to the "approved_scopes" field. -func (m *ApiSubscriptionMutation) ResetApprovedScopes() { - m.approved_scopes = nil - m.appendapproved_scopes = nil -} - -// SetOwnerID sets the "owner" edge to the Application entity by id. -func (m *ApiSubscriptionMutation) SetOwnerID(id int) { - m.owner = &id + return m.appendfeatures, true } -// ClearOwner clears the "owner" edge to the Application entity. -func (m *ApiSubscriptionMutation) ClearOwner() { - m.clearedowner = true +// ResetFeatures resets all changes to the "features" field. +func (m *ApiExposureMutation) ResetFeatures() { + m.features = nil + m.appendfeatures = nil } -// OwnerCleared reports if the "owner" edge to the Application entity was cleared. -func (m *ApiSubscriptionMutation) OwnerCleared() bool { - return m.clearedowner +// SetUpstreams sets the "upstreams" field. +func (m *ApiExposureMutation) SetUpstreams(value []model.Upstream) { + m.upstreams = &value + m.appendupstreams = nil } -// OwnerID returns the "owner" edge ID in the mutation. -func (m *ApiSubscriptionMutation) OwnerID() (id int, exists bool) { - if m.owner != nil { - return *m.owner, true +// Upstreams returns the value of the "upstreams" field in the mutation. +func (m *ApiExposureMutation) Upstreams() (r []model.Upstream, exists bool) { + v := m.upstreams + if v == nil { + return } - return + return *v, true } -// 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 *ApiSubscriptionMutation) OwnerIDs() (ids []int) { - if id := m.owner; id != nil { - ids = append(ids, *id) +// OldUpstreams returns the old "upstreams" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiExposureMutation) OldUpstreams(ctx context.Context) (v []model.Upstream, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldUpstreams is only allowed on UpdateOne operations") } - return + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldUpstreams requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldUpstreams: %w", err) + } + return oldValue.Upstreams, nil } -// ResetOwner resets all changes to the "owner" edge. -func (m *ApiSubscriptionMutation) ResetOwner() { - m.owner = nil - m.clearedowner = false +// AppendUpstreams adds value to the "upstreams" field. +func (m *ApiExposureMutation) AppendUpstreams(value []model.Upstream) { + m.appendupstreams = append(m.appendupstreams, value...) } -// SetTargetID sets the "target" edge to the ApiExposure entity by id. -func (m *ApiSubscriptionMutation) SetTargetID(id int) { - m.target = &id +// AppendedUpstreams returns the list of values that were appended to the "upstreams" field in this mutation. +func (m *ApiExposureMutation) AppendedUpstreams() ([]model.Upstream, bool) { + if len(m.appendupstreams) == 0 { + return nil, false + } + return m.appendupstreams, true } -// ClearTarget clears the "target" edge to the ApiExposure entity. -func (m *ApiSubscriptionMutation) ClearTarget() { - m.clearedtarget = true +// ResetUpstreams resets all changes to the "upstreams" field. +func (m *ApiExposureMutation) ResetUpstreams() { + m.upstreams = nil + m.appendupstreams = nil } -// TargetCleared reports if the "target" edge to the ApiExposure entity was cleared. -func (m *ApiSubscriptionMutation) TargetCleared() bool { - return m.clearedtarget +// SetApprovalConfig sets the "approval_config" field. +func (m *ApiExposureMutation) SetApprovalConfig(mc model.ApprovalConfig) { + m.approval_config = &mc } -// TargetID returns the "target" edge ID in the mutation. -func (m *ApiSubscriptionMutation) TargetID() (id int, exists bool) { - if m.target != nil { - return *m.target, true +// ApprovalConfig returns the value of the "approval_config" field in the mutation. +func (m *ApiExposureMutation) ApprovalConfig() (r model.ApprovalConfig, exists bool) { + v := m.approval_config + if v == nil { + return } - return + return *v, true } -// 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 *ApiSubscriptionMutation) TargetIDs() (ids []int) { - if id := m.target; id != nil { - ids = append(ids, *id) +// OldApprovalConfig returns the old "approval_config" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiExposureMutation) 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") } - return + 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 } -// ResetTarget resets all changes to the "target" edge. -func (m *ApiSubscriptionMutation) ResetTarget() { - m.target = nil - m.clearedtarget = false +// ResetApprovalConfig resets all changes to the "approval_config" field. +func (m *ApiExposureMutation) ResetApprovalConfig() { + m.approval_config = nil } -// AddFailoverZoneIDs adds the "failover_zones" edge to the Zone entity by ids. -func (m *ApiSubscriptionMutation) AddFailoverZoneIDs(ids ...int) { - if m.failover_zones == nil { - m.failover_zones = make(map[int]struct{}) +// SetAPIVersion sets the "api_version" field. +func (m *ApiExposureMutation) SetAPIVersion(s string) { + m.api_version = &s +} + +// APIVersion returns the value of the "api_version" field in the mutation. +func (m *ApiExposureMutation) APIVersion() (r string, exists bool) { + v := m.api_version + if v == nil { + return } - for i := range ids { - m.failover_zones[ids[i]] = struct{}{} + return *v, true +} + +// OldAPIVersion returns the old "api_version" field's value of the ApiExposure entity. +// If the ApiExposure 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 *ApiExposureMutation) OldAPIVersion(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldAPIVersion is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldAPIVersion requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldAPIVersion: %w", err) } + return oldValue.APIVersion, nil } -// ClearFailoverZones clears the "failover_zones" edge to the Zone entity. -func (m *ApiSubscriptionMutation) ClearFailoverZones() { - m.clearedfailover_zones = true +// ClearAPIVersion clears the value of the "api_version" field. +func (m *ApiExposureMutation) ClearAPIVersion() { + m.api_version = nil + m.clearedFields[apiexposure.FieldAPIVersion] = struct{}{} } -// FailoverZonesCleared reports if the "failover_zones" edge to the Zone entity was cleared. -func (m *ApiSubscriptionMutation) FailoverZonesCleared() bool { - return m.clearedfailover_zones +// APIVersionCleared returns if the "api_version" field was cleared in this mutation. +func (m *ApiExposureMutation) APIVersionCleared() bool { + _, ok := m.clearedFields[apiexposure.FieldAPIVersion] + return ok } -// RemoveFailoverZoneIDs removes the "failover_zones" edge to the Zone entity by IDs. -func (m *ApiSubscriptionMutation) RemoveFailoverZoneIDs(ids ...int) { - if m.removedfailover_zones == nil { - m.removedfailover_zones = make(map[int]struct{}) - } - for i := range ids { - delete(m.failover_zones, ids[i]) - m.removedfailover_zones[ids[i]] = struct{}{} - } +// ResetAPIVersion resets all changes to the "api_version" field. +func (m *ApiExposureMutation) ResetAPIVersion() { + m.api_version = nil + delete(m.clearedFields, apiexposure.FieldAPIVersion) } -// RemovedFailoverZones returns the removed IDs of the "failover_zones" edge to the Zone entity. -func (m *ApiSubscriptionMutation) RemovedFailoverZonesIDs() (ids []int) { - for id := range m.removedfailover_zones { - ids = append(ids, id) +// SetOwnerID sets the "owner" edge to the Application entity by id. +func (m *ApiExposureMutation) SetOwnerID(id int) { + m.owner = &id +} + +// ClearOwner clears the "owner" edge to the Application entity. +func (m *ApiExposureMutation) ClearOwner() { + m.clearedowner = true +} + +// OwnerCleared reports if the "owner" edge to the Application entity was cleared. +func (m *ApiExposureMutation) OwnerCleared() bool { + return m.clearedowner +} + +// OwnerID returns the "owner" edge ID in the mutation. +func (m *ApiExposureMutation) OwnerID() (id int, exists bool) { + if m.owner != nil { + return *m.owner, true } return } -// FailoverZonesIDs returns the "failover_zones" edge IDs in the mutation. -func (m *ApiSubscriptionMutation) FailoverZonesIDs() (ids []int) { - for id := range m.failover_zones { - ids = append(ids, id) +// 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 *ApiExposureMutation) OwnerIDs() (ids []int) { + if id := m.owner; id != nil { + ids = append(ids, *id) } return } -// ResetFailoverZones resets all changes to the "failover_zones" edge. -func (m *ApiSubscriptionMutation) ResetFailoverZones() { - m.failover_zones = nil - m.clearedfailover_zones = false - m.removedfailover_zones = nil +// ResetOwner resets all changes to the "owner" edge. +func (m *ApiExposureMutation) ResetOwner() { + m.owner = nil + m.clearedowner = false } -// SetApprovalID sets the "approval" edge to the Approval entity by id. -func (m *ApiSubscriptionMutation) SetApprovalID(id int) { - m.approval = &id +// SetAPIID sets the "api" edge to the Api entity by id. +func (m *ApiExposureMutation) SetAPIID(id int) { + m.api = &id } -// ClearApproval clears the "approval" edge to the Approval entity. -func (m *ApiSubscriptionMutation) ClearApproval() { - m.clearedapproval = true +// ClearAPI clears the "api" edge to the Api entity. +func (m *ApiExposureMutation) ClearAPI() { + m.clearedapi = true } -// ApprovalCleared reports if the "approval" edge to the Approval entity was cleared. -func (m *ApiSubscriptionMutation) ApprovalCleared() bool { - return m.clearedapproval +// APICleared reports if the "api" edge to the Api entity was cleared. +func (m *ApiExposureMutation) APICleared() bool { + return m.clearedapi } -// ApprovalID returns the "approval" edge ID in the mutation. -func (m *ApiSubscriptionMutation) ApprovalID() (id int, exists bool) { - if m.approval != nil { - return *m.approval, true +// APIID returns the "api" edge ID in the mutation. +func (m *ApiExposureMutation) APIID() (id int, exists bool) { + if m.api != nil { + return *m.api, true } return } -// ApprovalIDs returns the "approval" edge IDs in the mutation. +// APIIDs returns the "api" 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 *ApiSubscriptionMutation) ApprovalIDs() (ids []int) { - if id := m.approval; id != nil { +// APIID instead. It exists only for internal usage by the builders. +func (m *ApiExposureMutation) APIIDs() (ids []int) { + if id := m.api; id != nil { ids = append(ids, *id) } return } -// ResetApproval resets all changes to the "approval" edge. -func (m *ApiSubscriptionMutation) ResetApproval() { - m.approval = nil - m.clearedapproval = false +// ResetAPI resets all changes to the "api" edge. +func (m *ApiExposureMutation) ResetAPI() { + m.api = nil + m.clearedapi = false } -// AddApprovalRequestIDs adds the "approval_requests" edge to the ApprovalRequest entity by ids. -func (m *ApiSubscriptionMutation) AddApprovalRequestIDs(ids ...int) { - if m.approval_requests == nil { - m.approval_requests = make(map[int]struct{}) +// AddSubscriptionIDs adds the "subscriptions" edge to the ApiSubscription entity by ids. +func (m *ApiExposureMutation) AddSubscriptionIDs(ids ...int) { + if m.subscriptions == nil { + m.subscriptions = make(map[int]struct{}) } for i := range ids { - m.approval_requests[ids[i]] = struct{}{} + m.subscriptions[ids[i]] = struct{}{} } } -// ClearApprovalRequests clears the "approval_requests" edge to the ApprovalRequest entity. -func (m *ApiSubscriptionMutation) ClearApprovalRequests() { - m.clearedapproval_requests = true +// ClearSubscriptions clears the "subscriptions" edge to the ApiSubscription entity. +func (m *ApiExposureMutation) ClearSubscriptions() { + m.clearedsubscriptions = true } -// ApprovalRequestsCleared reports if the "approval_requests" edge to the ApprovalRequest entity was cleared. -func (m *ApiSubscriptionMutation) ApprovalRequestsCleared() bool { - return m.clearedapproval_requests +// SubscriptionsCleared reports if the "subscriptions" edge to the ApiSubscription entity was cleared. +func (m *ApiExposureMutation) SubscriptionsCleared() bool { + return m.clearedsubscriptions } -// RemoveApprovalRequestIDs removes the "approval_requests" edge to the ApprovalRequest entity by IDs. -func (m *ApiSubscriptionMutation) RemoveApprovalRequestIDs(ids ...int) { - if m.removedapproval_requests == nil { - m.removedapproval_requests = make(map[int]struct{}) +// RemoveSubscriptionIDs removes the "subscriptions" edge to the ApiSubscription entity by IDs. +func (m *ApiExposureMutation) RemoveSubscriptionIDs(ids ...int) { + if m.removedsubscriptions == nil { + m.removedsubscriptions = make(map[int]struct{}) } for i := range ids { - delete(m.approval_requests, ids[i]) - m.removedapproval_requests[ids[i]] = struct{}{} + delete(m.subscriptions, ids[i]) + m.removedsubscriptions[ids[i]] = struct{}{} } } -// RemovedApprovalRequests returns the removed IDs of the "approval_requests" edge to the ApprovalRequest entity. -func (m *ApiSubscriptionMutation) RemovedApprovalRequestsIDs() (ids []int) { - for id := range m.removedapproval_requests { +// RemovedSubscriptions returns the removed IDs of the "subscriptions" edge to the ApiSubscription entity. +func (m *ApiExposureMutation) RemovedSubscriptionsIDs() (ids []int) { + for id := range m.removedsubscriptions { ids = append(ids, id) } return } -// ApprovalRequestsIDs returns the "approval_requests" edge IDs in the mutation. -func (m *ApiSubscriptionMutation) ApprovalRequestsIDs() (ids []int) { - for id := range m.approval_requests { +// SubscriptionsIDs returns the "subscriptions" edge IDs in the mutation. +func (m *ApiExposureMutation) SubscriptionsIDs() (ids []int) { + for id := range m.subscriptions { ids = append(ids, id) } return } -// ResetApprovalRequests resets all changes to the "approval_requests" edge. -func (m *ApiSubscriptionMutation) ResetApprovalRequests() { - m.approval_requests = nil - m.clearedapproval_requests = false - m.removedapproval_requests = nil +// ResetSubscriptions resets all changes to the "subscriptions" edge. +func (m *ApiExposureMutation) ResetSubscriptions() { + m.subscriptions = nil + m.clearedsubscriptions = false + m.removedsubscriptions = nil } -// Where appends a list predicates to the ApiSubscriptionMutation builder. -func (m *ApiSubscriptionMutation) Where(ps ...predicate.ApiSubscription) { +// Where appends a list predicates to the ApiExposureMutation builder. +func (m *ApiExposureMutation) Where(ps ...predicate.ApiExposure) { m.predicates = append(m.predicates, ps...) } -// WhereP appends storage-level predicates to the ApiSubscriptionMutation builder. Using this method, +// WhereP appends storage-level predicates to the ApiExposureMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. -func (m *ApiSubscriptionMutation) WhereP(ps ...func(*sql.Selector)) { - p := make([]predicate.ApiSubscription, len(ps)) +func (m *ApiExposureMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.ApiExposure, len(ps)) for i := range ps { p[i] = ps[i] } @@ -2095,83 +2085,98 @@ func (m *ApiSubscriptionMutation) WhereP(ps ...func(*sql.Selector)) { } // Op returns the operation name. -func (m *ApiSubscriptionMutation) Op() Op { +func (m *ApiExposureMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. -func (m *ApiSubscriptionMutation) SetOp(op Op) { +func (m *ApiExposureMutation) SetOp(op Op) { m.op = op } -// Type returns the node type of this mutation (ApiSubscription). -func (m *ApiSubscriptionMutation) Type() string { +// Type returns the node type of this mutation (ApiExposure). +func (m *ApiExposureMutation) 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 *ApiSubscriptionMutation) Fields() []string { - fields := make([]string, 0, 10) +func (m *ApiExposureMutation) Fields() []string { + fields := make([]string, 0, 13) if m.created_at != nil { - fields = append(fields, apisubscription.FieldCreatedAt) + fields = append(fields, apiexposure.FieldCreatedAt) } if m.last_modified_at != nil { - fields = append(fields, apisubscription.FieldLastModifiedAt) + fields = append(fields, apiexposure.FieldLastModifiedAt) } if m.status_phase != nil { - fields = append(fields, apisubscription.FieldStatusPhase) + fields = append(fields, apiexposure.FieldStatusPhase) } if m.status_message != nil { - fields = append(fields, apisubscription.FieldStatusMessage) + fields = append(fields, apiexposure.FieldStatusMessage) } if m.environment != nil { - fields = append(fields, apisubscription.FieldEnvironment) + fields = append(fields, apiexposure.FieldEnvironment) } if m.namespace != nil { - fields = append(fields, apisubscription.FieldNamespace) - } - if m.name != nil { - fields = append(fields, apisubscription.FieldName) + fields = append(fields, apiexposure.FieldNamespace) } if m.base_path != nil { - fields = append(fields, apisubscription.FieldBasePath) + fields = append(fields, apiexposure.FieldBasePath) } - if m.m2m_auth_method != nil { - fields = append(fields, apisubscription.FieldM2mAuthMethod) + if m.visibility != nil { + fields = append(fields, apiexposure.FieldVisibility) } - if m.approved_scopes != nil { - fields = append(fields, apisubscription.FieldApprovedScopes) + if m.active != nil { + fields = append(fields, apiexposure.FieldActive) } - 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 *ApiSubscriptionMutation) Field(name string) (ent.Value, bool) { - switch name { - case apisubscription.FieldCreatedAt: + if m.features != nil { + fields = append(fields, apiexposure.FieldFeatures) + } + if m.upstreams != nil { + fields = append(fields, apiexposure.FieldUpstreams) + } + if m.approval_config != nil { + fields = append(fields, apiexposure.FieldApprovalConfig) + } + if m.api_version != nil { + fields = append(fields, apiexposure.FieldAPIVersion) + } + 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 *ApiExposureMutation) Field(name string) (ent.Value, bool) { + switch name { + case apiexposure.FieldCreatedAt: return m.CreatedAt() - case apisubscription.FieldLastModifiedAt: + case apiexposure.FieldLastModifiedAt: return m.LastModifiedAt() - case apisubscription.FieldStatusPhase: + case apiexposure.FieldStatusPhase: return m.StatusPhase() - case apisubscription.FieldStatusMessage: + case apiexposure.FieldStatusMessage: return m.StatusMessage() - case apisubscription.FieldEnvironment: + case apiexposure.FieldEnvironment: return m.Environment() - case apisubscription.FieldNamespace: + case apiexposure.FieldNamespace: return m.Namespace() - case apisubscription.FieldName: - return m.Name() - case apisubscription.FieldBasePath: + case apiexposure.FieldBasePath: return m.BasePath() - case apisubscription.FieldM2mAuthMethod: - return m.M2mAuthMethod() - case apisubscription.FieldApprovedScopes: - return m.ApprovedScopes() + case apiexposure.FieldVisibility: + return m.Visibility() + case apiexposure.FieldActive: + return m.Active() + case apiexposure.FieldFeatures: + return m.Features() + case apiexposure.FieldUpstreams: + return m.Upstreams() + case apiexposure.FieldApprovalConfig: + return m.ApprovalConfig() + case apiexposure.FieldAPIVersion: + return m.APIVersion() } return nil, false } @@ -2179,257 +2184,289 @@ func (m *ApiSubscriptionMutation) Field(name string) (ent.Value, bool) { // 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 *ApiSubscriptionMutation) OldField(ctx context.Context, name string) (ent.Value, error) { +func (m *ApiExposureMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { - case apisubscription.FieldCreatedAt: + case apiexposure.FieldCreatedAt: return m.OldCreatedAt(ctx) - case apisubscription.FieldLastModifiedAt: + case apiexposure.FieldLastModifiedAt: return m.OldLastModifiedAt(ctx) - case apisubscription.FieldStatusPhase: + case apiexposure.FieldStatusPhase: return m.OldStatusPhase(ctx) - case apisubscription.FieldStatusMessage: + case apiexposure.FieldStatusMessage: return m.OldStatusMessage(ctx) - case apisubscription.FieldEnvironment: + case apiexposure.FieldEnvironment: return m.OldEnvironment(ctx) - case apisubscription.FieldNamespace: + case apiexposure.FieldNamespace: return m.OldNamespace(ctx) - case apisubscription.FieldName: - return m.OldName(ctx) - case apisubscription.FieldBasePath: + case apiexposure.FieldBasePath: return m.OldBasePath(ctx) - case apisubscription.FieldM2mAuthMethod: - return m.OldM2mAuthMethod(ctx) - case apisubscription.FieldApprovedScopes: - return m.OldApprovedScopes(ctx) + case apiexposure.FieldVisibility: + return m.OldVisibility(ctx) + case apiexposure.FieldActive: + return m.OldActive(ctx) + case apiexposure.FieldFeatures: + return m.OldFeatures(ctx) + case apiexposure.FieldUpstreams: + return m.OldUpstreams(ctx) + case apiexposure.FieldApprovalConfig: + return m.OldApprovalConfig(ctx) + case apiexposure.FieldAPIVersion: + return m.OldAPIVersion(ctx) } - return nil, fmt.Errorf("unknown ApiSubscription field %s", name) + return nil, fmt.Errorf("unknown ApiExposure 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 *ApiSubscriptionMutation) SetField(name string, value ent.Value) error { +func (m *ApiExposureMutation) SetField(name string, value ent.Value) error { switch name { - case apisubscription.FieldCreatedAt: + case apiexposure.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 apisubscription.FieldLastModifiedAt: + case apiexposure.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 apisubscription.FieldStatusPhase: - v, ok := value.(apisubscription.StatusPhase) + case apiexposure.FieldStatusPhase: + v, ok := value.(apiexposure.StatusPhase) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetStatusPhase(v) return nil - case apisubscription.FieldStatusMessage: + case apiexposure.FieldStatusMessage: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetStatusMessage(v) return nil - case apisubscription.FieldEnvironment: + case apiexposure.FieldEnvironment: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetEnvironment(v) return nil - case apisubscription.FieldNamespace: + case apiexposure.FieldNamespace: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetNamespace(v) return nil - case apisubscription.FieldName: + case apiexposure.FieldBasePath: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetName(v) + m.SetBasePath(v) return nil - case apisubscription.FieldBasePath: - v, ok := value.(string) + case apiexposure.FieldVisibility: + v, ok := value.(apiexposure.Visibility) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetBasePath(v) + m.SetVisibility(v) return nil - case apisubscription.FieldM2mAuthMethod: - v, ok := value.(apisubscription.M2mAuthMethod) + case apiexposure.FieldActive: + v, ok := value.(bool) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetM2mAuthMethod(v) + m.SetActive(v) return nil - case apisubscription.FieldApprovedScopes: + case apiexposure.FieldFeatures: v, ok := value.([]string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetApprovedScopes(v) + m.SetFeatures(v) + return nil + case apiexposure.FieldUpstreams: + v, ok := value.([]model.Upstream) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetUpstreams(v) + return nil + case apiexposure.FieldApprovalConfig: + v, ok := value.(model.ApprovalConfig) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetApprovalConfig(v) + return nil + case apiexposure.FieldAPIVersion: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetAPIVersion(v) return nil } - return fmt.Errorf("unknown ApiSubscription field %s", name) + return fmt.Errorf("unknown ApiExposure field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. -func (m *ApiSubscriptionMutation) AddedFields() []string { +func (m *ApiExposureMutation) 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 *ApiSubscriptionMutation) AddedField(name string) (ent.Value, bool) { +func (m *ApiExposureMutation) 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 *ApiSubscriptionMutation) AddField(name string, value ent.Value) error { +func (m *ApiExposureMutation) AddField(name string, value ent.Value) error { switch name { } - return fmt.Errorf("unknown ApiSubscription numeric field %s", name) + return fmt.Errorf("unknown ApiExposure numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. -func (m *ApiSubscriptionMutation) ClearedFields() []string { +func (m *ApiExposureMutation) ClearedFields() []string { var fields []string - if m.FieldCleared(apisubscription.FieldStatusPhase) { - fields = append(fields, apisubscription.FieldStatusPhase) + if m.FieldCleared(apiexposure.FieldStatusPhase) { + fields = append(fields, apiexposure.FieldStatusPhase) } - if m.FieldCleared(apisubscription.FieldStatusMessage) { - fields = append(fields, apisubscription.FieldStatusMessage) + if m.FieldCleared(apiexposure.FieldStatusMessage) { + fields = append(fields, apiexposure.FieldStatusMessage) } - if m.FieldCleared(apisubscription.FieldEnvironment) { - fields = append(fields, apisubscription.FieldEnvironment) + if m.FieldCleared(apiexposure.FieldEnvironment) { + fields = append(fields, apiexposure.FieldEnvironment) + } + if m.FieldCleared(apiexposure.FieldActive) { + fields = append(fields, apiexposure.FieldActive) + } + if m.FieldCleared(apiexposure.FieldAPIVersion) { + fields = append(fields, apiexposure.FieldAPIVersion) } return fields } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. -func (m *ApiSubscriptionMutation) FieldCleared(name string) bool { +func (m *ApiExposureMutation) 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 *ApiSubscriptionMutation) ClearField(name string) error { +func (m *ApiExposureMutation) ClearField(name string) error { switch name { - case apisubscription.FieldStatusPhase: + case apiexposure.FieldStatusPhase: m.ClearStatusPhase() return nil - case apisubscription.FieldStatusMessage: + case apiexposure.FieldStatusMessage: m.ClearStatusMessage() return nil - case apisubscription.FieldEnvironment: + case apiexposure.FieldEnvironment: m.ClearEnvironment() return nil + case apiexposure.FieldActive: + m.ClearActive() + return nil + case apiexposure.FieldAPIVersion: + m.ClearAPIVersion() + return nil } - return fmt.Errorf("unknown ApiSubscription nullable field %s", name) + return fmt.Errorf("unknown ApiExposure 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 *ApiSubscriptionMutation) ResetField(name string) error { +func (m *ApiExposureMutation) ResetField(name string) error { switch name { - case apisubscription.FieldCreatedAt: + case apiexposure.FieldCreatedAt: m.ResetCreatedAt() return nil - case apisubscription.FieldLastModifiedAt: + case apiexposure.FieldLastModifiedAt: m.ResetLastModifiedAt() return nil - case apisubscription.FieldStatusPhase: + case apiexposure.FieldStatusPhase: m.ResetStatusPhase() return nil - case apisubscription.FieldStatusMessage: + case apiexposure.FieldStatusMessage: m.ResetStatusMessage() return nil - case apisubscription.FieldEnvironment: + case apiexposure.FieldEnvironment: m.ResetEnvironment() return nil - case apisubscription.FieldNamespace: + case apiexposure.FieldNamespace: m.ResetNamespace() return nil - case apisubscription.FieldName: - m.ResetName() - return nil - case apisubscription.FieldBasePath: + case apiexposure.FieldBasePath: m.ResetBasePath() return nil - case apisubscription.FieldM2mAuthMethod: - m.ResetM2mAuthMethod() + case apiexposure.FieldVisibility: + m.ResetVisibility() return nil - case apisubscription.FieldApprovedScopes: - m.ResetApprovedScopes() + case apiexposure.FieldActive: + m.ResetActive() + return nil + case apiexposure.FieldFeatures: + m.ResetFeatures() + return nil + case apiexposure.FieldUpstreams: + m.ResetUpstreams() + return nil + case apiexposure.FieldApprovalConfig: + m.ResetApprovalConfig() + return nil + case apiexposure.FieldAPIVersion: + m.ResetAPIVersion() return nil } - return fmt.Errorf("unknown ApiSubscription field %s", name) + return fmt.Errorf("unknown ApiExposure field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. -func (m *ApiSubscriptionMutation) AddedEdges() []string { - edges := make([]string, 0, 5) +func (m *ApiExposureMutation) AddedEdges() []string { + edges := make([]string, 0, 3) if m.owner != nil { - edges = append(edges, apisubscription.EdgeOwner) - } - if m.target != nil { - edges = append(edges, apisubscription.EdgeTarget) - } - if m.failover_zones != nil { - edges = append(edges, apisubscription.EdgeFailoverZones) + edges = append(edges, apiexposure.EdgeOwner) } - if m.approval != nil { - edges = append(edges, apisubscription.EdgeApproval) + if m.api != nil { + edges = append(edges, apiexposure.EdgeAPI) } - if m.approval_requests != nil { - edges = append(edges, apisubscription.EdgeApprovalRequests) + if m.subscriptions != nil { + edges = append(edges, apiexposure.EdgeSubscriptions) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. -func (m *ApiSubscriptionMutation) AddedIDs(name string) []ent.Value { +func (m *ApiExposureMutation) AddedIDs(name string) []ent.Value { switch name { - case apisubscription.EdgeOwner: + case apiexposure.EdgeOwner: if id := m.owner; id != nil { return []ent.Value{*id} } - case apisubscription.EdgeTarget: - if id := m.target; id != nil { - return []ent.Value{*id} - } - case apisubscription.EdgeFailoverZones: - ids := make([]ent.Value, 0, len(m.failover_zones)) - for id := range m.failover_zones { - ids = append(ids, id) - } - return ids - case apisubscription.EdgeApproval: - if id := m.approval; id != nil { + case apiexposure.EdgeAPI: + if id := m.api; id != nil { return []ent.Value{*id} } - case apisubscription.EdgeApprovalRequests: - ids := make([]ent.Value, 0, len(m.approval_requests)) - for id := range m.approval_requests { + case apiexposure.EdgeSubscriptions: + ids := make([]ent.Value, 0, len(m.subscriptions)) + for id := range m.subscriptions { ids = append(ids, id) } return ids @@ -2438,30 +2475,21 @@ func (m *ApiSubscriptionMutation) AddedIDs(name string) []ent.Value { } // RemovedEdges returns all edge names that were removed in this mutation. -func (m *ApiSubscriptionMutation) RemovedEdges() []string { - edges := make([]string, 0, 5) - if m.removedfailover_zones != nil { - edges = append(edges, apisubscription.EdgeFailoverZones) - } - if m.removedapproval_requests != nil { - edges = append(edges, apisubscription.EdgeApprovalRequests) +func (m *ApiExposureMutation) RemovedEdges() []string { + edges := make([]string, 0, 3) + if m.removedsubscriptions != nil { + edges = append(edges, apiexposure.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 *ApiSubscriptionMutation) RemovedIDs(name string) []ent.Value { +func (m *ApiExposureMutation) RemovedIDs(name string) []ent.Value { switch name { - case apisubscription.EdgeFailoverZones: - ids := make([]ent.Value, 0, len(m.removedfailover_zones)) - for id := range m.removedfailover_zones { - ids = append(ids, id) - } - return ids - case apisubscription.EdgeApprovalRequests: - ids := make([]ent.Value, 0, len(m.removedapproval_requests)) - for id := range m.removedapproval_requests { + case apiexposure.EdgeSubscriptions: + ids := make([]ent.Value, 0, len(m.removedsubscriptions)) + for id := range m.removedsubscriptions { ids = append(ids, id) } return ids @@ -2470,137 +2498,111 @@ func (m *ApiSubscriptionMutation) RemovedIDs(name string) []ent.Value { } // ClearedEdges returns all edge names that were cleared in this mutation. -func (m *ApiSubscriptionMutation) ClearedEdges() []string { - edges := make([]string, 0, 5) +func (m *ApiExposureMutation) ClearedEdges() []string { + edges := make([]string, 0, 3) if m.clearedowner { - edges = append(edges, apisubscription.EdgeOwner) - } - if m.clearedtarget { - edges = append(edges, apisubscription.EdgeTarget) - } - if m.clearedfailover_zones { - edges = append(edges, apisubscription.EdgeFailoverZones) + edges = append(edges, apiexposure.EdgeOwner) } - if m.clearedapproval { - edges = append(edges, apisubscription.EdgeApproval) + if m.clearedapi { + edges = append(edges, apiexposure.EdgeAPI) } - if m.clearedapproval_requests { - edges = append(edges, apisubscription.EdgeApprovalRequests) + if m.clearedsubscriptions { + edges = append(edges, apiexposure.EdgeSubscriptions) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. -func (m *ApiSubscriptionMutation) EdgeCleared(name string) bool { +func (m *ApiExposureMutation) EdgeCleared(name string) bool { switch name { - case apisubscription.EdgeOwner: + case apiexposure.EdgeOwner: return m.clearedowner - case apisubscription.EdgeTarget: - return m.clearedtarget - case apisubscription.EdgeFailoverZones: - return m.clearedfailover_zones - case apisubscription.EdgeApproval: - return m.clearedapproval - case apisubscription.EdgeApprovalRequests: - return m.clearedapproval_requests + case apiexposure.EdgeAPI: + return m.clearedapi + case apiexposure.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 *ApiSubscriptionMutation) ClearEdge(name string) error { +func (m *ApiExposureMutation) ClearEdge(name string) error { switch name { - case apisubscription.EdgeOwner: + case apiexposure.EdgeOwner: m.ClearOwner() return nil - case apisubscription.EdgeTarget: - m.ClearTarget() - return nil - case apisubscription.EdgeApproval: - m.ClearApproval() + case apiexposure.EdgeAPI: + m.ClearAPI() return nil } - return fmt.Errorf("unknown ApiSubscription unique edge %s", name) + return fmt.Errorf("unknown ApiExposure 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 *ApiSubscriptionMutation) ResetEdge(name string) error { +func (m *ApiExposureMutation) ResetEdge(name string) error { switch name { - case apisubscription.EdgeOwner: + case apiexposure.EdgeOwner: m.ResetOwner() return nil - case apisubscription.EdgeTarget: - m.ResetTarget() - return nil - case apisubscription.EdgeFailoverZones: - m.ResetFailoverZones() - return nil - case apisubscription.EdgeApproval: - m.ResetApproval() + case apiexposure.EdgeAPI: + m.ResetAPI() return nil - case apisubscription.EdgeApprovalRequests: - m.ResetApprovalRequests() + case apiexposure.EdgeSubscriptions: + m.ResetSubscriptions() return nil } - return fmt.Errorf("unknown ApiSubscription edge %s", name) + return fmt.Errorf("unknown ApiExposure edge %s", name) } -// ApplicationMutation represents an operation that mutates the Application nodes in the graph. -type ApplicationMutation struct { +// ApiSubscriptionMutation represents an operation that mutates the ApiSubscription nodes in the graph. +type ApiSubscriptionMutation struct { config op Op typ string id *int created_at *time.Time last_modified_at *time.Time - status_phase *application.StatusPhase + status_phase *apisubscription.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 + base_path *string + m2m_auth_method *apisubscription.M2mAuthMethod + approved_scopes *[]string + appendapproved_scopes []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 + owner *int + clearedowner bool + target *int + clearedtarget bool + failover_zones map[int]struct{} + removedfailover_zones map[int]struct{} + clearedfailover_zones bool + approval *int + clearedapproval bool + approval_requests map[int]struct{} + removedapproval_requests map[int]struct{} + clearedapproval_requests bool done bool - oldValue func(context.Context) (*Application, error) - predicates []predicate.Application + oldValue func(context.Context) (*ApiSubscription, error) + predicates []predicate.ApiSubscription } -var _ ent.Mutation = (*ApplicationMutation)(nil) +var _ ent.Mutation = (*ApiSubscriptionMutation)(nil) -// applicationOption allows management of the mutation configuration using functional options. -type applicationOption func(*ApplicationMutation) +// apisubscriptionOption allows management of the mutation configuration using functional options. +type apisubscriptionOption func(*ApiSubscriptionMutation) -// newApplicationMutation creates new mutation for the Application entity. -func newApplicationMutation(c config, op Op, opts ...applicationOption) *ApplicationMutation { - m := &ApplicationMutation{ +// newApiSubscriptionMutation creates new mutation for the ApiSubscription entity. +func newApiSubscriptionMutation(c config, op Op, opts ...apisubscriptionOption) *ApiSubscriptionMutation { + m := &ApiSubscriptionMutation{ config: c, op: op, - typ: TypeApplication, + typ: TypeApiSubscription, clearedFields: make(map[string]struct{}), } for _, opt := range opts { @@ -2609,20 +2611,20 @@ func newApplicationMutation(c config, op Op, opts ...applicationOption) *Applica return m } -// withApplicationID sets the ID field of the mutation. -func withApplicationID(id int) applicationOption { - return func(m *ApplicationMutation) { +// withApiSubscriptionID sets the ID field of the mutation. +func withApiSubscriptionID(id int) apisubscriptionOption { + return func(m *ApiSubscriptionMutation) { var ( err error once sync.Once - value *Application + value *ApiSubscription ) - m.oldValue = func(ctx context.Context) (*Application, error) { + m.oldValue = func(ctx context.Context) (*ApiSubscription, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { - value, err = m.Client().Application.Get(ctx, id) + value, err = m.Client().ApiSubscription.Get(ctx, id) } }) return value, err @@ -2631,10 +2633,10 @@ func withApplicationID(id int) applicationOption { } } -// withApplication sets the old Application of the mutation. -func withApplication(node *Application) applicationOption { - return func(m *ApplicationMutation) { - m.oldValue = func(context.Context) (*Application, error) { +// withApiSubscription sets the old ApiSubscription of the mutation. +func withApiSubscription(node *ApiSubscription) apisubscriptionOption { + return func(m *ApiSubscriptionMutation) { + m.oldValue = func(context.Context) (*ApiSubscription, error) { return node, nil } m.id = &node.ID @@ -2643,7 +2645,7 @@ func withApplication(node *Application) applicationOption { // 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 ApplicationMutation) Client() *Client { +func (m ApiSubscriptionMutation) Client() *Client { client := &Client{config: m.config} client.init() return client @@ -2651,7 +2653,7 @@ func (m ApplicationMutation) Client() *Client { // Tx returns an `ent.Tx` for mutations that were executed in transactions; // it returns an error otherwise. -func (m ApplicationMutation) Tx() (*Tx, error) { +func (m ApiSubscriptionMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("ent: mutation is not running in a transaction") } @@ -2662,7 +2664,7 @@ func (m ApplicationMutation) Tx() (*Tx, error) { // 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 *ApplicationMutation) ID() (id int, exists bool) { +func (m *ApiSubscriptionMutation) ID() (id int, exists bool) { if m.id == nil { return } @@ -2673,7 +2675,7 @@ func (m *ApplicationMutation) ID() (id int, exists bool) { // 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 *ApplicationMutation) IDs(ctx context.Context) ([]int, error) { +func (m *ApiSubscriptionMutation) IDs(ctx context.Context) ([]int, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() @@ -2682,19 +2684,19 @@ func (m *ApplicationMutation) IDs(ctx context.Context) ([]int, error) { } fallthrough case m.op.Is(OpUpdate | OpDelete): - return m.Client().Application.Query().Where(m.predicates...).IDs(ctx) + return m.Client().ApiSubscription.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 *ApplicationMutation) SetCreatedAt(t time.Time) { +func (m *ApiSubscriptionMutation) SetCreatedAt(t time.Time) { m.created_at = &t } // CreatedAt returns the value of the "created_at" field in the mutation. -func (m *ApplicationMutation) CreatedAt() (r time.Time, exists bool) { +func (m *ApiSubscriptionMutation) CreatedAt() (r time.Time, exists bool) { v := m.created_at if v == nil { return @@ -2702,10 +2704,10 @@ func (m *ApplicationMutation) CreatedAt() (r time.Time, exists bool) { return *v, true } -// OldCreatedAt returns the old "created_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. +// OldCreatedAt returns the old "created_at" field's value of the ApiSubscription entity. +// If the ApiSubscription 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) OldCreatedAt(ctx context.Context) (v time.Time, err error) { +func (m *ApiSubscriptionMutation) 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") } @@ -2720,17 +2722,17 @@ func (m *ApplicationMutation) OldCreatedAt(ctx context.Context) (v time.Time, er } // ResetCreatedAt resets all changes to the "created_at" field. -func (m *ApplicationMutation) ResetCreatedAt() { +func (m *ApiSubscriptionMutation) ResetCreatedAt() { m.created_at = nil } // SetLastModifiedAt sets the "last_modified_at" field. -func (m *ApplicationMutation) SetLastModifiedAt(t time.Time) { +func (m *ApiSubscriptionMutation) SetLastModifiedAt(t time.Time) { m.last_modified_at = &t } // LastModifiedAt returns the value of the "last_modified_at" field in the mutation. -func (m *ApplicationMutation) LastModifiedAt() (r time.Time, exists bool) { +func (m *ApiSubscriptionMutation) LastModifiedAt() (r time.Time, exists bool) { v := m.last_modified_at if v == nil { return @@ -2738,10 +2740,10 @@ func (m *ApplicationMutation) LastModifiedAt() (r time.Time, exists bool) { return *v, true } -// OldLastModifiedAt returns the old "last_modified_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. +// OldLastModifiedAt returns the old "last_modified_at" field's value of the ApiSubscription entity. +// If the ApiSubscription 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) OldLastModifiedAt(ctx context.Context) (v time.Time, err error) { +func (m *ApiSubscriptionMutation) 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") } @@ -2756,17 +2758,17 @@ func (m *ApplicationMutation) OldLastModifiedAt(ctx context.Context) (v time.Tim } // ResetLastModifiedAt resets all changes to the "last_modified_at" field. -func (m *ApplicationMutation) ResetLastModifiedAt() { +func (m *ApiSubscriptionMutation) ResetLastModifiedAt() { m.last_modified_at = nil } // SetStatusPhase sets the "status_phase" field. -func (m *ApplicationMutation) SetStatusPhase(ap application.StatusPhase) { +func (m *ApiSubscriptionMutation) SetStatusPhase(ap apisubscription.StatusPhase) { m.status_phase = &ap } // StatusPhase returns the value of the "status_phase" field in the mutation. -func (m *ApplicationMutation) StatusPhase() (r application.StatusPhase, exists bool) { +func (m *ApiSubscriptionMutation) StatusPhase() (r apisubscription.StatusPhase, exists bool) { v := m.status_phase if v == nil { return @@ -2774,10 +2776,10 @@ func (m *ApplicationMutation) StatusPhase() (r application.StatusPhase, exists b return *v, true } -// OldStatusPhase returns the old "status_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. +// OldStatusPhase returns the old "status_phase" field's value of the ApiSubscription entity. +// If the ApiSubscription 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) OldStatusPhase(ctx context.Context) (v *application.StatusPhase, err error) { +func (m *ApiSubscriptionMutation) OldStatusPhase(ctx context.Context) (v *apisubscription.StatusPhase, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStatusPhase is only allowed on UpdateOne operations") } @@ -2792,30 +2794,30 @@ func (m *ApplicationMutation) OldStatusPhase(ctx context.Context) (v *applicatio } // ClearStatusPhase clears the value of the "status_phase" field. -func (m *ApplicationMutation) ClearStatusPhase() { +func (m *ApiSubscriptionMutation) ClearStatusPhase() { m.status_phase = nil - m.clearedFields[application.FieldStatusPhase] = struct{}{} + m.clearedFields[apisubscription.FieldStatusPhase] = struct{}{} } // StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. -func (m *ApplicationMutation) StatusPhaseCleared() bool { - _, ok := m.clearedFields[application.FieldStatusPhase] +func (m *ApiSubscriptionMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[apisubscription.FieldStatusPhase] return ok } // ResetStatusPhase resets all changes to the "status_phase" field. -func (m *ApplicationMutation) ResetStatusPhase() { +func (m *ApiSubscriptionMutation) ResetStatusPhase() { m.status_phase = nil - delete(m.clearedFields, application.FieldStatusPhase) + delete(m.clearedFields, apisubscription.FieldStatusPhase) } // SetStatusMessage sets the "status_message" field. -func (m *ApplicationMutation) SetStatusMessage(s string) { +func (m *ApiSubscriptionMutation) SetStatusMessage(s string) { m.status_message = &s } // StatusMessage returns the value of the "status_message" field in the mutation. -func (m *ApplicationMutation) StatusMessage() (r string, exists bool) { +func (m *ApiSubscriptionMutation) StatusMessage() (r string, exists bool) { v := m.status_message if v == nil { return @@ -2823,10 +2825,10 @@ func (m *ApplicationMutation) StatusMessage() (r string, exists bool) { return *v, true } -// OldStatusMessage returns the old "status_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. +// OldStatusMessage returns the old "status_message" field's value of the ApiSubscription entity. +// If the ApiSubscription 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) OldStatusMessage(ctx context.Context) (v *string, err error) { +func (m *ApiSubscriptionMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStatusMessage is only allowed on UpdateOne operations") } @@ -2841,30 +2843,30 @@ func (m *ApplicationMutation) OldStatusMessage(ctx context.Context) (v *string, } // ClearStatusMessage clears the value of the "status_message" field. -func (m *ApplicationMutation) ClearStatusMessage() { +func (m *ApiSubscriptionMutation) ClearStatusMessage() { m.status_message = nil - m.clearedFields[application.FieldStatusMessage] = struct{}{} + m.clearedFields[apisubscription.FieldStatusMessage] = struct{}{} } // StatusMessageCleared returns if the "status_message" field was cleared in this mutation. -func (m *ApplicationMutation) StatusMessageCleared() bool { - _, ok := m.clearedFields[application.FieldStatusMessage] +func (m *ApiSubscriptionMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[apisubscription.FieldStatusMessage] return ok } // ResetStatusMessage resets all changes to the "status_message" field. -func (m *ApplicationMutation) ResetStatusMessage() { +func (m *ApiSubscriptionMutation) ResetStatusMessage() { m.status_message = nil - delete(m.clearedFields, application.FieldStatusMessage) + delete(m.clearedFields, apisubscription.FieldStatusMessage) } // SetEnvironment sets the "environment" field. -func (m *ApplicationMutation) SetEnvironment(s string) { +func (m *ApiSubscriptionMutation) SetEnvironment(s string) { m.environment = &s } // Environment returns the value of the "environment" field in the mutation. -func (m *ApplicationMutation) Environment() (r string, exists bool) { +func (m *ApiSubscriptionMutation) Environment() (r string, exists bool) { v := m.environment if v == nil { return @@ -2872,10 +2874,10 @@ func (m *ApplicationMutation) Environment() (r string, exists bool) { return *v, true } -// OldEnvironment returns the old "environment" field's value of the Application entity. -// If the Application object wasn't provided to the builder, the object is fetched from the database. +// OldEnvironment returns the old "environment" field's value of the ApiSubscription entity. +// If the ApiSubscription 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) OldEnvironment(ctx context.Context) (v *string, err error) { +func (m *ApiSubscriptionMutation) OldEnvironment(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldEnvironment is only allowed on UpdateOne operations") } @@ -2890,30 +2892,30 @@ func (m *ApplicationMutation) OldEnvironment(ctx context.Context) (v *string, er } // ClearEnvironment clears the value of the "environment" field. -func (m *ApplicationMutation) ClearEnvironment() { +func (m *ApiSubscriptionMutation) ClearEnvironment() { m.environment = nil - m.clearedFields[application.FieldEnvironment] = struct{}{} + m.clearedFields[apisubscription.FieldEnvironment] = struct{}{} } // EnvironmentCleared returns if the "environment" field was cleared in this mutation. -func (m *ApplicationMutation) EnvironmentCleared() bool { - _, ok := m.clearedFields[application.FieldEnvironment] +func (m *ApiSubscriptionMutation) EnvironmentCleared() bool { + _, ok := m.clearedFields[apisubscription.FieldEnvironment] return ok } // ResetEnvironment resets all changes to the "environment" field. -func (m *ApplicationMutation) ResetEnvironment() { +func (m *ApiSubscriptionMutation) ResetEnvironment() { m.environment = nil - delete(m.clearedFields, application.FieldEnvironment) + delete(m.clearedFields, apisubscription.FieldEnvironment) } // SetNamespace sets the "namespace" field. -func (m *ApplicationMutation) SetNamespace(s string) { +func (m *ApiSubscriptionMutation) SetNamespace(s string) { m.namespace = &s } // Namespace returns the value of the "namespace" field in the mutation. -func (m *ApplicationMutation) Namespace() (r string, exists bool) { +func (m *ApiSubscriptionMutation) Namespace() (r string, exists bool) { v := m.namespace if v == nil { return @@ -2921,10 +2923,10 @@ func (m *ApplicationMutation) Namespace() (r string, exists bool) { return *v, true } -// OldNamespace returns the old "namespace" field's value of the Application entity. -// If the Application object wasn't provided to the builder, the object is fetched from the database. +// OldNamespace returns the old "namespace" field's value of the ApiSubscription entity. +// If the ApiSubscription 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) OldNamespace(ctx context.Context) (v string, err error) { +func (m *ApiSubscriptionMutation) OldNamespace(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldNamespace is only allowed on UpdateOne operations") } @@ -2939,17 +2941,17 @@ func (m *ApplicationMutation) OldNamespace(ctx context.Context) (v string, err e } // ResetNamespace resets all changes to the "namespace" field. -func (m *ApplicationMutation) ResetNamespace() { +func (m *ApiSubscriptionMutation) ResetNamespace() { m.namespace = nil } // SetName sets the "name" field. -func (m *ApplicationMutation) SetName(s string) { +func (m *ApiSubscriptionMutation) SetName(s string) { m.name = &s } // Name returns the value of the "name" field in the mutation. -func (m *ApplicationMutation) Name() (r string, exists bool) { +func (m *ApiSubscriptionMutation) Name() (r string, exists bool) { v := m.name if v == nil { return @@ -2957,10 +2959,10 @@ func (m *ApplicationMutation) Name() (r string, exists bool) { return *v, true } -// OldName returns the old "name" field's value of the Application entity. -// If the Application object wasn't provided to the builder, the object is fetched from the database. +// OldName returns the old "name" field's value of the ApiSubscription entity. +// If the ApiSubscription 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) OldName(ctx context.Context) (v string, err error) { +func (m *ApiSubscriptionMutation) OldName(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldName is only allowed on UpdateOne operations") } @@ -2975,398 +2977,1646 @@ func (m *ApplicationMutation) OldName(ctx context.Context) (v string, err error) } // ResetName resets all changes to the "name" field. -func (m *ApplicationMutation) ResetName() { +func (m *ApiSubscriptionMutation) ResetName() { m.name = nil } -// SetClientID sets the "client_id" field. -func (m *ApplicationMutation) SetClientID(s string) { - m.client_id = &s +// SetBasePath sets the "base_path" field. +func (m *ApiSubscriptionMutation) SetBasePath(s string) { + m.base_path = &s } -// ClientID returns the value of the "client_id" field in the mutation. -func (m *ApplicationMutation) ClientID() (r string, exists bool) { - v := m.client_id +// BasePath returns the value of the "base_path" field in the mutation. +func (m *ApiSubscriptionMutation) BasePath() (r string, exists bool) { + v := m.base_path if v == nil { return } return *v, true } -// OldClientID returns the old "client_id" field's value of the Application entity. -// If the Application object wasn't provided to the builder, the object is fetched from the database. +// OldBasePath returns the old "base_path" field's value of the ApiSubscription entity. +// If the ApiSubscription 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) OldClientID(ctx context.Context) (v *string, err error) { +func (m *ApiSubscriptionMutation) OldBasePath(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldClientID is only allowed on UpdateOne operations") + return v, errors.New("OldBasePath is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldClientID requires an ID field in the mutation") + return v, errors.New("OldBasePath requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldClientID: %w", err) + return v, fmt.Errorf("querying old value for OldBasePath: %w", err) } - return oldValue.ClientID, nil -} - -// ClearClientID clears the value of the "client_id" field. -func (m *ApplicationMutation) ClearClientID() { - m.client_id = nil - m.clearedFields[application.FieldClientID] = struct{}{} -} - -// ClientIDCleared returns if the "client_id" field was cleared in this mutation. -func (m *ApplicationMutation) ClientIDCleared() bool { - _, ok := m.clearedFields[application.FieldClientID] - return ok + return oldValue.BasePath, nil } -// ResetClientID resets all changes to the "client_id" field. -func (m *ApplicationMutation) ResetClientID() { - m.client_id = nil - delete(m.clearedFields, application.FieldClientID) +// ResetBasePath resets all changes to the "base_path" field. +func (m *ApiSubscriptionMutation) ResetBasePath() { + m.base_path = nil } -// SetClientSecret sets the "client_secret" field. -func (m *ApplicationMutation) SetClientSecret(s string) { - m.client_secret = &s +// SetM2mAuthMethod sets the "m2m_auth_method" field. +func (m *ApiSubscriptionMutation) SetM2mAuthMethod(aam apisubscription.M2mAuthMethod) { + m.m2m_auth_method = &aam } -// ClientSecret returns the value of the "client_secret" field in the mutation. -func (m *ApplicationMutation) ClientSecret() (r string, exists bool) { - v := m.client_secret +// M2mAuthMethod returns the value of the "m2m_auth_method" field in the mutation. +func (m *ApiSubscriptionMutation) M2mAuthMethod() (r apisubscription.M2mAuthMethod, exists bool) { + v := m.m2m_auth_method if v == nil { return } return *v, true } -// OldClientSecret returns the old "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. +// OldM2mAuthMethod returns the old "m2m_auth_method" field's value of the ApiSubscription entity. +// If the ApiSubscription 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) OldClientSecret(ctx context.Context) (v *string, err error) { +func (m *ApiSubscriptionMutation) OldM2mAuthMethod(ctx context.Context) (v apisubscription.M2mAuthMethod, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldClientSecret is only allowed on UpdateOne operations") + return v, errors.New("OldM2mAuthMethod is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldClientSecret requires an ID field in the mutation") + return v, errors.New("OldM2mAuthMethod requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldClientSecret: %w", err) + return v, fmt.Errorf("querying old value for OldM2mAuthMethod: %w", err) } - return oldValue.ClientSecret, nil -} - -// ClearClientSecret clears the value of the "client_secret" field. -func (m *ApplicationMutation) ClearClientSecret() { - m.client_secret = nil - m.clearedFields[application.FieldClientSecret] = struct{}{} -} - -// ClientSecretCleared returns if the "client_secret" field was cleared in this mutation. -func (m *ApplicationMutation) ClientSecretCleared() bool { - _, ok := m.clearedFields[application.FieldClientSecret] - return ok + return oldValue.M2mAuthMethod, nil } -// ResetClientSecret resets all changes to the "client_secret" field. -func (m *ApplicationMutation) ResetClientSecret() { - m.client_secret = nil - delete(m.clearedFields, application.FieldClientSecret) +// ResetM2mAuthMethod resets all changes to the "m2m_auth_method" field. +func (m *ApiSubscriptionMutation) ResetM2mAuthMethod() { + m.m2m_auth_method = nil } -// SetRotatedClientSecret sets the "rotated_client_secret" field. -func (m *ApplicationMutation) SetRotatedClientSecret(s string) { - m.rotated_client_secret = &s +// SetApprovedScopes sets the "approved_scopes" field. +func (m *ApiSubscriptionMutation) SetApprovedScopes(s []string) { + m.approved_scopes = &s + m.appendapproved_scopes = nil } -// 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 +// ApprovedScopes returns the value of the "approved_scopes" field in the mutation. +func (m *ApiSubscriptionMutation) ApprovedScopes() (r []string, exists bool) { + v := m.approved_scopes if v == nil { return } return *v, true } -// 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. +// OldApprovedScopes returns the old "approved_scopes" field's value of the ApiSubscription entity. +// If the ApiSubscription 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) OldRotatedClientSecret(ctx context.Context) (v *string, err error) { +func (m *ApiSubscriptionMutation) OldApprovedScopes(ctx context.Context) (v []string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldRotatedClientSecret is only allowed on UpdateOne operations") + return v, errors.New("OldApprovedScopes is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldRotatedClientSecret requires an ID field in the mutation") + return v, errors.New("OldApprovedScopes requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldRotatedClientSecret: %w", err) + return v, fmt.Errorf("querying old value for OldApprovedScopes: %w", err) } - return oldValue.RotatedClientSecret, nil + return oldValue.ApprovedScopes, nil } -// ClearRotatedClientSecret clears the value of the "rotated_client_secret" field. -func (m *ApplicationMutation) ClearRotatedClientSecret() { - m.rotated_client_secret = nil - m.clearedFields[application.FieldRotatedClientSecret] = struct{}{} +// AppendApprovedScopes adds s to the "approved_scopes" field. +func (m *ApiSubscriptionMutation) AppendApprovedScopes(s []string) { + m.appendapproved_scopes = append(m.appendapproved_scopes, s...) } -// 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 +// AppendedApprovedScopes returns the list of values that were appended to the "approved_scopes" field in this mutation. +func (m *ApiSubscriptionMutation) AppendedApprovedScopes() ([]string, bool) { + if len(m.appendapproved_scopes) == 0 { + return nil, false + } + return m.appendapproved_scopes, true } -// ResetRotatedClientSecret resets all changes to the "rotated_client_secret" field. -func (m *ApplicationMutation) ResetRotatedClientSecret() { - m.rotated_client_secret = nil - delete(m.clearedFields, application.FieldRotatedClientSecret) +// ResetApprovedScopes resets all changes to the "approved_scopes" field. +func (m *ApiSubscriptionMutation) ResetApprovedScopes() { + m.approved_scopes = nil + m.appendapproved_scopes = nil } -// SetRotatedExpiresAt sets the "rotated_expires_at" field. -func (m *ApplicationMutation) SetRotatedExpiresAt(t time.Time) { - m.rotated_expires_at = &t +// SetOwnerID sets the "owner" edge to the Application entity by id. +func (m *ApiSubscriptionMutation) SetOwnerID(id int) { + m.owner = &id } -// 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 +// ClearOwner clears the "owner" edge to the Application entity. +func (m *ApiSubscriptionMutation) ClearOwner() { + m.clearedowner = 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 +// OwnerCleared reports if the "owner" edge to the Application entity was cleared. +func (m *ApiSubscriptionMutation) OwnerCleared() bool { + return m.clearedowner } -// ClearRotatedExpiresAt clears the value of the "rotated_expires_at" field. -func (m *ApplicationMutation) ClearRotatedExpiresAt() { - m.rotated_expires_at = nil - m.clearedFields[application.FieldRotatedExpiresAt] = struct{}{} +// OwnerID returns the "owner" edge ID in the mutation. +func (m *ApiSubscriptionMutation) OwnerID() (id int, exists bool) { + if m.owner != nil { + return *m.owner, true + } + return } -// 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 +// 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 *ApiSubscriptionMutation) OwnerIDs() (ids []int) { + if id := m.owner; id != nil { + ids = append(ids, *id) + } + return } -// 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 +// ResetOwner resets all changes to the "owner" edge. +func (m *ApiSubscriptionMutation) ResetOwner() { + m.owner = nil + m.clearedowner = false } -// 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 +// SetTargetID sets the "target" edge to the ApiExposure entity by id. +func (m *ApiSubscriptionMutation) SetTargetID(id int) { + m.target = &id } -// ClearCurrentExpiresAt clears the value of the "current_expires_at" field. -func (m *ApplicationMutation) ClearCurrentExpiresAt() { - m.current_expires_at = nil - m.clearedFields[application.FieldCurrentExpiresAt] = struct{}{} +// ClearTarget clears the "target" edge to the ApiExposure entity. +func (m *ApiSubscriptionMutation) ClearTarget() { + m.clearedtarget = true } -// 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 +// TargetCleared reports if the "target" edge to the ApiExposure entity was cleared. +func (m *ApiSubscriptionMutation) TargetCleared() bool { + return m.clearedtarget } -// ResetCurrentExpiresAt resets all changes to the "current_expires_at" field. -func (m *ApplicationMutation) ResetCurrentExpiresAt() { - m.current_expires_at = nil - delete(m.clearedFields, application.FieldCurrentExpiresAt) +// TargetID returns the "target" edge ID in the mutation. +func (m *ApiSubscriptionMutation) TargetID() (id int, exists bool) { + if m.target != nil { + return *m.target, true + } + return } -// SetSecretRotationPhase sets the "secret_rotation_phase" field. -func (m *ApplicationMutation) SetSecretRotationPhase(arp application.SecretRotationPhase) { - m.secret_rotation_phase = &arp +// 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 *ApiSubscriptionMutation) TargetIDs() (ids []int) { + if id := m.target; id != nil { + ids = append(ids, *id) + } + return } -// 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 +// ResetTarget resets all changes to the "target" edge. +func (m *ApiSubscriptionMutation) ResetTarget() { + m.target = nil + m.clearedtarget = false } -// 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") +// AddFailoverZoneIDs adds the "failover_zones" edge to the Zone entity by ids. +func (m *ApiSubscriptionMutation) AddFailoverZoneIDs(ids ...int) { + if m.failover_zones == nil { + m.failover_zones = make(map[int]struct{}) } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSecretRotationPhase: %w", err) + for i := range ids { + m.failover_zones[ids[i]] = struct{}{} } - 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 +// ClearFailoverZones clears the "failover_zones" edge to the Zone entity. +func (m *ApiSubscriptionMutation) ClearFailoverZones() { + m.clearedfailover_zones = true } -// 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 +// FailoverZonesCleared reports if the "failover_zones" edge to the Zone entity was cleared. +func (m *ApiSubscriptionMutation) FailoverZonesCleared() bool { + return m.clearedfailover_zones } -// 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") +// RemoveFailoverZoneIDs removes the "failover_zones" edge to the Zone entity by IDs. +func (m *ApiSubscriptionMutation) RemoveFailoverZoneIDs(ids ...int) { + if m.removedfailover_zones == nil { + m.removedfailover_zones = make(map[int]struct{}) } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSecretRotationMessage: %w", err) + for i := range ids { + delete(m.failover_zones, ids[i]) + m.removedfailover_zones[ids[i]] = struct{}{} } - 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{}{} +// RemovedFailoverZones returns the removed IDs of the "failover_zones" edge to the Zone entity. +func (m *ApiSubscriptionMutation) RemovedFailoverZonesIDs() (ids []int) { + for id := range m.removedfailover_zones { + ids = append(ids, id) + } + return } -// 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 +// FailoverZonesIDs returns the "failover_zones" edge IDs in the mutation. +func (m *ApiSubscriptionMutation) FailoverZonesIDs() (ids []int) { + for id := range m.failover_zones { + ids = append(ids, id) + } + return } -// ResetSecretRotationMessage resets all changes to the "secret_rotation_message" field. -func (m *ApplicationMutation) ResetSecretRotationMessage() { - m.secret_rotation_message = nil - delete(m.clearedFields, application.FieldSecretRotationMessage) +// ResetFailoverZones resets all changes to the "failover_zones" edge. +func (m *ApiSubscriptionMutation) ResetFailoverZones() { + m.failover_zones = nil + m.clearedfailover_zones = false + m.removedfailover_zones = nil } -// SetZoneID sets the "zone" edge to the Zone entity by id. -func (m *ApplicationMutation) SetZoneID(id int) { - m.zone = &id +// SetApprovalID sets the "approval" edge to the Approval entity by id. +func (m *ApiSubscriptionMutation) SetApprovalID(id int) { + m.approval = &id } -// ClearZone clears the "zone" edge to the Zone entity. -func (m *ApplicationMutation) ClearZone() { - m.clearedzone = true +// ClearApproval clears the "approval" edge to the Approval entity. +func (m *ApiSubscriptionMutation) ClearApproval() { + m.clearedapproval = true } -// ZoneCleared reports if the "zone" edge to the Zone entity was cleared. -func (m *ApplicationMutation) ZoneCleared() bool { - return m.clearedzone +// ApprovalCleared reports if the "approval" edge to the Approval entity was cleared. +func (m *ApiSubscriptionMutation) ApprovalCleared() bool { + return m.clearedapproval } -// ZoneID returns the "zone" edge ID in the mutation. -func (m *ApplicationMutation) ZoneID() (id int, exists bool) { - if m.zone != nil { - return *m.zone, true +// ApprovalID returns the "approval" edge ID in the mutation. +func (m *ApiSubscriptionMutation) ApprovalID() (id int, exists bool) { + if m.approval != nil { + return *m.approval, true } return } -// ZoneIDs returns the "zone" edge IDs in the mutation. +// ApprovalIDs returns the "approval" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// ZoneID instead. It exists only for internal usage by the builders. -func (m *ApplicationMutation) ZoneIDs() (ids []int) { - if id := m.zone; id != nil { +// ApprovalID instead. It exists only for internal usage by the builders. +func (m *ApiSubscriptionMutation) ApprovalIDs() (ids []int) { + if id := m.approval; id != nil { ids = append(ids, *id) } return } -// ResetZone resets all changes to the "zone" edge. -func (m *ApplicationMutation) ResetZone() { - m.zone = nil - m.clearedzone = false +// ResetApproval resets all changes to the "approval" edge. +func (m *ApiSubscriptionMutation) ResetApproval() { + m.approval = nil + m.clearedapproval = false } -// SetOwnerTeamID sets the "owner_team" edge to the Team entity by id. -func (m *ApplicationMutation) SetOwnerTeamID(id int) { - m.owner_team = &id +// AddApprovalRequestIDs adds the "approval_requests" edge to the ApprovalRequest entity by ids. +func (m *ApiSubscriptionMutation) 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{}{} + } } -// ClearOwnerTeam clears the "owner_team" edge to the Team entity. -func (m *ApplicationMutation) ClearOwnerTeam() { - m.clearedowner_team = true +// ClearApprovalRequests clears the "approval_requests" edge to the ApprovalRequest entity. +func (m *ApiSubscriptionMutation) ClearApprovalRequests() { + m.clearedapproval_requests = true } -// OwnerTeamCleared reports if the "owner_team" edge to the Team entity was cleared. -func (m *ApplicationMutation) OwnerTeamCleared() bool { - return m.clearedowner_team +// ApprovalRequestsCleared reports if the "approval_requests" edge to the ApprovalRequest entity was cleared. +func (m *ApiSubscriptionMutation) ApprovalRequestsCleared() bool { + return m.clearedapproval_requests } -// OwnerTeamID returns the "owner_team" edge ID in the mutation. -func (m *ApplicationMutation) OwnerTeamID() (id int, exists bool) { - if m.owner_team != nil { - return *m.owner_team, true +// RemoveApprovalRequestIDs removes the "approval_requests" edge to the ApprovalRequest entity by IDs. +func (m *ApiSubscriptionMutation) 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 *ApiSubscriptionMutation) 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 *ApiSubscriptionMutation) 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 *ApiSubscriptionMutation) ResetApprovalRequests() { + m.approval_requests = nil + m.clearedapproval_requests = false + m.removedapproval_requests = nil +} + +// Where appends a list predicates to the ApiSubscriptionMutation builder. +func (m *ApiSubscriptionMutation) Where(ps ...predicate.ApiSubscription) { + m.predicates = append(m.predicates, ps...) +} + +// WhereP appends storage-level predicates to the ApiSubscriptionMutation builder. Using this method, +// users can use type-assertion to append predicates that do not depend on any generated package. +func (m *ApiSubscriptionMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.ApiSubscription, len(ps)) + for i := range ps { + p[i] = ps[i] + } + m.Where(p...) +} + +// Op returns the operation name. +func (m *ApiSubscriptionMutation) Op() Op { + return m.op +} + +// SetOp allows setting the mutation operation. +func (m *ApiSubscriptionMutation) SetOp(op Op) { + m.op = op +} + +// Type returns the node type of this mutation (ApiSubscription). +func (m *ApiSubscriptionMutation) 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 *ApiSubscriptionMutation) Fields() []string { + fields := make([]string, 0, 10) + if m.created_at != nil { + fields = append(fields, apisubscription.FieldCreatedAt) + } + if m.last_modified_at != nil { + fields = append(fields, apisubscription.FieldLastModifiedAt) + } + if m.status_phase != nil { + fields = append(fields, apisubscription.FieldStatusPhase) + } + if m.status_message != nil { + fields = append(fields, apisubscription.FieldStatusMessage) + } + if m.environment != nil { + fields = append(fields, apisubscription.FieldEnvironment) + } + if m.namespace != nil { + fields = append(fields, apisubscription.FieldNamespace) + } + if m.name != nil { + fields = append(fields, apisubscription.FieldName) + } + if m.base_path != nil { + fields = append(fields, apisubscription.FieldBasePath) + } + if m.m2m_auth_method != nil { + fields = append(fields, apisubscription.FieldM2mAuthMethod) + } + if m.approved_scopes != nil { + fields = append(fields, apisubscription.FieldApprovedScopes) + } + 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 *ApiSubscriptionMutation) Field(name string) (ent.Value, bool) { + switch name { + case apisubscription.FieldCreatedAt: + return m.CreatedAt() + case apisubscription.FieldLastModifiedAt: + return m.LastModifiedAt() + case apisubscription.FieldStatusPhase: + return m.StatusPhase() + case apisubscription.FieldStatusMessage: + return m.StatusMessage() + case apisubscription.FieldEnvironment: + return m.Environment() + case apisubscription.FieldNamespace: + return m.Namespace() + case apisubscription.FieldName: + return m.Name() + case apisubscription.FieldBasePath: + return m.BasePath() + case apisubscription.FieldM2mAuthMethod: + return m.M2mAuthMethod() + case apisubscription.FieldApprovedScopes: + return m.ApprovedScopes() + } + 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 *ApiSubscriptionMutation) OldField(ctx context.Context, name string) (ent.Value, error) { + switch name { + case apisubscription.FieldCreatedAt: + return m.OldCreatedAt(ctx) + case apisubscription.FieldLastModifiedAt: + return m.OldLastModifiedAt(ctx) + case apisubscription.FieldStatusPhase: + return m.OldStatusPhase(ctx) + case apisubscription.FieldStatusMessage: + return m.OldStatusMessage(ctx) + case apisubscription.FieldEnvironment: + return m.OldEnvironment(ctx) + case apisubscription.FieldNamespace: + return m.OldNamespace(ctx) + case apisubscription.FieldName: + return m.OldName(ctx) + case apisubscription.FieldBasePath: + return m.OldBasePath(ctx) + case apisubscription.FieldM2mAuthMethod: + return m.OldM2mAuthMethod(ctx) + case apisubscription.FieldApprovedScopes: + return m.OldApprovedScopes(ctx) + } + return nil, fmt.Errorf("unknown ApiSubscription 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 *ApiSubscriptionMutation) SetField(name string, value ent.Value) error { + switch name { + case apisubscription.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 apisubscription.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 apisubscription.FieldStatusPhase: + v, ok := value.(apisubscription.StatusPhase) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatusPhase(v) + return nil + case apisubscription.FieldStatusMessage: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatusMessage(v) + return nil + case apisubscription.FieldEnvironment: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetEnvironment(v) + return nil + case apisubscription.FieldNamespace: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetNamespace(v) + return nil + case apisubscription.FieldName: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetName(v) + return nil + case apisubscription.FieldBasePath: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetBasePath(v) + return nil + case apisubscription.FieldM2mAuthMethod: + v, ok := value.(apisubscription.M2mAuthMethod) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetM2mAuthMethod(v) + return nil + case apisubscription.FieldApprovedScopes: + v, ok := value.([]string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetApprovedScopes(v) + return nil + } + return fmt.Errorf("unknown ApiSubscription field %s", name) +} + +// AddedFields returns all numeric fields that were incremented/decremented during +// this mutation. +func (m *ApiSubscriptionMutation) 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 *ApiSubscriptionMutation) 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 *ApiSubscriptionMutation) AddField(name string, value ent.Value) error { + switch name { + } + return fmt.Errorf("unknown ApiSubscription numeric field %s", name) +} + +// ClearedFields returns all nullable fields that were cleared during this +// mutation. +func (m *ApiSubscriptionMutation) ClearedFields() []string { + var fields []string + if m.FieldCleared(apisubscription.FieldStatusPhase) { + fields = append(fields, apisubscription.FieldStatusPhase) + } + if m.FieldCleared(apisubscription.FieldStatusMessage) { + fields = append(fields, apisubscription.FieldStatusMessage) + } + if m.FieldCleared(apisubscription.FieldEnvironment) { + fields = append(fields, apisubscription.FieldEnvironment) + } + return fields +} + +// FieldCleared returns a boolean indicating if a field with the given name was +// cleared in this mutation. +func (m *ApiSubscriptionMutation) 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 *ApiSubscriptionMutation) ClearField(name string) error { + switch name { + case apisubscription.FieldStatusPhase: + m.ClearStatusPhase() + return nil + case apisubscription.FieldStatusMessage: + m.ClearStatusMessage() + return nil + case apisubscription.FieldEnvironment: + m.ClearEnvironment() + return nil + } + return fmt.Errorf("unknown ApiSubscription 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 *ApiSubscriptionMutation) ResetField(name string) error { + switch name { + case apisubscription.FieldCreatedAt: + m.ResetCreatedAt() + return nil + case apisubscription.FieldLastModifiedAt: + m.ResetLastModifiedAt() + return nil + case apisubscription.FieldStatusPhase: + m.ResetStatusPhase() + return nil + case apisubscription.FieldStatusMessage: + m.ResetStatusMessage() + return nil + case apisubscription.FieldEnvironment: + m.ResetEnvironment() + return nil + case apisubscription.FieldNamespace: + m.ResetNamespace() + return nil + case apisubscription.FieldName: + m.ResetName() + return nil + case apisubscription.FieldBasePath: + m.ResetBasePath() + return nil + case apisubscription.FieldM2mAuthMethod: + m.ResetM2mAuthMethod() + return nil + case apisubscription.FieldApprovedScopes: + m.ResetApprovedScopes() + return nil + } + return fmt.Errorf("unknown ApiSubscription field %s", name) +} + +// AddedEdges returns all edge names that were set/added in this mutation. +func (m *ApiSubscriptionMutation) AddedEdges() []string { + edges := make([]string, 0, 5) + if m.owner != nil { + edges = append(edges, apisubscription.EdgeOwner) + } + if m.target != nil { + edges = append(edges, apisubscription.EdgeTarget) + } + if m.failover_zones != nil { + edges = append(edges, apisubscription.EdgeFailoverZones) + } + if m.approval != nil { + edges = append(edges, apisubscription.EdgeApproval) + } + if m.approval_requests != nil { + edges = append(edges, apisubscription.EdgeApprovalRequests) + } + return edges +} + +// AddedIDs returns all IDs (to other nodes) that were added for the given edge +// name in this mutation. +func (m *ApiSubscriptionMutation) AddedIDs(name string) []ent.Value { + switch name { + case apisubscription.EdgeOwner: + if id := m.owner; id != nil { + return []ent.Value{*id} + } + case apisubscription.EdgeTarget: + if id := m.target; id != nil { + return []ent.Value{*id} + } + case apisubscription.EdgeFailoverZones: + ids := make([]ent.Value, 0, len(m.failover_zones)) + for id := range m.failover_zones { + ids = append(ids, id) + } + return ids + case apisubscription.EdgeApproval: + if id := m.approval; id != nil { + return []ent.Value{*id} + } + case apisubscription.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 *ApiSubscriptionMutation) RemovedEdges() []string { + edges := make([]string, 0, 5) + if m.removedfailover_zones != nil { + edges = append(edges, apisubscription.EdgeFailoverZones) + } + if m.removedapproval_requests != nil { + edges = append(edges, apisubscription.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 *ApiSubscriptionMutation) RemovedIDs(name string) []ent.Value { + switch name { + case apisubscription.EdgeFailoverZones: + ids := make([]ent.Value, 0, len(m.removedfailover_zones)) + for id := range m.removedfailover_zones { + ids = append(ids, id) + } + return ids + case apisubscription.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 *ApiSubscriptionMutation) ClearedEdges() []string { + edges := make([]string, 0, 5) + if m.clearedowner { + edges = append(edges, apisubscription.EdgeOwner) + } + if m.clearedtarget { + edges = append(edges, apisubscription.EdgeTarget) + } + if m.clearedfailover_zones { + edges = append(edges, apisubscription.EdgeFailoverZones) + } + if m.clearedapproval { + edges = append(edges, apisubscription.EdgeApproval) + } + if m.clearedapproval_requests { + edges = append(edges, apisubscription.EdgeApprovalRequests) + } + return edges +} + +// EdgeCleared returns a boolean which indicates if the edge with the given name +// was cleared in this mutation. +func (m *ApiSubscriptionMutation) EdgeCleared(name string) bool { + switch name { + case apisubscription.EdgeOwner: + return m.clearedowner + case apisubscription.EdgeTarget: + return m.clearedtarget + case apisubscription.EdgeFailoverZones: + return m.clearedfailover_zones + case apisubscription.EdgeApproval: + return m.clearedapproval + case apisubscription.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 *ApiSubscriptionMutation) ClearEdge(name string) error { + switch name { + case apisubscription.EdgeOwner: + m.ClearOwner() + return nil + case apisubscription.EdgeTarget: + m.ClearTarget() + return nil + case apisubscription.EdgeApproval: + m.ClearApproval() + return nil + } + return fmt.Errorf("unknown ApiSubscription 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 *ApiSubscriptionMutation) ResetEdge(name string) error { + switch name { + case apisubscription.EdgeOwner: + m.ResetOwner() + return nil + case apisubscription.EdgeTarget: + m.ResetTarget() + return nil + case apisubscription.EdgeFailoverZones: + m.ResetFailoverZones() + return nil + case apisubscription.EdgeApproval: + m.ResetApproval() + return nil + case apisubscription.EdgeApprovalRequests: + m.ResetApprovalRequests() + return nil + } + return fmt.Errorf("unknown ApiSubscription edge %s", name) +} + +// 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 + 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) + +// applicationOption allows management of the mutation configuration using functional options. +type applicationOption func(*ApplicationMutation) + +// newApplicationMutation creates new mutation for the Application entity. +func newApplicationMutation(c config, op Op, opts ...applicationOption) *ApplicationMutation { + m := &ApplicationMutation{ + config: c, + op: op, + typ: TypeApplication, + clearedFields: make(map[string]struct{}), + } + for _, opt := range opts { + opt(m) + } + return m +} + +// withApplicationID sets the ID field of the mutation. +func withApplicationID(id int) applicationOption { + return func(m *ApplicationMutation) { + var ( + err error + once sync.Once + value *Application + ) + m.oldValue = func(ctx context.Context) (*Application, error) { + once.Do(func() { + if m.done { + err = errors.New("querying old values post mutation is not allowed") + } else { + value, err = m.Client().Application.Get(ctx, id) + } + }) + return value, err + } + m.id = &id + } +} + +// withApplication sets the old Application of the mutation. +func withApplication(node *Application) applicationOption { + return func(m *ApplicationMutation) { + m.oldValue = func(context.Context) (*Application, 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 ApplicationMutation) 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 ApplicationMutation) 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 *ApplicationMutation) 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 *ApplicationMutation) 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().Application.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 *ApplicationMutation) SetCreatedAt(t time.Time) { + m.created_at = &t +} + +// CreatedAt returns the value of the "created_at" field in the mutation. +func (m *ApplicationMutation) 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 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) 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 *ApplicationMutation) ResetCreatedAt() { + m.created_at = nil +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (m *ApplicationMutation) SetLastModifiedAt(t time.Time) { + m.last_modified_at = &t +} + +// LastModifiedAt returns the value of the "last_modified_at" field in the mutation. +func (m *ApplicationMutation) 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 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) 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 *ApplicationMutation) ResetLastModifiedAt() { + m.last_modified_at = nil +} + +// SetStatusPhase sets the "status_phase" field. +func (m *ApplicationMutation) SetStatusPhase(ap application.StatusPhase) { + m.status_phase = &ap +} + +// StatusPhase returns the value of the "status_phase" field in the mutation. +func (m *ApplicationMutation) StatusPhase() (r application.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 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) OldStatusPhase(ctx context.Context) (v *application.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 *ApplicationMutation) ClearStatusPhase() { + m.status_phase = nil + m.clearedFields[application.FieldStatusPhase] = struct{}{} +} + +// StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. +func (m *ApplicationMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[application.FieldStatusPhase] + return ok +} + +// ResetStatusPhase resets all changes to the "status_phase" field. +func (m *ApplicationMutation) ResetStatusPhase() { + m.status_phase = nil + delete(m.clearedFields, application.FieldStatusPhase) +} + +// SetStatusMessage sets the "status_message" field. +func (m *ApplicationMutation) SetStatusMessage(s string) { + m.status_message = &s +} + +// StatusMessage returns the value of the "status_message" field in the mutation. +func (m *ApplicationMutation) 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 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) 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 *ApplicationMutation) ClearStatusMessage() { + m.status_message = nil + m.clearedFields[application.FieldStatusMessage] = struct{}{} +} + +// StatusMessageCleared returns if the "status_message" field was cleared in this mutation. +func (m *ApplicationMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[application.FieldStatusMessage] + return ok +} + +// ResetStatusMessage resets all changes to the "status_message" field. +func (m *ApplicationMutation) ResetStatusMessage() { + m.status_message = nil + delete(m.clearedFields, application.FieldStatusMessage) +} + +// SetEnvironment sets the "environment" field. +func (m *ApplicationMutation) SetEnvironment(s string) { + m.environment = &s +} + +// Environment returns the value of the "environment" field in the mutation. +func (m *ApplicationMutation) 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 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) 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 *ApplicationMutation) ClearEnvironment() { + m.environment = nil + m.clearedFields[application.FieldEnvironment] = struct{}{} +} + +// EnvironmentCleared returns if the "environment" field was cleared in this mutation. +func (m *ApplicationMutation) EnvironmentCleared() bool { + _, ok := m.clearedFields[application.FieldEnvironment] + return ok +} + +// ResetEnvironment resets all changes to the "environment" field. +func (m *ApplicationMutation) ResetEnvironment() { + m.environment = nil + delete(m.clearedFields, application.FieldEnvironment) +} + +// SetNamespace sets the "namespace" field. +func (m *ApplicationMutation) SetNamespace(s string) { + m.namespace = &s +} + +// Namespace returns the value of the "namespace" field in the mutation. +func (m *ApplicationMutation) 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 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) 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 *ApplicationMutation) ResetNamespace() { + m.namespace = nil +} + +// SetName sets the "name" field. +func (m *ApplicationMutation) SetName(s string) { + m.name = &s +} + +// Name returns the value of the "name" field in the mutation. +func (m *ApplicationMutation) 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 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) 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 *ApplicationMutation) ResetName() { + m.name = nil +} + +// SetClientID sets the "client_id" field. +func (m *ApplicationMutation) SetClientID(s string) { + m.client_id = &s +} + +// ClientID returns the value of the "client_id" field in the mutation. +func (m *ApplicationMutation) ClientID() (r string, exists bool) { + v := m.client_id + if v == nil { + return + } + return *v, true +} + +// OldClientID returns the old "client_id" 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) OldClientID(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldClientID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldClientID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldClientID: %w", err) + } + return oldValue.ClientID, nil +} + +// ClearClientID clears the value of the "client_id" field. +func (m *ApplicationMutation) ClearClientID() { + m.client_id = nil + m.clearedFields[application.FieldClientID] = struct{}{} +} + +// ClientIDCleared returns if the "client_id" field was cleared in this mutation. +func (m *ApplicationMutation) ClientIDCleared() bool { + _, ok := m.clearedFields[application.FieldClientID] + return ok +} + +// ResetClientID resets all changes to the "client_id" field. +func (m *ApplicationMutation) ResetClientID() { + m.client_id = nil + delete(m.clearedFields, application.FieldClientID) +} + +// SetClientSecret sets the "client_secret" field. +func (m *ApplicationMutation) SetClientSecret(s string) { + m.client_secret = &s +} + +// ClientSecret returns the value of the "client_secret" field in the mutation. +func (m *ApplicationMutation) ClientSecret() (r string, exists bool) { + v := m.client_secret + if v == nil { + return + } + return *v, true +} + +// OldClientSecret returns the old "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) OldClientSecret(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldClientSecret is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldClientSecret requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldClientSecret: %w", err) + } + return oldValue.ClientSecret, nil +} + +// ClearClientSecret clears the value of the "client_secret" field. +func (m *ApplicationMutation) ClearClientSecret() { + m.client_secret = nil + m.clearedFields[application.FieldClientSecret] = struct{}{} +} + +// ClientSecretCleared returns if the "client_secret" field was cleared in this mutation. +func (m *ApplicationMutation) ClientSecretCleared() bool { + _, ok := m.clearedFields[application.FieldClientSecret] + return ok +} + +// ResetClientSecret resets all changes to the "client_secret" field. +func (m *ApplicationMutation) ResetClientSecret() { + m.client_secret = nil + delete(m.clearedFields, application.FieldClientSecret) +} + +// SetRotatedClientSecret sets the "rotated_client_secret" field. +func (m *ApplicationMutation) SetRotatedClientSecret(s string) { + m.rotated_client_secret = &s +} + +// 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 +} + +// 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) OldRotatedClientSecret(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldRotatedClientSecret is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + 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 OldRotatedClientSecret: %w", err) + } + return oldValue.RotatedClientSecret, nil +} + +// ClearRotatedClientSecret clears the value of the "rotated_client_secret" field. +func (m *ApplicationMutation) ClearRotatedClientSecret() { + m.rotated_client_secret = nil + m.clearedFields[application.FieldRotatedClientSecret] = struct{}{} +} + +// 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 +} + +// 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. +func (m *ApplicationMutation) SetZoneID(id int) { + m.zone = &id +} + +// ClearZone clears the "zone" edge to the Zone entity. +func (m *ApplicationMutation) ClearZone() { + m.clearedzone = true +} + +// ZoneCleared reports if the "zone" edge to the Zone entity was cleared. +func (m *ApplicationMutation) ZoneCleared() bool { + return m.clearedzone +} + +// ZoneID returns the "zone" edge ID in the mutation. +func (m *ApplicationMutation) ZoneID() (id int, exists bool) { + if m.zone != nil { + return *m.zone, true + } + return +} + +// ZoneIDs returns the "zone" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// ZoneID instead. It exists only for internal usage by the builders. +func (m *ApplicationMutation) ZoneIDs() (ids []int) { + if id := m.zone; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetZone resets all changes to the "zone" edge. +func (m *ApplicationMutation) ResetZone() { + m.zone = nil + m.clearedzone = false +} + +// SetOwnerTeamID sets the "owner_team" edge to the Team entity by id. +func (m *ApplicationMutation) SetOwnerTeamID(id int) { + m.owner_team = &id +} + +// ClearOwnerTeam clears the "owner_team" edge to the Team entity. +func (m *ApplicationMutation) ClearOwnerTeam() { + m.clearedowner_team = true +} + +// OwnerTeamCleared reports if the "owner_team" edge to the Team entity was cleared. +func (m *ApplicationMutation) OwnerTeamCleared() bool { + return m.clearedowner_team +} + +// OwnerTeamID returns the "owner_team" edge ID in the mutation. +func (m *ApplicationMutation) OwnerTeamID() (id int, exists bool) { + if m.owner_team != nil { + return *m.owner_team, true } return } @@ -3378,240 +4628,1679 @@ func (m *ApplicationMutation) OwnerTeamIDs() (ids []int) { if id := m.owner_team; id != nil { ids = append(ids, *id) } - return + return +} + +// ResetOwnerTeam resets all changes to the "owner_team" edge. +func (m *ApplicationMutation) ResetOwnerTeam() { + m.owner_team = nil + m.clearedowner_team = false +} + +// AddExposedAPIIDs adds the "exposed_apis" edge to the ApiExposure entity by ids. +func (m *ApplicationMutation) AddExposedAPIIDs(ids ...int) { + if m.exposed_apis == nil { + m.exposed_apis = make(map[int]struct{}) + } + for i := range ids { + m.exposed_apis[ids[i]] = struct{}{} + } +} + +// ClearExposedApis clears the "exposed_apis" edge to the ApiExposure entity. +func (m *ApplicationMutation) ClearExposedApis() { + m.clearedexposed_apis = true +} + +// ExposedApisCleared reports if the "exposed_apis" edge to the ApiExposure entity was cleared. +func (m *ApplicationMutation) ExposedApisCleared() bool { + return m.clearedexposed_apis +} + +// RemoveExposedAPIIDs removes the "exposed_apis" edge to the ApiExposure entity by IDs. +func (m *ApplicationMutation) RemoveExposedAPIIDs(ids ...int) { + if m.removedexposed_apis == nil { + m.removedexposed_apis = make(map[int]struct{}) + } + for i := range ids { + delete(m.exposed_apis, ids[i]) + m.removedexposed_apis[ids[i]] = struct{}{} + } +} + +// RemovedExposedApis returns the removed IDs of the "exposed_apis" edge to the ApiExposure entity. +func (m *ApplicationMutation) RemovedExposedApisIDs() (ids []int) { + for id := range m.removedexposed_apis { + ids = append(ids, id) + } + return +} + +// ExposedApisIDs returns the "exposed_apis" edge IDs in the mutation. +func (m *ApplicationMutation) ExposedApisIDs() (ids []int) { + for id := range m.exposed_apis { + ids = append(ids, id) + } + return +} + +// ResetExposedApis resets all changes to the "exposed_apis" edge. +func (m *ApplicationMutation) ResetExposedApis() { + m.exposed_apis = nil + m.clearedexposed_apis = false + m.removedexposed_apis = nil +} + +// AddSubscribedAPIIDs adds the "subscribed_apis" edge to the ApiSubscription entity by ids. +func (m *ApplicationMutation) AddSubscribedAPIIDs(ids ...int) { + if m.subscribed_apis == nil { + m.subscribed_apis = make(map[int]struct{}) + } + for i := range ids { + m.subscribed_apis[ids[i]] = struct{}{} + } +} + +// ClearSubscribedApis clears the "subscribed_apis" edge to the ApiSubscription entity. +func (m *ApplicationMutation) ClearSubscribedApis() { + m.clearedsubscribed_apis = true +} + +// SubscribedApisCleared reports if the "subscribed_apis" edge to the ApiSubscription entity was cleared. +func (m *ApplicationMutation) SubscribedApisCleared() bool { + return m.clearedsubscribed_apis +} + +// RemoveSubscribedAPIIDs removes the "subscribed_apis" edge to the ApiSubscription entity by IDs. +func (m *ApplicationMutation) RemoveSubscribedAPIIDs(ids ...int) { + if m.removedsubscribed_apis == nil { + m.removedsubscribed_apis = make(map[int]struct{}) + } + for i := range ids { + delete(m.subscribed_apis, ids[i]) + m.removedsubscribed_apis[ids[i]] = struct{}{} + } +} + +// RemovedSubscribedApis returns the removed IDs of the "subscribed_apis" edge to the ApiSubscription entity. +func (m *ApplicationMutation) RemovedSubscribedApisIDs() (ids []int) { + for id := range m.removedsubscribed_apis { + ids = append(ids, id) + } + return +} + +// SubscribedApisIDs returns the "subscribed_apis" edge IDs in the mutation. +func (m *ApplicationMutation) SubscribedApisIDs() (ids []int) { + for id := range m.subscribed_apis { + ids = append(ids, id) + } + return +} + +// ResetSubscribedApis resets all changes to the "subscribed_apis" edge. +func (m *ApplicationMutation) ResetSubscribedApis() { + m.subscribed_apis = nil + m.clearedsubscribed_apis = false + 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...) +} + +// WhereP appends storage-level predicates to the ApplicationMutation builder. Using this method, +// users can use type-assertion to append predicates that do not depend on any generated package. +func (m *ApplicationMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.Application, len(ps)) + for i := range ps { + p[i] = ps[i] + } + m.Where(p...) +} + +// Op returns the operation name. +func (m *ApplicationMutation) Op() Op { + return m.op +} + +// SetOp allows setting the mutation operation. +func (m *ApplicationMutation) SetOp(op Op) { + m.op = op +} + +// Type returns the node type of this mutation (Application). +func (m *ApplicationMutation) 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 *ApplicationMutation) Fields() []string { + fields := make([]string, 0, 14) + if m.created_at != nil { + fields = append(fields, application.FieldCreatedAt) + } + if m.last_modified_at != nil { + fields = append(fields, application.FieldLastModifiedAt) + } + if m.status_phase != nil { + fields = append(fields, application.FieldStatusPhase) + } + if m.status_message != nil { + fields = append(fields, application.FieldStatusMessage) + } + if m.environment != nil { + fields = append(fields, application.FieldEnvironment) + } + if m.namespace != nil { + fields = append(fields, application.FieldNamespace) + } + if m.name != nil { + fields = append(fields, application.FieldName) + } + if m.client_id != nil { + fields = append(fields, application.FieldClientID) + } + if m.client_secret != nil { + fields = append(fields, application.FieldClientSecret) + } + 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 +} + +// 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 *ApplicationMutation) Field(name string) (ent.Value, bool) { + switch name { + case application.FieldCreatedAt: + return m.CreatedAt() + case application.FieldLastModifiedAt: + return m.LastModifiedAt() + case application.FieldStatusPhase: + return m.StatusPhase() + case application.FieldStatusMessage: + return m.StatusMessage() + case application.FieldEnvironment: + return m.Environment() + case application.FieldNamespace: + return m.Namespace() + case application.FieldName: + return m.Name() + case application.FieldClientID: + return m.ClientID() + case application.FieldClientSecret: + return m.ClientSecret() + 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 +} + +// 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 *ApplicationMutation) OldField(ctx context.Context, name string) (ent.Value, error) { + switch name { + case application.FieldCreatedAt: + return m.OldCreatedAt(ctx) + case application.FieldLastModifiedAt: + return m.OldLastModifiedAt(ctx) + case application.FieldStatusPhase: + return m.OldStatusPhase(ctx) + case application.FieldStatusMessage: + return m.OldStatusMessage(ctx) + case application.FieldEnvironment: + return m.OldEnvironment(ctx) + case application.FieldNamespace: + return m.OldNamespace(ctx) + case application.FieldName: + return m.OldName(ctx) + case application.FieldClientID: + return m.OldClientID(ctx) + case application.FieldClientSecret: + return m.OldClientSecret(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) +} + +// 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 *ApplicationMutation) SetField(name string, value ent.Value) error { + switch name { + case application.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 application.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 application.FieldStatusPhase: + v, ok := value.(application.StatusPhase) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatusPhase(v) + return nil + case application.FieldStatusMessage: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatusMessage(v) + return nil + case application.FieldEnvironment: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetEnvironment(v) + return nil + case application.FieldNamespace: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetNamespace(v) + return nil + case application.FieldName: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetName(v) + return nil + case application.FieldClientID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetClientID(v) + return nil + case application.FieldClientSecret: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetClientSecret(v) + return nil + case application.FieldRotatedClientSecret: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + 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) +} + +// AddedFields returns all numeric fields that were incremented/decremented during +// this mutation. +func (m *ApplicationMutation) 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 *ApplicationMutation) 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 *ApplicationMutation) AddField(name string, value ent.Value) error { + switch name { + } + return fmt.Errorf("unknown Application numeric field %s", name) +} + +// ClearedFields returns all nullable fields that were cleared during this +// mutation. +func (m *ApplicationMutation) ClearedFields() []string { + var fields []string + if m.FieldCleared(application.FieldStatusPhase) { + fields = append(fields, application.FieldStatusPhase) + } + if m.FieldCleared(application.FieldStatusMessage) { + fields = append(fields, application.FieldStatusMessage) + } + if m.FieldCleared(application.FieldEnvironment) { + fields = append(fields, application.FieldEnvironment) + } + if m.FieldCleared(application.FieldClientID) { + fields = append(fields, application.FieldClientID) + } + if m.FieldCleared(application.FieldClientSecret) { + fields = append(fields, application.FieldClientSecret) + } + 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 +} + +// FieldCleared returns a boolean indicating if a field with the given name was +// cleared in this mutation. +func (m *ApplicationMutation) 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 *ApplicationMutation) ClearField(name string) error { + switch name { + case application.FieldStatusPhase: + m.ClearStatusPhase() + return nil + case application.FieldStatusMessage: + m.ClearStatusMessage() + return nil + case application.FieldEnvironment: + m.ClearEnvironment() + return nil + case application.FieldClientID: + m.ClearClientID() + return nil + case application.FieldClientSecret: + m.ClearClientSecret() + return nil + 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) +} + +// 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 *ApplicationMutation) ResetField(name string) error { + switch name { + case application.FieldCreatedAt: + m.ResetCreatedAt() + return nil + case application.FieldLastModifiedAt: + m.ResetLastModifiedAt() + return nil + case application.FieldStatusPhase: + m.ResetStatusPhase() + return nil + case application.FieldStatusMessage: + m.ResetStatusMessage() + return nil + case application.FieldEnvironment: + m.ResetEnvironment() + return nil + case application.FieldNamespace: + m.ResetNamespace() + return nil + case application.FieldName: + m.ResetName() + return nil + case application.FieldClientID: + m.ResetClientID() + return nil + case application.FieldClientSecret: + m.ResetClientSecret() + return nil + 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) +} + +// AddedEdges returns all edge names that were set/added in this mutation. +func (m *ApplicationMutation) AddedEdges() []string { + edges := make([]string, 0, 6) + if m.zone != nil { + edges = append(edges, application.EdgeZone) + } + if m.owner_team != nil { + edges = append(edges, application.EdgeOwnerTeam) + } + if m.exposed_apis != nil { + edges = append(edges, application.EdgeExposedApis) + } + 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 +} + +// AddedIDs returns all IDs (to other nodes) that were added for the given edge +// name in this mutation. +func (m *ApplicationMutation) AddedIDs(name string) []ent.Value { + switch name { + case application.EdgeZone: + if id := m.zone; id != nil { + return []ent.Value{*id} + } + case application.EdgeOwnerTeam: + if id := m.owner_team; id != nil { + return []ent.Value{*id} + } + case application.EdgeExposedApis: + ids := make([]ent.Value, 0, len(m.exposed_apis)) + for id := range m.exposed_apis { + ids = append(ids, id) + } + return ids + case application.EdgeSubscribedApis: + ids := make([]ent.Value, 0, len(m.subscribed_apis)) + for id := range m.subscribed_apis { + 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, 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 +} + +// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with +// the given name in this mutation. +func (m *ApplicationMutation) RemovedIDs(name string) []ent.Value { + switch name { + case application.EdgeExposedApis: + ids := make([]ent.Value, 0, len(m.removedexposed_apis)) + for id := range m.removedexposed_apis { + ids = append(ids, id) + } + return ids + case application.EdgeSubscribedApis: + ids := make([]ent.Value, 0, len(m.removedsubscribed_apis)) + for id := range m.removedsubscribed_apis { + 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, 6) + if m.clearedzone { + edges = append(edges, application.EdgeZone) + } + if m.clearedowner_team { + edges = append(edges, application.EdgeOwnerTeam) + } + if m.clearedexposed_apis { + edges = append(edges, application.EdgeExposedApis) + } + 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 +} + +// EdgeCleared returns a boolean which indicates if the edge with the given name +// was cleared in this mutation. +func (m *ApplicationMutation) EdgeCleared(name string) bool { + switch name { + case application.EdgeZone: + return m.clearedzone + case application.EdgeOwnerTeam: + return m.clearedowner_team + case application.EdgeExposedApis: + 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 +} + +// 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 *ApplicationMutation) ClearEdge(name string) error { + switch name { + case application.EdgeZone: + m.ClearZone() + return nil + case application.EdgeOwnerTeam: + m.ClearOwnerTeam() + return nil + } + return fmt.Errorf("unknown Application 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 *ApplicationMutation) ResetEdge(name string) error { + switch name { + case application.EdgeZone: + m.ResetZone() + return nil + case application.EdgeOwnerTeam: + m.ResetOwnerTeam() + return nil + case application.EdgeExposedApis: + m.ResetExposedApis() + return nil + 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) +} + +// ApprovalMutation represents an operation that mutates the Approval nodes in the graph. +type ApprovalMutation struct { + config + op Op + typ string + id *int + created_at *time.Time + last_modified_at *time.Time + status_phase *approval.StatusPhase + status_message *string + environment *string + namespace *string + action *string + strategy *approval.Strategy + requester *model.RequesterInfo + decider *model.DeciderInfo + decider_team_name *string + decisions *[]model.Decision + appenddecisions []model.Decision + available_transitions *[]model.AvailableTransition + appendavailable_transitions []model.AvailableTransition + name *string + state *approval.State + 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 +} + +var _ ent.Mutation = (*ApprovalMutation)(nil) + +// approvalOption allows management of the mutation configuration using functional options. +type approvalOption func(*ApprovalMutation) + +// newApprovalMutation creates new mutation for the Approval entity. +func newApprovalMutation(c config, op Op, opts ...approvalOption) *ApprovalMutation { + m := &ApprovalMutation{ + config: c, + op: op, + typ: TypeApproval, + clearedFields: make(map[string]struct{}), + } + for _, opt := range opts { + opt(m) + } + return m +} + +// withApprovalID sets the ID field of the mutation. +func withApprovalID(id int) approvalOption { + return func(m *ApprovalMutation) { + var ( + err error + once sync.Once + value *Approval + ) + m.oldValue = func(ctx context.Context) (*Approval, error) { + once.Do(func() { + if m.done { + err = errors.New("querying old values post mutation is not allowed") + } else { + value, err = m.Client().Approval.Get(ctx, id) + } + }) + return value, err + } + m.id = &id + } +} + +// withApproval sets the old Approval of the mutation. +func withApproval(node *Approval) approvalOption { + return func(m *ApprovalMutation) { + m.oldValue = func(context.Context) (*Approval, 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 ApprovalMutation) 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 ApprovalMutation) 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 *ApprovalMutation) 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 *ApprovalMutation) 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().Approval.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 *ApprovalMutation) SetCreatedAt(t time.Time) { + m.created_at = &t +} + +// CreatedAt returns the value of the "created_at" field in the mutation. +func (m *ApprovalMutation) 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 Approval entity. +// If the Approval 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 *ApprovalMutation) 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 *ApprovalMutation) ResetCreatedAt() { + m.created_at = nil +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (m *ApprovalMutation) SetLastModifiedAt(t time.Time) { + m.last_modified_at = &t +} + +// LastModifiedAt returns the value of the "last_modified_at" field in the mutation. +func (m *ApprovalMutation) 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 Approval entity. +// If the Approval 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 *ApprovalMutation) 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 *ApprovalMutation) ResetLastModifiedAt() { + m.last_modified_at = nil +} + +// SetStatusPhase sets the "status_phase" field. +func (m *ApprovalMutation) SetStatusPhase(ap approval.StatusPhase) { + m.status_phase = &ap +} + +// StatusPhase returns the value of the "status_phase" field in the mutation. +func (m *ApprovalMutation) StatusPhase() (r approval.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 Approval entity. +// If the Approval 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 *ApprovalMutation) OldStatusPhase(ctx context.Context) (v *approval.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 *ApprovalMutation) ClearStatusPhase() { + m.status_phase = nil + m.clearedFields[approval.FieldStatusPhase] = struct{}{} +} + +// StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. +func (m *ApprovalMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[approval.FieldStatusPhase] + return ok +} + +// ResetStatusPhase resets all changes to the "status_phase" field. +func (m *ApprovalMutation) ResetStatusPhase() { + m.status_phase = nil + delete(m.clearedFields, approval.FieldStatusPhase) +} + +// SetStatusMessage sets the "status_message" field. +func (m *ApprovalMutation) SetStatusMessage(s string) { + m.status_message = &s +} + +// StatusMessage returns the value of the "status_message" field in the mutation. +func (m *ApprovalMutation) 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 Approval entity. +// If the Approval 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 *ApprovalMutation) 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 *ApprovalMutation) ClearStatusMessage() { + m.status_message = nil + m.clearedFields[approval.FieldStatusMessage] = struct{}{} +} + +// StatusMessageCleared returns if the "status_message" field was cleared in this mutation. +func (m *ApprovalMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[approval.FieldStatusMessage] + return ok +} + +// ResetStatusMessage resets all changes to the "status_message" field. +func (m *ApprovalMutation) ResetStatusMessage() { + m.status_message = nil + delete(m.clearedFields, approval.FieldStatusMessage) +} + +// SetEnvironment sets the "environment" field. +func (m *ApprovalMutation) SetEnvironment(s string) { + m.environment = &s +} + +// Environment returns the value of the "environment" field in the mutation. +func (m *ApprovalMutation) 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 Approval entity. +// If the Approval 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 *ApprovalMutation) 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 *ApprovalMutation) ClearEnvironment() { + m.environment = nil + m.clearedFields[approval.FieldEnvironment] = struct{}{} +} + +// EnvironmentCleared returns if the "environment" field was cleared in this mutation. +func (m *ApprovalMutation) EnvironmentCleared() bool { + _, ok := m.clearedFields[approval.FieldEnvironment] + return ok +} + +// ResetEnvironment resets all changes to the "environment" field. +func (m *ApprovalMutation) ResetEnvironment() { + m.environment = nil + delete(m.clearedFields, approval.FieldEnvironment) +} + +// SetNamespace sets the "namespace" field. +func (m *ApprovalMutation) SetNamespace(s string) { + m.namespace = &s +} + +// Namespace returns the value of the "namespace" field in the mutation. +func (m *ApprovalMutation) 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 Approval entity. +// If the Approval 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 *ApprovalMutation) 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 *ApprovalMutation) ResetNamespace() { + m.namespace = nil +} + +// SetAction sets the "action" field. +func (m *ApprovalMutation) SetAction(s string) { + m.action = &s +} + +// Action returns the value of the "action" field in the mutation. +func (m *ApprovalMutation) Action() (r string, exists bool) { + v := m.action + if v == nil { + return + } + return *v, true +} + +// OldAction returns the old "action" field's value of the Approval entity. +// If the Approval 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 *ApprovalMutation) OldAction(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldAction is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldAction requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldAction: %w", err) + } + return oldValue.Action, nil +} + +// ResetAction resets all changes to the "action" field. +func (m *ApprovalMutation) ResetAction() { + m.action = nil +} + +// SetStrategy sets the "strategy" field. +func (m *ApprovalMutation) SetStrategy(a approval.Strategy) { + m.strategy = &a +} + +// Strategy returns the value of the "strategy" field in the mutation. +func (m *ApprovalMutation) Strategy() (r approval.Strategy, exists bool) { + v := m.strategy + if v == nil { + return + } + return *v, true +} + +// OldStrategy returns the old "strategy" field's value of the Approval entity. +// If the Approval 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 *ApprovalMutation) OldStrategy(ctx context.Context) (v approval.Strategy, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldStrategy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldStrategy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldStrategy: %w", err) + } + return oldValue.Strategy, nil +} + +// ResetStrategy resets all changes to the "strategy" field. +func (m *ApprovalMutation) ResetStrategy() { + m.strategy = nil +} + +// SetRequester sets the "requester" field. +func (m *ApprovalMutation) SetRequester(mi model.RequesterInfo) { + m.requester = &mi +} + +// Requester returns the value of the "requester" field in the mutation. +func (m *ApprovalMutation) Requester() (r model.RequesterInfo, exists bool) { + v := m.requester + if v == nil { + return + } + return *v, true +} + +// OldRequester returns the old "requester" field's value of the Approval entity. +// If the Approval 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 *ApprovalMutation) OldRequester(ctx context.Context) (v model.RequesterInfo, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldRequester is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldRequester requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldRequester: %w", err) + } + return oldValue.Requester, nil +} + +// ResetRequester resets all changes to the "requester" field. +func (m *ApprovalMutation) ResetRequester() { + m.requester = nil +} + +// SetDecider sets the "decider" field. +func (m *ApprovalMutation) SetDecider(mi model.DeciderInfo) { + m.decider = &mi +} + +// Decider returns the value of the "decider" field in the mutation. +func (m *ApprovalMutation) Decider() (r model.DeciderInfo, exists bool) { + v := m.decider + if v == nil { + return + } + return *v, true +} + +// OldDecider returns the old "decider" field's value of the Approval entity. +// If the Approval 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 *ApprovalMutation) OldDecider(ctx context.Context) (v model.DeciderInfo, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldDecider is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldDecider requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldDecider: %w", err) + } + return oldValue.Decider, nil +} + +// ResetDecider resets all changes to the "decider" field. +func (m *ApprovalMutation) ResetDecider() { + m.decider = nil +} + +// SetDeciderTeamName sets the "decider_team_name" field. +func (m *ApprovalMutation) SetDeciderTeamName(s string) { + m.decider_team_name = &s +} + +// DeciderTeamName returns the value of the "decider_team_name" field in the mutation. +func (m *ApprovalMutation) DeciderTeamName() (r string, exists bool) { + v := m.decider_team_name + if v == nil { + return + } + return *v, true +} + +// OldDeciderTeamName returns the old "decider_team_name" field's value of the Approval entity. +// If the Approval 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 *ApprovalMutation) OldDeciderTeamName(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldDeciderTeamName is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldDeciderTeamName requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldDeciderTeamName: %w", err) + } + return oldValue.DeciderTeamName, nil } -// ResetOwnerTeam resets all changes to the "owner_team" edge. -func (m *ApplicationMutation) ResetOwnerTeam() { - m.owner_team = nil - m.clearedowner_team = false +// ResetDeciderTeamName resets all changes to the "decider_team_name" field. +func (m *ApprovalMutation) ResetDeciderTeamName() { + m.decider_team_name = nil } -// AddExposedAPIIDs adds the "exposed_apis" edge to the ApiExposure entity by ids. -func (m *ApplicationMutation) AddExposedAPIIDs(ids ...int) { - if m.exposed_apis == nil { - m.exposed_apis = make(map[int]struct{}) - } - for i := range ids { - m.exposed_apis[ids[i]] = struct{}{} +// SetDecisions sets the "decisions" field. +func (m *ApprovalMutation) SetDecisions(value []model.Decision) { + m.decisions = &value + m.appenddecisions = nil +} + +// Decisions returns the value of the "decisions" field in the mutation. +func (m *ApprovalMutation) Decisions() (r []model.Decision, exists bool) { + v := m.decisions + if v == nil { + return } + return *v, true } -// ClearExposedApis clears the "exposed_apis" edge to the ApiExposure entity. -func (m *ApplicationMutation) ClearExposedApis() { - m.clearedexposed_apis = true +// OldDecisions returns the old "decisions" field's value of the Approval entity. +// If the Approval 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 *ApprovalMutation) OldDecisions(ctx context.Context) (v []model.Decision, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldDecisions is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldDecisions requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldDecisions: %w", err) + } + return oldValue.Decisions, nil } -// ExposedApisCleared reports if the "exposed_apis" edge to the ApiExposure entity was cleared. -func (m *ApplicationMutation) ExposedApisCleared() bool { - return m.clearedexposed_apis +// AppendDecisions adds value to the "decisions" field. +func (m *ApprovalMutation) AppendDecisions(value []model.Decision) { + m.appenddecisions = append(m.appenddecisions, value...) } -// RemoveExposedAPIIDs removes the "exposed_apis" edge to the ApiExposure entity by IDs. -func (m *ApplicationMutation) RemoveExposedAPIIDs(ids ...int) { - if m.removedexposed_apis == nil { - m.removedexposed_apis = make(map[int]struct{}) - } - for i := range ids { - delete(m.exposed_apis, ids[i]) - m.removedexposed_apis[ids[i]] = struct{}{} +// AppendedDecisions returns the list of values that were appended to the "decisions" field in this mutation. +func (m *ApprovalMutation) AppendedDecisions() ([]model.Decision, bool) { + if len(m.appenddecisions) == 0 { + return nil, false } + return m.appenddecisions, true } -// RemovedExposedApis returns the removed IDs of the "exposed_apis" edge to the ApiExposure entity. -func (m *ApplicationMutation) RemovedExposedApisIDs() (ids []int) { - for id := range m.removedexposed_apis { - ids = append(ids, id) - } - return +// ResetDecisions resets all changes to the "decisions" field. +func (m *ApprovalMutation) ResetDecisions() { + m.decisions = nil + m.appenddecisions = nil } -// ExposedApisIDs returns the "exposed_apis" edge IDs in the mutation. -func (m *ApplicationMutation) ExposedApisIDs() (ids []int) { - for id := range m.exposed_apis { - ids = append(ids, id) - } - return +// SetAvailableTransitions sets the "available_transitions" field. +func (m *ApprovalMutation) SetAvailableTransitions(mt []model.AvailableTransition) { + m.available_transitions = &mt + m.appendavailable_transitions = nil } -// ResetExposedApis resets all changes to the "exposed_apis" edge. -func (m *ApplicationMutation) ResetExposedApis() { - m.exposed_apis = nil - m.clearedexposed_apis = false - m.removedexposed_apis = nil +// AvailableTransitions returns the value of the "available_transitions" field in the mutation. +func (m *ApprovalMutation) AvailableTransitions() (r []model.AvailableTransition, exists bool) { + v := m.available_transitions + if v == nil { + return + } + return *v, true } -// AddSubscribedAPIIDs adds the "subscribed_apis" edge to the ApiSubscription entity by ids. -func (m *ApplicationMutation) AddSubscribedAPIIDs(ids ...int) { - if m.subscribed_apis == nil { - m.subscribed_apis = make(map[int]struct{}) +// OldAvailableTransitions returns the old "available_transitions" field's value of the Approval entity. +// If the Approval 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 *ApprovalMutation) OldAvailableTransitions(ctx context.Context) (v []model.AvailableTransition, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldAvailableTransitions is only allowed on UpdateOne operations") } - for i := range ids { - m.subscribed_apis[ids[i]] = struct{}{} + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldAvailableTransitions requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldAvailableTransitions: %w", err) } + return oldValue.AvailableTransitions, nil } -// ClearSubscribedApis clears the "subscribed_apis" edge to the ApiSubscription entity. -func (m *ApplicationMutation) ClearSubscribedApis() { - m.clearedsubscribed_apis = true +// AppendAvailableTransitions adds mt to the "available_transitions" field. +func (m *ApprovalMutation) AppendAvailableTransitions(mt []model.AvailableTransition) { + m.appendavailable_transitions = append(m.appendavailable_transitions, mt...) } -// SubscribedApisCleared reports if the "subscribed_apis" edge to the ApiSubscription entity was cleared. -func (m *ApplicationMutation) SubscribedApisCleared() bool { - return m.clearedsubscribed_apis +// AppendedAvailableTransitions returns the list of values that were appended to the "available_transitions" field in this mutation. +func (m *ApprovalMutation) AppendedAvailableTransitions() ([]model.AvailableTransition, bool) { + if len(m.appendavailable_transitions) == 0 { + return nil, false + } + return m.appendavailable_transitions, true } -// RemoveSubscribedAPIIDs removes the "subscribed_apis" edge to the ApiSubscription entity by IDs. -func (m *ApplicationMutation) RemoveSubscribedAPIIDs(ids ...int) { - if m.removedsubscribed_apis == nil { - m.removedsubscribed_apis = make(map[int]struct{}) - } - for i := range ids { - delete(m.subscribed_apis, ids[i]) - m.removedsubscribed_apis[ids[i]] = struct{}{} - } +// ClearAvailableTransitions clears the value of the "available_transitions" field. +func (m *ApprovalMutation) ClearAvailableTransitions() { + m.available_transitions = nil + m.appendavailable_transitions = nil + m.clearedFields[approval.FieldAvailableTransitions] = struct{}{} } -// RemovedSubscribedApis returns the removed IDs of the "subscribed_apis" edge to the ApiSubscription entity. -func (m *ApplicationMutation) RemovedSubscribedApisIDs() (ids []int) { - for id := range m.removedsubscribed_apis { - ids = append(ids, id) - } - return +// AvailableTransitionsCleared returns if the "available_transitions" field was cleared in this mutation. +func (m *ApprovalMutation) AvailableTransitionsCleared() bool { + _, ok := m.clearedFields[approval.FieldAvailableTransitions] + return ok } -// SubscribedApisIDs returns the "subscribed_apis" edge IDs in the mutation. -func (m *ApplicationMutation) SubscribedApisIDs() (ids []int) { - for id := range m.subscribed_apis { - ids = append(ids, id) - } - return +// ResetAvailableTransitions resets all changes to the "available_transitions" field. +func (m *ApprovalMutation) ResetAvailableTransitions() { + m.available_transitions = nil + m.appendavailable_transitions = nil + delete(m.clearedFields, approval.FieldAvailableTransitions) } -// ResetSubscribedApis resets all changes to the "subscribed_apis" edge. -func (m *ApplicationMutation) ResetSubscribedApis() { - m.subscribed_apis = nil - m.clearedsubscribed_apis = false - m.removedsubscribed_apis = nil +// SetName sets the "name" field. +func (m *ApprovalMutation) SetName(s string) { + m.name = &s } -// 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{}) +// Name returns the value of the "name" field in the mutation. +func (m *ApprovalMutation) Name() (r string, exists bool) { + v := m.name + if v == nil { + return } - for i := range ids { - m.exposed_events[ids[i]] = struct{}{} + return *v, true +} + +// OldName returns the old "name" field's value of the Approval entity. +// If the Approval 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 *ApprovalMutation) 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 } -// ClearExposedEvents clears the "exposed_events" edge to the EventExposure entity. -func (m *ApplicationMutation) ClearExposedEvents() { - m.clearedexposed_events = true +// ResetName resets all changes to the "name" field. +func (m *ApprovalMutation) ResetName() { + m.name = nil } -// ExposedEventsCleared reports if the "exposed_events" edge to the EventExposure entity was cleared. -func (m *ApplicationMutation) ExposedEventsCleared() bool { - return m.clearedexposed_events +// SetState sets the "state" field. +func (m *ApprovalMutation) SetState(a approval.State) { + m.state = &a } -// 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{}) +// State returns the value of the "state" field in the mutation. +func (m *ApprovalMutation) State() (r approval.State, exists bool) { + v := m.state + if v == nil { + return } - for i := range ids { - delete(m.exposed_events, ids[i]) - m.removedexposed_events[ids[i]] = struct{}{} + return *v, true +} + +// OldState returns the old "state" field's value of the Approval entity. +// If the Approval 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 *ApprovalMutation) OldState(ctx context.Context) (v approval.State, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldState is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldState requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldState: %w", err) } + return oldValue.State, nil +} + +// ResetState resets all changes to the "state" field. +func (m *ApprovalMutation) ResetState() { + m.state = nil +} + +// SetAPISubscriptionID sets the "api_subscription" edge to the ApiSubscription entity by id. +func (m *ApprovalMutation) SetAPISubscriptionID(id int) { + m.api_subscription = &id } -// 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 +// ClearAPISubscription clears the "api_subscription" edge to the ApiSubscription entity. +func (m *ApprovalMutation) ClearAPISubscription() { + m.clearedapi_subscription = true } -// 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) +// APISubscriptionCleared reports if the "api_subscription" edge to the ApiSubscription entity was cleared. +func (m *ApprovalMutation) APISubscriptionCleared() bool { + return m.clearedapi_subscription +} + +// APISubscriptionID returns the "api_subscription" edge ID in the mutation. +func (m *ApprovalMutation) APISubscriptionID() (id int, exists bool) { + if m.api_subscription != nil { + return *m.api_subscription, true } 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 +// APISubscriptionIDs returns the "api_subscription" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// APISubscriptionID instead. It exists only for internal usage by the builders. +func (m *ApprovalMutation) APISubscriptionIDs() (ids []int) { + if id := m.api_subscription; id != nil { + ids = append(ids, *id) + } + return } -// 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{}{} - } +// ResetAPISubscription resets all changes to the "api_subscription" edge. +func (m *ApprovalMutation) ResetAPISubscription() { + m.api_subscription = nil + m.clearedapi_subscription = false } -// ClearSubscribedEvents clears the "subscribed_events" edge to the EventSubscription entity. -func (m *ApplicationMutation) ClearSubscribedEvents() { - m.clearedsubscribed_events = true +// SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by id. +func (m *ApprovalMutation) SetEventSubscriptionID(id int) { + m.event_subscription = &id } -// SubscribedEventsCleared reports if the "subscribed_events" edge to the EventSubscription entity was cleared. -func (m *ApplicationMutation) SubscribedEventsCleared() bool { - return m.clearedsubscribed_events +// ClearEventSubscription clears the "event_subscription" edge to the EventSubscription entity. +func (m *ApprovalMutation) ClearEventSubscription() { + m.clearedevent_subscription = true } -// 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{}{} - } +// EventSubscriptionCleared reports if the "event_subscription" edge to the EventSubscription entity was cleared. +func (m *ApprovalMutation) EventSubscriptionCleared() bool { + return m.clearedevent_subscription } -// 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) +// 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 } -// 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) +// 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 } -// 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 +// 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 ApplicationMutation builder. -func (m *ApplicationMutation) Where(ps ...predicate.Application) { +// 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 ApplicationMutation builder. Using this method, +// 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 *ApplicationMutation) WhereP(ps ...func(*sql.Selector)) { - p := make([]predicate.Application, len(ps)) +func (m *ApprovalMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.Approval, len(ps)) for i := range ps { p[i] = ps[i] } @@ -3619,66 +6308,69 @@ func (m *ApplicationMutation) WhereP(ps ...func(*sql.Selector)) { } // Op returns the operation name. -func (m *ApplicationMutation) Op() Op { +func (m *ApprovalMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. -func (m *ApplicationMutation) SetOp(op Op) { +func (m *ApprovalMutation) SetOp(op Op) { m.op = op } -// Type returns the node type of this mutation (Application). -func (m *ApplicationMutation) Type() string { +// Type returns the node type of this mutation (Approval). +func (m *ApprovalMutation) 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 *ApplicationMutation) Fields() []string { - fields := make([]string, 0, 14) +func (m *ApprovalMutation) Fields() []string { + fields := make([]string, 0, 15) if m.created_at != nil { - fields = append(fields, application.FieldCreatedAt) + fields = append(fields, approval.FieldCreatedAt) } if m.last_modified_at != nil { - fields = append(fields, application.FieldLastModifiedAt) + fields = append(fields, approval.FieldLastModifiedAt) } if m.status_phase != nil { - fields = append(fields, application.FieldStatusPhase) + fields = append(fields, approval.FieldStatusPhase) } if m.status_message != nil { - fields = append(fields, application.FieldStatusMessage) + fields = append(fields, approval.FieldStatusMessage) } if m.environment != nil { - fields = append(fields, application.FieldEnvironment) + fields = append(fields, approval.FieldEnvironment) } if m.namespace != nil { - fields = append(fields, application.FieldNamespace) + fields = append(fields, approval.FieldNamespace) } - if m.name != nil { - fields = append(fields, application.FieldName) + if m.action != nil { + fields = append(fields, approval.FieldAction) } - if m.client_id != nil { - fields = append(fields, application.FieldClientID) + if m.strategy != nil { + fields = append(fields, approval.FieldStrategy) } - if m.client_secret != nil { - fields = append(fields, application.FieldClientSecret) + if m.requester != nil { + fields = append(fields, approval.FieldRequester) } - if m.rotated_client_secret != nil { - fields = append(fields, application.FieldRotatedClientSecret) + if m.decider != nil { + fields = append(fields, approval.FieldDecider) } - if m.rotated_expires_at != nil { - fields = append(fields, application.FieldRotatedExpiresAt) + if m.decider_team_name != nil { + fields = append(fields, approval.FieldDeciderTeamName) } - if m.current_expires_at != nil { - fields = append(fields, application.FieldCurrentExpiresAt) + if m.decisions != nil { + fields = append(fields, approval.FieldDecisions) } - if m.secret_rotation_phase != nil { - fields = append(fields, application.FieldSecretRotationPhase) + if m.available_transitions != nil { + fields = append(fields, approval.FieldAvailableTransitions) } - if m.secret_rotation_message != nil { - fields = append(fields, application.FieldSecretRotationMessage) + if m.name != nil { + fields = append(fields, approval.FieldName) + } + if m.state != nil { + fields = append(fields, approval.FieldState) } return fields } @@ -3686,36 +6378,38 @@ func (m *ApplicationMutation) Fields() []string { // 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 *ApplicationMutation) Field(name string) (ent.Value, bool) { +func (m *ApprovalMutation) Field(name string) (ent.Value, bool) { switch name { - case application.FieldCreatedAt: + case approval.FieldCreatedAt: return m.CreatedAt() - case application.FieldLastModifiedAt: + case approval.FieldLastModifiedAt: return m.LastModifiedAt() - case application.FieldStatusPhase: + case approval.FieldStatusPhase: return m.StatusPhase() - case application.FieldStatusMessage: + case approval.FieldStatusMessage: return m.StatusMessage() - case application.FieldEnvironment: + case approval.FieldEnvironment: return m.Environment() - case application.FieldNamespace: + case approval.FieldNamespace: return m.Namespace() - case application.FieldName: + case approval.FieldAction: + return m.Action() + case approval.FieldStrategy: + return m.Strategy() + case approval.FieldRequester: + return m.Requester() + case approval.FieldDecider: + return m.Decider() + case approval.FieldDeciderTeamName: + return m.DeciderTeamName() + case approval.FieldDecisions: + return m.Decisions() + case approval.FieldAvailableTransitions: + return m.AvailableTransitions() + case approval.FieldName: return m.Name() - case application.FieldClientID: - return m.ClientID() - case application.FieldClientSecret: - return m.ClientSecret() - 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() + case approval.FieldState: + return m.State() } return nil, false } @@ -3723,507 +6417,383 @@ func (m *ApplicationMutation) Field(name string) (ent.Value, bool) { // 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 *ApplicationMutation) OldField(ctx context.Context, name string) (ent.Value, error) { +func (m *ApprovalMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { - case application.FieldCreatedAt: + case approval.FieldCreatedAt: return m.OldCreatedAt(ctx) - case application.FieldLastModifiedAt: + case approval.FieldLastModifiedAt: return m.OldLastModifiedAt(ctx) - case application.FieldStatusPhase: + case approval.FieldStatusPhase: return m.OldStatusPhase(ctx) - case application.FieldStatusMessage: + case approval.FieldStatusMessage: return m.OldStatusMessage(ctx) - case application.FieldEnvironment: + case approval.FieldEnvironment: return m.OldEnvironment(ctx) - case application.FieldNamespace: + case approval.FieldNamespace: return m.OldNamespace(ctx) - case application.FieldName: - return m.OldName(ctx) - case application.FieldClientID: - return m.OldClientID(ctx) - case application.FieldClientSecret: - return m.OldClientSecret(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) + case approval.FieldAction: + return m.OldAction(ctx) + case approval.FieldStrategy: + return m.OldStrategy(ctx) + case approval.FieldRequester: + return m.OldRequester(ctx) + case approval.FieldDecider: + return m.OldDecider(ctx) + case approval.FieldDeciderTeamName: + return m.OldDeciderTeamName(ctx) + case approval.FieldDecisions: + return m.OldDecisions(ctx) + case approval.FieldAvailableTransitions: + return m.OldAvailableTransitions(ctx) + case approval.FieldName: + return m.OldName(ctx) + case approval.FieldState: + return m.OldState(ctx) } - return nil, fmt.Errorf("unknown Application field %s", name) + return nil, fmt.Errorf("unknown Approval 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 *ApplicationMutation) SetField(name string, value ent.Value) error { +func (m *ApprovalMutation) SetField(name string, value ent.Value) error { switch name { - case application.FieldCreatedAt: + case approval.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 application.FieldLastModifiedAt: + case approval.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 application.FieldStatusPhase: - v, ok := value.(application.StatusPhase) + case approval.FieldStatusPhase: + v, ok := value.(approval.StatusPhase) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetStatusPhase(v) return nil - case application.FieldStatusMessage: + case approval.FieldStatusMessage: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetStatusMessage(v) return nil - case application.FieldEnvironment: + case approval.FieldEnvironment: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetEnvironment(v) return nil - case application.FieldNamespace: + case approval.FieldNamespace: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetNamespace(v) return nil - case application.FieldName: + case approval.FieldAction: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetName(v) + m.SetAction(v) return nil - case application.FieldClientID: - v, ok := value.(string) + case approval.FieldStrategy: + v, ok := value.(approval.Strategy) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetClientID(v) + m.SetStrategy(v) return nil - case application.FieldClientSecret: - v, ok := value.(string) + case approval.FieldRequester: + v, ok := value.(model.RequesterInfo) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetClientSecret(v) + m.SetRequester(v) return nil - case application.FieldRotatedClientSecret: - v, ok := value.(string) + case approval.FieldDecider: + v, ok := value.(model.DeciderInfo) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetRotatedClientSecret(v) + m.SetDecider(v) return nil - case application.FieldRotatedExpiresAt: - v, ok := value.(time.Time) + case approval.FieldDeciderTeamName: + v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetRotatedExpiresAt(v) + m.SetDeciderTeamName(v) return nil - case application.FieldCurrentExpiresAt: - v, ok := value.(time.Time) + case approval.FieldDecisions: + v, ok := value.([]model.Decision) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetCurrentExpiresAt(v) + m.SetDecisions(v) return nil - case application.FieldSecretRotationPhase: - v, ok := value.(application.SecretRotationPhase) + case approval.FieldAvailableTransitions: + v, ok := value.([]model.AvailableTransition) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetSecretRotationPhase(v) + m.SetAvailableTransitions(v) return nil - case application.FieldSecretRotationMessage: + case approval.FieldName: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetSecretRotationMessage(v) + m.SetName(v) + return nil + case approval.FieldState: + v, ok := value.(approval.State) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetState(v) return nil } - return fmt.Errorf("unknown Application field %s", name) + return fmt.Errorf("unknown Approval field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. -func (m *ApplicationMutation) AddedFields() []string { +func (m *ApprovalMutation) 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 *ApplicationMutation) AddedField(name string) (ent.Value, bool) { +func (m *ApprovalMutation) 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 *ApplicationMutation) AddField(name string, value ent.Value) error { +func (m *ApprovalMutation) AddField(name string, value ent.Value) error { switch name { } - return fmt.Errorf("unknown Application numeric field %s", name) + return fmt.Errorf("unknown Approval numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. -func (m *ApplicationMutation) ClearedFields() []string { +func (m *ApprovalMutation) ClearedFields() []string { var fields []string - if m.FieldCleared(application.FieldStatusPhase) { - fields = append(fields, application.FieldStatusPhase) - } - if m.FieldCleared(application.FieldStatusMessage) { - fields = append(fields, application.FieldStatusMessage) - } - if m.FieldCleared(application.FieldEnvironment) { - fields = append(fields, application.FieldEnvironment) - } - if m.FieldCleared(application.FieldClientID) { - fields = append(fields, application.FieldClientID) - } - if m.FieldCleared(application.FieldClientSecret) { - fields = append(fields, application.FieldClientSecret) - } - if m.FieldCleared(application.FieldRotatedClientSecret) { - fields = append(fields, application.FieldRotatedClientSecret) + if m.FieldCleared(approval.FieldStatusPhase) { + fields = append(fields, approval.FieldStatusPhase) } - if m.FieldCleared(application.FieldRotatedExpiresAt) { - fields = append(fields, application.FieldRotatedExpiresAt) + if m.FieldCleared(approval.FieldStatusMessage) { + fields = append(fields, approval.FieldStatusMessage) } - if m.FieldCleared(application.FieldCurrentExpiresAt) { - fields = append(fields, application.FieldCurrentExpiresAt) + if m.FieldCleared(approval.FieldEnvironment) { + fields = append(fields, approval.FieldEnvironment) } - if m.FieldCleared(application.FieldSecretRotationMessage) { - fields = append(fields, application.FieldSecretRotationMessage) + if m.FieldCleared(approval.FieldAvailableTransitions) { + fields = append(fields, approval.FieldAvailableTransitions) } return fields } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. -func (m *ApplicationMutation) FieldCleared(name string) bool { +func (m *ApprovalMutation) 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 *ApplicationMutation) ClearField(name string) error { +func (m *ApprovalMutation) ClearField(name string) error { switch name { - case application.FieldStatusPhase: + case approval.FieldStatusPhase: m.ClearStatusPhase() return nil - case application.FieldStatusMessage: + case approval.FieldStatusMessage: m.ClearStatusMessage() return nil - case application.FieldEnvironment: + case approval.FieldEnvironment: m.ClearEnvironment() return nil - case application.FieldClientID: - m.ClearClientID() - return nil - case application.FieldClientSecret: - m.ClearClientSecret() - return nil - 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() + case approval.FieldAvailableTransitions: + m.ClearAvailableTransitions() return nil } - return fmt.Errorf("unknown Application nullable field %s", name) + return fmt.Errorf("unknown Approval 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 *ApplicationMutation) ResetField(name string) error { +func (m *ApprovalMutation) ResetField(name string) error { switch name { - case application.FieldCreatedAt: + case approval.FieldCreatedAt: m.ResetCreatedAt() return nil - case application.FieldLastModifiedAt: + case approval.FieldLastModifiedAt: m.ResetLastModifiedAt() return nil - case application.FieldStatusPhase: + case approval.FieldStatusPhase: m.ResetStatusPhase() return nil - case application.FieldStatusMessage: + case approval.FieldStatusMessage: m.ResetStatusMessage() return nil - case application.FieldEnvironment: + case approval.FieldEnvironment: m.ResetEnvironment() return nil - case application.FieldNamespace: + case approval.FieldNamespace: m.ResetNamespace() return nil - case application.FieldName: - m.ResetName() + case approval.FieldAction: + m.ResetAction() return nil - case application.FieldClientID: - m.ResetClientID() + case approval.FieldStrategy: + m.ResetStrategy() return nil - case application.FieldClientSecret: - m.ResetClientSecret() + case approval.FieldRequester: + m.ResetRequester() return nil - case application.FieldRotatedClientSecret: - m.ResetRotatedClientSecret() + case approval.FieldDecider: + m.ResetDecider() return nil - case application.FieldRotatedExpiresAt: - m.ResetRotatedExpiresAt() + case approval.FieldDeciderTeamName: + m.ResetDeciderTeamName() return nil - case application.FieldCurrentExpiresAt: - m.ResetCurrentExpiresAt() + case approval.FieldDecisions: + m.ResetDecisions() return nil - case application.FieldSecretRotationPhase: - m.ResetSecretRotationPhase() + case approval.FieldAvailableTransitions: + m.ResetAvailableTransitions() return nil - case application.FieldSecretRotationMessage: - m.ResetSecretRotationMessage() + case approval.FieldName: + m.ResetName() + return nil + case approval.FieldState: + m.ResetState() return nil } - return fmt.Errorf("unknown Application field %s", name) + return fmt.Errorf("unknown Approval field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. -func (m *ApplicationMutation) AddedEdges() []string { - edges := make([]string, 0, 6) - if m.zone != nil { - edges = append(edges, application.EdgeZone) - } - if m.owner_team != nil { - edges = append(edges, application.EdgeOwnerTeam) - } - if m.exposed_apis != nil { - edges = append(edges, application.EdgeExposedApis) - } - if m.subscribed_apis != nil { - edges = append(edges, application.EdgeSubscribedApis) - } - if m.exposed_events != nil { - edges = append(edges, application.EdgeExposedEvents) +func (m *ApprovalMutation) AddedEdges() []string { + edges := make([]string, 0, 2) + if m.api_subscription != nil { + edges = append(edges, approval.EdgeAPISubscription) } - if m.subscribed_events != nil { - edges = append(edges, application.EdgeSubscribedEvents) + if m.event_subscription != nil { + edges = append(edges, approval.EdgeEventSubscription) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. -func (m *ApplicationMutation) AddedIDs(name string) []ent.Value { +func (m *ApprovalMutation) AddedIDs(name string) []ent.Value { switch name { - case application.EdgeZone: - if id := m.zone; id != nil { - return []ent.Value{*id} - } - case application.EdgeOwnerTeam: - if id := m.owner_team; id != nil { - return []ent.Value{*id} - } - case application.EdgeExposedApis: - ids := make([]ent.Value, 0, len(m.exposed_apis)) - for id := range m.exposed_apis { - ids = append(ids, id) - } - return ids - case application.EdgeSubscribedApis: - ids := make([]ent.Value, 0, len(m.subscribed_apis)) - for id := range m.subscribed_apis { - 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) + case approval.EdgeAPISubscription: + 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 ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. -func (m *ApplicationMutation) RemovedEdges() []string { - 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) - } +func (m *ApprovalMutation) 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 *ApplicationMutation) RemovedIDs(name string) []ent.Value { - switch name { - case application.EdgeExposedApis: - ids := make([]ent.Value, 0, len(m.removedexposed_apis)) - for id := range m.removedexposed_apis { - ids = append(ids, id) - } - return ids - case application.EdgeSubscribedApis: - ids := make([]ent.Value, 0, len(m.removedsubscribed_apis)) - for id := range m.removedsubscribed_apis { - 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 - } +func (m *ApprovalMutation) RemovedIDs(name string) []ent.Value { return nil } // ClearedEdges returns all edge names that were cleared in this mutation. -func (m *ApplicationMutation) ClearedEdges() []string { - edges := make([]string, 0, 6) - if m.clearedzone { - edges = append(edges, application.EdgeZone) - } - if m.clearedowner_team { - edges = append(edges, application.EdgeOwnerTeam) - } - if m.clearedexposed_apis { - edges = append(edges, application.EdgeExposedApis) - } - if m.clearedsubscribed_apis { - edges = append(edges, application.EdgeSubscribedApis) - } - if m.clearedexposed_events { - edges = append(edges, application.EdgeExposedEvents) +func (m *ApprovalMutation) ClearedEdges() []string { + edges := make([]string, 0, 2) + if m.clearedapi_subscription { + edges = append(edges, approval.EdgeAPISubscription) } - if m.clearedsubscribed_events { - edges = append(edges, application.EdgeSubscribedEvents) + if m.clearedevent_subscription { + edges = append(edges, approval.EdgeEventSubscription) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. -func (m *ApplicationMutation) EdgeCleared(name string) bool { +func (m *ApprovalMutation) EdgeCleared(name string) bool { switch name { - case application.EdgeZone: - return m.clearedzone - case application.EdgeOwnerTeam: - return m.clearedowner_team - case application.EdgeExposedApis: - 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 + case approval.EdgeAPISubscription: + return m.clearedapi_subscription + case approval.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 *ApplicationMutation) ClearEdge(name string) error { +func (m *ApprovalMutation) ClearEdge(name string) error { switch name { - case application.EdgeZone: - m.ClearZone() + case approval.EdgeAPISubscription: + m.ClearAPISubscription() return nil - case application.EdgeOwnerTeam: - m.ClearOwnerTeam() + case approval.EdgeEventSubscription: + m.ClearEventSubscription() return nil } - return fmt.Errorf("unknown Application unique edge %s", name) + return fmt.Errorf("unknown Approval 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 *ApplicationMutation) ResetEdge(name string) error { +func (m *ApprovalMutation) ResetEdge(name string) error { switch name { - case application.EdgeZone: - m.ResetZone() - return nil - case application.EdgeOwnerTeam: - m.ResetOwnerTeam() - return nil - case application.EdgeExposedApis: - m.ResetExposedApis() - return nil - case application.EdgeSubscribedApis: - m.ResetSubscribedApis() - return nil - case application.EdgeExposedEvents: - m.ResetExposedEvents() + case approval.EdgeAPISubscription: + m.ResetAPISubscription() return nil - case application.EdgeSubscribedEvents: - m.ResetSubscribedEvents() + case approval.EdgeEventSubscription: + m.ResetEventSubscription() return nil } - return fmt.Errorf("unknown Application edge %s", name) + return fmt.Errorf("unknown Approval edge %s", name) } -// ApprovalMutation represents an operation that mutates the Approval nodes in the graph. -type ApprovalMutation struct { +// ApprovalRequestMutation represents an operation that mutates the ApprovalRequest nodes in the graph. +type ApprovalRequestMutation struct { config op Op typ string id *int created_at *time.Time last_modified_at *time.Time - status_phase *approval.StatusPhase + status_phase *approvalrequest.StatusPhase status_message *string environment *string namespace *string action *string - strategy *approval.Strategy + strategy *approvalrequest.Strategy requester *model.RequesterInfo decider *model.DeciderInfo decider_team_name *string @@ -4232,28 +6802,28 @@ type ApprovalMutation struct { available_transitions *[]model.AvailableTransition appendavailable_transitions []model.AvailableTransition name *string - state *approval.State + state *approvalrequest.State 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 + oldValue func(context.Context) (*ApprovalRequest, error) + predicates []predicate.ApprovalRequest } -var _ ent.Mutation = (*ApprovalMutation)(nil) +var _ ent.Mutation = (*ApprovalRequestMutation)(nil) -// approvalOption allows management of the mutation configuration using functional options. -type approvalOption func(*ApprovalMutation) +// approvalrequestOption allows management of the mutation configuration using functional options. +type approvalrequestOption func(*ApprovalRequestMutation) -// newApprovalMutation creates new mutation for the Approval entity. -func newApprovalMutation(c config, op Op, opts ...approvalOption) *ApprovalMutation { - m := &ApprovalMutation{ +// newApprovalRequestMutation creates new mutation for the ApprovalRequest entity. +func newApprovalRequestMutation(c config, op Op, opts ...approvalrequestOption) *ApprovalRequestMutation { + m := &ApprovalRequestMutation{ config: c, op: op, - typ: TypeApproval, + typ: TypeApprovalRequest, clearedFields: make(map[string]struct{}), } for _, opt := range opts { @@ -4262,20 +6832,20 @@ func newApprovalMutation(c config, op Op, opts ...approvalOption) *ApprovalMutat return m } -// withApprovalID sets the ID field of the mutation. -func withApprovalID(id int) approvalOption { - return func(m *ApprovalMutation) { +// withApprovalRequestID sets the ID field of the mutation. +func withApprovalRequestID(id int) approvalrequestOption { + return func(m *ApprovalRequestMutation) { var ( err error once sync.Once - value *Approval + value *ApprovalRequest ) - m.oldValue = func(ctx context.Context) (*Approval, error) { + m.oldValue = func(ctx context.Context) (*ApprovalRequest, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { - value, err = m.Client().Approval.Get(ctx, id) + value, err = m.Client().ApprovalRequest.Get(ctx, id) } }) return value, err @@ -4284,10 +6854,10 @@ func withApprovalID(id int) approvalOption { } } -// withApproval sets the old Approval of the mutation. -func withApproval(node *Approval) approvalOption { - return func(m *ApprovalMutation) { - m.oldValue = func(context.Context) (*Approval, error) { +// withApprovalRequest sets the old ApprovalRequest of the mutation. +func withApprovalRequest(node *ApprovalRequest) approvalrequestOption { + return func(m *ApprovalRequestMutation) { + m.oldValue = func(context.Context) (*ApprovalRequest, error) { return node, nil } m.id = &node.ID @@ -4296,7 +6866,7 @@ func withApproval(node *Approval) approvalOption { // 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 ApprovalMutation) Client() *Client { +func (m ApprovalRequestMutation) Client() *Client { client := &Client{config: m.config} client.init() return client @@ -4304,7 +6874,7 @@ func (m ApprovalMutation) Client() *Client { // Tx returns an `ent.Tx` for mutations that were executed in transactions; // it returns an error otherwise. -func (m ApprovalMutation) Tx() (*Tx, error) { +func (m ApprovalRequestMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("ent: mutation is not running in a transaction") } @@ -4315,7 +6885,7 @@ func (m ApprovalMutation) Tx() (*Tx, error) { // 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 *ApprovalMutation) ID() (id int, exists bool) { +func (m *ApprovalRequestMutation) ID() (id int, exists bool) { if m.id == nil { return } @@ -4326,7 +6896,7 @@ func (m *ApprovalMutation) ID() (id int, exists bool) { // 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 *ApprovalMutation) IDs(ctx context.Context) ([]int, error) { +func (m *ApprovalRequestMutation) IDs(ctx context.Context) ([]int, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() @@ -4335,19 +6905,19 @@ func (m *ApprovalMutation) IDs(ctx context.Context) ([]int, error) { } fallthrough case m.op.Is(OpUpdate | OpDelete): - return m.Client().Approval.Query().Where(m.predicates...).IDs(ctx) + return m.Client().ApprovalRequest.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 *ApprovalMutation) SetCreatedAt(t time.Time) { +func (m *ApprovalRequestMutation) SetCreatedAt(t time.Time) { m.created_at = &t } // CreatedAt returns the value of the "created_at" field in the mutation. -func (m *ApprovalMutation) CreatedAt() (r time.Time, exists bool) { +func (m *ApprovalRequestMutation) CreatedAt() (r time.Time, exists bool) { v := m.created_at if v == nil { return @@ -4355,10 +6925,10 @@ func (m *ApprovalMutation) CreatedAt() (r time.Time, exists bool) { return *v, true } -// OldCreatedAt returns the old "created_at" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldCreatedAt returns the old "created_at" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { +func (m *ApprovalRequestMutation) 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") } @@ -4373,17 +6943,17 @@ func (m *ApprovalMutation) OldCreatedAt(ctx context.Context) (v time.Time, err e } // ResetCreatedAt resets all changes to the "created_at" field. -func (m *ApprovalMutation) ResetCreatedAt() { +func (m *ApprovalRequestMutation) ResetCreatedAt() { m.created_at = nil } // SetLastModifiedAt sets the "last_modified_at" field. -func (m *ApprovalMutation) SetLastModifiedAt(t time.Time) { +func (m *ApprovalRequestMutation) SetLastModifiedAt(t time.Time) { m.last_modified_at = &t } // LastModifiedAt returns the value of the "last_modified_at" field in the mutation. -func (m *ApprovalMutation) LastModifiedAt() (r time.Time, exists bool) { +func (m *ApprovalRequestMutation) LastModifiedAt() (r time.Time, exists bool) { v := m.last_modified_at if v == nil { return @@ -4391,10 +6961,10 @@ func (m *ApprovalMutation) LastModifiedAt() (r time.Time, exists bool) { return *v, true } -// OldLastModifiedAt returns the old "last_modified_at" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldLastModifiedAt returns the old "last_modified_at" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldLastModifiedAt(ctx context.Context) (v time.Time, err error) { +func (m *ApprovalRequestMutation) 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") } @@ -4409,17 +6979,17 @@ func (m *ApprovalMutation) OldLastModifiedAt(ctx context.Context) (v time.Time, } // ResetLastModifiedAt resets all changes to the "last_modified_at" field. -func (m *ApprovalMutation) ResetLastModifiedAt() { +func (m *ApprovalRequestMutation) ResetLastModifiedAt() { m.last_modified_at = nil } // SetStatusPhase sets the "status_phase" field. -func (m *ApprovalMutation) SetStatusPhase(ap approval.StatusPhase) { +func (m *ApprovalRequestMutation) SetStatusPhase(ap approvalrequest.StatusPhase) { m.status_phase = &ap } // StatusPhase returns the value of the "status_phase" field in the mutation. -func (m *ApprovalMutation) StatusPhase() (r approval.StatusPhase, exists bool) { +func (m *ApprovalRequestMutation) StatusPhase() (r approvalrequest.StatusPhase, exists bool) { v := m.status_phase if v == nil { return @@ -4427,10 +6997,10 @@ func (m *ApprovalMutation) StatusPhase() (r approval.StatusPhase, exists bool) { return *v, true } -// OldStatusPhase returns the old "status_phase" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldStatusPhase returns the old "status_phase" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldStatusPhase(ctx context.Context) (v *approval.StatusPhase, err error) { +func (m *ApprovalRequestMutation) OldStatusPhase(ctx context.Context) (v *approvalrequest.StatusPhase, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStatusPhase is only allowed on UpdateOne operations") } @@ -4445,30 +7015,30 @@ func (m *ApprovalMutation) OldStatusPhase(ctx context.Context) (v *approval.Stat } // ClearStatusPhase clears the value of the "status_phase" field. -func (m *ApprovalMutation) ClearStatusPhase() { +func (m *ApprovalRequestMutation) ClearStatusPhase() { m.status_phase = nil - m.clearedFields[approval.FieldStatusPhase] = struct{}{} + m.clearedFields[approvalrequest.FieldStatusPhase] = struct{}{} } // StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. -func (m *ApprovalMutation) StatusPhaseCleared() bool { - _, ok := m.clearedFields[approval.FieldStatusPhase] +func (m *ApprovalRequestMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[approvalrequest.FieldStatusPhase] return ok } // ResetStatusPhase resets all changes to the "status_phase" field. -func (m *ApprovalMutation) ResetStatusPhase() { +func (m *ApprovalRequestMutation) ResetStatusPhase() { m.status_phase = nil - delete(m.clearedFields, approval.FieldStatusPhase) + delete(m.clearedFields, approvalrequest.FieldStatusPhase) } // SetStatusMessage sets the "status_message" field. -func (m *ApprovalMutation) SetStatusMessage(s string) { +func (m *ApprovalRequestMutation) SetStatusMessage(s string) { m.status_message = &s } // StatusMessage returns the value of the "status_message" field in the mutation. -func (m *ApprovalMutation) StatusMessage() (r string, exists bool) { +func (m *ApprovalRequestMutation) StatusMessage() (r string, exists bool) { v := m.status_message if v == nil { return @@ -4476,10 +7046,10 @@ func (m *ApprovalMutation) StatusMessage() (r string, exists bool) { return *v, true } -// OldStatusMessage returns the old "status_message" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldStatusMessage returns the old "status_message" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { +func (m *ApprovalRequestMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStatusMessage is only allowed on UpdateOne operations") } @@ -4494,30 +7064,30 @@ func (m *ApprovalMutation) OldStatusMessage(ctx context.Context) (v *string, err } // ClearStatusMessage clears the value of the "status_message" field. -func (m *ApprovalMutation) ClearStatusMessage() { +func (m *ApprovalRequestMutation) ClearStatusMessage() { m.status_message = nil - m.clearedFields[approval.FieldStatusMessage] = struct{}{} + m.clearedFields[approvalrequest.FieldStatusMessage] = struct{}{} } // StatusMessageCleared returns if the "status_message" field was cleared in this mutation. -func (m *ApprovalMutation) StatusMessageCleared() bool { - _, ok := m.clearedFields[approval.FieldStatusMessage] +func (m *ApprovalRequestMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[approvalrequest.FieldStatusMessage] return ok } // ResetStatusMessage resets all changes to the "status_message" field. -func (m *ApprovalMutation) ResetStatusMessage() { +func (m *ApprovalRequestMutation) ResetStatusMessage() { m.status_message = nil - delete(m.clearedFields, approval.FieldStatusMessage) + delete(m.clearedFields, approvalrequest.FieldStatusMessage) } // SetEnvironment sets the "environment" field. -func (m *ApprovalMutation) SetEnvironment(s string) { +func (m *ApprovalRequestMutation) SetEnvironment(s string) { m.environment = &s } // Environment returns the value of the "environment" field in the mutation. -func (m *ApprovalMutation) Environment() (r string, exists bool) { +func (m *ApprovalRequestMutation) Environment() (r string, exists bool) { v := m.environment if v == nil { return @@ -4525,10 +7095,10 @@ func (m *ApprovalMutation) Environment() (r string, exists bool) { return *v, true } -// OldEnvironment returns the old "environment" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldEnvironment returns the old "environment" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldEnvironment(ctx context.Context) (v *string, err error) { +func (m *ApprovalRequestMutation) OldEnvironment(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldEnvironment is only allowed on UpdateOne operations") } @@ -4543,30 +7113,30 @@ func (m *ApprovalMutation) OldEnvironment(ctx context.Context) (v *string, err e } // ClearEnvironment clears the value of the "environment" field. -func (m *ApprovalMutation) ClearEnvironment() { +func (m *ApprovalRequestMutation) ClearEnvironment() { m.environment = nil - m.clearedFields[approval.FieldEnvironment] = struct{}{} + m.clearedFields[approvalrequest.FieldEnvironment] = struct{}{} } // EnvironmentCleared returns if the "environment" field was cleared in this mutation. -func (m *ApprovalMutation) EnvironmentCleared() bool { - _, ok := m.clearedFields[approval.FieldEnvironment] +func (m *ApprovalRequestMutation) EnvironmentCleared() bool { + _, ok := m.clearedFields[approvalrequest.FieldEnvironment] return ok } // ResetEnvironment resets all changes to the "environment" field. -func (m *ApprovalMutation) ResetEnvironment() { +func (m *ApprovalRequestMutation) ResetEnvironment() { m.environment = nil - delete(m.clearedFields, approval.FieldEnvironment) + delete(m.clearedFields, approvalrequest.FieldEnvironment) } // SetNamespace sets the "namespace" field. -func (m *ApprovalMutation) SetNamespace(s string) { +func (m *ApprovalRequestMutation) SetNamespace(s string) { m.namespace = &s } // Namespace returns the value of the "namespace" field in the mutation. -func (m *ApprovalMutation) Namespace() (r string, exists bool) { +func (m *ApprovalRequestMutation) Namespace() (r string, exists bool) { v := m.namespace if v == nil { return @@ -4574,10 +7144,10 @@ func (m *ApprovalMutation) Namespace() (r string, exists bool) { return *v, true } -// OldNamespace returns the old "namespace" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldNamespace returns the old "namespace" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldNamespace(ctx context.Context) (v string, err error) { +func (m *ApprovalRequestMutation) OldNamespace(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldNamespace is only allowed on UpdateOne operations") } @@ -4592,17 +7162,17 @@ func (m *ApprovalMutation) OldNamespace(ctx context.Context) (v string, err erro } // ResetNamespace resets all changes to the "namespace" field. -func (m *ApprovalMutation) ResetNamespace() { +func (m *ApprovalRequestMutation) ResetNamespace() { m.namespace = nil } // SetAction sets the "action" field. -func (m *ApprovalMutation) SetAction(s string) { +func (m *ApprovalRequestMutation) SetAction(s string) { m.action = &s } // Action returns the value of the "action" field in the mutation. -func (m *ApprovalMutation) Action() (r string, exists bool) { +func (m *ApprovalRequestMutation) Action() (r string, exists bool) { v := m.action if v == nil { return @@ -4610,10 +7180,10 @@ func (m *ApprovalMutation) Action() (r string, exists bool) { return *v, true } -// OldAction returns the old "action" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldAction returns the old "action" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldAction(ctx context.Context) (v string, err error) { +func (m *ApprovalRequestMutation) OldAction(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldAction is only allowed on UpdateOne operations") } @@ -4628,17 +7198,17 @@ func (m *ApprovalMutation) OldAction(ctx context.Context) (v string, err error) } // ResetAction resets all changes to the "action" field. -func (m *ApprovalMutation) ResetAction() { +func (m *ApprovalRequestMutation) ResetAction() { m.action = nil } // SetStrategy sets the "strategy" field. -func (m *ApprovalMutation) SetStrategy(a approval.Strategy) { +func (m *ApprovalRequestMutation) SetStrategy(a approvalrequest.Strategy) { m.strategy = &a } // Strategy returns the value of the "strategy" field in the mutation. -func (m *ApprovalMutation) Strategy() (r approval.Strategy, exists bool) { +func (m *ApprovalRequestMutation) Strategy() (r approvalrequest.Strategy, exists bool) { v := m.strategy if v == nil { return @@ -4646,10 +7216,10 @@ func (m *ApprovalMutation) Strategy() (r approval.Strategy, exists bool) { return *v, true } -// OldStrategy returns the old "strategy" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldStrategy returns the old "strategy" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldStrategy(ctx context.Context) (v approval.Strategy, err error) { +func (m *ApprovalRequestMutation) OldStrategy(ctx context.Context) (v approvalrequest.Strategy, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStrategy is only allowed on UpdateOne operations") } @@ -4664,17 +7234,17 @@ func (m *ApprovalMutation) OldStrategy(ctx context.Context) (v approval.Strategy } // ResetStrategy resets all changes to the "strategy" field. -func (m *ApprovalMutation) ResetStrategy() { +func (m *ApprovalRequestMutation) ResetStrategy() { m.strategy = nil } // SetRequester sets the "requester" field. -func (m *ApprovalMutation) SetRequester(mi model.RequesterInfo) { +func (m *ApprovalRequestMutation) SetRequester(mi model.RequesterInfo) { m.requester = &mi } // Requester returns the value of the "requester" field in the mutation. -func (m *ApprovalMutation) Requester() (r model.RequesterInfo, exists bool) { +func (m *ApprovalRequestMutation) Requester() (r model.RequesterInfo, exists bool) { v := m.requester if v == nil { return @@ -4682,10 +7252,10 @@ func (m *ApprovalMutation) Requester() (r model.RequesterInfo, exists bool) { return *v, true } -// OldRequester returns the old "requester" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldRequester returns the old "requester" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldRequester(ctx context.Context) (v model.RequesterInfo, err error) { +func (m *ApprovalRequestMutation) OldRequester(ctx context.Context) (v model.RequesterInfo, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldRequester is only allowed on UpdateOne operations") } @@ -4700,17 +7270,17 @@ func (m *ApprovalMutation) OldRequester(ctx context.Context) (v model.RequesterI } // ResetRequester resets all changes to the "requester" field. -func (m *ApprovalMutation) ResetRequester() { +func (m *ApprovalRequestMutation) ResetRequester() { m.requester = nil } // SetDecider sets the "decider" field. -func (m *ApprovalMutation) SetDecider(mi model.DeciderInfo) { +func (m *ApprovalRequestMutation) SetDecider(mi model.DeciderInfo) { m.decider = &mi } // Decider returns the value of the "decider" field in the mutation. -func (m *ApprovalMutation) Decider() (r model.DeciderInfo, exists bool) { +func (m *ApprovalRequestMutation) Decider() (r model.DeciderInfo, exists bool) { v := m.decider if v == nil { return @@ -4718,10 +7288,10 @@ func (m *ApprovalMutation) Decider() (r model.DeciderInfo, exists bool) { return *v, true } -// OldDecider returns the old "decider" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldDecider returns the old "decider" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldDecider(ctx context.Context) (v model.DeciderInfo, err error) { +func (m *ApprovalRequestMutation) OldDecider(ctx context.Context) (v model.DeciderInfo, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldDecider is only allowed on UpdateOne operations") } @@ -4736,17 +7306,17 @@ func (m *ApprovalMutation) OldDecider(ctx context.Context) (v model.DeciderInfo, } // ResetDecider resets all changes to the "decider" field. -func (m *ApprovalMutation) ResetDecider() { +func (m *ApprovalRequestMutation) ResetDecider() { m.decider = nil } // SetDeciderTeamName sets the "decider_team_name" field. -func (m *ApprovalMutation) SetDeciderTeamName(s string) { +func (m *ApprovalRequestMutation) SetDeciderTeamName(s string) { m.decider_team_name = &s } // DeciderTeamName returns the value of the "decider_team_name" field in the mutation. -func (m *ApprovalMutation) DeciderTeamName() (r string, exists bool) { +func (m *ApprovalRequestMutation) DeciderTeamName() (r string, exists bool) { v := m.decider_team_name if v == nil { return @@ -4754,10 +7324,10 @@ func (m *ApprovalMutation) DeciderTeamName() (r string, exists bool) { return *v, true } -// OldDeciderTeamName returns the old "decider_team_name" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldDeciderTeamName returns the old "decider_team_name" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldDeciderTeamName(ctx context.Context) (v string, err error) { +func (m *ApprovalRequestMutation) OldDeciderTeamName(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldDeciderTeamName is only allowed on UpdateOne operations") } @@ -4772,18 +7342,18 @@ func (m *ApprovalMutation) OldDeciderTeamName(ctx context.Context) (v string, er } // ResetDeciderTeamName resets all changes to the "decider_team_name" field. -func (m *ApprovalMutation) ResetDeciderTeamName() { +func (m *ApprovalRequestMutation) ResetDeciderTeamName() { m.decider_team_name = nil } // SetDecisions sets the "decisions" field. -func (m *ApprovalMutation) SetDecisions(value []model.Decision) { +func (m *ApprovalRequestMutation) SetDecisions(value []model.Decision) { m.decisions = &value m.appenddecisions = nil } // Decisions returns the value of the "decisions" field in the mutation. -func (m *ApprovalMutation) Decisions() (r []model.Decision, exists bool) { +func (m *ApprovalRequestMutation) Decisions() (r []model.Decision, exists bool) { v := m.decisions if v == nil { return @@ -4791,10 +7361,10 @@ func (m *ApprovalMutation) Decisions() (r []model.Decision, exists bool) { return *v, true } -// OldDecisions returns the old "decisions" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldDecisions returns the old "decisions" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldDecisions(ctx context.Context) (v []model.Decision, err error) { +func (m *ApprovalRequestMutation) OldDecisions(ctx context.Context) (v []model.Decision, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldDecisions is only allowed on UpdateOne operations") } @@ -4809,12 +7379,12 @@ func (m *ApprovalMutation) OldDecisions(ctx context.Context) (v []model.Decision } // AppendDecisions adds value to the "decisions" field. -func (m *ApprovalMutation) AppendDecisions(value []model.Decision) { +func (m *ApprovalRequestMutation) AppendDecisions(value []model.Decision) { m.appenddecisions = append(m.appenddecisions, value...) } // AppendedDecisions returns the list of values that were appended to the "decisions" field in this mutation. -func (m *ApprovalMutation) AppendedDecisions() ([]model.Decision, bool) { +func (m *ApprovalRequestMutation) AppendedDecisions() ([]model.Decision, bool) { if len(m.appenddecisions) == 0 { return nil, false } @@ -4822,19 +7392,19 @@ func (m *ApprovalMutation) AppendedDecisions() ([]model.Decision, bool) { } // ResetDecisions resets all changes to the "decisions" field. -func (m *ApprovalMutation) ResetDecisions() { +func (m *ApprovalRequestMutation) ResetDecisions() { m.decisions = nil m.appenddecisions = nil } // SetAvailableTransitions sets the "available_transitions" field. -func (m *ApprovalMutation) SetAvailableTransitions(mt []model.AvailableTransition) { +func (m *ApprovalRequestMutation) SetAvailableTransitions(mt []model.AvailableTransition) { m.available_transitions = &mt m.appendavailable_transitions = nil } // AvailableTransitions returns the value of the "available_transitions" field in the mutation. -func (m *ApprovalMutation) AvailableTransitions() (r []model.AvailableTransition, exists bool) { +func (m *ApprovalRequestMutation) AvailableTransitions() (r []model.AvailableTransition, exists bool) { v := m.available_transitions if v == nil { return @@ -4842,10 +7412,10 @@ func (m *ApprovalMutation) AvailableTransitions() (r []model.AvailableTransition return *v, true } -// OldAvailableTransitions returns the old "available_transitions" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldAvailableTransitions returns the old "available_transitions" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldAvailableTransitions(ctx context.Context) (v []model.AvailableTransition, err error) { +func (m *ApprovalRequestMutation) OldAvailableTransitions(ctx context.Context) (v []model.AvailableTransition, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldAvailableTransitions is only allowed on UpdateOne operations") } @@ -4860,12 +7430,12 @@ func (m *ApprovalMutation) OldAvailableTransitions(ctx context.Context) (v []mod } // AppendAvailableTransitions adds mt to the "available_transitions" field. -func (m *ApprovalMutation) AppendAvailableTransitions(mt []model.AvailableTransition) { +func (m *ApprovalRequestMutation) AppendAvailableTransitions(mt []model.AvailableTransition) { m.appendavailable_transitions = append(m.appendavailable_transitions, mt...) } // AppendedAvailableTransitions returns the list of values that were appended to the "available_transitions" field in this mutation. -func (m *ApprovalMutation) AppendedAvailableTransitions() ([]model.AvailableTransition, bool) { +func (m *ApprovalRequestMutation) AppendedAvailableTransitions() ([]model.AvailableTransition, bool) { if len(m.appendavailable_transitions) == 0 { return nil, false } @@ -4873,32 +7443,32 @@ func (m *ApprovalMutation) AppendedAvailableTransitions() ([]model.AvailableTran } // ClearAvailableTransitions clears the value of the "available_transitions" field. -func (m *ApprovalMutation) ClearAvailableTransitions() { +func (m *ApprovalRequestMutation) ClearAvailableTransitions() { m.available_transitions = nil m.appendavailable_transitions = nil - m.clearedFields[approval.FieldAvailableTransitions] = struct{}{} + m.clearedFields[approvalrequest.FieldAvailableTransitions] = struct{}{} } // AvailableTransitionsCleared returns if the "available_transitions" field was cleared in this mutation. -func (m *ApprovalMutation) AvailableTransitionsCleared() bool { - _, ok := m.clearedFields[approval.FieldAvailableTransitions] +func (m *ApprovalRequestMutation) AvailableTransitionsCleared() bool { + _, ok := m.clearedFields[approvalrequest.FieldAvailableTransitions] return ok } // ResetAvailableTransitions resets all changes to the "available_transitions" field. -func (m *ApprovalMutation) ResetAvailableTransitions() { +func (m *ApprovalRequestMutation) ResetAvailableTransitions() { m.available_transitions = nil m.appendavailable_transitions = nil - delete(m.clearedFields, approval.FieldAvailableTransitions) + delete(m.clearedFields, approvalrequest.FieldAvailableTransitions) } // SetName sets the "name" field. -func (m *ApprovalMutation) SetName(s string) { +func (m *ApprovalRequestMutation) SetName(s string) { m.name = &s } // Name returns the value of the "name" field in the mutation. -func (m *ApprovalMutation) Name() (r string, exists bool) { +func (m *ApprovalRequestMutation) Name() (r string, exists bool) { v := m.name if v == nil { return @@ -4906,10 +7476,10 @@ func (m *ApprovalMutation) Name() (r string, exists bool) { return *v, true } -// OldName returns the old "name" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldName returns the old "name" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldName(ctx context.Context) (v string, err error) { +func (m *ApprovalRequestMutation) OldName(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldName is only allowed on UpdateOne operations") } @@ -4924,17 +7494,17 @@ func (m *ApprovalMutation) OldName(ctx context.Context) (v string, err error) { } // ResetName resets all changes to the "name" field. -func (m *ApprovalMutation) ResetName() { +func (m *ApprovalRequestMutation) ResetName() { m.name = nil } // SetState sets the "state" field. -func (m *ApprovalMutation) SetState(a approval.State) { +func (m *ApprovalRequestMutation) SetState(a approvalrequest.State) { m.state = &a } // State returns the value of the "state" field in the mutation. -func (m *ApprovalMutation) State() (r approval.State, exists bool) { +func (m *ApprovalRequestMutation) State() (r approvalrequest.State, exists bool) { v := m.state if v == nil { return @@ -4942,10 +7512,10 @@ func (m *ApprovalMutation) State() (r approval.State, exists bool) { return *v, true } -// OldState returns the old "state" field's value of the Approval entity. -// If the Approval object wasn't provided to the builder, the object is fetched from the database. +// OldState returns the old "state" field's value of the ApprovalRequest entity. +// If the ApprovalRequest 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 *ApprovalMutation) OldState(ctx context.Context) (v approval.State, err error) { +func (m *ApprovalRequestMutation) OldState(ctx context.Context) (v approvalrequest.State, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldState is only allowed on UpdateOne operations") } @@ -4960,27 +7530,27 @@ func (m *ApprovalMutation) OldState(ctx context.Context) (v approval.State, err } // ResetState resets all changes to the "state" field. -func (m *ApprovalMutation) ResetState() { +func (m *ApprovalRequestMutation) ResetState() { m.state = nil } // SetAPISubscriptionID sets the "api_subscription" edge to the ApiSubscription entity by id. -func (m *ApprovalMutation) SetAPISubscriptionID(id int) { +func (m *ApprovalRequestMutation) SetAPISubscriptionID(id int) { m.api_subscription = &id } // ClearAPISubscription clears the "api_subscription" edge to the ApiSubscription entity. -func (m *ApprovalMutation) ClearAPISubscription() { +func (m *ApprovalRequestMutation) ClearAPISubscription() { m.clearedapi_subscription = true } // APISubscriptionCleared reports if the "api_subscription" edge to the ApiSubscription entity was cleared. -func (m *ApprovalMutation) APISubscriptionCleared() bool { +func (m *ApprovalRequestMutation) APISubscriptionCleared() bool { return m.clearedapi_subscription } // APISubscriptionID returns the "api_subscription" edge ID in the mutation. -func (m *ApprovalMutation) APISubscriptionID() (id int, exists bool) { +func (m *ApprovalRequestMutation) APISubscriptionID() (id int, exists bool) { if m.api_subscription != nil { return *m.api_subscription, true } @@ -4990,7 +7560,7 @@ func (m *ApprovalMutation) APISubscriptionID() (id int, exists bool) { // APISubscriptionIDs returns the "api_subscription" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // APISubscriptionID instead. It exists only for internal usage by the builders. -func (m *ApprovalMutation) APISubscriptionIDs() (ids []int) { +func (m *ApprovalRequestMutation) APISubscriptionIDs() (ids []int) { if id := m.api_subscription; id != nil { ids = append(ids, *id) } @@ -4998,28 +7568,28 @@ func (m *ApprovalMutation) APISubscriptionIDs() (ids []int) { } // ResetAPISubscription resets all changes to the "api_subscription" edge. -func (m *ApprovalMutation) ResetAPISubscription() { +func (m *ApprovalRequestMutation) ResetAPISubscription() { m.api_subscription = nil m.clearedapi_subscription = false } // SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by id. -func (m *ApprovalMutation) SetEventSubscriptionID(id int) { +func (m *ApprovalRequestMutation) SetEventSubscriptionID(id int) { m.event_subscription = &id } // ClearEventSubscription clears the "event_subscription" edge to the EventSubscription entity. -func (m *ApprovalMutation) ClearEventSubscription() { +func (m *ApprovalRequestMutation) ClearEventSubscription() { m.clearedevent_subscription = true } // EventSubscriptionCleared reports if the "event_subscription" edge to the EventSubscription entity was cleared. -func (m *ApprovalMutation) EventSubscriptionCleared() bool { +func (m *ApprovalRequestMutation) EventSubscriptionCleared() bool { return m.clearedevent_subscription } // EventSubscriptionID returns the "event_subscription" edge ID in the mutation. -func (m *ApprovalMutation) EventSubscriptionID() (id int, exists bool) { +func (m *ApprovalRequestMutation) EventSubscriptionID() (id int, exists bool) { if m.event_subscription != nil { return *m.event_subscription, true } @@ -5029,7 +7599,7 @@ func (m *ApprovalMutation) EventSubscriptionID() (id int, exists bool) { // 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) { +func (m *ApprovalRequestMutation) EventSubscriptionIDs() (ids []int) { if id := m.event_subscription; id != nil { ids = append(ids, *id) } @@ -5037,20 +7607,20 @@ func (m *ApprovalMutation) EventSubscriptionIDs() (ids []int) { } // ResetEventSubscription resets all changes to the "event_subscription" edge. -func (m *ApprovalMutation) ResetEventSubscription() { +func (m *ApprovalRequestMutation) 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) { +// Where appends a list predicates to the ApprovalRequestMutation builder. +func (m *ApprovalRequestMutation) Where(ps ...predicate.ApprovalRequest) { m.predicates = append(m.predicates, ps...) } -// WhereP appends storage-level predicates to the ApprovalMutation builder. Using this method, +// WhereP appends storage-level predicates to the ApprovalRequestMutation 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)) +func (m *ApprovalRequestMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.ApprovalRequest, len(ps)) for i := range ps { p[i] = ps[i] } @@ -5058,69 +7628,69 @@ func (m *ApprovalMutation) WhereP(ps ...func(*sql.Selector)) { } // Op returns the operation name. -func (m *ApprovalMutation) Op() Op { +func (m *ApprovalRequestMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. -func (m *ApprovalMutation) SetOp(op Op) { +func (m *ApprovalRequestMutation) SetOp(op Op) { m.op = op } -// Type returns the node type of this mutation (Approval). -func (m *ApprovalMutation) Type() string { +// Type returns the node type of this mutation (ApprovalRequest). +func (m *ApprovalRequestMutation) 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 *ApprovalMutation) Fields() []string { +func (m *ApprovalRequestMutation) Fields() []string { fields := make([]string, 0, 15) if m.created_at != nil { - fields = append(fields, approval.FieldCreatedAt) + fields = append(fields, approvalrequest.FieldCreatedAt) } if m.last_modified_at != nil { - fields = append(fields, approval.FieldLastModifiedAt) + fields = append(fields, approvalrequest.FieldLastModifiedAt) } if m.status_phase != nil { - fields = append(fields, approval.FieldStatusPhase) + fields = append(fields, approvalrequest.FieldStatusPhase) } if m.status_message != nil { - fields = append(fields, approval.FieldStatusMessage) + fields = append(fields, approvalrequest.FieldStatusMessage) } if m.environment != nil { - fields = append(fields, approval.FieldEnvironment) + fields = append(fields, approvalrequest.FieldEnvironment) } if m.namespace != nil { - fields = append(fields, approval.FieldNamespace) + fields = append(fields, approvalrequest.FieldNamespace) } if m.action != nil { - fields = append(fields, approval.FieldAction) + fields = append(fields, approvalrequest.FieldAction) } if m.strategy != nil { - fields = append(fields, approval.FieldStrategy) + fields = append(fields, approvalrequest.FieldStrategy) } if m.requester != nil { - fields = append(fields, approval.FieldRequester) + fields = append(fields, approvalrequest.FieldRequester) } if m.decider != nil { - fields = append(fields, approval.FieldDecider) + fields = append(fields, approvalrequest.FieldDecider) } if m.decider_team_name != nil { - fields = append(fields, approval.FieldDeciderTeamName) + fields = append(fields, approvalrequest.FieldDeciderTeamName) } if m.decisions != nil { - fields = append(fields, approval.FieldDecisions) + fields = append(fields, approvalrequest.FieldDecisions) } if m.available_transitions != nil { - fields = append(fields, approval.FieldAvailableTransitions) + fields = append(fields, approvalrequest.FieldAvailableTransitions) } if m.name != nil { - fields = append(fields, approval.FieldName) + fields = append(fields, approvalrequest.FieldName) } if m.state != nil { - fields = append(fields, approval.FieldState) + fields = append(fields, approvalrequest.FieldState) } return fields } @@ -5128,37 +7698,37 @@ func (m *ApprovalMutation) Fields() []string { // 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 *ApprovalMutation) Field(name string) (ent.Value, bool) { +func (m *ApprovalRequestMutation) Field(name string) (ent.Value, bool) { switch name { - case approval.FieldCreatedAt: + case approvalrequest.FieldCreatedAt: return m.CreatedAt() - case approval.FieldLastModifiedAt: + case approvalrequest.FieldLastModifiedAt: return m.LastModifiedAt() - case approval.FieldStatusPhase: + case approvalrequest.FieldStatusPhase: return m.StatusPhase() - case approval.FieldStatusMessage: + case approvalrequest.FieldStatusMessage: return m.StatusMessage() - case approval.FieldEnvironment: + case approvalrequest.FieldEnvironment: return m.Environment() - case approval.FieldNamespace: + case approvalrequest.FieldNamespace: return m.Namespace() - case approval.FieldAction: + case approvalrequest.FieldAction: return m.Action() - case approval.FieldStrategy: + case approvalrequest.FieldStrategy: return m.Strategy() - case approval.FieldRequester: + case approvalrequest.FieldRequester: return m.Requester() - case approval.FieldDecider: + case approvalrequest.FieldDecider: return m.Decider() - case approval.FieldDeciderTeamName: + case approvalrequest.FieldDeciderTeamName: return m.DeciderTeamName() - case approval.FieldDecisions: + case approvalrequest.FieldDecisions: return m.Decisions() - case approval.FieldAvailableTransitions: + case approvalrequest.FieldAvailableTransitions: return m.AvailableTransitions() - case approval.FieldName: + case approvalrequest.FieldName: return m.Name() - case approval.FieldState: + case approvalrequest.FieldState: return m.State() } return nil, false @@ -5167,298 +7737,298 @@ func (m *ApprovalMutation) Field(name string) (ent.Value, bool) { // 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 *ApprovalMutation) OldField(ctx context.Context, name string) (ent.Value, error) { +func (m *ApprovalRequestMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { - case approval.FieldCreatedAt: + case approvalrequest.FieldCreatedAt: return m.OldCreatedAt(ctx) - case approval.FieldLastModifiedAt: + case approvalrequest.FieldLastModifiedAt: return m.OldLastModifiedAt(ctx) - case approval.FieldStatusPhase: + case approvalrequest.FieldStatusPhase: return m.OldStatusPhase(ctx) - case approval.FieldStatusMessage: + case approvalrequest.FieldStatusMessage: return m.OldStatusMessage(ctx) - case approval.FieldEnvironment: + case approvalrequest.FieldEnvironment: return m.OldEnvironment(ctx) - case approval.FieldNamespace: + case approvalrequest.FieldNamespace: return m.OldNamespace(ctx) - case approval.FieldAction: + case approvalrequest.FieldAction: return m.OldAction(ctx) - case approval.FieldStrategy: + case approvalrequest.FieldStrategy: return m.OldStrategy(ctx) - case approval.FieldRequester: + case approvalrequest.FieldRequester: return m.OldRequester(ctx) - case approval.FieldDecider: + case approvalrequest.FieldDecider: return m.OldDecider(ctx) - case approval.FieldDeciderTeamName: + case approvalrequest.FieldDeciderTeamName: return m.OldDeciderTeamName(ctx) - case approval.FieldDecisions: + case approvalrequest.FieldDecisions: return m.OldDecisions(ctx) - case approval.FieldAvailableTransitions: + case approvalrequest.FieldAvailableTransitions: return m.OldAvailableTransitions(ctx) - case approval.FieldName: + case approvalrequest.FieldName: return m.OldName(ctx) - case approval.FieldState: + case approvalrequest.FieldState: return m.OldState(ctx) } - return nil, fmt.Errorf("unknown Approval field %s", name) + 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 *ApprovalMutation) SetField(name string, value ent.Value) error { +func (m *ApprovalRequestMutation) SetField(name string, value ent.Value) error { switch name { - case approval.FieldCreatedAt: + 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 approval.FieldLastModifiedAt: + 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 approval.FieldStatusPhase: - v, ok := value.(approval.StatusPhase) + 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 approval.FieldStatusMessage: + 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 approval.FieldEnvironment: + 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 approval.FieldNamespace: + 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 approval.FieldAction: + 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 approval.FieldStrategy: - v, ok := value.(approval.Strategy) + 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 approval.FieldRequester: + 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 approval.FieldDecider: + 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 approval.FieldDeciderTeamName: + 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 approval.FieldDecisions: + 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 approval.FieldAvailableTransitions: + 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 approval.FieldName: + 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 approval.FieldState: - v, ok := value.(approval.State) + 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 Approval field %s", name) + return fmt.Errorf("unknown ApprovalRequest field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. -func (m *ApprovalMutation) AddedFields() []string { +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 *ApprovalMutation) AddedField(name string) (ent.Value, bool) { +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 *ApprovalMutation) AddField(name string, value ent.Value) error { +func (m *ApprovalRequestMutation) AddField(name string, value ent.Value) error { switch name { } - return fmt.Errorf("unknown Approval numeric field %s", name) + return fmt.Errorf("unknown ApprovalRequest numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. -func (m *ApprovalMutation) ClearedFields() []string { +func (m *ApprovalRequestMutation) ClearedFields() []string { var fields []string - if m.FieldCleared(approval.FieldStatusPhase) { - fields = append(fields, approval.FieldStatusPhase) + if m.FieldCleared(approvalrequest.FieldStatusPhase) { + fields = append(fields, approvalrequest.FieldStatusPhase) } - if m.FieldCleared(approval.FieldStatusMessage) { - fields = append(fields, approval.FieldStatusMessage) + if m.FieldCleared(approvalrequest.FieldStatusMessage) { + fields = append(fields, approvalrequest.FieldStatusMessage) } - if m.FieldCleared(approval.FieldEnvironment) { - fields = append(fields, approval.FieldEnvironment) + if m.FieldCleared(approvalrequest.FieldEnvironment) { + fields = append(fields, approvalrequest.FieldEnvironment) } - if m.FieldCleared(approval.FieldAvailableTransitions) { - fields = append(fields, approval.FieldAvailableTransitions) + 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 *ApprovalMutation) FieldCleared(name string) bool { +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 *ApprovalMutation) ClearField(name string) error { +func (m *ApprovalRequestMutation) ClearField(name string) error { switch name { - case approval.FieldStatusPhase: + case approvalrequest.FieldStatusPhase: m.ClearStatusPhase() return nil - case approval.FieldStatusMessage: + case approvalrequest.FieldStatusMessage: m.ClearStatusMessage() return nil - case approval.FieldEnvironment: + case approvalrequest.FieldEnvironment: m.ClearEnvironment() return nil - case approval.FieldAvailableTransitions: + case approvalrequest.FieldAvailableTransitions: m.ClearAvailableTransitions() return nil } - return fmt.Errorf("unknown Approval nullable field %s", name) + 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 *ApprovalMutation) ResetField(name string) error { +func (m *ApprovalRequestMutation) ResetField(name string) error { switch name { - case approval.FieldCreatedAt: + case approvalrequest.FieldCreatedAt: m.ResetCreatedAt() return nil - case approval.FieldLastModifiedAt: + case approvalrequest.FieldLastModifiedAt: m.ResetLastModifiedAt() return nil - case approval.FieldStatusPhase: + case approvalrequest.FieldStatusPhase: m.ResetStatusPhase() return nil - case approval.FieldStatusMessage: + case approvalrequest.FieldStatusMessage: m.ResetStatusMessage() return nil - case approval.FieldEnvironment: + case approvalrequest.FieldEnvironment: m.ResetEnvironment() return nil - case approval.FieldNamespace: + case approvalrequest.FieldNamespace: m.ResetNamespace() return nil - case approval.FieldAction: + case approvalrequest.FieldAction: m.ResetAction() return nil - case approval.FieldStrategy: + case approvalrequest.FieldStrategy: m.ResetStrategy() return nil - case approval.FieldRequester: + case approvalrequest.FieldRequester: m.ResetRequester() return nil - case approval.FieldDecider: + case approvalrequest.FieldDecider: m.ResetDecider() return nil - case approval.FieldDeciderTeamName: + case approvalrequest.FieldDeciderTeamName: m.ResetDeciderTeamName() return nil - case approval.FieldDecisions: + case approvalrequest.FieldDecisions: m.ResetDecisions() return nil - case approval.FieldAvailableTransitions: + case approvalrequest.FieldAvailableTransitions: m.ResetAvailableTransitions() return nil - case approval.FieldName: + case approvalrequest.FieldName: m.ResetName() return nil - case approval.FieldState: + case approvalrequest.FieldState: m.ResetState() return nil } - return fmt.Errorf("unknown Approval field %s", name) + return fmt.Errorf("unknown ApprovalRequest field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. -func (m *ApprovalMutation) AddedEdges() []string { +func (m *ApprovalRequestMutation) AddedEdges() []string { edges := make([]string, 0, 2) if m.api_subscription != nil { - edges = append(edges, approval.EdgeAPISubscription) + edges = append(edges, approvalrequest.EdgeAPISubscription) } if m.event_subscription != nil { - edges = append(edges, approval.EdgeEventSubscription) + 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 *ApprovalMutation) AddedIDs(name string) []ent.Value { +func (m *ApprovalRequestMutation) AddedIDs(name string) []ent.Value { switch name { - case approval.EdgeAPISubscription: + case approvalrequest.EdgeAPISubscription: if id := m.api_subscription; id != nil { return []ent.Value{*id} } - case approval.EdgeEventSubscription: + case approvalrequest.EdgeEventSubscription: if id := m.event_subscription; id != nil { return []ent.Value{*id} } @@ -5467,36 +8037,36 @@ func (m *ApprovalMutation) AddedIDs(name string) []ent.Value { } // RemovedEdges returns all edge names that were removed in this mutation. -func (m *ApprovalMutation) RemovedEdges() []string { +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 *ApprovalMutation) RemovedIDs(name string) []ent.Value { +func (m *ApprovalRequestMutation) RemovedIDs(name string) []ent.Value { return nil } // ClearedEdges returns all edge names that were cleared in this mutation. -func (m *ApprovalMutation) ClearedEdges() []string { +func (m *ApprovalRequestMutation) ClearedEdges() []string { edges := make([]string, 0, 2) if m.clearedapi_subscription { - edges = append(edges, approval.EdgeAPISubscription) + edges = append(edges, approvalrequest.EdgeAPISubscription) } if m.clearedevent_subscription { - edges = append(edges, approval.EdgeEventSubscription) + 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 *ApprovalMutation) EdgeCleared(name string) bool { +func (m *ApprovalRequestMutation) EdgeCleared(name string) bool { switch name { - case approval.EdgeAPISubscription: + case approvalrequest.EdgeAPISubscription: return m.clearedapi_subscription - case approval.EdgeEventSubscription: + case approvalrequest.EdgeEventSubscription: return m.clearedevent_subscription } return false @@ -5504,76 +8074,72 @@ func (m *ApprovalMutation) EdgeCleared(name string) bool { // 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 *ApprovalMutation) ClearEdge(name string) error { +func (m *ApprovalRequestMutation) ClearEdge(name string) error { switch name { - case approval.EdgeAPISubscription: + case approvalrequest.EdgeAPISubscription: m.ClearAPISubscription() return nil - case approval.EdgeEventSubscription: + case approvalrequest.EdgeEventSubscription: m.ClearEventSubscription() return nil } - return fmt.Errorf("unknown Approval unique edge %s", name) + 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 *ApprovalMutation) ResetEdge(name string) error { +func (m *ApprovalRequestMutation) ResetEdge(name string) error { switch name { - case approval.EdgeAPISubscription: + case approvalrequest.EdgeAPISubscription: m.ResetAPISubscription() return nil - case approval.EdgeEventSubscription: + case approvalrequest.EdgeEventSubscription: m.ResetEventSubscription() return nil } - return fmt.Errorf("unknown Approval edge %s", name) + return fmt.Errorf("unknown ApprovalRequest edge %s", name) } -// ApprovalRequestMutation represents an operation that mutates the ApprovalRequest nodes in the graph. -type ApprovalRequestMutation struct { +// 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 *approvalrequest.StatusPhase - status_message *string - environment *string - namespace *string - action *string - strategy *approvalrequest.Strategy - requester *model.RequesterInfo - decider *model.DeciderInfo - decider_team_name *string - decisions *[]model.Decision - appenddecisions []model.Decision - available_transitions *[]model.AvailableTransition - appendavailable_transitions []model.AvailableTransition - name *string - state *approvalrequest.State - 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 + 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 + event_type_def *int + clearedevent_type_def 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 = (*ApprovalRequestMutation)(nil) +var _ ent.Mutation = (*EventExposureMutation)(nil) -// approvalrequestOption allows management of the mutation configuration using functional options. -type approvalrequestOption func(*ApprovalRequestMutation) +// eventexposureOption allows management of the mutation configuration using functional options. +type eventexposureOption func(*EventExposureMutation) -// newApprovalRequestMutation creates new mutation for the ApprovalRequest entity. -func newApprovalRequestMutation(c config, op Op, opts ...approvalrequestOption) *ApprovalRequestMutation { - m := &ApprovalRequestMutation{ +// newEventExposureMutation creates new mutation for the EventExposure entity. +func newEventExposureMutation(c config, op Op, opts ...eventexposureOption) *EventExposureMutation { + m := &EventExposureMutation{ config: c, op: op, - typ: TypeApprovalRequest, + typ: TypeEventExposure, clearedFields: make(map[string]struct{}), } for _, opt := range opts { @@ -5582,20 +8148,20 @@ func newApprovalRequestMutation(c config, op Op, opts ...approvalrequestOption) return m } -// withApprovalRequestID sets the ID field of the mutation. -func withApprovalRequestID(id int) approvalrequestOption { - return func(m *ApprovalRequestMutation) { +// withEventExposureID sets the ID field of the mutation. +func withEventExposureID(id int) eventexposureOption { + return func(m *EventExposureMutation) { var ( err error once sync.Once - value *ApprovalRequest + value *EventExposure ) - m.oldValue = func(ctx context.Context) (*ApprovalRequest, error) { + 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().ApprovalRequest.Get(ctx, id) + value, err = m.Client().EventExposure.Get(ctx, id) } }) return value, err @@ -5604,10 +8170,10 @@ func withApprovalRequestID(id int) approvalrequestOption { } } -// withApprovalRequest sets the old ApprovalRequest of the mutation. -func withApprovalRequest(node *ApprovalRequest) approvalrequestOption { - return func(m *ApprovalRequestMutation) { - m.oldValue = func(context.Context) (*ApprovalRequest, error) { +// 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 @@ -5616,7 +8182,7 @@ func withApprovalRequest(node *ApprovalRequest) approvalrequestOption { // 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 ApprovalRequestMutation) Client() *Client { +func (m EventExposureMutation) Client() *Client { client := &Client{config: m.config} client.init() return client @@ -5624,7 +8190,7 @@ func (m ApprovalRequestMutation) Client() *Client { // Tx returns an `ent.Tx` for mutations that were executed in transactions; // it returns an error otherwise. -func (m ApprovalRequestMutation) Tx() (*Tx, error) { +func (m EventExposureMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("ent: mutation is not running in a transaction") } @@ -5635,7 +8201,7 @@ func (m ApprovalRequestMutation) Tx() (*Tx, error) { // 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 *ApprovalRequestMutation) ID() (id int, exists bool) { +func (m *EventExposureMutation) ID() (id int, exists bool) { if m.id == nil { return } @@ -5646,7 +8212,7 @@ func (m *ApprovalRequestMutation) ID() (id int, exists bool) { // 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 *ApprovalRequestMutation) IDs(ctx context.Context) ([]int, error) { +func (m *EventExposureMutation) IDs(ctx context.Context) ([]int, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() @@ -5655,19 +8221,19 @@ func (m *ApprovalRequestMutation) IDs(ctx context.Context) ([]int, error) { } fallthrough case m.op.Is(OpUpdate | OpDelete): - return m.Client().ApprovalRequest.Query().Where(m.predicates...).IDs(ctx) + 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 *ApprovalRequestMutation) SetCreatedAt(t time.Time) { +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 *ApprovalRequestMutation) CreatedAt() (r time.Time, exists bool) { +func (m *EventExposureMutation) CreatedAt() (r time.Time, exists bool) { v := m.created_at if v == nil { return @@ -5675,10 +8241,10 @@ func (m *ApprovalRequestMutation) CreatedAt() (r time.Time, exists bool) { return *v, true } -// OldCreatedAt returns the old "created_at" field's value of the ApprovalRequest entity. -// If the ApprovalRequest object wasn't provided to the builder, the object is fetched from the database. +// 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 *ApprovalRequestMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { +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") } @@ -5693,17 +8259,17 @@ func (m *ApprovalRequestMutation) OldCreatedAt(ctx context.Context) (v time.Time } // ResetCreatedAt resets all changes to the "created_at" field. -func (m *ApprovalRequestMutation) ResetCreatedAt() { +func (m *EventExposureMutation) ResetCreatedAt() { m.created_at = nil } // SetLastModifiedAt sets the "last_modified_at" field. -func (m *ApprovalRequestMutation) SetLastModifiedAt(t time.Time) { +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 *ApprovalRequestMutation) LastModifiedAt() (r time.Time, exists bool) { +func (m *EventExposureMutation) LastModifiedAt() (r time.Time, exists bool) { v := m.last_modified_at if v == nil { return @@ -5711,10 +8277,10 @@ func (m *ApprovalRequestMutation) LastModifiedAt() (r time.Time, exists bool) { return *v, true } -// OldLastModifiedAt returns the old "last_modified_at" field's value of the ApprovalRequest entity. -// If the ApprovalRequest object wasn't provided to the builder, the object is fetched from the database. +// 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 *ApprovalRequestMutation) OldLastModifiedAt(ctx context.Context) (v time.Time, err error) { +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") } @@ -5729,17 +8295,17 @@ func (m *ApprovalRequestMutation) OldLastModifiedAt(ctx context.Context) (v time } // ResetLastModifiedAt resets all changes to the "last_modified_at" field. -func (m *ApprovalRequestMutation) ResetLastModifiedAt() { +func (m *EventExposureMutation) ResetLastModifiedAt() { m.last_modified_at = nil } // SetStatusPhase sets the "status_phase" field. -func (m *ApprovalRequestMutation) SetStatusPhase(ap approvalrequest.StatusPhase) { - m.status_phase = &ap +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 *ApprovalRequestMutation) StatusPhase() (r approvalrequest.StatusPhase, exists bool) { +func (m *EventExposureMutation) StatusPhase() (r eventexposure.StatusPhase, exists bool) { v := m.status_phase if v == nil { return @@ -5747,10 +8313,10 @@ func (m *ApprovalRequestMutation) StatusPhase() (r approvalrequest.StatusPhase, return *v, true } -// OldStatusPhase returns the old "status_phase" field's value of the ApprovalRequest entity. -// If the ApprovalRequest object wasn't provided to the builder, the object is fetched from the database. +// 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 *ApprovalRequestMutation) OldStatusPhase(ctx context.Context) (v *approvalrequest.StatusPhase, err error) { +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") } @@ -5765,30 +8331,30 @@ func (m *ApprovalRequestMutation) OldStatusPhase(ctx context.Context) (v *approv } // ClearStatusPhase clears the value of the "status_phase" field. -func (m *ApprovalRequestMutation) ClearStatusPhase() { +func (m *EventExposureMutation) ClearStatusPhase() { m.status_phase = nil - m.clearedFields[approvalrequest.FieldStatusPhase] = struct{}{} + m.clearedFields[eventexposure.FieldStatusPhase] = struct{}{} } // StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. -func (m *ApprovalRequestMutation) StatusPhaseCleared() bool { - _, ok := m.clearedFields[approvalrequest.FieldStatusPhase] +func (m *EventExposureMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[eventexposure.FieldStatusPhase] return ok } // ResetStatusPhase resets all changes to the "status_phase" field. -func (m *ApprovalRequestMutation) ResetStatusPhase() { +func (m *EventExposureMutation) ResetStatusPhase() { m.status_phase = nil - delete(m.clearedFields, approvalrequest.FieldStatusPhase) + delete(m.clearedFields, eventexposure.FieldStatusPhase) } // SetStatusMessage sets the "status_message" field. -func (m *ApprovalRequestMutation) SetStatusMessage(s string) { +func (m *EventExposureMutation) SetStatusMessage(s string) { m.status_message = &s } // StatusMessage returns the value of the "status_message" field in the mutation. -func (m *ApprovalRequestMutation) StatusMessage() (r string, exists bool) { +func (m *EventExposureMutation) StatusMessage() (r string, exists bool) { v := m.status_message if v == nil { return @@ -5796,10 +8362,10 @@ func (m *ApprovalRequestMutation) StatusMessage() (r string, exists bool) { return *v, true } -// OldStatusMessage returns the old "status_message" field's value of the ApprovalRequest entity. -// If the ApprovalRequest object wasn't provided to the builder, the object is fetched from the database. +// 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 *ApprovalRequestMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { +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") } @@ -5814,30 +8380,30 @@ func (m *ApprovalRequestMutation) OldStatusMessage(ctx context.Context) (v *stri } // ClearStatusMessage clears the value of the "status_message" field. -func (m *ApprovalRequestMutation) ClearStatusMessage() { +func (m *EventExposureMutation) ClearStatusMessage() { m.status_message = nil - m.clearedFields[approvalrequest.FieldStatusMessage] = struct{}{} + m.clearedFields[eventexposure.FieldStatusMessage] = struct{}{} } // StatusMessageCleared returns if the "status_message" field was cleared in this mutation. -func (m *ApprovalRequestMutation) StatusMessageCleared() bool { - _, ok := m.clearedFields[approvalrequest.FieldStatusMessage] +func (m *EventExposureMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[eventexposure.FieldStatusMessage] return ok } // ResetStatusMessage resets all changes to the "status_message" field. -func (m *ApprovalRequestMutation) ResetStatusMessage() { +func (m *EventExposureMutation) ResetStatusMessage() { m.status_message = nil - delete(m.clearedFields, approvalrequest.FieldStatusMessage) + delete(m.clearedFields, eventexposure.FieldStatusMessage) } // SetEnvironment sets the "environment" field. -func (m *ApprovalRequestMutation) SetEnvironment(s string) { +func (m *EventExposureMutation) SetEnvironment(s string) { m.environment = &s } // Environment returns the value of the "environment" field in the mutation. -func (m *ApprovalRequestMutation) Environment() (r string, exists bool) { +func (m *EventExposureMutation) Environment() (r string, exists bool) { v := m.environment if v == nil { return @@ -5845,532 +8411,375 @@ func (m *ApprovalRequestMutation) Environment() (r string, exists bool) { return *v, true } -// OldEnvironment returns the old "environment" field's value of the ApprovalRequest entity. -// If the ApprovalRequest 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 *ApprovalRequestMutation) 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 *ApprovalRequestMutation) ClearEnvironment() { - m.environment = nil - m.clearedFields[approvalrequest.FieldEnvironment] = struct{}{} -} - -// EnvironmentCleared returns if the "environment" field was cleared in this mutation. -func (m *ApprovalRequestMutation) EnvironmentCleared() bool { - _, ok := m.clearedFields[approvalrequest.FieldEnvironment] - return ok -} - -// ResetEnvironment resets all changes to the "environment" field. -func (m *ApprovalRequestMutation) ResetEnvironment() { - m.environment = nil - delete(m.clearedFields, approvalrequest.FieldEnvironment) -} - -// SetNamespace sets the "namespace" field. -func (m *ApprovalRequestMutation) SetNamespace(s string) { - m.namespace = &s -} - -// Namespace returns the value of the "namespace" field in the mutation. -func (m *ApprovalRequestMutation) 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 ApprovalRequest entity. -// If the ApprovalRequest 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 *ApprovalRequestMutation) 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 *ApprovalRequestMutation) ResetNamespace() { - m.namespace = nil -} - -// SetAction sets the "action" field. -func (m *ApprovalRequestMutation) SetAction(s string) { - m.action = &s -} - -// Action returns the value of the "action" field in the mutation. -func (m *ApprovalRequestMutation) Action() (r string, exists bool) { - v := m.action - if v == nil { - return - } - return *v, true -} - -// OldAction returns the old "action" field's value of the ApprovalRequest entity. -// If the ApprovalRequest 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 *ApprovalRequestMutation) OldAction(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldAction is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldAction requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldAction: %w", err) - } - return oldValue.Action, nil -} - -// ResetAction resets all changes to the "action" field. -func (m *ApprovalRequestMutation) ResetAction() { - m.action = nil -} - -// SetStrategy sets the "strategy" field. -func (m *ApprovalRequestMutation) SetStrategy(a approvalrequest.Strategy) { - m.strategy = &a -} - -// Strategy returns the value of the "strategy" field in the mutation. -func (m *ApprovalRequestMutation) Strategy() (r approvalrequest.Strategy, exists bool) { - v := m.strategy - if v == nil { - return - } - return *v, true -} - -// OldStrategy returns the old "strategy" field's value of the ApprovalRequest entity. -// If the ApprovalRequest 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 *ApprovalRequestMutation) OldStrategy(ctx context.Context) (v approvalrequest.Strategy, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldStrategy is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldStrategy requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldStrategy: %w", err) - } - return oldValue.Strategy, nil -} - -// ResetStrategy resets all changes to the "strategy" field. -func (m *ApprovalRequestMutation) ResetStrategy() { - m.strategy = nil -} - -// SetRequester sets the "requester" field. -func (m *ApprovalRequestMutation) SetRequester(mi model.RequesterInfo) { - m.requester = &mi -} - -// Requester returns the value of the "requester" field in the mutation. -func (m *ApprovalRequestMutation) Requester() (r model.RequesterInfo, exists bool) { - v := m.requester - if v == nil { - return - } - return *v, true -} - -// OldRequester returns the old "requester" field's value of the ApprovalRequest entity. -// If the ApprovalRequest object wasn't provided to the builder, the object is fetched from the database. +// 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 *ApprovalRequestMutation) OldRequester(ctx context.Context) (v model.RequesterInfo, err error) { +func (m *EventExposureMutation) OldEnvironment(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldRequester is only allowed on UpdateOne operations") + return v, errors.New("OldEnvironment is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldRequester requires an ID field in the mutation") + 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 OldRequester: %w", err) + return v, fmt.Errorf("querying old value for OldEnvironment: %w", err) } - return oldValue.Requester, nil + return oldValue.Environment, nil } -// ResetRequester resets all changes to the "requester" field. -func (m *ApprovalRequestMutation) ResetRequester() { - m.requester = nil +// ClearEnvironment clears the value of the "environment" field. +func (m *EventExposureMutation) ClearEnvironment() { + m.environment = nil + m.clearedFields[eventexposure.FieldEnvironment] = struct{}{} } -// SetDecider sets the "decider" field. -func (m *ApprovalRequestMutation) SetDecider(mi model.DeciderInfo) { - m.decider = &mi +// EnvironmentCleared returns if the "environment" field was cleared in this mutation. +func (m *EventExposureMutation) EnvironmentCleared() bool { + _, ok := m.clearedFields[eventexposure.FieldEnvironment] + return ok } -// Decider returns the value of the "decider" field in the mutation. -func (m *ApprovalRequestMutation) Decider() (r model.DeciderInfo, exists bool) { - v := m.decider +// 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 } -// OldDecider returns the old "decider" field's value of the ApprovalRequest entity. -// If the ApprovalRequest object wasn't provided to the builder, the object is fetched from the database. +// 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 *ApprovalRequestMutation) OldDecider(ctx context.Context) (v model.DeciderInfo, err error) { +func (m *EventExposureMutation) OldNamespace(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldDecider is only allowed on UpdateOne operations") + return v, errors.New("OldNamespace is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldDecider requires an ID field in the mutation") + 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 OldDecider: %w", err) + return v, fmt.Errorf("querying old value for OldNamespace: %w", err) } - return oldValue.Decider, nil + return oldValue.Namespace, nil } -// ResetDecider resets all changes to the "decider" field. -func (m *ApprovalRequestMutation) ResetDecider() { - m.decider = nil +// ResetNamespace resets all changes to the "namespace" field. +func (m *EventExposureMutation) ResetNamespace() { + m.namespace = nil } -// SetDeciderTeamName sets the "decider_team_name" field. -func (m *ApprovalRequestMutation) SetDeciderTeamName(s string) { - m.decider_team_name = &s +// SetEventType sets the "event_type" field. +func (m *EventExposureMutation) SetEventType(s string) { + m.event_type = &s } -// DeciderTeamName returns the value of the "decider_team_name" field in the mutation. -func (m *ApprovalRequestMutation) DeciderTeamName() (r string, exists bool) { - v := m.decider_team_name +// 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 } -// OldDeciderTeamName returns the old "decider_team_name" field's value of the ApprovalRequest entity. -// If the ApprovalRequest object wasn't provided to the builder, the object is fetched from the database. +// 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 *ApprovalRequestMutation) OldDeciderTeamName(ctx context.Context) (v string, err error) { +func (m *EventExposureMutation) OldEventType(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldDeciderTeamName is only allowed on UpdateOne operations") + return v, errors.New("OldEventType is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldDeciderTeamName requires an ID field in the mutation") + 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 OldDeciderTeamName: %w", err) + return v, fmt.Errorf("querying old value for OldEventType: %w", err) } - return oldValue.DeciderTeamName, nil + return oldValue.EventType, nil } -// ResetDeciderTeamName resets all changes to the "decider_team_name" field. -func (m *ApprovalRequestMutation) ResetDeciderTeamName() { - m.decider_team_name = nil +// ResetEventType resets all changes to the "event_type" field. +func (m *EventExposureMutation) ResetEventType() { + m.event_type = nil } -// SetDecisions sets the "decisions" field. -func (m *ApprovalRequestMutation) SetDecisions(value []model.Decision) { - m.decisions = &value - m.appenddecisions = nil +// SetVisibility sets the "visibility" field. +func (m *EventExposureMutation) SetVisibility(e eventexposure.Visibility) { + m.visibility = &e } -// Decisions returns the value of the "decisions" field in the mutation. -func (m *ApprovalRequestMutation) Decisions() (r []model.Decision, exists bool) { - v := m.decisions +// 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 } -// OldDecisions returns the old "decisions" field's value of the ApprovalRequest entity. -// If the ApprovalRequest object wasn't provided to the builder, the object is fetched from the database. +// 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 *ApprovalRequestMutation) OldDecisions(ctx context.Context) (v []model.Decision, err error) { +func (m *EventExposureMutation) OldVisibility(ctx context.Context) (v eventexposure.Visibility, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldDecisions is only allowed on UpdateOne operations") + return v, errors.New("OldVisibility is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldDecisions requires an ID field in the mutation") + 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 OldDecisions: %w", err) - } - return oldValue.Decisions, nil -} - -// AppendDecisions adds value to the "decisions" field. -func (m *ApprovalRequestMutation) AppendDecisions(value []model.Decision) { - m.appenddecisions = append(m.appenddecisions, value...) -} - -// AppendedDecisions returns the list of values that were appended to the "decisions" field in this mutation. -func (m *ApprovalRequestMutation) AppendedDecisions() ([]model.Decision, bool) { - if len(m.appenddecisions) == 0 { - return nil, false + return v, fmt.Errorf("querying old value for OldVisibility: %w", err) } - return m.appenddecisions, true + return oldValue.Visibility, nil } -// ResetDecisions resets all changes to the "decisions" field. -func (m *ApprovalRequestMutation) ResetDecisions() { - m.decisions = nil - m.appenddecisions = nil +// ResetVisibility resets all changes to the "visibility" field. +func (m *EventExposureMutation) ResetVisibility() { + m.visibility = nil } -// SetAvailableTransitions sets the "available_transitions" field. -func (m *ApprovalRequestMutation) SetAvailableTransitions(mt []model.AvailableTransition) { - m.available_transitions = &mt - m.appendavailable_transitions = nil +// SetActive sets the "active" field. +func (m *EventExposureMutation) SetActive(b bool) { + m.active = &b } -// AvailableTransitions returns the value of the "available_transitions" field in the mutation. -func (m *ApprovalRequestMutation) AvailableTransitions() (r []model.AvailableTransition, exists bool) { - v := m.available_transitions +// 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 } -// OldAvailableTransitions returns the old "available_transitions" field's value of the ApprovalRequest entity. -// If the ApprovalRequest object wasn't provided to the builder, the object is fetched from the database. +// 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 *ApprovalRequestMutation) OldAvailableTransitions(ctx context.Context) (v []model.AvailableTransition, err error) { +func (m *EventExposureMutation) OldActive(ctx context.Context) (v *bool, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldAvailableTransitions is only allowed on UpdateOne operations") + return v, errors.New("OldActive is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldAvailableTransitions requires an ID field in the mutation") + 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 OldAvailableTransitions: %w", err) - } - return oldValue.AvailableTransitions, nil -} - -// AppendAvailableTransitions adds mt to the "available_transitions" field. -func (m *ApprovalRequestMutation) AppendAvailableTransitions(mt []model.AvailableTransition) { - m.appendavailable_transitions = append(m.appendavailable_transitions, mt...) -} - -// AppendedAvailableTransitions returns the list of values that were appended to the "available_transitions" field in this mutation. -func (m *ApprovalRequestMutation) AppendedAvailableTransitions() ([]model.AvailableTransition, bool) { - if len(m.appendavailable_transitions) == 0 { - return nil, false + return v, fmt.Errorf("querying old value for OldActive: %w", err) } - return m.appendavailable_transitions, true + return oldValue.Active, nil } -// ClearAvailableTransitions clears the value of the "available_transitions" field. -func (m *ApprovalRequestMutation) ClearAvailableTransitions() { - m.available_transitions = nil - m.appendavailable_transitions = nil - m.clearedFields[approvalrequest.FieldAvailableTransitions] = struct{}{} +// ClearActive clears the value of the "active" field. +func (m *EventExposureMutation) ClearActive() { + m.active = nil + m.clearedFields[eventexposure.FieldActive] = struct{}{} } -// AvailableTransitionsCleared returns if the "available_transitions" field was cleared in this mutation. -func (m *ApprovalRequestMutation) AvailableTransitionsCleared() bool { - _, ok := m.clearedFields[approvalrequest.FieldAvailableTransitions] +// ActiveCleared returns if the "active" field was cleared in this mutation. +func (m *EventExposureMutation) ActiveCleared() bool { + _, ok := m.clearedFields[eventexposure.FieldActive] return ok } -// ResetAvailableTransitions resets all changes to the "available_transitions" field. -func (m *ApprovalRequestMutation) ResetAvailableTransitions() { - m.available_transitions = nil - m.appendavailable_transitions = nil - delete(m.clearedFields, approvalrequest.FieldAvailableTransitions) +// ResetActive resets all changes to the "active" field. +func (m *EventExposureMutation) ResetActive() { + m.active = nil + delete(m.clearedFields, eventexposure.FieldActive) } -// SetName sets the "name" field. -func (m *ApprovalRequestMutation) SetName(s string) { - m.name = &s +// SetApprovalConfig sets the "approval_config" field. +func (m *EventExposureMutation) SetApprovalConfig(mc model.ApprovalConfig) { + m.approval_config = &mc } -// Name returns the value of the "name" field in the mutation. -func (m *ApprovalRequestMutation) Name() (r string, exists bool) { - v := m.name +// 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 } -// OldName returns the old "name" field's value of the ApprovalRequest entity. -// If the ApprovalRequest object wasn't provided to the builder, the object is fetched from the database. +// 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 *ApprovalRequestMutation) OldName(ctx context.Context) (v string, err error) { +func (m *EventExposureMutation) OldApprovalConfig(ctx context.Context) (v model.ApprovalConfig, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldName is only allowed on UpdateOne operations") + return v, errors.New("OldApprovalConfig 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") + 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 OldName: %w", err) + return v, fmt.Errorf("querying old value for OldApprovalConfig: %w", err) } - return oldValue.Name, nil + return oldValue.ApprovalConfig, nil } -// ResetName resets all changes to the "name" field. -func (m *ApprovalRequestMutation) ResetName() { - m.name = nil +// ResetApprovalConfig resets all changes to the "approval_config" field. +func (m *EventExposureMutation) ResetApprovalConfig() { + m.approval_config = nil } -// SetState sets the "state" field. -func (m *ApprovalRequestMutation) SetState(a approvalrequest.State) { - m.state = &a +// SetOwnerID sets the "owner" edge to the Application entity by id. +func (m *EventExposureMutation) SetOwnerID(id int) { + m.owner = &id } -// State returns the value of the "state" field in the mutation. -func (m *ApprovalRequestMutation) State() (r approvalrequest.State, exists bool) { - v := m.state - if v == nil { - return - } - return *v, true +// 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 } -// OldState returns the old "state" field's value of the ApprovalRequest entity. -// If the ApprovalRequest 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 *ApprovalRequestMutation) OldState(ctx context.Context) (v approvalrequest.State, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldState is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldState requires an ID field in the mutation") +// 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 } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldState: %w", err) + 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 oldValue.State, nil + return } -// ResetState resets all changes to the "state" field. -func (m *ApprovalRequestMutation) ResetState() { - m.state = nil +// ResetOwner resets all changes to the "owner" edge. +func (m *EventExposureMutation) ResetOwner() { + m.owner = nil + m.clearedowner = false } -// SetAPISubscriptionID sets the "api_subscription" edge to the ApiSubscription entity by id. -func (m *ApprovalRequestMutation) SetAPISubscriptionID(id int) { - m.api_subscription = &id +// SetEventTypeDefID sets the "event_type_def" edge to the EventType entity by id. +func (m *EventExposureMutation) SetEventTypeDefID(id int) { + m.event_type_def = &id } -// ClearAPISubscription clears the "api_subscription" edge to the ApiSubscription entity. -func (m *ApprovalRequestMutation) ClearAPISubscription() { - m.clearedapi_subscription = true +// ClearEventTypeDef clears the "event_type_def" edge to the EventType entity. +func (m *EventExposureMutation) ClearEventTypeDef() { + m.clearedevent_type_def = true } -// APISubscriptionCleared reports if the "api_subscription" edge to the ApiSubscription entity was cleared. -func (m *ApprovalRequestMutation) APISubscriptionCleared() bool { - return m.clearedapi_subscription +// EventTypeDefCleared reports if the "event_type_def" edge to the EventType entity was cleared. +func (m *EventExposureMutation) EventTypeDefCleared() bool { + return m.clearedevent_type_def } -// APISubscriptionID returns the "api_subscription" edge ID in the mutation. -func (m *ApprovalRequestMutation) APISubscriptionID() (id int, exists bool) { - if m.api_subscription != nil { - return *m.api_subscription, true +// EventTypeDefID returns the "event_type_def" edge ID in the mutation. +func (m *EventExposureMutation) EventTypeDefID() (id int, exists bool) { + if m.event_type_def != nil { + return *m.event_type_def, true } return } -// APISubscriptionIDs returns the "api_subscription" edge IDs in the mutation. +// EventTypeDefIDs returns the "event_type_def" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// APISubscriptionID instead. It exists only for internal usage by the builders. -func (m *ApprovalRequestMutation) APISubscriptionIDs() (ids []int) { - if id := m.api_subscription; id != nil { +// EventTypeDefID instead. It exists only for internal usage by the builders. +func (m *EventExposureMutation) EventTypeDefIDs() (ids []int) { + if id := m.event_type_def; id != nil { ids = append(ids, *id) } return } -// ResetAPISubscription resets all changes to the "api_subscription" edge. -func (m *ApprovalRequestMutation) ResetAPISubscription() { - m.api_subscription = nil - m.clearedapi_subscription = false +// ResetEventTypeDef resets all changes to the "event_type_def" edge. +func (m *EventExposureMutation) ResetEventTypeDef() { + m.event_type_def = nil + m.clearedevent_type_def = false } -// SetEventSubscriptionID sets the "event_subscription" edge to the EventSubscription entity by id. -func (m *ApprovalRequestMutation) SetEventSubscriptionID(id int) { - m.event_subscription = &id +// 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{}{} + } } -// ClearEventSubscription clears the "event_subscription" edge to the EventSubscription entity. -func (m *ApprovalRequestMutation) ClearEventSubscription() { - m.clearedevent_subscription = true +// ClearSubscriptions clears the "subscriptions" edge to the EventSubscription entity. +func (m *EventExposureMutation) ClearSubscriptions() { + m.clearedsubscriptions = true } -// EventSubscriptionCleared reports if the "event_subscription" edge to the EventSubscription entity was cleared. -func (m *ApprovalRequestMutation) EventSubscriptionCleared() bool { - return m.clearedevent_subscription +// SubscriptionsCleared reports if the "subscriptions" edge to the EventSubscription entity was cleared. +func (m *EventExposureMutation) SubscriptionsCleared() bool { + return m.clearedsubscriptions } -// 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 +// 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 } -// 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) +// 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 } -// ResetEventSubscription resets all changes to the "event_subscription" edge. -func (m *ApprovalRequestMutation) ResetEventSubscription() { - m.event_subscription = nil - m.clearedevent_subscription = false +// 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 ApprovalRequestMutation builder. -func (m *ApprovalRequestMutation) Where(ps ...predicate.ApprovalRequest) { +// 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 ApprovalRequestMutation builder. Using this method, +// 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 *ApprovalRequestMutation) WhereP(ps ...func(*sql.Selector)) { - p := make([]predicate.ApprovalRequest, len(ps)) +func (m *EventExposureMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.EventExposure, len(ps)) for i := range ps { p[i] = ps[i] } @@ -6378,69 +8787,54 @@ func (m *ApprovalRequestMutation) WhereP(ps ...func(*sql.Selector)) { } // Op returns the operation name. -func (m *ApprovalRequestMutation) Op() Op { +func (m *EventExposureMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. -func (m *ApprovalRequestMutation) SetOp(op Op) { +func (m *EventExposureMutation) SetOp(op Op) { m.op = op } -// Type returns the node type of this mutation (ApprovalRequest). -func (m *ApprovalRequestMutation) Type() string { +// 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 *ApprovalRequestMutation) Fields() []string { - fields := make([]string, 0, 15) +func (m *EventExposureMutation) Fields() []string { + fields := make([]string, 0, 10) if m.created_at != nil { - fields = append(fields, approvalrequest.FieldCreatedAt) + fields = append(fields, eventexposure.FieldCreatedAt) } if m.last_modified_at != nil { - fields = append(fields, approvalrequest.FieldLastModifiedAt) + fields = append(fields, eventexposure.FieldLastModifiedAt) } if m.status_phase != nil { - fields = append(fields, approvalrequest.FieldStatusPhase) + fields = append(fields, eventexposure.FieldStatusPhase) } if m.status_message != nil { - fields = append(fields, approvalrequest.FieldStatusMessage) + fields = append(fields, eventexposure.FieldStatusMessage) } if m.environment != nil { - fields = append(fields, approvalrequest.FieldEnvironment) + fields = append(fields, eventexposure.FieldEnvironment) } if m.namespace != nil { - fields = append(fields, approvalrequest.FieldNamespace) - } - if m.action != nil { - fields = append(fields, approvalrequest.FieldAction) - } - if m.strategy != nil { - fields = append(fields, approvalrequest.FieldStrategy) - } - if m.requester != nil { - fields = append(fields, approvalrequest.FieldRequester) - } - if m.decider != nil { - fields = append(fields, approvalrequest.FieldDecider) - } - if m.decider_team_name != nil { - fields = append(fields, approvalrequest.FieldDeciderTeamName) + fields = append(fields, eventexposure.FieldNamespace) } - if m.decisions != nil { - fields = append(fields, approvalrequest.FieldDecisions) + if m.event_type != nil { + fields = append(fields, eventexposure.FieldEventType) } - if m.available_transitions != nil { - fields = append(fields, approvalrequest.FieldAvailableTransitions) + if m.visibility != nil { + fields = append(fields, eventexposure.FieldVisibility) } - if m.name != nil { - fields = append(fields, approvalrequest.FieldName) + if m.active != nil { + fields = append(fields, eventexposure.FieldActive) } - if m.state != nil { - fields = append(fields, approvalrequest.FieldState) + if m.approval_config != nil { + fields = append(fields, eventexposure.FieldApprovalConfig) } return fields } @@ -6448,38 +8842,28 @@ func (m *ApprovalRequestMutation) Fields() []string { // 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 *ApprovalRequestMutation) Field(name string) (ent.Value, bool) { +func (m *EventExposureMutation) Field(name string) (ent.Value, bool) { switch name { - case approvalrequest.FieldCreatedAt: + case eventexposure.FieldCreatedAt: return m.CreatedAt() - case approvalrequest.FieldLastModifiedAt: + case eventexposure.FieldLastModifiedAt: return m.LastModifiedAt() - case approvalrequest.FieldStatusPhase: + case eventexposure.FieldStatusPhase: return m.StatusPhase() - case approvalrequest.FieldStatusMessage: + case eventexposure.FieldStatusMessage: return m.StatusMessage() - case approvalrequest.FieldEnvironment: + case eventexposure.FieldEnvironment: return m.Environment() - case approvalrequest.FieldNamespace: + case eventexposure.FieldNamespace: return m.Namespace() - case approvalrequest.FieldAction: - return m.Action() - case approvalrequest.FieldStrategy: - return m.Strategy() - case approvalrequest.FieldRequester: - return m.Requester() - case approvalrequest.FieldDecider: - return m.Decider() - case approvalrequest.FieldDeciderTeamName: - return m.DeciderTeamName() - case approvalrequest.FieldDecisions: - return m.Decisions() - case approvalrequest.FieldAvailableTransitions: - return m.AvailableTransitions() - case approvalrequest.FieldName: - return m.Name() - case approvalrequest.FieldState: - return m.State() + 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 } @@ -6487,407 +8871,379 @@ func (m *ApprovalRequestMutation) Field(name string) (ent.Value, bool) { // 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 *ApprovalRequestMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case approvalrequest.FieldCreatedAt: - return m.OldCreatedAt(ctx) - case approvalrequest.FieldLastModifiedAt: - return m.OldLastModifiedAt(ctx) - case approvalrequest.FieldStatusPhase: - return m.OldStatusPhase(ctx) - case approvalrequest.FieldStatusMessage: - return m.OldStatusMessage(ctx) - case approvalrequest.FieldEnvironment: - return m.OldEnvironment(ctx) - case approvalrequest.FieldNamespace: - return m.OldNamespace(ctx) - case approvalrequest.FieldAction: - return m.OldAction(ctx) - case approvalrequest.FieldStrategy: - return m.OldStrategy(ctx) - case approvalrequest.FieldRequester: - return m.OldRequester(ctx) - case approvalrequest.FieldDecider: - return m.OldDecider(ctx) - case approvalrequest.FieldDeciderTeamName: - return m.OldDeciderTeamName(ctx) - case approvalrequest.FieldDecisions: - return m.OldDecisions(ctx) - case approvalrequest.FieldAvailableTransitions: - return m.OldAvailableTransitions(ctx) - case approvalrequest.FieldName: - return m.OldName(ctx) - case approvalrequest.FieldState: - return m.OldState(ctx) +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 ApprovalRequest field %s", name) + 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 *ApprovalRequestMutation) SetField(name string, value ent.Value) error { +func (m *EventExposureMutation) SetField(name string, value ent.Value) error { switch name { - case approvalrequest.FieldCreatedAt: + 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 approvalrequest.FieldLastModifiedAt: + 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 approvalrequest.FieldStatusPhase: - v, ok := value.(approvalrequest.StatusPhase) + 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 approvalrequest.FieldStatusMessage: + 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 approvalrequest.FieldEnvironment: + 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 approvalrequest.FieldNamespace: + 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 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: + case eventexposure.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 eventexposure.FieldVisibility: + v, ok := value.(eventexposure.Visibility) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetAvailableTransitions(v) + m.SetVisibility(v) return nil - case approvalrequest.FieldName: - v, ok := value.(string) + case eventexposure.FieldActive: + v, ok := value.(bool) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetName(v) + m.SetActive(v) return nil - case approvalrequest.FieldState: - v, ok := value.(approvalrequest.State) + case eventexposure.FieldApprovalConfig: + v, ok := value.(model.ApprovalConfig) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetState(v) + m.SetApprovalConfig(v) return nil } - return fmt.Errorf("unknown ApprovalRequest field %s", name) + return fmt.Errorf("unknown EventExposure field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. -func (m *ApprovalRequestMutation) AddedFields() []string { +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 *ApprovalRequestMutation) AddedField(name string) (ent.Value, bool) { +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 *ApprovalRequestMutation) AddField(name string, value ent.Value) error { +func (m *EventExposureMutation) AddField(name string, value ent.Value) error { switch name { } - return fmt.Errorf("unknown ApprovalRequest numeric field %s", name) + return fmt.Errorf("unknown EventExposure numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. -func (m *ApprovalRequestMutation) ClearedFields() []string { +func (m *EventExposureMutation) ClearedFields() []string { var fields []string - if m.FieldCleared(approvalrequest.FieldStatusPhase) { - fields = append(fields, approvalrequest.FieldStatusPhase) + if m.FieldCleared(eventexposure.FieldStatusPhase) { + fields = append(fields, eventexposure.FieldStatusPhase) } - if m.FieldCleared(approvalrequest.FieldStatusMessage) { - fields = append(fields, approvalrequest.FieldStatusMessage) + if m.FieldCleared(eventexposure.FieldStatusMessage) { + fields = append(fields, eventexposure.FieldStatusMessage) } - if m.FieldCleared(approvalrequest.FieldEnvironment) { - fields = append(fields, approvalrequest.FieldEnvironment) + if m.FieldCleared(eventexposure.FieldEnvironment) { + fields = append(fields, eventexposure.FieldEnvironment) } - if m.FieldCleared(approvalrequest.FieldAvailableTransitions) { - fields = append(fields, approvalrequest.FieldAvailableTransitions) + 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 *ApprovalRequestMutation) FieldCleared(name string) bool { +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 *ApprovalRequestMutation) ClearField(name string) error { +func (m *EventExposureMutation) ClearField(name string) error { switch name { - case approvalrequest.FieldStatusPhase: + case eventexposure.FieldStatusPhase: m.ClearStatusPhase() return nil - case approvalrequest.FieldStatusMessage: + case eventexposure.FieldStatusMessage: m.ClearStatusMessage() return nil - case approvalrequest.FieldEnvironment: + case eventexposure.FieldEnvironment: m.ClearEnvironment() return nil - case approvalrequest.FieldAvailableTransitions: - m.ClearAvailableTransitions() + case eventexposure.FieldActive: + m.ClearActive() return nil } - return fmt.Errorf("unknown ApprovalRequest nullable field %s", name) + 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 *ApprovalRequestMutation) ResetField(name string) error { +func (m *EventExposureMutation) ResetField(name string) error { switch name { - case approvalrequest.FieldCreatedAt: + case eventexposure.FieldCreatedAt: m.ResetCreatedAt() return nil - case approvalrequest.FieldLastModifiedAt: + case eventexposure.FieldLastModifiedAt: m.ResetLastModifiedAt() return nil - case approvalrequest.FieldStatusPhase: + case eventexposure.FieldStatusPhase: m.ResetStatusPhase() return nil - case approvalrequest.FieldStatusMessage: + case eventexposure.FieldStatusMessage: m.ResetStatusMessage() return nil - case approvalrequest.FieldEnvironment: + case eventexposure.FieldEnvironment: m.ResetEnvironment() return nil - case approvalrequest.FieldNamespace: + case eventexposure.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 eventexposure.FieldEventType: + m.ResetEventType() return nil - case approvalrequest.FieldAvailableTransitions: - m.ResetAvailableTransitions() + case eventexposure.FieldVisibility: + m.ResetVisibility() return nil - case approvalrequest.FieldName: - m.ResetName() + case eventexposure.FieldActive: + m.ResetActive() return nil - case approvalrequest.FieldState: - m.ResetState() + case eventexposure.FieldApprovalConfig: + m.ResetApprovalConfig() return nil } - return fmt.Errorf("unknown ApprovalRequest field %s", name) + return fmt.Errorf("unknown EventExposure 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) +func (m *EventExposureMutation) AddedEdges() []string { + edges := make([]string, 0, 3) + if m.owner != nil { + edges = append(edges, eventexposure.EdgeOwner) } - if m.event_subscription != nil { - edges = append(edges, approvalrequest.EdgeEventSubscription) + if m.event_type_def != nil { + edges = append(edges, eventexposure.EdgeEventTypeDef) + } + 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 *ApprovalRequestMutation) AddedIDs(name string) []ent.Value { +func (m *EventExposureMutation) AddedIDs(name string) []ent.Value { switch name { - case approvalrequest.EdgeAPISubscription: - if id := m.api_subscription; id != nil { + case eventexposure.EdgeOwner: + if id := m.owner; id != nil { return []ent.Value{*id} } - case approvalrequest.EdgeEventSubscription: - if id := m.event_subscription; id != nil { + case eventexposure.EdgeEventTypeDef: + if id := m.event_type_def; 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 *ApprovalRequestMutation) RemovedEdges() []string { - edges := make([]string, 0, 2) +func (m *EventExposureMutation) RemovedEdges() []string { + edges := make([]string, 0, 3) + 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 *ApprovalRequestMutation) RemovedIDs(name string) []ent.Value { +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 *ApprovalRequestMutation) ClearedEdges() []string { - edges := make([]string, 0, 2) - if m.clearedapi_subscription { - edges = append(edges, approvalrequest.EdgeAPISubscription) +func (m *EventExposureMutation) ClearedEdges() []string { + edges := make([]string, 0, 3) + if m.clearedowner { + edges = append(edges, eventexposure.EdgeOwner) } - if m.clearedevent_subscription { - edges = append(edges, approvalrequest.EdgeEventSubscription) + if m.clearedevent_type_def { + edges = append(edges, eventexposure.EdgeEventTypeDef) + } + 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 *ApprovalRequestMutation) EdgeCleared(name string) bool { +func (m *EventExposureMutation) EdgeCleared(name string) bool { switch name { - case approvalrequest.EdgeAPISubscription: - return m.clearedapi_subscription - case approvalrequest.EdgeEventSubscription: - return m.clearedevent_subscription + case eventexposure.EdgeOwner: + return m.clearedowner + case eventexposure.EdgeEventTypeDef: + return m.clearedevent_type_def + 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 *ApprovalRequestMutation) ClearEdge(name string) error { +func (m *EventExposureMutation) ClearEdge(name string) error { switch name { - case approvalrequest.EdgeAPISubscription: - m.ClearAPISubscription() + case eventexposure.EdgeOwner: + m.ClearOwner() return nil - case approvalrequest.EdgeEventSubscription: - m.ClearEventSubscription() + case eventexposure.EdgeEventTypeDef: + m.ClearEventTypeDef() return nil } - return fmt.Errorf("unknown ApprovalRequest unique edge %s", name) + 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 *ApprovalRequestMutation) ResetEdge(name string) error { +func (m *EventExposureMutation) ResetEdge(name string) error { switch name { - case approvalrequest.EdgeAPISubscription: - m.ResetAPISubscription() + case eventexposure.EdgeOwner: + m.ResetOwner() return nil - case approvalrequest.EdgeEventSubscription: - m.ResetEventSubscription() + case eventexposure.EdgeEventTypeDef: + m.ResetEventTypeDef() + return nil + case eventexposure.EdgeSubscriptions: + m.ResetSubscriptions() return nil } - return fmt.Errorf("unknown ApprovalRequest edge %s", name) + return fmt.Errorf("unknown EventExposure edge %s", name) } -// EventExposureMutation represents an operation that mutates the EventExposure nodes in the graph. -type EventExposureMutation struct { +// 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 *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 + 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 = (*EventExposureMutation)(nil) +var _ ent.Mutation = (*EventSubscriptionMutation)(nil) -// eventexposureOption allows management of the mutation configuration using functional options. -type eventexposureOption func(*EventExposureMutation) +// eventsubscriptionOption allows management of the mutation configuration using functional options. +type eventsubscriptionOption func(*EventSubscriptionMutation) -// newEventExposureMutation creates new mutation for the EventExposure entity. -func newEventExposureMutation(c config, op Op, opts ...eventexposureOption) *EventExposureMutation { - m := &EventExposureMutation{ +// newEventSubscriptionMutation creates new mutation for the EventSubscription entity. +func newEventSubscriptionMutation(c config, op Op, opts ...eventsubscriptionOption) *EventSubscriptionMutation { + m := &EventSubscriptionMutation{ config: c, op: op, - typ: TypeEventExposure, + typ: TypeEventSubscription, clearedFields: make(map[string]struct{}), } for _, opt := range opts { @@ -6896,20 +9252,20 @@ func newEventExposureMutation(c config, op Op, opts ...eventexposureOption) *Eve return m } -// withEventExposureID sets the ID field of the mutation. -func withEventExposureID(id int) eventexposureOption { - return func(m *EventExposureMutation) { +// withEventSubscriptionID sets the ID field of the mutation. +func withEventSubscriptionID(id int) eventsubscriptionOption { + return func(m *EventSubscriptionMutation) { var ( err error once sync.Once - value *EventExposure + value *EventSubscription ) - m.oldValue = func(ctx context.Context) (*EventExposure, error) { + 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().EventExposure.Get(ctx, id) + value, err = m.Client().EventSubscription.Get(ctx, id) } }) return value, err @@ -6918,10 +9274,10 @@ func withEventExposureID(id int) eventexposureOption { } } -// withEventExposure sets the old EventExposure of the mutation. -func withEventExposure(node *EventExposure) eventexposureOption { - return func(m *EventExposureMutation) { - m.oldValue = func(context.Context) (*EventExposure, error) { +// 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 @@ -6930,7 +9286,7 @@ func withEventExposure(node *EventExposure) eventexposureOption { // 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 { +func (m EventSubscriptionMutation) Client() *Client { client := &Client{config: m.config} client.init() return client @@ -6938,7 +9294,7 @@ func (m EventExposureMutation) Client() *Client { // Tx returns an `ent.Tx` for mutations that were executed in transactions; // it returns an error otherwise. -func (m EventExposureMutation) Tx() (*Tx, error) { +func (m EventSubscriptionMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("ent: mutation is not running in a transaction") } @@ -6949,7 +9305,7 @@ func (m EventExposureMutation) Tx() (*Tx, error) { // 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) { +func (m *EventSubscriptionMutation) ID() (id int, exists bool) { if m.id == nil { return } @@ -6960,7 +9316,7 @@ func (m *EventExposureMutation) ID() (id int, exists bool) { // 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) { +func (m *EventSubscriptionMutation) IDs(ctx context.Context) ([]int, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() @@ -6969,19 +9325,19 @@ func (m *EventExposureMutation) IDs(ctx context.Context) ([]int, error) { } fallthrough case m.op.Is(OpUpdate | OpDelete): - return m.Client().EventExposure.Query().Where(m.predicates...).IDs(ctx) + 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 *EventExposureMutation) SetCreatedAt(t time.Time) { +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 *EventExposureMutation) CreatedAt() (r time.Time, exists bool) { +func (m *EventSubscriptionMutation) CreatedAt() (r time.Time, exists bool) { v := m.created_at if v == nil { return @@ -6989,10 +9345,10 @@ func (m *EventExposureMutation) CreatedAt() (r time.Time, exists bool) { 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. +// 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 *EventExposureMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { +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") } @@ -7007,17 +9363,17 @@ func (m *EventExposureMutation) OldCreatedAt(ctx context.Context) (v time.Time, } // ResetCreatedAt resets all changes to the "created_at" field. -func (m *EventExposureMutation) ResetCreatedAt() { +func (m *EventSubscriptionMutation) ResetCreatedAt() { m.created_at = nil } // SetLastModifiedAt sets the "last_modified_at" field. -func (m *EventExposureMutation) SetLastModifiedAt(t time.Time) { +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 *EventExposureMutation) LastModifiedAt() (r time.Time, exists bool) { +func (m *EventSubscriptionMutation) LastModifiedAt() (r time.Time, exists bool) { v := m.last_modified_at if v == nil { return @@ -7025,10 +9381,10 @@ func (m *EventExposureMutation) LastModifiedAt() (r time.Time, exists bool) { 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. +// 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 *EventExposureMutation) OldLastModifiedAt(ctx context.Context) (v time.Time, err error) { +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") } @@ -7043,17 +9399,17 @@ func (m *EventExposureMutation) OldLastModifiedAt(ctx context.Context) (v time.T } // ResetLastModifiedAt resets all changes to the "last_modified_at" field. -func (m *EventExposureMutation) ResetLastModifiedAt() { +func (m *EventSubscriptionMutation) ResetLastModifiedAt() { m.last_modified_at = nil } // SetStatusPhase sets the "status_phase" field. -func (m *EventExposureMutation) SetStatusPhase(ep eventexposure.StatusPhase) { +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 *EventExposureMutation) StatusPhase() (r eventexposure.StatusPhase, exists bool) { +func (m *EventSubscriptionMutation) StatusPhase() (r eventsubscription.StatusPhase, exists bool) { v := m.status_phase if v == nil { return @@ -7061,10 +9417,10 @@ func (m *EventExposureMutation) StatusPhase() (r eventexposure.StatusPhase, exis 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. +// 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 *EventExposureMutation) OldStatusPhase(ctx context.Context) (v *eventexposure.StatusPhase, err error) { +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") } @@ -7079,30 +9435,30 @@ func (m *EventExposureMutation) OldStatusPhase(ctx context.Context) (v *eventexp } // ClearStatusPhase clears the value of the "status_phase" field. -func (m *EventExposureMutation) ClearStatusPhase() { +func (m *EventSubscriptionMutation) ClearStatusPhase() { m.status_phase = nil - m.clearedFields[eventexposure.FieldStatusPhase] = struct{}{} + m.clearedFields[eventsubscription.FieldStatusPhase] = struct{}{} } // StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. -func (m *EventExposureMutation) StatusPhaseCleared() bool { - _, ok := m.clearedFields[eventexposure.FieldStatusPhase] +func (m *EventSubscriptionMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[eventsubscription.FieldStatusPhase] return ok } // ResetStatusPhase resets all changes to the "status_phase" field. -func (m *EventExposureMutation) ResetStatusPhase() { +func (m *EventSubscriptionMutation) ResetStatusPhase() { m.status_phase = nil - delete(m.clearedFields, eventexposure.FieldStatusPhase) + delete(m.clearedFields, eventsubscription.FieldStatusPhase) } // SetStatusMessage sets the "status_message" field. -func (m *EventExposureMutation) SetStatusMessage(s string) { +func (m *EventSubscriptionMutation) 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) { +func (m *EventSubscriptionMutation) StatusMessage() (r string, exists bool) { v := m.status_message if v == nil { return @@ -7110,10 +9466,10 @@ func (m *EventExposureMutation) StatusMessage() (r string, exists bool) { 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. +// 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 *EventExposureMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { +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") } @@ -7128,30 +9484,30 @@ func (m *EventExposureMutation) OldStatusMessage(ctx context.Context) (v *string } // ClearStatusMessage clears the value of the "status_message" field. -func (m *EventExposureMutation) ClearStatusMessage() { +func (m *EventSubscriptionMutation) ClearStatusMessage() { m.status_message = nil - m.clearedFields[eventexposure.FieldStatusMessage] = struct{}{} + m.clearedFields[eventsubscription.FieldStatusMessage] = struct{}{} } // StatusMessageCleared returns if the "status_message" field was cleared in this mutation. -func (m *EventExposureMutation) StatusMessageCleared() bool { - _, ok := m.clearedFields[eventexposure.FieldStatusMessage] +func (m *EventSubscriptionMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[eventsubscription.FieldStatusMessage] return ok } // ResetStatusMessage resets all changes to the "status_message" field. -func (m *EventExposureMutation) ResetStatusMessage() { +func (m *EventSubscriptionMutation) ResetStatusMessage() { m.status_message = nil - delete(m.clearedFields, eventexposure.FieldStatusMessage) + delete(m.clearedFields, eventsubscription.FieldStatusMessage) } // SetEnvironment sets the "environment" field. -func (m *EventExposureMutation) SetEnvironment(s string) { +func (m *EventSubscriptionMutation) 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) { +func (m *EventSubscriptionMutation) Environment() (r string, exists bool) { v := m.environment if v == nil { return @@ -7159,10 +9515,10 @@ func (m *EventExposureMutation) Environment() (r string, exists bool) { 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. +// 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 *EventExposureMutation) OldEnvironment(ctx context.Context) (v *string, err error) { +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") } @@ -7177,30 +9533,30 @@ func (m *EventExposureMutation) OldEnvironment(ctx context.Context) (v *string, } // ClearEnvironment clears the value of the "environment" field. -func (m *EventExposureMutation) ClearEnvironment() { +func (m *EventSubscriptionMutation) ClearEnvironment() { m.environment = nil - m.clearedFields[eventexposure.FieldEnvironment] = struct{}{} + m.clearedFields[eventsubscription.FieldEnvironment] = struct{}{} } // EnvironmentCleared returns if the "environment" field was cleared in this mutation. -func (m *EventExposureMutation) EnvironmentCleared() bool { - _, ok := m.clearedFields[eventexposure.FieldEnvironment] +func (m *EventSubscriptionMutation) EnvironmentCleared() bool { + _, ok := m.clearedFields[eventsubscription.FieldEnvironment] return ok } // ResetEnvironment resets all changes to the "environment" field. -func (m *EventExposureMutation) ResetEnvironment() { +func (m *EventSubscriptionMutation) ResetEnvironment() { m.environment = nil - delete(m.clearedFields, eventexposure.FieldEnvironment) + delete(m.clearedFields, eventsubscription.FieldEnvironment) } // SetNamespace sets the "namespace" field. -func (m *EventExposureMutation) SetNamespace(s string) { +func (m *EventSubscriptionMutation) 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) { +func (m *EventSubscriptionMutation) Namespace() (r string, exists bool) { v := m.namespace if v == nil { return @@ -7208,10 +9564,10 @@ func (m *EventExposureMutation) Namespace() (r string, exists bool) { 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. +// 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 *EventExposureMutation) OldNamespace(ctx context.Context) (v string, err error) { +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") } @@ -7226,17 +9582,53 @@ func (m *EventExposureMutation) OldNamespace(ctx context.Context) (v string, err } // ResetNamespace resets all changes to the "namespace" field. -func (m *EventExposureMutation) ResetNamespace() { +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 *EventExposureMutation) SetEventType(s string) { +func (m *EventSubscriptionMutation) 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) { +func (m *EventSubscriptionMutation) EventType() (r string, exists bool) { v := m.event_type if v == nil { return @@ -7244,10 +9636,10 @@ func (m *EventExposureMutation) EventType() (r string, exists bool) { 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. +// 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 *EventExposureMutation) OldEventType(ctx context.Context) (v string, err error) { +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") } @@ -7262,148 +9654,112 @@ func (m *EventExposureMutation) OldEventType(ctx context.Context) (v string, err } // ResetEventType resets all changes to the "event_type" field. -func (m *EventExposureMutation) ResetEventType() { +func (m *EventSubscriptionMutation) ResetEventType() { m.event_type = nil } -// SetVisibility sets the "visibility" field. -func (m *EventExposureMutation) SetVisibility(e eventexposure.Visibility) { - m.visibility = &e +// SetDeliveryType sets the "delivery_type" field. +func (m *EventSubscriptionMutation) SetDeliveryType(et eventsubscription.DeliveryType) { + m.delivery_type = &et } -// Visibility returns the value of the "visibility" field in the mutation. -func (m *EventExposureMutation) Visibility() (r eventexposure.Visibility, exists bool) { - v := m.visibility +// 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 } -// 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. +// 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 *EventExposureMutation) OldVisibility(ctx context.Context) (v eventexposure.Visibility, err error) { +func (m *EventSubscriptionMutation) OldDeliveryType(ctx context.Context) (v eventsubscription.DeliveryType, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldVisibility is only allowed on UpdateOne operations") + return v, errors.New("OldDeliveryType 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") + 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 OldVisibility: %w", err) + return v, fmt.Errorf("querying old value for OldDeliveryType: %w", err) } - return oldValue.Visibility, nil + return oldValue.DeliveryType, nil } -// ResetVisibility resets all changes to the "visibility" field. -func (m *EventExposureMutation) ResetVisibility() { - m.visibility = nil +// ResetDeliveryType resets all changes to the "delivery_type" field. +func (m *EventSubscriptionMutation) ResetDeliveryType() { + m.delivery_type = nil } -// SetActive sets the "active" field. -func (m *EventExposureMutation) SetActive(b bool) { - m.active = &b +// SetCallbackURL sets the "callback_url" field. +func (m *EventSubscriptionMutation) SetCallbackURL(s string) { + m.callback_url = &s } -// Active returns the value of the "active" field in the mutation. -func (m *EventExposureMutation) Active() (r bool, exists bool) { - v := m.active +// 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 } -// 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. +// 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 *EventExposureMutation) OldActive(ctx context.Context) (v *bool, err error) { +func (m *EventSubscriptionMutation) OldCallbackURL(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldActive is only allowed on UpdateOne operations") + return v, errors.New("OldCallbackURL 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") + 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 OldActive: %w", err) + return v, fmt.Errorf("querying old value for OldCallbackURL: %w", err) } - return oldValue.Active, nil + return oldValue.CallbackURL, nil } -// ClearActive clears the value of the "active" field. -func (m *EventExposureMutation) ClearActive() { - m.active = nil - m.clearedFields[eventexposure.FieldActive] = struct{}{} +// ClearCallbackURL clears the value of the "callback_url" field. +func (m *EventSubscriptionMutation) ClearCallbackURL() { + m.callback_url = nil + m.clearedFields[eventsubscription.FieldCallbackURL] = struct{}{} } -// ActiveCleared returns if the "active" field was cleared in this mutation. -func (m *EventExposureMutation) ActiveCleared() bool { - _, ok := m.clearedFields[eventexposure.FieldActive] +// CallbackURLCleared returns if the "callback_url" field was cleared in this mutation. +func (m *EventSubscriptionMutation) CallbackURLCleared() bool { + _, ok := m.clearedFields[eventsubscription.FieldCallbackURL] 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 +// 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 *EventExposureMutation) SetOwnerID(id int) { +func (m *EventSubscriptionMutation) SetOwnerID(id int) { m.owner = &id } // ClearOwner clears the "owner" edge to the Application entity. -func (m *EventExposureMutation) ClearOwner() { +func (m *EventSubscriptionMutation) ClearOwner() { m.clearedowner = true } // OwnerCleared reports if the "owner" edge to the Application entity was cleared. -func (m *EventExposureMutation) OwnerCleared() bool { +func (m *EventSubscriptionMutation) OwnerCleared() bool { return m.clearedowner } // OwnerID returns the "owner" edge ID in the mutation. -func (m *EventExposureMutation) OwnerID() (id int, exists bool) { +func (m *EventSubscriptionMutation) OwnerID() (id int, exists bool) { if m.owner != nil { return *m.owner, true } @@ -7413,7 +9769,7 @@ func (m *EventExposureMutation) OwnerID() (id int, exists bool) { // 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) { +func (m *EventSubscriptionMutation) OwnerIDs() (ids []int) { if id := m.owner; id != nil { ids = append(ids, *id) } @@ -7421,74 +9777,152 @@ func (m *EventExposureMutation) OwnerIDs() (ids []int) { } // ResetOwner resets all changes to the "owner" edge. -func (m *EventExposureMutation) ResetOwner() { +func (m *EventSubscriptionMutation) 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{}) +// 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.subscriptions[ids[i]] = struct{}{} + m.approval_requests[ids[i]] = struct{}{} } } -// ClearSubscriptions clears the "subscriptions" edge to the EventSubscription entity. -func (m *EventExposureMutation) ClearSubscriptions() { - m.clearedsubscriptions = true +// ClearApprovalRequests clears the "approval_requests" edge to the ApprovalRequest entity. +func (m *EventSubscriptionMutation) ClearApprovalRequests() { + m.clearedapproval_requests = true } -// SubscriptionsCleared reports if the "subscriptions" edge to the EventSubscription entity was cleared. -func (m *EventExposureMutation) SubscriptionsCleared() bool { - return m.clearedsubscriptions +// ApprovalRequestsCleared reports if the "approval_requests" edge to the ApprovalRequest entity was cleared. +func (m *EventSubscriptionMutation) ApprovalRequestsCleared() bool { + return m.clearedapproval_requests } -// 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{}) +// 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.subscriptions, ids[i]) - m.removedsubscriptions[ids[i]] = struct{}{} + delete(m.approval_requests, ids[i]) + m.removedapproval_requests[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 { +// 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 } -// SubscriptionsIDs returns the "subscriptions" edge IDs in the mutation. -func (m *EventExposureMutation) SubscriptionsIDs() (ids []int) { - for id := range m.subscriptions { +// 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 } -// ResetSubscriptions resets all changes to the "subscriptions" edge. -func (m *EventExposureMutation) ResetSubscriptions() { - m.subscriptions = nil - m.clearedsubscriptions = false - m.removedsubscriptions = nil +// 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 EventExposureMutation builder. -func (m *EventExposureMutation) Where(ps ...predicate.EventExposure) { +// 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 EventExposureMutation builder. Using this method, +// 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 *EventExposureMutation) WhereP(ps ...func(*sql.Selector)) { - p := make([]predicate.EventExposure, len(ps)) +func (m *EventSubscriptionMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.EventSubscription, len(ps)) for i := range ps { p[i] = ps[i] } @@ -7496,54 +9930,54 @@ func (m *EventExposureMutation) WhereP(ps ...func(*sql.Selector)) { } // Op returns the operation name. -func (m *EventExposureMutation) Op() Op { +func (m *EventSubscriptionMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. -func (m *EventExposureMutation) SetOp(op Op) { +func (m *EventSubscriptionMutation) SetOp(op Op) { m.op = op } -// Type returns the node type of this mutation (EventExposure). -func (m *EventExposureMutation) Type() string { +// 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 *EventExposureMutation) Fields() []string { +func (m *EventSubscriptionMutation) Fields() []string { fields := make([]string, 0, 10) if m.created_at != nil { - fields = append(fields, eventexposure.FieldCreatedAt) + fields = append(fields, eventsubscription.FieldCreatedAt) } if m.last_modified_at != nil { - fields = append(fields, eventexposure.FieldLastModifiedAt) + fields = append(fields, eventsubscription.FieldLastModifiedAt) } if m.status_phase != nil { - fields = append(fields, eventexposure.FieldStatusPhase) + fields = append(fields, eventsubscription.FieldStatusPhase) } if m.status_message != nil { - fields = append(fields, eventexposure.FieldStatusMessage) + fields = append(fields, eventsubscription.FieldStatusMessage) } if m.environment != nil { - fields = append(fields, eventexposure.FieldEnvironment) + fields = append(fields, eventsubscription.FieldEnvironment) } if m.namespace != nil { - fields = append(fields, eventexposure.FieldNamespace) + fields = append(fields, eventsubscription.FieldNamespace) } - if m.event_type != nil { - fields = append(fields, eventexposure.FieldEventType) + if m.name != nil { + fields = append(fields, eventsubscription.FieldName) } - if m.visibility != nil { - fields = append(fields, eventexposure.FieldVisibility) + if m.event_type != nil { + fields = append(fields, eventsubscription.FieldEventType) } - if m.active != nil { - fields = append(fields, eventexposure.FieldActive) + if m.delivery_type != nil { + fields = append(fields, eventsubscription.FieldDeliveryType) } - if m.approval_config != nil { - fields = append(fields, eventexposure.FieldApprovalConfig) + if m.callback_url != nil { + fields = append(fields, eventsubscription.FieldCallbackURL) } return fields } @@ -7551,28 +9985,28 @@ func (m *EventExposureMutation) Fields() []string { // 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) { +func (m *EventSubscriptionMutation) Field(name string) (ent.Value, bool) { switch name { - case eventexposure.FieldCreatedAt: + case eventsubscription.FieldCreatedAt: return m.CreatedAt() - case eventexposure.FieldLastModifiedAt: + case eventsubscription.FieldLastModifiedAt: return m.LastModifiedAt() - case eventexposure.FieldStatusPhase: + case eventsubscription.FieldStatusPhase: return m.StatusPhase() - case eventexposure.FieldStatusMessage: + case eventsubscription.FieldStatusMessage: return m.StatusMessage() - case eventexposure.FieldEnvironment: + case eventsubscription.FieldEnvironment: return m.Environment() - case eventexposure.FieldNamespace: + case eventsubscription.FieldNamespace: return m.Namespace() - case eventexposure.FieldEventType: + case eventsubscription.FieldName: + return m.Name() + case eventsubscription.FieldEventType: return m.EventType() - case eventexposure.FieldVisibility: - return m.Visibility() - case eventexposure.FieldActive: - return m.Active() - case eventexposure.FieldApprovalConfig: - return m.ApprovalConfig() + case eventsubscription.FieldDeliveryType: + return m.DeliveryType() + case eventsubscription.FieldCallbackURL: + return m.CallbackURL() } return nil, false } @@ -7580,240 +10014,254 @@ func (m *EventExposureMutation) Field(name string) (ent.Value, bool) { // 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) { +func (m *EventSubscriptionMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { - case eventexposure.FieldCreatedAt: + case eventsubscription.FieldCreatedAt: return m.OldCreatedAt(ctx) - case eventexposure.FieldLastModifiedAt: + case eventsubscription.FieldLastModifiedAt: return m.OldLastModifiedAt(ctx) - case eventexposure.FieldStatusPhase: + case eventsubscription.FieldStatusPhase: return m.OldStatusPhase(ctx) - case eventexposure.FieldStatusMessage: + case eventsubscription.FieldStatusMessage: return m.OldStatusMessage(ctx) - case eventexposure.FieldEnvironment: + case eventsubscription.FieldEnvironment: return m.OldEnvironment(ctx) - case eventexposure.FieldNamespace: + case eventsubscription.FieldNamespace: return m.OldNamespace(ctx) - case eventexposure.FieldEventType: + case eventsubscription.FieldName: + return m.OldName(ctx) + case eventsubscription.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) + case eventsubscription.FieldDeliveryType: + return m.OldDeliveryType(ctx) + case eventsubscription.FieldCallbackURL: + return m.OldCallbackURL(ctx) } - return nil, fmt.Errorf("unknown EventExposure 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 *EventExposureMutation) SetField(name string, value ent.Value) error { +func (m *EventSubscriptionMutation) SetField(name string, value ent.Value) error { switch name { - case eventexposure.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 eventexposure.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 eventexposure.FieldStatusPhase: - v, ok := value.(eventexposure.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 eventexposure.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 eventexposure.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 eventexposure.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 eventexposure.FieldEventType: + case eventsubscription.FieldName: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetEventType(v) + m.SetName(v) return nil - case eventexposure.FieldVisibility: - v, ok := value.(eventexposure.Visibility) + case eventsubscription.FieldEventType: + v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetVisibility(v) + m.SetEventType(v) return nil - case eventexposure.FieldActive: - v, ok := value.(bool) + case eventsubscription.FieldDeliveryType: + v, ok := value.(eventsubscription.DeliveryType) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetActive(v) + m.SetDeliveryType(v) return nil - case eventexposure.FieldApprovalConfig: - v, ok := value.(model.ApprovalConfig) + case eventsubscription.FieldCallbackURL: + v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetApprovalConfig(v) + m.SetCallbackURL(v) return nil } - return fmt.Errorf("unknown EventExposure 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 *EventExposureMutation) 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 *EventExposureMutation) 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 *EventExposureMutation) AddField(name string, value ent.Value) error { +func (m *EventSubscriptionMutation) AddField(name string, value ent.Value) error { switch name { } - return fmt.Errorf("unknown EventExposure 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 *EventExposureMutation) ClearedFields() []string { +func (m *EventSubscriptionMutation) ClearedFields() []string { var fields []string - if m.FieldCleared(eventexposure.FieldStatusPhase) { - fields = append(fields, eventexposure.FieldStatusPhase) + if m.FieldCleared(eventsubscription.FieldStatusPhase) { + fields = append(fields, eventsubscription.FieldStatusPhase) } - if m.FieldCleared(eventexposure.FieldStatusMessage) { - fields = append(fields, eventexposure.FieldStatusMessage) + if m.FieldCleared(eventsubscription.FieldStatusMessage) { + fields = append(fields, eventsubscription.FieldStatusMessage) } - if m.FieldCleared(eventexposure.FieldEnvironment) { - fields = append(fields, eventexposure.FieldEnvironment) + if m.FieldCleared(eventsubscription.FieldEnvironment) { + fields = append(fields, eventsubscription.FieldEnvironment) } - if m.FieldCleared(eventexposure.FieldActive) { - fields = append(fields, eventexposure.FieldActive) + 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 *EventExposureMutation) 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 *EventExposureMutation) ClearField(name string) error { +func (m *EventSubscriptionMutation) ClearField(name string) error { switch name { - case eventexposure.FieldStatusPhase: + case eventsubscription.FieldStatusPhase: m.ClearStatusPhase() return nil - case eventexposure.FieldStatusMessage: + case eventsubscription.FieldStatusMessage: m.ClearStatusMessage() return nil - case eventexposure.FieldEnvironment: + case eventsubscription.FieldEnvironment: m.ClearEnvironment() return nil - case eventexposure.FieldActive: - m.ClearActive() + case eventsubscription.FieldCallbackURL: + m.ClearCallbackURL() return nil } - return fmt.Errorf("unknown EventExposure 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 *EventExposureMutation) ResetField(name string) error { +func (m *EventSubscriptionMutation) ResetField(name string) error { switch name { - case eventexposure.FieldCreatedAt: + case eventsubscription.FieldCreatedAt: m.ResetCreatedAt() return nil - case eventexposure.FieldLastModifiedAt: + case eventsubscription.FieldLastModifiedAt: m.ResetLastModifiedAt() return nil - case eventexposure.FieldStatusPhase: + case eventsubscription.FieldStatusPhase: m.ResetStatusPhase() return nil - case eventexposure.FieldStatusMessage: + case eventsubscription.FieldStatusMessage: m.ResetStatusMessage() return nil - case eventexposure.FieldEnvironment: + case eventsubscription.FieldEnvironment: m.ResetEnvironment() return nil - case eventexposure.FieldNamespace: + case eventsubscription.FieldNamespace: m.ResetNamespace() return nil - case eventexposure.FieldEventType: - m.ResetEventType() + case eventsubscription.FieldName: + m.ResetName() return nil - case eventexposure.FieldVisibility: - m.ResetVisibility() + case eventsubscription.FieldEventType: + m.ResetEventType() return nil - case eventexposure.FieldActive: - m.ResetActive() + case eventsubscription.FieldDeliveryType: + m.ResetDeliveryType() return nil - case eventexposure.FieldApprovalConfig: - m.ResetApprovalConfig() + case eventsubscription.FieldCallbackURL: + m.ResetCallbackURL() return nil } - return fmt.Errorf("unknown EventExposure 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 *EventExposureMutation) AddedEdges() []string { - edges := make([]string, 0, 2) +func (m *EventSubscriptionMutation) AddedEdges() []string { + edges := make([]string, 0, 4) if m.owner != nil { - edges = append(edges, eventexposure.EdgeOwner) + edges = append(edges, eventsubscription.EdgeOwner) } - if m.subscriptions != nil { - edges = append(edges, eventexposure.EdgeSubscriptions) + 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 *EventExposureMutation) AddedIDs(name string) []ent.Value { +func (m *EventSubscriptionMutation) AddedIDs(name string) []ent.Value { switch name { - case eventexposure.EdgeOwner: + case eventsubscription.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 { + 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 @@ -7822,21 +10270,21 @@ func (m *EventExposureMutation) AddedIDs(name string) []ent.Value { } // 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) +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 *EventExposureMutation) RemovedIDs(name string) []ent.Value { +func (m *EventSubscriptionMutation) RemovedIDs(name string) []ent.Value { switch name { - case eventexposure.EdgeSubscriptions: - ids := make([]ent.Value, 0, len(m.removedsubscriptions)) - for id := range m.removedsubscriptions { + case eventsubscription.EdgeApprovalRequests: + ids := make([]ent.Value, 0, len(m.removedapproval_requests)) + for id := range m.removedapproval_requests { ids = append(ids, id) } return ids @@ -7845,96 +10293,114 @@ func (m *EventExposureMutation) RemovedIDs(name string) []ent.Value { } // ClearedEdges returns all edge names that were cleared in this mutation. -func (m *EventExposureMutation) ClearedEdges() []string { - edges := make([]string, 0, 2) +func (m *EventSubscriptionMutation) ClearedEdges() []string { + edges := make([]string, 0, 4) if m.clearedowner { - edges = append(edges, eventexposure.EdgeOwner) + edges = append(edges, eventsubscription.EdgeOwner) } - if m.clearedsubscriptions { - edges = append(edges, eventexposure.EdgeSubscriptions) + 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 *EventExposureMutation) EdgeCleared(name string) bool { +func (m *EventSubscriptionMutation) EdgeCleared(name string) bool { switch name { - case eventexposure.EdgeOwner: + case eventsubscription.EdgeOwner: return m.clearedowner - case eventexposure.EdgeSubscriptions: - return m.clearedsubscriptions + 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 *EventExposureMutation) ClearEdge(name string) error { +func (m *EventSubscriptionMutation) ClearEdge(name string) error { switch name { - case eventexposure.EdgeOwner: + 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 EventExposure 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 *EventExposureMutation) ResetEdge(name string) error { +func (m *EventSubscriptionMutation) ResetEdge(name string) error { switch name { - case eventexposure.EdgeOwner: + case eventsubscription.EdgeOwner: m.ResetOwner() return nil - case eventexposure.EdgeSubscriptions: - m.ResetSubscriptions() + 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 EventExposure edge %s", name) + return fmt.Errorf("unknown EventSubscription edge %s", name) } -// EventSubscriptionMutation represents an operation that mutates the EventSubscription nodes in the graph. -type EventSubscriptionMutation struct { +// EventTypeMutation represents an operation that mutates the EventType nodes in the graph. +type EventTypeMutation 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{ + op Op + typ string + id *int + created_at *time.Time + last_modified_at *time.Time + status_phase *eventtype.StatusPhase + status_message *string + namespace *string + event_type *string + version *string + description *string + specification *string + active *bool + clearedFields map[string]struct{} + owner *int + clearedowner bool + exposures map[int]struct{} + removedexposures map[int]struct{} + clearedexposures bool + done bool + oldValue func(context.Context) (*EventType, error) + predicates []predicate.EventType +} + +var _ ent.Mutation = (*EventTypeMutation)(nil) + +// eventtypeOption allows management of the mutation configuration using functional options. +type eventtypeOption func(*EventTypeMutation) + +// newEventTypeMutation creates new mutation for the EventType entity. +func newEventTypeMutation(c config, op Op, opts ...eventtypeOption) *EventTypeMutation { + m := &EventTypeMutation{ config: c, op: op, - typ: TypeEventSubscription, + typ: TypeEventType, clearedFields: make(map[string]struct{}), } for _, opt := range opts { @@ -7943,20 +10409,20 @@ func newEventSubscriptionMutation(c config, op Op, opts ...eventsubscriptionOpti return m } -// withEventSubscriptionID sets the ID field of the mutation. -func withEventSubscriptionID(id int) eventsubscriptionOption { - return func(m *EventSubscriptionMutation) { +// withEventTypeID sets the ID field of the mutation. +func withEventTypeID(id int) eventtypeOption { + return func(m *EventTypeMutation) { var ( err error once sync.Once - value *EventSubscription + value *EventType ) - m.oldValue = func(ctx context.Context) (*EventSubscription, error) { + m.oldValue = func(ctx context.Context) (*EventType, 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) + value, err = m.Client().EventType.Get(ctx, id) } }) return value, err @@ -7965,10 +10431,10 @@ func withEventSubscriptionID(id int) eventsubscriptionOption { } } -// withEventSubscription sets the old EventSubscription of the mutation. -func withEventSubscription(node *EventSubscription) eventsubscriptionOption { - return func(m *EventSubscriptionMutation) { - m.oldValue = func(context.Context) (*EventSubscription, error) { +// withEventType sets the old EventType of the mutation. +func withEventType(node *EventType) eventtypeOption { + return func(m *EventTypeMutation) { + m.oldValue = func(context.Context) (*EventType, error) { return node, nil } m.id = &node.ID @@ -7977,7 +10443,7 @@ func withEventSubscription(node *EventSubscription) eventsubscriptionOption { // 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 { +func (m EventTypeMutation) Client() *Client { client := &Client{config: m.config} client.init() return client @@ -7985,7 +10451,7 @@ func (m EventSubscriptionMutation) Client() *Client { // Tx returns an `ent.Tx` for mutations that were executed in transactions; // it returns an error otherwise. -func (m EventSubscriptionMutation) Tx() (*Tx, error) { +func (m EventTypeMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("ent: mutation is not running in a transaction") } @@ -7996,7 +10462,7 @@ func (m EventSubscriptionMutation) Tx() (*Tx, error) { // 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) { +func (m *EventTypeMutation) ID() (id int, exists bool) { if m.id == nil { return } @@ -8007,7 +10473,7 @@ func (m *EventSubscriptionMutation) ID() (id int, exists bool) { // 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) { +func (m *EventTypeMutation) IDs(ctx context.Context) ([]int, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() @@ -8016,19 +10482,19 @@ func (m *EventSubscriptionMutation) IDs(ctx context.Context) ([]int, error) { } fallthrough case m.op.Is(OpUpdate | OpDelete): - return m.Client().EventSubscription.Query().Where(m.predicates...).IDs(ctx) + return m.Client().EventType.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) { +func (m *EventTypeMutation) 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) { +func (m *EventTypeMutation) CreatedAt() (r time.Time, exists bool) { v := m.created_at if v == nil { return @@ -8036,10 +10502,10 @@ func (m *EventSubscriptionMutation) CreatedAt() (r time.Time, exists bool) { 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. +// OldCreatedAt returns the old "created_at" field's value of the EventType entity. +// If the EventType 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) { +func (m *EventTypeMutation) 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") } @@ -8054,17 +10520,17 @@ func (m *EventSubscriptionMutation) OldCreatedAt(ctx context.Context) (v time.Ti } // ResetCreatedAt resets all changes to the "created_at" field. -func (m *EventSubscriptionMutation) ResetCreatedAt() { +func (m *EventTypeMutation) ResetCreatedAt() { m.created_at = nil } // SetLastModifiedAt sets the "last_modified_at" field. -func (m *EventSubscriptionMutation) SetLastModifiedAt(t time.Time) { +func (m *EventTypeMutation) 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) { +func (m *EventTypeMutation) LastModifiedAt() (r time.Time, exists bool) { v := m.last_modified_at if v == nil { return @@ -8072,10 +10538,10 @@ func (m *EventSubscriptionMutation) LastModifiedAt() (r time.Time, exists bool) 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. +// OldLastModifiedAt returns the old "last_modified_at" field's value of the EventType entity. +// If the EventType 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) { +func (m *EventTypeMutation) 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") } @@ -8090,17 +10556,17 @@ func (m *EventSubscriptionMutation) OldLastModifiedAt(ctx context.Context) (v ti } // ResetLastModifiedAt resets all changes to the "last_modified_at" field. -func (m *EventSubscriptionMutation) ResetLastModifiedAt() { +func (m *EventTypeMutation) ResetLastModifiedAt() { m.last_modified_at = nil } // SetStatusPhase sets the "status_phase" field. -func (m *EventSubscriptionMutation) SetStatusPhase(ep eventsubscription.StatusPhase) { +func (m *EventTypeMutation) SetStatusPhase(ep eventtype.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) { +func (m *EventTypeMutation) StatusPhase() (r eventtype.StatusPhase, exists bool) { v := m.status_phase if v == nil { return @@ -8108,10 +10574,10 @@ func (m *EventSubscriptionMutation) StatusPhase() (r eventsubscription.StatusPha 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. +// OldStatusPhase returns the old "status_phase" field's value of the EventType entity. +// If the EventType 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) { +func (m *EventTypeMutation) OldStatusPhase(ctx context.Context) (v *eventtype.StatusPhase, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStatusPhase is only allowed on UpdateOne operations") } @@ -8126,30 +10592,30 @@ func (m *EventSubscriptionMutation) OldStatusPhase(ctx context.Context) (v *even } // ClearStatusPhase clears the value of the "status_phase" field. -func (m *EventSubscriptionMutation) ClearStatusPhase() { +func (m *EventTypeMutation) ClearStatusPhase() { m.status_phase = nil - m.clearedFields[eventsubscription.FieldStatusPhase] = struct{}{} + m.clearedFields[eventtype.FieldStatusPhase] = struct{}{} } // StatusPhaseCleared returns if the "status_phase" field was cleared in this mutation. -func (m *EventSubscriptionMutation) StatusPhaseCleared() bool { - _, ok := m.clearedFields[eventsubscription.FieldStatusPhase] +func (m *EventTypeMutation) StatusPhaseCleared() bool { + _, ok := m.clearedFields[eventtype.FieldStatusPhase] return ok } // ResetStatusPhase resets all changes to the "status_phase" field. -func (m *EventSubscriptionMutation) ResetStatusPhase() { +func (m *EventTypeMutation) ResetStatusPhase() { m.status_phase = nil - delete(m.clearedFields, eventsubscription.FieldStatusPhase) + delete(m.clearedFields, eventtype.FieldStatusPhase) } // SetStatusMessage sets the "status_message" field. -func (m *EventSubscriptionMutation) SetStatusMessage(s string) { +func (m *EventTypeMutation) 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) { +func (m *EventTypeMutation) StatusMessage() (r string, exists bool) { v := m.status_message if v == nil { return @@ -8157,10 +10623,10 @@ func (m *EventSubscriptionMutation) StatusMessage() (r string, exists bool) { 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. +// OldStatusMessage returns the old "status_message" field's value of the EventType entity. +// If the EventType 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) { +func (m *EventTypeMutation) OldStatusMessage(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldStatusMessage is only allowed on UpdateOne operations") } @@ -8175,151 +10641,66 @@ func (m *EventSubscriptionMutation) OldStatusMessage(ctx context.Context) (v *st } // ClearStatusMessage clears the value of the "status_message" field. -func (m *EventSubscriptionMutation) ClearStatusMessage() { +func (m *EventTypeMutation) ClearStatusMessage() { m.status_message = nil - m.clearedFields[eventsubscription.FieldStatusMessage] = struct{}{} + m.clearedFields[eventtype.FieldStatusMessage] = struct{}{} } // StatusMessageCleared returns if the "status_message" field was cleared in this mutation. -func (m *EventSubscriptionMutation) StatusMessageCleared() bool { - _, ok := m.clearedFields[eventsubscription.FieldStatusMessage] +func (m *EventTypeMutation) StatusMessageCleared() bool { + _, ok := m.clearedFields[eventtype.FieldStatusMessage] return ok } // ResetStatusMessage resets all changes to the "status_message" field. -func (m *EventSubscriptionMutation) ResetStatusMessage() { +func (m *EventTypeMutation) 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) + delete(m.clearedFields, eventtype.FieldStatusMessage) } // SetNamespace sets the "namespace" field. -func (m *EventSubscriptionMutation) SetNamespace(s string) { +func (m *EventTypeMutation) 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 +// Namespace returns the value of the "namespace" field in the mutation. +func (m *EventTypeMutation) Namespace() (r string, exists bool) { + v := m.namespace 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. +// OldNamespace returns the old "namespace" field's value of the EventType entity. +// If the EventType 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) { +func (m *EventTypeMutation) OldNamespace(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldName is only allowed on UpdateOne operations") + return v, errors.New("OldNamespace 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") + 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 OldName: %w", err) + return v, fmt.Errorf("querying old value for OldNamespace: %w", err) } - return oldValue.Name, nil + return oldValue.Namespace, nil } -// ResetName resets all changes to the "name" field. -func (m *EventSubscriptionMutation) ResetName() { - m.name = nil +// ResetNamespace resets all changes to the "namespace" field. +func (m *EventTypeMutation) ResetNamespace() { + m.namespace = nil } // SetEventType sets the "event_type" field. -func (m *EventSubscriptionMutation) SetEventType(s string) { +func (m *EventTypeMutation) 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) { +func (m *EventTypeMutation) EventType() (r string, exists bool) { v := m.event_type if v == nil { return @@ -8327,10 +10708,10 @@ func (m *EventSubscriptionMutation) EventType() (r string, exists bool) { 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. +// OldEventType returns the old "event_type" field's value of the EventType entity. +// If the EventType 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) { +func (m *EventTypeMutation) OldEventType(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldEventType is only allowed on UpdateOne operations") } @@ -8345,275 +10726,282 @@ func (m *EventSubscriptionMutation) OldEventType(ctx context.Context) (v string, } // ResetEventType resets all changes to the "event_type" field. -func (m *EventSubscriptionMutation) ResetEventType() { +func (m *EventTypeMutation) ResetEventType() { m.event_type = nil } -// SetDeliveryType sets the "delivery_type" field. -func (m *EventSubscriptionMutation) SetDeliveryType(et eventsubscription.DeliveryType) { - m.delivery_type = &et +// SetVersion sets the "version" field. +func (m *EventTypeMutation) SetVersion(s string) { + m.version = &s } -// 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 +// Version returns the value of the "version" field in the mutation. +func (m *EventTypeMutation) Version() (r string, exists bool) { + v := m.version 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. +// OldVersion returns the old "version" field's value of the EventType entity. +// If the EventType 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) { +func (m *EventTypeMutation) OldVersion(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldDeliveryType is only allowed on UpdateOne operations") + return v, errors.New("OldVersion 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") + return v, errors.New("OldVersion 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 v, fmt.Errorf("querying old value for OldVersion: %w", err) } - return oldValue.DeliveryType, nil + return oldValue.Version, nil } -// ResetDeliveryType resets all changes to the "delivery_type" field. -func (m *EventSubscriptionMutation) ResetDeliveryType() { - m.delivery_type = nil +// ResetVersion resets all changes to the "version" field. +func (m *EventTypeMutation) ResetVersion() { + m.version = nil } -// SetCallbackURL sets the "callback_url" field. -func (m *EventSubscriptionMutation) SetCallbackURL(s string) { - m.callback_url = &s +// SetDescription sets the "description" field. +func (m *EventTypeMutation) SetDescription(s string) { + m.description = &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 +// Description returns the value of the "description" field in the mutation. +func (m *EventTypeMutation) Description() (r string, exists bool) { + v := m.description 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. +// OldDescription returns the old "description" field's value of the EventType entity. +// If the EventType 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) { +func (m *EventTypeMutation) OldDescription(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldCallbackURL is only allowed on UpdateOne operations") + return v, errors.New("OldDescription 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") + return v, errors.New("OldDescription 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 v, fmt.Errorf("querying old value for OldDescription: %w", err) } - return oldValue.CallbackURL, nil + return oldValue.Description, nil } -// ClearCallbackURL clears the value of the "callback_url" field. -func (m *EventSubscriptionMutation) ClearCallbackURL() { - m.callback_url = nil - m.clearedFields[eventsubscription.FieldCallbackURL] = struct{}{} +// ClearDescription clears the value of the "description" field. +func (m *EventTypeMutation) ClearDescription() { + m.description = nil + m.clearedFields[eventtype.FieldDescription] = struct{}{} } -// CallbackURLCleared returns if the "callback_url" field was cleared in this mutation. -func (m *EventSubscriptionMutation) CallbackURLCleared() bool { - _, ok := m.clearedFields[eventsubscription.FieldCallbackURL] +// DescriptionCleared returns if the "description" field was cleared in this mutation. +func (m *EventTypeMutation) DescriptionCleared() bool { + _, ok := m.clearedFields[eventtype.FieldDescription] 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 +// ResetDescription resets all changes to the "description" field. +func (m *EventTypeMutation) ResetDescription() { + m.description = nil + delete(m.clearedFields, eventtype.FieldDescription) } -// OwnerCleared reports if the "owner" edge to the Application entity was cleared. -func (m *EventSubscriptionMutation) OwnerCleared() bool { - return m.clearedowner +// SetSpecification sets the "specification" field. +func (m *EventTypeMutation) SetSpecification(s string) { + m.specification = &s } -// 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 +// Specification returns the value of the "specification" field in the mutation. +func (m *EventTypeMutation) Specification() (r string, exists bool) { + v := m.specification + if v == nil { + return } - return + return *v, true } -// 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) +// OldSpecification returns the old "specification" field's value of the EventType entity. +// If the EventType 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 *EventTypeMutation) OldSpecification(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldSpecification is only allowed on UpdateOne operations") } - return + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldSpecification requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldSpecification: %w", err) + } + return oldValue.Specification, nil } -// ResetOwner resets all changes to the "owner" edge. -func (m *EventSubscriptionMutation) ResetOwner() { - m.owner = nil - m.clearedowner = false +// ClearSpecification clears the value of the "specification" field. +func (m *EventTypeMutation) ClearSpecification() { + m.specification = nil + m.clearedFields[eventtype.FieldSpecification] = struct{}{} } -// SetTargetID sets the "target" edge to the EventExposure entity by id. -func (m *EventSubscriptionMutation) SetTargetID(id int) { - m.target = &id +// SpecificationCleared returns if the "specification" field was cleared in this mutation. +func (m *EventTypeMutation) SpecificationCleared() bool { + _, ok := m.clearedFields[eventtype.FieldSpecification] + return ok } -// ClearTarget clears the "target" edge to the EventExposure entity. -func (m *EventSubscriptionMutation) ClearTarget() { - m.clearedtarget = true +// ResetSpecification resets all changes to the "specification" field. +func (m *EventTypeMutation) ResetSpecification() { + m.specification = nil + delete(m.clearedFields, eventtype.FieldSpecification) } -// TargetCleared reports if the "target" edge to the EventExposure entity was cleared. -func (m *EventSubscriptionMutation) TargetCleared() bool { - return m.clearedtarget +// SetActive sets the "active" field. +func (m *EventTypeMutation) SetActive(b bool) { + m.active = &b } -// 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 +// Active returns the value of the "active" field in the mutation. +func (m *EventTypeMutation) Active() (r bool, exists bool) { + v := m.active + if v == nil { + return } - return + return *v, true } -// 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) +// OldActive returns the old "active" field's value of the EventType entity. +// If the EventType 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 *EventTypeMutation) OldActive(ctx context.Context) (v bool, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldActive is only allowed on UpdateOne operations") } - return + 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 } -// ResetTarget resets all changes to the "target" edge. -func (m *EventSubscriptionMutation) ResetTarget() { - m.target = nil - m.clearedtarget = false +// ResetActive resets all changes to the "active" field. +func (m *EventTypeMutation) ResetActive() { + m.active = nil } -// SetApprovalID sets the "approval" edge to the Approval entity by id. -func (m *EventSubscriptionMutation) SetApprovalID(id int) { - m.approval = &id +// SetOwnerID sets the "owner" edge to the Team entity by id. +func (m *EventTypeMutation) SetOwnerID(id int) { + m.owner = &id } -// ClearApproval clears the "approval" edge to the Approval entity. -func (m *EventSubscriptionMutation) ClearApproval() { - m.clearedapproval = true +// ClearOwner clears the "owner" edge to the Team entity. +func (m *EventTypeMutation) ClearOwner() { + m.clearedowner = true } -// ApprovalCleared reports if the "approval" edge to the Approval entity was cleared. -func (m *EventSubscriptionMutation) ApprovalCleared() bool { - return m.clearedapproval +// OwnerCleared reports if the "owner" edge to the Team entity was cleared. +func (m *EventTypeMutation) OwnerCleared() bool { + return m.clearedowner } -// 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 +// OwnerID returns the "owner" edge ID in the mutation. +func (m *EventTypeMutation) OwnerID() (id int, exists bool) { + if m.owner != nil { + return *m.owner, true } return } -// ApprovalIDs returns the "approval" edge IDs in the mutation. +// OwnerIDs returns the "owner" 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 { +// OwnerID instead. It exists only for internal usage by the builders. +func (m *EventTypeMutation) OwnerIDs() (ids []int) { + if id := m.owner; 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 +// ResetOwner resets all changes to the "owner" edge. +func (m *EventTypeMutation) ResetOwner() { + m.owner = nil + m.clearedowner = 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{}) +// AddExposureIDs adds the "exposures" edge to the EventExposure entity by ids. +func (m *EventTypeMutation) AddExposureIDs(ids ...int) { + if m.exposures == nil { + m.exposures = make(map[int]struct{}) } for i := range ids { - m.approval_requests[ids[i]] = struct{}{} + m.exposures[ids[i]] = struct{}{} } } -// ClearApprovalRequests clears the "approval_requests" edge to the ApprovalRequest entity. -func (m *EventSubscriptionMutation) ClearApprovalRequests() { - m.clearedapproval_requests = true +// ClearExposures clears the "exposures" edge to the EventExposure entity. +func (m *EventTypeMutation) ClearExposures() { + m.clearedexposures = true } -// ApprovalRequestsCleared reports if the "approval_requests" edge to the ApprovalRequest entity was cleared. -func (m *EventSubscriptionMutation) ApprovalRequestsCleared() bool { - return m.clearedapproval_requests +// ExposuresCleared reports if the "exposures" edge to the EventExposure entity was cleared. +func (m *EventTypeMutation) ExposuresCleared() bool { + return m.clearedexposures } -// 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{}) +// RemoveExposureIDs removes the "exposures" edge to the EventExposure entity by IDs. +func (m *EventTypeMutation) RemoveExposureIDs(ids ...int) { + if m.removedexposures == nil { + m.removedexposures = make(map[int]struct{}) } for i := range ids { - delete(m.approval_requests, ids[i]) - m.removedapproval_requests[ids[i]] = struct{}{} + delete(m.exposures, ids[i]) + m.removedexposures[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 { +// RemovedExposures returns the removed IDs of the "exposures" edge to the EventExposure entity. +func (m *EventTypeMutation) RemovedExposuresIDs() (ids []int) { + for id := range m.removedexposures { 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 { +// ExposuresIDs returns the "exposures" edge IDs in the mutation. +func (m *EventTypeMutation) ExposuresIDs() (ids []int) { + for id := range m.exposures { 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 +// ResetExposures resets all changes to the "exposures" edge. +func (m *EventTypeMutation) ResetExposures() { + m.exposures = nil + m.clearedexposures = false + m.removedexposures = nil } -// Where appends a list predicates to the EventSubscriptionMutation builder. -func (m *EventSubscriptionMutation) Where(ps ...predicate.EventSubscription) { +// Where appends a list predicates to the EventTypeMutation builder. +func (m *EventTypeMutation) Where(ps ...predicate.EventType) { m.predicates = append(m.predicates, ps...) } -// WhereP appends storage-level predicates to the EventSubscriptionMutation builder. Using this method, +// WhereP appends storage-level predicates to the EventTypeMutation 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)) +func (m *EventTypeMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.EventType, len(ps)) for i := range ps { p[i] = ps[i] } @@ -8621,54 +11009,54 @@ func (m *EventSubscriptionMutation) WhereP(ps ...func(*sql.Selector)) { } // Op returns the operation name. -func (m *EventSubscriptionMutation) Op() Op { +func (m *EventTypeMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. -func (m *EventSubscriptionMutation) SetOp(op Op) { +func (m *EventTypeMutation) SetOp(op Op) { m.op = op } -// Type returns the node type of this mutation (EventSubscription). -func (m *EventSubscriptionMutation) Type() string { +// Type returns the node type of this mutation (EventType). +func (m *EventTypeMutation) 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 { +func (m *EventTypeMutation) Fields() []string { fields := make([]string, 0, 10) if m.created_at != nil { - fields = append(fields, eventsubscription.FieldCreatedAt) + fields = append(fields, eventtype.FieldCreatedAt) } if m.last_modified_at != nil { - fields = append(fields, eventsubscription.FieldLastModifiedAt) + fields = append(fields, eventtype.FieldLastModifiedAt) } if m.status_phase != nil { - fields = append(fields, eventsubscription.FieldStatusPhase) + fields = append(fields, eventtype.FieldStatusPhase) } if m.status_message != nil { - fields = append(fields, eventsubscription.FieldStatusMessage) - } - if m.environment != nil { - fields = append(fields, eventsubscription.FieldEnvironment) + fields = append(fields, eventtype.FieldStatusMessage) } if m.namespace != nil { - fields = append(fields, eventsubscription.FieldNamespace) - } - if m.name != nil { - fields = append(fields, eventsubscription.FieldName) + fields = append(fields, eventtype.FieldNamespace) } if m.event_type != nil { - fields = append(fields, eventsubscription.FieldEventType) + fields = append(fields, eventtype.FieldEventType) } - if m.delivery_type != nil { - fields = append(fields, eventsubscription.FieldDeliveryType) + if m.version != nil { + fields = append(fields, eventtype.FieldVersion) } - if m.callback_url != nil { - fields = append(fields, eventsubscription.FieldCallbackURL) + if m.description != nil { + fields = append(fields, eventtype.FieldDescription) + } + if m.specification != nil { + fields = append(fields, eventtype.FieldSpecification) + } + if m.active != nil { + fields = append(fields, eventtype.FieldActive) } return fields } @@ -8676,28 +11064,28 @@ func (m *EventSubscriptionMutation) Fields() []string { // 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) { +func (m *EventTypeMutation) Field(name string) (ent.Value, bool) { switch name { - case eventsubscription.FieldCreatedAt: + case eventtype.FieldCreatedAt: return m.CreatedAt() - case eventsubscription.FieldLastModifiedAt: + case eventtype.FieldLastModifiedAt: return m.LastModifiedAt() - case eventsubscription.FieldStatusPhase: + case eventtype.FieldStatusPhase: return m.StatusPhase() - case eventsubscription.FieldStatusMessage: + case eventtype.FieldStatusMessage: return m.StatusMessage() - case eventsubscription.FieldEnvironment: - return m.Environment() - case eventsubscription.FieldNamespace: + case eventtype.FieldNamespace: return m.Namespace() - case eventsubscription.FieldName: - return m.Name() - case eventsubscription.FieldEventType: + case eventtype.FieldEventType: return m.EventType() - case eventsubscription.FieldDeliveryType: - return m.DeliveryType() - case eventsubscription.FieldCallbackURL: - return m.CallbackURL() + case eventtype.FieldVersion: + return m.Version() + case eventtype.FieldDescription: + return m.Description() + case eventtype.FieldSpecification: + return m.Specification() + case eventtype.FieldActive: + return m.Active() } return nil, false } @@ -8705,254 +11093,240 @@ func (m *EventSubscriptionMutation) Field(name string) (ent.Value, bool) { // 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) { +func (m *EventTypeMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { - case eventsubscription.FieldCreatedAt: + case eventtype.FieldCreatedAt: return m.OldCreatedAt(ctx) - case eventsubscription.FieldLastModifiedAt: + case eventtype.FieldLastModifiedAt: return m.OldLastModifiedAt(ctx) - case eventsubscription.FieldStatusPhase: + case eventtype.FieldStatusPhase: return m.OldStatusPhase(ctx) - case eventsubscription.FieldStatusMessage: + case eventtype.FieldStatusMessage: return m.OldStatusMessage(ctx) - case eventsubscription.FieldEnvironment: - return m.OldEnvironment(ctx) - case eventsubscription.FieldNamespace: + case eventtype.FieldNamespace: return m.OldNamespace(ctx) - case eventsubscription.FieldName: - return m.OldName(ctx) - case eventsubscription.FieldEventType: + case eventtype.FieldEventType: return m.OldEventType(ctx) - case eventsubscription.FieldDeliveryType: - return m.OldDeliveryType(ctx) - case eventsubscription.FieldCallbackURL: - return m.OldCallbackURL(ctx) + case eventtype.FieldVersion: + return m.OldVersion(ctx) + case eventtype.FieldDescription: + return m.OldDescription(ctx) + case eventtype.FieldSpecification: + return m.OldSpecification(ctx) + case eventtype.FieldActive: + return m.OldActive(ctx) } - return nil, fmt.Errorf("unknown EventSubscription field %s", name) + return nil, fmt.Errorf("unknown EventType 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 *EventSubscriptionMutation) SetField(name string, value ent.Value) error { +func (m *EventTypeMutation) SetField(name string, value ent.Value) error { switch name { - case eventsubscription.FieldCreatedAt: + case eventtype.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 eventsubscription.FieldLastModifiedAt: + case eventtype.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 eventsubscription.FieldStatusPhase: - v, ok := value.(eventsubscription.StatusPhase) + case eventtype.FieldStatusPhase: + v, ok := value.(eventtype.StatusPhase) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetStatusPhase(v) return nil - case eventsubscription.FieldStatusMessage: + case eventtype.FieldStatusMessage: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetStatusMessage(v) return nil - case eventsubscription.FieldEnvironment: + case eventtype.FieldNamespace: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetEnvironment(v) + m.SetNamespace(v) return nil - case eventsubscription.FieldNamespace: + case eventtype.FieldEventType: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetNamespace(v) + m.SetEventType(v) return nil - case eventsubscription.FieldName: + case eventtype.FieldVersion: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetName(v) + m.SetVersion(v) return nil - case eventsubscription.FieldEventType: + case eventtype.FieldDescription: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetEventType(v) + m.SetDescription(v) return nil - case eventsubscription.FieldDeliveryType: - v, ok := value.(eventsubscription.DeliveryType) + case eventtype.FieldSpecification: + v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetDeliveryType(v) + m.SetSpecification(v) return nil - case eventsubscription.FieldCallbackURL: - v, ok := value.(string) + case eventtype.FieldActive: + v, ok := value.(bool) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetCallbackURL(v) + m.SetActive(v) return nil } - return fmt.Errorf("unknown EventSubscription field %s", name) + return fmt.Errorf("unknown EventType field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. -func (m *EventSubscriptionMutation) AddedFields() []string { +func (m *EventTypeMutation) 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 *EventSubscriptionMutation) AddedField(name string) (ent.Value, bool) { +func (m *EventTypeMutation) 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 *EventSubscriptionMutation) AddField(name string, value ent.Value) error { +func (m *EventTypeMutation) AddField(name string, value ent.Value) error { switch name { } - return fmt.Errorf("unknown EventSubscription numeric field %s", name) + return fmt.Errorf("unknown EventType numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. -func (m *EventSubscriptionMutation) ClearedFields() []string { +func (m *EventTypeMutation) ClearedFields() []string { var fields []string - if m.FieldCleared(eventsubscription.FieldStatusPhase) { - fields = append(fields, eventsubscription.FieldStatusPhase) + if m.FieldCleared(eventtype.FieldStatusPhase) { + fields = append(fields, eventtype.FieldStatusPhase) } - if m.FieldCleared(eventsubscription.FieldStatusMessage) { - fields = append(fields, eventsubscription.FieldStatusMessage) + if m.FieldCleared(eventtype.FieldStatusMessage) { + fields = append(fields, eventtype.FieldStatusMessage) } - if m.FieldCleared(eventsubscription.FieldEnvironment) { - fields = append(fields, eventsubscription.FieldEnvironment) + if m.FieldCleared(eventtype.FieldDescription) { + fields = append(fields, eventtype.FieldDescription) } - if m.FieldCleared(eventsubscription.FieldCallbackURL) { - fields = append(fields, eventsubscription.FieldCallbackURL) + if m.FieldCleared(eventtype.FieldSpecification) { + fields = append(fields, eventtype.FieldSpecification) } return fields } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. -func (m *EventSubscriptionMutation) FieldCleared(name string) bool { +func (m *EventTypeMutation) 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 *EventSubscriptionMutation) ClearField(name string) error { +func (m *EventTypeMutation) ClearField(name string) error { switch name { - case eventsubscription.FieldStatusPhase: + case eventtype.FieldStatusPhase: m.ClearStatusPhase() return nil - case eventsubscription.FieldStatusMessage: + case eventtype.FieldStatusMessage: m.ClearStatusMessage() return nil - case eventsubscription.FieldEnvironment: - m.ClearEnvironment() + case eventtype.FieldDescription: + m.ClearDescription() return nil - case eventsubscription.FieldCallbackURL: - m.ClearCallbackURL() + case eventtype.FieldSpecification: + m.ClearSpecification() return nil } - return fmt.Errorf("unknown EventSubscription nullable field %s", name) + return fmt.Errorf("unknown EventType 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 *EventSubscriptionMutation) ResetField(name string) error { +func (m *EventTypeMutation) ResetField(name string) error { switch name { - case eventsubscription.FieldCreatedAt: + case eventtype.FieldCreatedAt: m.ResetCreatedAt() return nil - case eventsubscription.FieldLastModifiedAt: + case eventtype.FieldLastModifiedAt: m.ResetLastModifiedAt() return nil - case eventsubscription.FieldStatusPhase: + case eventtype.FieldStatusPhase: m.ResetStatusPhase() return nil - case eventsubscription.FieldStatusMessage: + case eventtype.FieldStatusMessage: m.ResetStatusMessage() return nil - case eventsubscription.FieldEnvironment: - m.ResetEnvironment() - return nil - case eventsubscription.FieldNamespace: + case eventtype.FieldNamespace: m.ResetNamespace() return nil - case eventsubscription.FieldName: - m.ResetName() - return nil - case eventsubscription.FieldEventType: + case eventtype.FieldEventType: m.ResetEventType() return nil - case eventsubscription.FieldDeliveryType: - m.ResetDeliveryType() + case eventtype.FieldVersion: + m.ResetVersion() return nil - case eventsubscription.FieldCallbackURL: - m.ResetCallbackURL() + case eventtype.FieldDescription: + m.ResetDescription() + return nil + case eventtype.FieldSpecification: + m.ResetSpecification() + return nil + case eventtype.FieldActive: + m.ResetActive() return nil } - return fmt.Errorf("unknown EventSubscription field %s", name) + return fmt.Errorf("unknown EventType field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. -func (m *EventSubscriptionMutation) AddedEdges() []string { - edges := make([]string, 0, 4) +func (m *EventTypeMutation) AddedEdges() []string { + edges := make([]string, 0, 2) 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) + edges = append(edges, eventtype.EdgeOwner) } - if m.approval_requests != nil { - edges = append(edges, eventsubscription.EdgeApprovalRequests) + if m.exposures != nil { + edges = append(edges, eventtype.EdgeExposures) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. -func (m *EventSubscriptionMutation) AddedIDs(name string) []ent.Value { +func (m *EventTypeMutation) AddedIDs(name string) []ent.Value { switch name { - case eventsubscription.EdgeOwner: + case eventtype.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 { + case eventtype.EdgeExposures: + ids := make([]ent.Value, 0, len(m.exposures)) + for id := range m.exposures { ids = append(ids, id) } return ids @@ -8961,21 +11335,21 @@ func (m *EventSubscriptionMutation) AddedIDs(name string) []ent.Value { } // RemovedEdges returns all edge names that were removed in this mutation. -func (m *EventSubscriptionMutation) RemovedEdges() []string { - edges := make([]string, 0, 4) - if m.removedapproval_requests != nil { - edges = append(edges, eventsubscription.EdgeApprovalRequests) +func (m *EventTypeMutation) RemovedEdges() []string { + edges := make([]string, 0, 2) + if m.removedexposures != nil { + edges = append(edges, eventtype.EdgeExposures) } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. -func (m *EventSubscriptionMutation) RemovedIDs(name string) []ent.Value { +func (m *EventTypeMutation) 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 { + case eventtype.EdgeExposures: + ids := make([]ent.Value, 0, len(m.removedexposures)) + for id := range m.removedexposures { ids = append(ids, id) } return ids @@ -8984,74 +11358,52 @@ func (m *EventSubscriptionMutation) RemovedIDs(name string) []ent.Value { } // ClearedEdges returns all edge names that were cleared in this mutation. -func (m *EventSubscriptionMutation) ClearedEdges() []string { - edges := make([]string, 0, 4) +func (m *EventTypeMutation) ClearedEdges() []string { + edges := make([]string, 0, 2) if m.clearedowner { - edges = append(edges, eventsubscription.EdgeOwner) - } - if m.clearedtarget { - edges = append(edges, eventsubscription.EdgeTarget) - } - if m.clearedapproval { - edges = append(edges, eventsubscription.EdgeApproval) + edges = append(edges, eventtype.EdgeOwner) } - if m.clearedapproval_requests { - edges = append(edges, eventsubscription.EdgeApprovalRequests) + if m.clearedexposures { + edges = append(edges, eventtype.EdgeExposures) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. -func (m *EventSubscriptionMutation) EdgeCleared(name string) bool { +func (m *EventTypeMutation) EdgeCleared(name string) bool { switch name { - case eventsubscription.EdgeOwner: + case eventtype.EdgeOwner: return m.clearedowner - case eventsubscription.EdgeTarget: - return m.clearedtarget - case eventsubscription.EdgeApproval: - return m.clearedapproval - case eventsubscription.EdgeApprovalRequests: - return m.clearedapproval_requests + case eventtype.EdgeExposures: + return m.clearedexposures } 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 *EventSubscriptionMutation) ClearEdge(name string) error { +func (m *EventTypeMutation) ClearEdge(name string) error { switch name { - case eventsubscription.EdgeOwner: + case eventtype.EdgeOwner: m.ClearOwner() return nil - case eventsubscription.EdgeTarget: - m.ClearTarget() - return nil - case eventsubscription.EdgeApproval: - m.ClearApproval() - return nil } - return fmt.Errorf("unknown EventSubscription unique edge %s", name) + return fmt.Errorf("unknown EventType 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 *EventSubscriptionMutation) ResetEdge(name string) error { +func (m *EventTypeMutation) ResetEdge(name string) error { switch name { - case eventsubscription.EdgeOwner: + case eventtype.EdgeOwner: m.ResetOwner() return nil - case eventsubscription.EdgeTarget: - m.ResetTarget() - return nil - case eventsubscription.EdgeApproval: - m.ResetApproval() - return nil - case eventsubscription.EdgeApprovalRequests: - m.ResetApprovalRequests() + case eventtype.EdgeExposures: + m.ResetExposures() return nil } - return fmt.Errorf("unknown EventSubscription edge %s", name) + return fmt.Errorf("unknown EventType edge %s", name) } // GroupMutation represents an operation that mutates the Group nodes in the graph. @@ -10259,6 +12611,12 @@ type TeamMutation struct { applications map[int]struct{} removedapplications map[int]struct{} clearedapplications bool + apis map[int]struct{} + removedapis map[int]struct{} + clearedapis bool + event_types map[int]struct{} + removedevent_types map[int]struct{} + clearedevent_types bool done bool oldValue func(context.Context) (*Team, error) predicates []predicate.Team @@ -10921,6 +13279,114 @@ func (m *TeamMutation) ResetApplications() { m.removedapplications = nil } +// AddAPIIDs adds the "apis" edge to the Api entity by ids. +func (m *TeamMutation) AddAPIIDs(ids ...int) { + if m.apis == nil { + m.apis = make(map[int]struct{}) + } + for i := range ids { + m.apis[ids[i]] = struct{}{} + } +} + +// ClearApis clears the "apis" edge to the Api entity. +func (m *TeamMutation) ClearApis() { + m.clearedapis = true +} + +// ApisCleared reports if the "apis" edge to the Api entity was cleared. +func (m *TeamMutation) ApisCleared() bool { + return m.clearedapis +} + +// RemoveAPIIDs removes the "apis" edge to the Api entity by IDs. +func (m *TeamMutation) RemoveAPIIDs(ids ...int) { + if m.removedapis == nil { + m.removedapis = make(map[int]struct{}) + } + for i := range ids { + delete(m.apis, ids[i]) + m.removedapis[ids[i]] = struct{}{} + } +} + +// RemovedApis returns the removed IDs of the "apis" edge to the Api entity. +func (m *TeamMutation) RemovedApisIDs() (ids []int) { + for id := range m.removedapis { + ids = append(ids, id) + } + return +} + +// ApisIDs returns the "apis" edge IDs in the mutation. +func (m *TeamMutation) ApisIDs() (ids []int) { + for id := range m.apis { + ids = append(ids, id) + } + return +} + +// ResetApis resets all changes to the "apis" edge. +func (m *TeamMutation) ResetApis() { + m.apis = nil + m.clearedapis = false + m.removedapis = nil +} + +// AddEventTypeIDs adds the "event_types" edge to the EventType entity by ids. +func (m *TeamMutation) AddEventTypeIDs(ids ...int) { + if m.event_types == nil { + m.event_types = make(map[int]struct{}) + } + for i := range ids { + m.event_types[ids[i]] = struct{}{} + } +} + +// ClearEventTypes clears the "event_types" edge to the EventType entity. +func (m *TeamMutation) ClearEventTypes() { + m.clearedevent_types = true +} + +// EventTypesCleared reports if the "event_types" edge to the EventType entity was cleared. +func (m *TeamMutation) EventTypesCleared() bool { + return m.clearedevent_types +} + +// RemoveEventTypeIDs removes the "event_types" edge to the EventType entity by IDs. +func (m *TeamMutation) RemoveEventTypeIDs(ids ...int) { + if m.removedevent_types == nil { + m.removedevent_types = make(map[int]struct{}) + } + for i := range ids { + delete(m.event_types, ids[i]) + m.removedevent_types[ids[i]] = struct{}{} + } +} + +// RemovedEventTypes returns the removed IDs of the "event_types" edge to the EventType entity. +func (m *TeamMutation) RemovedEventTypesIDs() (ids []int) { + for id := range m.removedevent_types { + ids = append(ids, id) + } + return +} + +// EventTypesIDs returns the "event_types" edge IDs in the mutation. +func (m *TeamMutation) EventTypesIDs() (ids []int) { + for id := range m.event_types { + ids = append(ids, id) + } + return +} + +// ResetEventTypes resets all changes to the "event_types" edge. +func (m *TeamMutation) ResetEventTypes() { + m.event_types = nil + m.clearedevent_types = false + m.removedevent_types = nil +} + // Where appends a list predicates to the TeamMutation builder. func (m *TeamMutation) Where(ps ...predicate.Team) { m.predicates = append(m.predicates, ps...) @@ -11234,7 +13700,7 @@ func (m *TeamMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this mutation. func (m *TeamMutation) AddedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 5) if m.group != nil { edges = append(edges, team.EdgeGroup) } @@ -11244,6 +13710,12 @@ func (m *TeamMutation) AddedEdges() []string { if m.applications != nil { edges = append(edges, team.EdgeApplications) } + if m.apis != nil { + edges = append(edges, team.EdgeApis) + } + if m.event_types != nil { + edges = append(edges, team.EdgeEventTypes) + } return edges } @@ -11267,19 +13739,37 @@ func (m *TeamMutation) AddedIDs(name string) []ent.Value { ids = append(ids, id) } return ids + case team.EdgeApis: + ids := make([]ent.Value, 0, len(m.apis)) + for id := range m.apis { + ids = append(ids, id) + } + return ids + case team.EdgeEventTypes: + ids := make([]ent.Value, 0, len(m.event_types)) + for id := range m.event_types { + ids = append(ids, id) + } + return ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *TeamMutation) RemovedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 5) if m.removedmembers != nil { edges = append(edges, team.EdgeMembers) } if m.removedapplications != nil { edges = append(edges, team.EdgeApplications) } + if m.removedapis != nil { + edges = append(edges, team.EdgeApis) + } + if m.removedevent_types != nil { + edges = append(edges, team.EdgeEventTypes) + } return edges } @@ -11299,13 +13789,25 @@ func (m *TeamMutation) RemovedIDs(name string) []ent.Value { ids = append(ids, id) } return ids + case team.EdgeApis: + ids := make([]ent.Value, 0, len(m.removedapis)) + for id := range m.removedapis { + ids = append(ids, id) + } + return ids + case team.EdgeEventTypes: + ids := make([]ent.Value, 0, len(m.removedevent_types)) + for id := range m.removedevent_types { + ids = append(ids, id) + } + return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *TeamMutation) ClearedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 5) if m.clearedgroup { edges = append(edges, team.EdgeGroup) } @@ -11315,6 +13817,12 @@ func (m *TeamMutation) ClearedEdges() []string { if m.clearedapplications { edges = append(edges, team.EdgeApplications) } + if m.clearedapis { + edges = append(edges, team.EdgeApis) + } + if m.clearedevent_types { + edges = append(edges, team.EdgeEventTypes) + } return edges } @@ -11328,6 +13836,10 @@ func (m *TeamMutation) EdgeCleared(name string) bool { return m.clearedmembers case team.EdgeApplications: return m.clearedapplications + case team.EdgeApis: + return m.clearedapis + case team.EdgeEventTypes: + return m.clearedevent_types } return false } @@ -11356,6 +13868,12 @@ func (m *TeamMutation) ResetEdge(name string) error { case team.EdgeApplications: m.ResetApplications() return nil + case team.EdgeApis: + m.ResetApis() + return nil + case team.EdgeEventTypes: + m.ResetEventTypes() + return nil } return fmt.Errorf("unknown Team edge %s", name) } diff --git a/controlplane-api/ent/predicate/predicate.go b/controlplane-api/ent/predicate/predicate.go index 351f33662..96b5aa117 100644 --- a/controlplane-api/ent/predicate/predicate.go +++ b/controlplane-api/ent/predicate/predicate.go @@ -9,6 +9,9 @@ import ( "entgo.io/ent/dialect/sql" ) +// Api is the predicate function for api builders. +type Api func(*sql.Selector) + // ApiExposure is the predicate function for apiexposure builders. type ApiExposure func(*sql.Selector) @@ -30,6 +33,9 @@ type EventExposure func(*sql.Selector) // EventSubscription is the predicate function for eventsubscription builders. type EventSubscription func(*sql.Selector) +// EventType is the predicate function for eventtype builders. +type EventType 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 fb2b00a08..c3ee32e00 100644 --- a/controlplane-api/ent/privacy/privacy.go +++ b/controlplane-api/ent/privacy/privacy.go @@ -113,6 +113,30 @@ func DenyMutationOperationRule(op ent.Op) MutationRule { return OnMutationOperation(rule, op) } +// The ApiQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type ApiQueryRuleFunc func(context.Context, *ent.APIQuery) error + +// EvalQuery return f(ctx, q). +func (f ApiQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.APIQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.APIQuery", q) +} + +// The ApiMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type ApiMutationRuleFunc func(context.Context, *ent.APIMutation) error + +// EvalMutation calls f(ctx, m). +func (f ApiMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.APIMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.APIMutation", m) +} + // The ApiExposureQueryRuleFunc type is an adapter to allow the use of ordinary // functions as a query rule. type ApiExposureQueryRuleFunc func(context.Context, *ent.ApiExposureQuery) error @@ -281,6 +305,30 @@ func (f EventSubscriptionMutationRuleFunc) EvalMutation(ctx context.Context, m e return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.EventSubscriptionMutation", m) } +// The EventTypeQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type EventTypeQueryRuleFunc func(context.Context, *ent.EventTypeQuery) error + +// EvalQuery return f(ctx, q). +func (f EventTypeQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.EventTypeQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.EventTypeQuery", q) +} + +// The EventTypeMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type EventTypeMutationRuleFunc func(context.Context, *ent.EventTypeMutation) error + +// EvalMutation calls f(ctx, m). +func (f EventTypeMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.EventTypeMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.EventTypeMutation", 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/runtime.go b/controlplane-api/ent/runtime/runtime.go index 94af5da4f..d75bd42b6 100644 --- a/controlplane-api/ent/runtime/runtime.go +++ b/controlplane-api/ent/runtime/runtime.go @@ -9,6 +9,7 @@ import ( "context" "time" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -16,6 +17,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/schema" @@ -31,6 +33,52 @@ import ( // (default values, validators, hooks and policies) and stitches it // to their package variables. func init() { + apiMixin := schema.Api{}.Mixin() + api.Policy = privacy.NewPolicies(apiMixin[0], schema.Api{}) + api.Hooks[0] = func(next ent.Mutator) ent.Mutator { + return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if err := api.Policy.EvalMutation(ctx, m); err != nil { + return nil, err + } + return next.Mutate(ctx, m) + }) + } + apiMixinFields1 := apiMixin[1].Fields() + _ = apiMixinFields1 + apiMixinFields3 := apiMixin[3].Fields() + _ = apiMixinFields3 + apiFields := schema.Api{}.Fields() + _ = apiFields + // apiDescCreatedAt is the schema descriptor for created_at field. + apiDescCreatedAt := apiMixinFields1[0].Descriptor() + // api.DefaultCreatedAt holds the default value on creation for the created_at field. + api.DefaultCreatedAt = apiDescCreatedAt.Default.(func() time.Time) + // apiDescLastModifiedAt is the schema descriptor for last_modified_at field. + apiDescLastModifiedAt := apiMixinFields1[1].Descriptor() + // api.DefaultLastModifiedAt holds the default value on creation for the last_modified_at field. + api.DefaultLastModifiedAt = apiDescLastModifiedAt.Default.(func() time.Time) + // api.UpdateDefaultLastModifiedAt holds the default value on update for the last_modified_at field. + api.UpdateDefaultLastModifiedAt = apiDescLastModifiedAt.UpdateDefault.(func() time.Time) + // apiDescNamespace is the schema descriptor for namespace field. + apiDescNamespace := apiMixinFields3[0].Descriptor() + // api.NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. + api.NamespaceValidator = apiDescNamespace.Validators[0].(func(string) error) + // apiDescBasePath is the schema descriptor for base_path field. + apiDescBasePath := apiFields[0].Descriptor() + // api.BasePathValidator is a validator for the "base_path" field. It is called by the builders before save. + api.BasePathValidator = apiDescBasePath.Validators[0].(func(string) error) + // apiDescVersion is the schema descriptor for version field. + apiDescVersion := apiFields[1].Descriptor() + // api.VersionValidator is a validator for the "version" field. It is called by the builders before save. + api.VersionValidator = apiDescVersion.Validators[0].(func(string) error) + // apiDescXVendor is the schema descriptor for x_vendor field. + apiDescXVendor := apiFields[4].Descriptor() + // api.DefaultXVendor holds the default value on creation for the x_vendor field. + api.DefaultXVendor = apiDescXVendor.Default.(bool) + // apiDescActive is the schema descriptor for active field. + apiDescActive := apiFields[6].Descriptor() + // api.DefaultActive holds the default value on creation for the active field. + api.DefaultActive = apiDescActive.Default.(bool) apiexposureMixin := schema.ApiExposure{}.Mixin() apiexposure.Policy = privacy.NewPolicies(apiexposureMixin[0], schema.ApiExposure{}) apiexposure.Hooks[0] = func(next ent.Mutator) ent.Mutator { @@ -345,6 +393,48 @@ func init() { 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) + eventtypeMixin := schema.EventType{}.Mixin() + eventtype.Policy = privacy.NewPolicies(eventtypeMixin[0], schema.EventType{}) + eventtype.Hooks[0] = func(next ent.Mutator) ent.Mutator { + return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if err := eventtype.Policy.EvalMutation(ctx, m); err != nil { + return nil, err + } + return next.Mutate(ctx, m) + }) + } + eventtypeMixinFields1 := eventtypeMixin[1].Fields() + _ = eventtypeMixinFields1 + eventtypeMixinFields3 := eventtypeMixin[3].Fields() + _ = eventtypeMixinFields3 + eventtypeFields := schema.EventType{}.Fields() + _ = eventtypeFields + // eventtypeDescCreatedAt is the schema descriptor for created_at field. + eventtypeDescCreatedAt := eventtypeMixinFields1[0].Descriptor() + // eventtype.DefaultCreatedAt holds the default value on creation for the created_at field. + eventtype.DefaultCreatedAt = eventtypeDescCreatedAt.Default.(func() time.Time) + // eventtypeDescLastModifiedAt is the schema descriptor for last_modified_at field. + eventtypeDescLastModifiedAt := eventtypeMixinFields1[1].Descriptor() + // eventtype.DefaultLastModifiedAt holds the default value on creation for the last_modified_at field. + eventtype.DefaultLastModifiedAt = eventtypeDescLastModifiedAt.Default.(func() time.Time) + // eventtype.UpdateDefaultLastModifiedAt holds the default value on update for the last_modified_at field. + eventtype.UpdateDefaultLastModifiedAt = eventtypeDescLastModifiedAt.UpdateDefault.(func() time.Time) + // eventtypeDescNamespace is the schema descriptor for namespace field. + eventtypeDescNamespace := eventtypeMixinFields3[0].Descriptor() + // eventtype.NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. + eventtype.NamespaceValidator = eventtypeDescNamespace.Validators[0].(func(string) error) + // eventtypeDescEventType is the schema descriptor for event_type field. + eventtypeDescEventType := eventtypeFields[0].Descriptor() + // eventtype.EventTypeValidator is a validator for the "event_type" field. It is called by the builders before save. + eventtype.EventTypeValidator = eventtypeDescEventType.Validators[0].(func(string) error) + // eventtypeDescVersion is the schema descriptor for version field. + eventtypeDescVersion := eventtypeFields[1].Descriptor() + // eventtype.VersionValidator is a validator for the "version" field. It is called by the builders before save. + eventtype.VersionValidator = eventtypeDescVersion.Validators[0].(func(string) error) + // eventtypeDescActive is the schema descriptor for active field. + eventtypeDescActive := eventtypeFields[4].Descriptor() + // eventtype.DefaultActive holds the default value on creation for the active field. + eventtype.DefaultActive = eventtypeDescActive.Default.(bool) groupMixin := schema.Group{}.Mixin() group.Policy = privacy.NewPolicies(groupMixin[0], schema.Group{}) group.Hooks[0] = func(next ent.Mutator) ent.Mutator { diff --git a/controlplane-api/ent/schema/api.go b/controlplane-api/ent/schema/api.go new file mode 100644 index 000000000..ea737ed80 --- /dev/null +++ b/controlplane-api/ent/schema/api.go @@ -0,0 +1,76 @@ +// Copyright 2026 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" +) + +// Api holds the schema definition for a registered API in the catalogue. +type Api struct { + ent.Schema +} + +func (Api) Mixin() []ent.Mixin { + return []ent.Mixin{ + schemamixin.PrivacyMixin{}, + schemamixin.TimestampsMixin{}, + schemamixin.StatusMixin{}, + schemamixin.NamespaceMixin{}, + } +} + +func (Api) Fields() []ent.Field { + return []ent.Field{ + field.Text("base_path"). + NotEmpty(), + field.Text("version"). + NotEmpty(), + field.Text("category"). + Optional(), + field.JSON("oauth2_scopes", []string{}). + Optional(). + Annotations(entgql.Skip(entgql.SkipWhereInput)), + field.Bool("x_vendor"). + Default(false), + field.Text("specification"). + Optional(). + Annotations(entgql.Skip(entgql.SkipType)), + field.Bool("active"). + Default(false), + } +} + +func (Api) Edges() []ent.Edge { + return []ent.Edge{ + edge.From("owner", Team.Type). + Ref("apis"). + Required(). + Unique(). + Annotations(entgql.Skip(entgql.SkipType)), + edge.To("exposures", ApiExposure.Type). + Annotations(entgql.Skip(entgql.SkipType)), + } +} + +func (Api) Annotations() []schema.Annotation { + return []schema.Annotation{ + entgql.QueryField(), + entgql.RelayConnection(), + } +} + +func (Api) Indexes() []ent.Index { + return []ent.Index{ + index.Fields("base_path").Edges("owner").Unique(), + } +} diff --git a/controlplane-api/ent/schema/api_exposure.go b/controlplane-api/ent/schema/api_exposure.go index cb5feb9f6..4eb59d321 100644 --- a/controlplane-api/ent/schema/api_exposure.go +++ b/controlplane-api/ent/schema/api_exposure.go @@ -67,6 +67,9 @@ func (ApiExposure) Edges() []ent.Edge { Ref("exposed_apis"). Required(). Unique(), + edge.From("api", Api.Type). + Ref("exposures"). + Unique(), edge.From("subscriptions", ApiSubscription.Type). Ref("target"). Annotations(entgql.Skip(entgql.SkipType)), diff --git a/controlplane-api/ent/schema/event_exposure.go b/controlplane-api/ent/schema/event_exposure.go index 02d4f1e76..65b0274bc 100644 --- a/controlplane-api/ent/schema/event_exposure.go +++ b/controlplane-api/ent/schema/event_exposure.go @@ -58,6 +58,9 @@ func (EventExposure) Edges() []ent.Edge { Ref("exposed_events"). Required(). Unique(), + edge.From("event_type_def", EventType.Type). + Ref("exposures"). + Unique(), edge.From("subscriptions", EventSubscription.Type). Ref("target"). Annotations(entgql.Skip(entgql.SkipType)), diff --git a/controlplane-api/ent/schema/event_type.go b/controlplane-api/ent/schema/event_type.go new file mode 100644 index 000000000..8078e857b --- /dev/null +++ b/controlplane-api/ent/schema/event_type.go @@ -0,0 +1,71 @@ +// Copyright 2026 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" +) + +// EventType holds the schema definition for a registered event type in the catalogue. +type EventType struct { + ent.Schema +} + +func (EventType) Mixin() []ent.Mixin { + return []ent.Mixin{ + schemamixin.PrivacyMixin{}, + schemamixin.TimestampsMixin{}, + schemamixin.StatusMixin{}, + schemamixin.NamespaceMixin{}, + } +} + +func (EventType) Fields() []ent.Field { + return []ent.Field{ + field.Text("event_type"). + NotEmpty(), + field.Text("version"). + NotEmpty(), + field.Text("description"). + Optional(), + field.Text("specification"). + Optional(). + Annotations(entgql.Skip(entgql.SkipType)), + field.Bool("active"). + Default(false), + } +} + +func (EventType) Edges() []ent.Edge { + return []ent.Edge{ + edge.From("owner", Team.Type). + Ref("event_types"). + Required(). + Unique(). + Annotations(entgql.Skip(entgql.SkipType)), + edge.To("exposures", EventExposure.Type). + Annotations(entgql.Skip(entgql.SkipType)), + } +} + +func (EventType) Annotations() []schema.Annotation { + return []schema.Annotation{ + entgql.QueryField(), + entgql.RelayConnection(), + } +} + +func (EventType) 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 7a9802f96..68e31ce63 100644 --- a/controlplane-api/ent/schema/team.go +++ b/controlplane-api/ent/schema/team.go @@ -57,6 +57,10 @@ func (Team) Edges() []ent.Edge { edge.To("members", Member.Type), edge.To("applications", Application.Type). Annotations(entgql.RelayConnection()), + edge.To("apis", Api.Type). + Annotations(entgql.RelayConnection()), + edge.To("event_types", EventType.Type). + Annotations(entgql.RelayConnection()), } } diff --git a/controlplane-api/ent/team.go b/controlplane-api/ent/team.go index dfae8ac09..6d13bdaf3 100644 --- a/controlplane-api/ent/team.go +++ b/controlplane-api/ent/team.go @@ -56,14 +56,20 @@ type TeamEdges struct { Members []*Member `json:"members,omitempty"` // Applications holds the value of the applications edge. Applications []*Application `json:"applications,omitempty"` + // Apis holds the value of the apis edge. + Apis []*Api `json:"apis,omitempty"` + // EventTypes holds the value of the event_types edge. + EventTypes []*EventType `json:"event_types,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [3]bool + loadedTypes [5]bool // totalCount holds the count of the edges above. - totalCount [3]map[string]int + totalCount [5]map[string]int namedMembers map[string][]*Member namedApplications map[string][]*Application + namedApis map[string][]*Api + namedEventTypes map[string][]*EventType } // GroupOrErr returns the Group value or an error if the edge @@ -95,6 +101,24 @@ func (e TeamEdges) ApplicationsOrErr() ([]*Application, error) { return nil, &NotLoadedError{edge: "applications"} } +// ApisOrErr returns the Apis value or an error if the edge +// was not loaded in eager-loading. +func (e TeamEdges) ApisOrErr() ([]*Api, error) { + if e.loadedTypes[3] { + return e.Apis, nil + } + return nil, &NotLoadedError{edge: "apis"} +} + +// EventTypesOrErr returns the EventTypes value or an error if the edge +// was not loaded in eager-loading. +func (e TeamEdges) EventTypesOrErr() ([]*EventType, error) { + if e.loadedTypes[4] { + return e.EventTypes, nil + } + return nil, &NotLoadedError{edge: "event_types"} +} + // scanValues returns the types for scanning values from sql.Rows. func (*Team) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) @@ -228,6 +252,16 @@ func (_m *Team) QueryApplications() *ApplicationQuery { return NewTeamClient(_m.config).QueryApplications(_m) } +// QueryApis queries the "apis" edge of the Team entity. +func (_m *Team) QueryApis() *APIQuery { + return NewTeamClient(_m.config).QueryApis(_m) +} + +// QueryEventTypes queries the "event_types" edge of the Team entity. +func (_m *Team) QueryEventTypes() *EventTypeQuery { + return NewTeamClient(_m.config).QueryEventTypes(_m) +} + // Update returns a builder for updating this Team. // Note that you need to call Team.Unwrap() before calling this method if this Team // was returned from a transaction, and the transaction was committed or rolled back. @@ -340,5 +374,53 @@ func (_m *Team) appendNamedApplications(name string, edges ...*Application) { } } +// NamedApis returns the Apis named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *Team) NamedApis(name string) ([]*Api, error) { + if _m.Edges.namedApis == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedApis[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *Team) appendNamedApis(name string, edges ...*Api) { + if _m.Edges.namedApis == nil { + _m.Edges.namedApis = make(map[string][]*Api) + } + if len(edges) == 0 { + _m.Edges.namedApis[name] = []*Api{} + } else { + _m.Edges.namedApis[name] = append(_m.Edges.namedApis[name], edges...) + } +} + +// NamedEventTypes returns the EventTypes named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *Team) NamedEventTypes(name string) ([]*EventType, error) { + if _m.Edges.namedEventTypes == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedEventTypes[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *Team) appendNamedEventTypes(name string, edges ...*EventType) { + if _m.Edges.namedEventTypes == nil { + _m.Edges.namedEventTypes = make(map[string][]*EventType) + } + if len(edges) == 0 { + _m.Edges.namedEventTypes[name] = []*EventType{} + } else { + _m.Edges.namedEventTypes[name] = append(_m.Edges.namedEventTypes[name], edges...) + } +} + // Teams is a parsable slice of Team. type Teams []*Team diff --git a/controlplane-api/ent/team/team.go b/controlplane-api/ent/team/team.go index 1bc8b9c3e..e2b7d409f 100644 --- a/controlplane-api/ent/team/team.go +++ b/controlplane-api/ent/team/team.go @@ -47,6 +47,10 @@ const ( EdgeMembers = "members" // EdgeApplications holds the string denoting the applications edge name in mutations. EdgeApplications = "applications" + // EdgeApis holds the string denoting the apis edge name in mutations. + EdgeApis = "apis" + // EdgeEventTypes holds the string denoting the event_types edge name in mutations. + EdgeEventTypes = "event_types" // Table holds the table name of the team in the database. Table = "teams" // GroupTable is the table that holds the group relation/edge. @@ -70,6 +74,20 @@ const ( ApplicationsInverseTable = "applications" // ApplicationsColumn is the table column denoting the applications relation/edge. ApplicationsColumn = "team_applications" + // ApisTable is the table that holds the apis relation/edge. + ApisTable = "apis" + // ApisInverseTable is the table name for the Api entity. + // It exists in this package in order to avoid circular dependency with the "api" package. + ApisInverseTable = "apis" + // ApisColumn is the table column denoting the apis relation/edge. + ApisColumn = "team_apis" + // EventTypesTable is the table that holds the event_types relation/edge. + EventTypesTable = "event_types" + // EventTypesInverseTable is the table name for the EventType entity. + // It exists in this package in order to avoid circular dependency with the "eventtype" package. + EventTypesInverseTable = "event_types" + // EventTypesColumn is the table column denoting the event_types relation/edge. + EventTypesColumn = "team_event_types" ) // Columns holds all SQL columns for team fields. @@ -273,6 +291,34 @@ func ByApplications(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { sqlgraph.OrderByNeighborTerms(s, newApplicationsStep(), append([]sql.OrderTerm{term}, terms...)...) } } + +// ByApisCount orders the results by apis count. +func ByApisCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newApisStep(), opts...) + } +} + +// ByApis orders the results by apis terms. +func ByApis(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newApisStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} + +// ByEventTypesCount orders the results by event_types count. +func ByEventTypesCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newEventTypesStep(), opts...) + } +} + +// ByEventTypes orders the results by event_types terms. +func ByEventTypes(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newEventTypesStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} func newGroupStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), @@ -294,6 +340,20 @@ func newApplicationsStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.O2M, false, ApplicationsTable, ApplicationsColumn), ) } +func newApisStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(ApisInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ApisTable, ApisColumn), + ) +} +func newEventTypesStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(EventTypesInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, EventTypesTable, EventTypesColumn), + ) +} // MarshalGQL implements graphql.Marshaler interface. func (e StatusPhase) MarshalGQL(w io.Writer) { diff --git a/controlplane-api/ent/team/where.go b/controlplane-api/ent/team/where.go index b58e5bd59..5d780e991 100644 --- a/controlplane-api/ent/team/where.go +++ b/controlplane-api/ent/team/where.go @@ -717,6 +717,52 @@ func HasApplicationsWith(preds ...predicate.Application) predicate.Team { }) } +// HasApis applies the HasEdge predicate on the "apis" edge. +func HasApis() predicate.Team { + return predicate.Team(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ApisTable, ApisColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasApisWith applies the HasEdge predicate on the "apis" edge with a given conditions (other predicates). +func HasApisWith(preds ...predicate.Api) predicate.Team { + return predicate.Team(func(s *sql.Selector) { + step := newApisStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasEventTypes applies the HasEdge predicate on the "event_types" edge. +func HasEventTypes() predicate.Team { + return predicate.Team(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, EventTypesTable, EventTypesColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasEventTypesWith applies the HasEdge predicate on the "event_types" edge with a given conditions (other predicates). +func HasEventTypesWith(preds ...predicate.EventType) predicate.Team { + return predicate.Team(func(s *sql.Selector) { + step := newEventTypesStep() + 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.Team) predicate.Team { return predicate.Team(sql.AndPredicates(predicates...)) diff --git a/controlplane-api/ent/team_create.go b/controlplane-api/ent/team_create.go index e5ef3c5a3..a14b686e1 100644 --- a/controlplane-api/ent/team_create.go +++ b/controlplane-api/ent/team_create.go @@ -14,7 +14,9 @@ import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/team" @@ -193,6 +195,36 @@ func (_c *TeamCreate) AddApplications(v ...*Application) *TeamCreate { return _c.AddApplicationIDs(ids...) } +// AddAPIIDs adds the "apis" edge to the Api entity by IDs. +func (_c *TeamCreate) AddAPIIDs(ids ...int) *TeamCreate { + _c.mutation.AddAPIIDs(ids...) + return _c +} + +// AddApis adds the "apis" edges to the Api entity. +func (_c *TeamCreate) AddApis(v ...*Api) *TeamCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _c.AddAPIIDs(ids...) +} + +// AddEventTypeIDs adds the "event_types" edge to the EventType entity by IDs. +func (_c *TeamCreate) AddEventTypeIDs(ids ...int) *TeamCreate { + _c.mutation.AddEventTypeIDs(ids...) + return _c +} + +// AddEventTypes adds the "event_types" edges to the EventType entity. +func (_c *TeamCreate) AddEventTypes(v ...*EventType) *TeamCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _c.AddEventTypeIDs(ids...) +} + // Mutation returns the TeamMutation object of the builder. func (_c *TeamCreate) Mutation() *TeamMutation { return _c.mutation @@ -412,6 +444,38 @@ func (_c *TeamCreate) createSpec() (*Team, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } + if nodes := _c.mutation.ApisIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.ApisTable, + Columns: []string{team.ApisColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.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.EventTypesIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.EventTypesTable, + Columns: []string{team.EventTypesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } return _node, _spec } diff --git a/controlplane-api/ent/team_query.go b/controlplane-api/ent/team_query.go index 5194fa8e1..b42090a6a 100644 --- a/controlplane-api/ent/team_query.go +++ b/controlplane-api/ent/team_query.go @@ -16,7 +16,9 @@ import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/predicate" @@ -33,11 +35,15 @@ type TeamQuery struct { withGroup *GroupQuery withMembers *MemberQuery withApplications *ApplicationQuery + withApis *APIQuery + withEventTypes *EventTypeQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*Team) error withNamedMembers map[string]*MemberQuery withNamedApplications map[string]*ApplicationQuery + withNamedApis map[string]*APIQuery + withNamedEventTypes map[string]*EventTypeQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -140,6 +146,50 @@ func (_q *TeamQuery) QueryApplications() *ApplicationQuery { return query } +// QueryApis chains the current query on the "apis" edge. +func (_q *TeamQuery) QueryApis() *APIQuery { + query := (&APIClient{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(team.Table, team.FieldID, selector), + sqlgraph.To(api.Table, api.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, team.ApisTable, team.ApisColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryEventTypes chains the current query on the "event_types" edge. +func (_q *TeamQuery) QueryEventTypes() *EventTypeQuery { + query := (&EventTypeClient{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(team.Table, team.FieldID, selector), + sqlgraph.To(eventtype.Table, eventtype.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, team.EventTypesTable, team.EventTypesColumn), + ) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) + return fromU, nil + } + return query +} + // First returns the first Team entity from the query. // Returns a *NotFoundError when no Team was found. func (_q *TeamQuery) First(ctx context.Context) (*Team, error) { @@ -335,6 +385,8 @@ func (_q *TeamQuery) Clone() *TeamQuery { withGroup: _q.withGroup.Clone(), withMembers: _q.withMembers.Clone(), withApplications: _q.withApplications.Clone(), + withApis: _q.withApis.Clone(), + withEventTypes: _q.withEventTypes.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, @@ -374,6 +426,28 @@ func (_q *TeamQuery) WithApplications(opts ...func(*ApplicationQuery)) *TeamQuer return _q } +// WithApis tells the query-builder to eager-load the nodes that are connected to +// the "apis" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *TeamQuery) WithApis(opts ...func(*APIQuery)) *TeamQuery { + query := (&APIClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withApis = query + return _q +} + +// WithEventTypes tells the query-builder to eager-load the nodes that are connected to +// the "event_types" edge. The optional arguments are used to configure the query builder of the edge. +func (_q *TeamQuery) WithEventTypes(opts ...func(*EventTypeQuery)) *TeamQuery { + query := (&EventTypeClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + _q.withEventTypes = 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. // @@ -459,10 +533,12 @@ func (_q *TeamQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Team, e nodes = []*Team{} withFKs = _q.withFKs _spec = _q.querySpec() - loadedTypes = [3]bool{ + loadedTypes = [5]bool{ _q.withGroup != nil, _q.withMembers != nil, _q.withApplications != nil, + _q.withApis != nil, + _q.withEventTypes != nil, } ) if _q.withGroup != nil { @@ -512,6 +588,20 @@ func (_q *TeamQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Team, e return nil, err } } + if query := _q.withApis; query != nil { + if err := _q.loadApis(ctx, query, nodes, + func(n *Team) { n.Edges.Apis = []*Api{} }, + func(n *Team, e *Api) { n.Edges.Apis = append(n.Edges.Apis, e) }); err != nil { + return nil, err + } + } + if query := _q.withEventTypes; query != nil { + if err := _q.loadEventTypes(ctx, query, nodes, + func(n *Team) { n.Edges.EventTypes = []*EventType{} }, + func(n *Team, e *EventType) { n.Edges.EventTypes = append(n.Edges.EventTypes, e) }); err != nil { + return nil, err + } + } for name, query := range _q.withNamedMembers { if err := _q.loadMembers(ctx, query, nodes, func(n *Team) { n.appendNamedMembers(name) }, @@ -526,6 +616,20 @@ func (_q *TeamQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Team, e return nil, err } } + for name, query := range _q.withNamedApis { + if err := _q.loadApis(ctx, query, nodes, + func(n *Team) { n.appendNamedApis(name) }, + func(n *Team, e *Api) { n.appendNamedApis(name, e) }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedEventTypes { + if err := _q.loadEventTypes(ctx, query, nodes, + func(n *Team) { n.appendNamedEventTypes(name) }, + func(n *Team, e *EventType) { n.appendNamedEventTypes(name, e) }); err != nil { + return nil, err + } + } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err @@ -628,6 +732,68 @@ func (_q *TeamQuery) loadApplications(ctx context.Context, query *ApplicationQue } return nil } +func (_q *TeamQuery) loadApis(ctx context.Context, query *APIQuery, nodes []*Team, init func(*Team), assign func(*Team, *Api)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*Team) + 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.Api(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(team.ApisColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.team_apis + if fk == nil { + return fmt.Errorf(`foreign-key "team_apis" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "team_apis" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} +func (_q *TeamQuery) loadEventTypes(ctx context.Context, query *EventTypeQuery, nodes []*Team, init func(*Team), assign func(*Team, *EventType)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*Team) + 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.EventType(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(team.EventTypesColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.team_event_types + if fk == nil { + return fmt.Errorf(`foreign-key "team_event_types" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "team_event_types" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} func (_q *TeamQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() @@ -741,6 +907,34 @@ func (_q *TeamQuery) WithNamedApplications(name string, opts ...func(*Applicatio return _q } +// WithNamedApis tells the query-builder to eager-load the nodes that are connected to the "apis" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *TeamQuery) WithNamedApis(name string, opts ...func(*APIQuery)) *TeamQuery { + query := (&APIClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedApis == nil { + _q.withNamedApis = make(map[string]*APIQuery) + } + _q.withNamedApis[name] = query + return _q +} + +// WithNamedEventTypes tells the query-builder to eager-load the nodes that are connected to the "event_types" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *TeamQuery) WithNamedEventTypes(name string, opts ...func(*EventTypeQuery)) *TeamQuery { + query := (&EventTypeClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedEventTypes == nil { + _q.withNamedEventTypes = make(map[string]*EventTypeQuery) + } + _q.withNamedEventTypes[name] = query + return _q +} + // TeamGroupBy is the group-by builder for Team entities. type TeamGroupBy struct { selector diff --git a/controlplane-api/ent/team_update.go b/controlplane-api/ent/team_update.go index 40a9d7e14..04d93967e 100644 --- a/controlplane-api/ent/team_update.go +++ b/controlplane-api/ent/team_update.go @@ -14,7 +14,9 @@ import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/application" + "github.com/telekom/controlplane/controlplane-api/ent/eventtype" "github.com/telekom/controlplane/controlplane-api/ent/group" "github.com/telekom/controlplane/controlplane-api/ent/member" "github.com/telekom/controlplane/controlplane-api/ent/predicate" @@ -225,6 +227,36 @@ func (_u *TeamUpdate) AddApplications(v ...*Application) *TeamUpdate { return _u.AddApplicationIDs(ids...) } +// AddAPIIDs adds the "apis" edge to the Api entity by IDs. +func (_u *TeamUpdate) AddAPIIDs(ids ...int) *TeamUpdate { + _u.mutation.AddAPIIDs(ids...) + return _u +} + +// AddApis adds the "apis" edges to the Api entity. +func (_u *TeamUpdate) AddApis(v ...*Api) *TeamUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddAPIIDs(ids...) +} + +// AddEventTypeIDs adds the "event_types" edge to the EventType entity by IDs. +func (_u *TeamUpdate) AddEventTypeIDs(ids ...int) *TeamUpdate { + _u.mutation.AddEventTypeIDs(ids...) + return _u +} + +// AddEventTypes adds the "event_types" edges to the EventType entity. +func (_u *TeamUpdate) AddEventTypes(v ...*EventType) *TeamUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddEventTypeIDs(ids...) +} + // Mutation returns the TeamMutation object of the builder. func (_u *TeamUpdate) Mutation() *TeamMutation { return _u.mutation @@ -278,6 +310,48 @@ func (_u *TeamUpdate) RemoveApplications(v ...*Application) *TeamUpdate { return _u.RemoveApplicationIDs(ids...) } +// ClearApis clears all "apis" edges to the Api entity. +func (_u *TeamUpdate) ClearApis() *TeamUpdate { + _u.mutation.ClearApis() + return _u +} + +// RemoveAPIIDs removes the "apis" edge to Api entities by IDs. +func (_u *TeamUpdate) RemoveAPIIDs(ids ...int) *TeamUpdate { + _u.mutation.RemoveAPIIDs(ids...) + return _u +} + +// RemoveApis removes "apis" edges to Api entities. +func (_u *TeamUpdate) RemoveApis(v ...*Api) *TeamUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveAPIIDs(ids...) +} + +// ClearEventTypes clears all "event_types" edges to the EventType entity. +func (_u *TeamUpdate) ClearEventTypes() *TeamUpdate { + _u.mutation.ClearEventTypes() + return _u +} + +// RemoveEventTypeIDs removes the "event_types" edge to EventType entities by IDs. +func (_u *TeamUpdate) RemoveEventTypeIDs(ids ...int) *TeamUpdate { + _u.mutation.RemoveEventTypeIDs(ids...) + return _u +} + +// RemoveEventTypes removes "event_types" edges to EventType entities. +func (_u *TeamUpdate) RemoveEventTypes(v ...*EventType) *TeamUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveEventTypeIDs(ids...) +} + // Save executes the query and returns the number of nodes affected by the update operation. func (_u *TeamUpdate) Save(ctx context.Context) (int, error) { if err := _u.defaults(); err != nil { @@ -520,6 +594,96 @@ func (_u *TeamUpdate) sqlSave(ctx context.Context) (_node int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.ApisCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.ApisTable, + Columns: []string{team.ApisColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedApisIDs(); len(nodes) > 0 && !_u.mutation.ApisCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.ApisTable, + Columns: []string{team.ApisColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.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.ApisIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.ApisTable, + Columns: []string{team.ApisColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.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.EventTypesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.EventTypesTable, + Columns: []string{team.EventTypesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedEventTypesIDs(); len(nodes) > 0 && !_u.mutation.EventTypesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.EventTypesTable, + Columns: []string{team.EventTypesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.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.EventTypesIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.EventTypesTable, + Columns: []string{team.EventTypesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.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{team.Label} @@ -731,6 +895,36 @@ func (_u *TeamUpdateOne) AddApplications(v ...*Application) *TeamUpdateOne { return _u.AddApplicationIDs(ids...) } +// AddAPIIDs adds the "apis" edge to the Api entity by IDs. +func (_u *TeamUpdateOne) AddAPIIDs(ids ...int) *TeamUpdateOne { + _u.mutation.AddAPIIDs(ids...) + return _u +} + +// AddApis adds the "apis" edges to the Api entity. +func (_u *TeamUpdateOne) AddApis(v ...*Api) *TeamUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddAPIIDs(ids...) +} + +// AddEventTypeIDs adds the "event_types" edge to the EventType entity by IDs. +func (_u *TeamUpdateOne) AddEventTypeIDs(ids ...int) *TeamUpdateOne { + _u.mutation.AddEventTypeIDs(ids...) + return _u +} + +// AddEventTypes adds the "event_types" edges to the EventType entity. +func (_u *TeamUpdateOne) AddEventTypes(v ...*EventType) *TeamUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.AddEventTypeIDs(ids...) +} + // Mutation returns the TeamMutation object of the builder. func (_u *TeamUpdateOne) Mutation() *TeamMutation { return _u.mutation @@ -784,6 +978,48 @@ func (_u *TeamUpdateOne) RemoveApplications(v ...*Application) *TeamUpdateOne { return _u.RemoveApplicationIDs(ids...) } +// ClearApis clears all "apis" edges to the Api entity. +func (_u *TeamUpdateOne) ClearApis() *TeamUpdateOne { + _u.mutation.ClearApis() + return _u +} + +// RemoveAPIIDs removes the "apis" edge to Api entities by IDs. +func (_u *TeamUpdateOne) RemoveAPIIDs(ids ...int) *TeamUpdateOne { + _u.mutation.RemoveAPIIDs(ids...) + return _u +} + +// RemoveApis removes "apis" edges to Api entities. +func (_u *TeamUpdateOne) RemoveApis(v ...*Api) *TeamUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveAPIIDs(ids...) +} + +// ClearEventTypes clears all "event_types" edges to the EventType entity. +func (_u *TeamUpdateOne) ClearEventTypes() *TeamUpdateOne { + _u.mutation.ClearEventTypes() + return _u +} + +// RemoveEventTypeIDs removes the "event_types" edge to EventType entities by IDs. +func (_u *TeamUpdateOne) RemoveEventTypeIDs(ids ...int) *TeamUpdateOne { + _u.mutation.RemoveEventTypeIDs(ids...) + return _u +} + +// RemoveEventTypes removes "event_types" edges to EventType entities. +func (_u *TeamUpdateOne) RemoveEventTypes(v ...*EventType) *TeamUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID + } + return _u.RemoveEventTypeIDs(ids...) +} + // Where appends a list predicates to the TeamUpdate builder. func (_u *TeamUpdateOne) Where(ps ...predicate.Team) *TeamUpdateOne { _u.mutation.Where(ps...) @@ -1056,6 +1292,96 @@ func (_u *TeamUpdateOne) sqlSave(ctx context.Context) (_node *Team, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if _u.mutation.ApisCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.ApisTable, + Columns: []string{team.ApisColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedApisIDs(); len(nodes) > 0 && !_u.mutation.ApisCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.ApisTable, + Columns: []string{team.ApisColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.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.ApisIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.ApisTable, + Columns: []string{team.ApisColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(api.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.EventTypesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.EventTypesTable, + Columns: []string{team.EventTypesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := _u.mutation.RemovedEventTypesIDs(); len(nodes) > 0 && !_u.mutation.EventTypesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.EventTypesTable, + Columns: []string{team.EventTypesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.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.EventTypesIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: team.EventTypesTable, + Columns: []string{team.EventTypesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(eventtype.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } _node = &Team{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/controlplane-api/ent/tx.go b/controlplane-api/ent/tx.go index 56a7a68b5..54c4b3d51 100644 --- a/controlplane-api/ent/tx.go +++ b/controlplane-api/ent/tx.go @@ -15,6 +15,8 @@ import ( // Tx is a transactional client that is created by calling Client.Tx(). type Tx struct { config + // Api is the client for interacting with the Api builders. + Api *APIClient // ApiExposure is the client for interacting with the ApiExposure builders. ApiExposure *ApiExposureClient // ApiSubscription is the client for interacting with the ApiSubscription builders. @@ -29,6 +31,8 @@ type Tx struct { EventExposure *EventExposureClient // EventSubscription is the client for interacting with the EventSubscription builders. EventSubscription *EventSubscriptionClient + // EventType is the client for interacting with the EventType builders. + EventType *EventTypeClient // Group is the client for interacting with the Group builders. Group *GroupClient // Member is the client for interacting with the Member builders. @@ -168,6 +172,7 @@ func (tx *Tx) Client() *Client { } func (tx *Tx) init() { + tx.Api = NewAPIClient(tx.config) tx.ApiExposure = NewApiExposureClient(tx.config) tx.ApiSubscription = NewApiSubscriptionClient(tx.config) tx.Application = NewApplicationClient(tx.config) @@ -175,6 +180,7 @@ func (tx *Tx) init() { tx.ApprovalRequest = NewApprovalRequestClient(tx.config) tx.EventExposure = NewEventExposureClient(tx.config) tx.EventSubscription = NewEventSubscriptionClient(tx.config) + tx.EventType = NewEventTypeClient(tx.config) tx.Group = NewGroupClient(tx.config) tx.Member = NewMemberClient(tx.config) tx.Team = NewTeamClient(tx.config) @@ -188,7 +194,7 @@ func (tx *Tx) init() { // of them in order to commit or rollback the transaction. // // If a closed transaction is embedded in one of the generated entities, and the entity -// applies a query, for example: ApiExposure.QueryXXX(), the query will be executed +// applies a query, for example: Api.QueryXXX(), the query will be executed // through the driver which created this transaction. // // Note that txDriver is not goroutine safe. diff --git a/controlplane-api/gqlgen.yml b/controlplane-api/gqlgen.yml index 9501c3489..54b0ebafb 100644 --- a/controlplane-api/gqlgen.yml +++ b/controlplane-api/gqlgen.yml @@ -23,12 +23,14 @@ model: autobind: - github.com/99designs/gqlgen/graphql/introspection - github.com/telekom/controlplane/controlplane-api/ent + - github.com/telekom/controlplane/controlplane-api/ent/api - github.com/telekom/controlplane/controlplane-api/ent/team - 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 + - github.com/telekom/controlplane/controlplane-api/ent/eventtype models: ID: diff --git a/controlplane-api/internal/interceptor/team_filter.go b/controlplane-api/internal/interceptor/team_filter.go index d0d5fe310..ad528cf80 100644 --- a/controlplane-api/internal/interceptor/team_filter.go +++ b/controlplane-api/internal/interceptor/team_filter.go @@ -130,9 +130,8 @@ func TeamFilterInterceptor() ent.Interceptor { application.HasOwnerTeamWith(team.NameIn(teams...)), )) - case *entgen.GroupQuery, *entgen.ZoneQuery: - // No team filtering for public entities - + case *entgen.GroupQuery, *entgen.ZoneQuery, *entgen.APIQuery, *entgen.EventTypeQuery: + // No team filtering for public/catalogue entities default: return nil, fmt.Errorf("team filter: unsupported query type %T", query) } diff --git a/controlplane-api/internal/resolvers/ent.generated.go b/controlplane-api/internal/resolvers/ent.generated.go index 547679d2c..b3a223366 100644 --- a/controlplane-api/internal/resolvers/ent.generated.go +++ b/controlplane-api/internal/resolvers/ent.generated.go @@ -18,6 +18,7 @@ import ( "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/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/application" @@ -25,45 +26,57 @@ import ( "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/eventtype" "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" - model1 "github.com/telekom/controlplane/controlplane-api/pkg/model" + model1 "github.com/telekom/controlplane/controlplane-api/internal/resolvers/model" + "github.com/telekom/controlplane/controlplane-api/pkg/model" "github.com/vektah/gqlparser/v2/ast" ) // region ************************** generated!.gotpl ************************** +type ApiResolver interface { + SpecificationURL(ctx context.Context, obj *ent.Api) (*string, error) + ActiveExposure(ctx context.Context, obj *ent.Api) (*model.ApiExposureInfo, error) + Owner(ctx context.Context, obj *ent.Api) (*model.TeamInfo, error) +} type ApiExposureResolver interface { - Features(ctx context.Context, obj *ent.ApiExposure) ([]model.APIExposureFeature, error) + Features(ctx context.Context, obj *ent.ApiExposure) ([]model1.APIExposureFeature, error) - Subscriptions(ctx context.Context, obj *ent.ApiExposure) ([]*model1.ApiSubscriptionInfo, error) + Subscriptions(ctx context.Context, obj *ent.ApiExposure) ([]*model.ApiSubscriptionInfo, error) } type ApiSubscriptionResolver interface { - Target(ctx context.Context, obj *ent.ApiSubscription) (*model1.ApiExposureInfo, error) + Target(ctx context.Context, obj *ent.ApiSubscription) (*model.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) + OwnerTeam(ctx context.Context, obj *ent.Application) (*model.TeamInfo, error) } type ApprovalResolver interface { - Subscription(ctx context.Context, obj *ent.Approval) (model.SubscriptionInfo, error) + Subscription(ctx context.Context, obj *ent.Approval) (model1.SubscriptionInfo, error) } type ApprovalRequestResolver interface { - Subscription(ctx context.Context, obj *ent.ApprovalRequest) (model.SubscriptionInfo, error) + Subscription(ctx context.Context, obj *ent.ApprovalRequest) (model1.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) + Subscriptions(ctx context.Context, obj *ent.EventExposure) ([]*model.EventSubscriptionInfo, error) } type EventSubscriptionResolver interface { - Target(ctx context.Context, obj *ent.EventSubscription) (*model1.EventExposureInfo, error) + Target(ctx context.Context, obj *ent.EventSubscription) (*model.EventExposureInfo, error) +} +type EventTypeResolver interface { + SpecificationURL(ctx context.Context, obj *ent.EventType) (*string, error) + ActiveExposure(ctx context.Context, obj *ent.EventType) (*model.EventExposureInfo, error) + Owner(ctx context.Context, obj *ent.EventType) (*model.TeamInfo, error) } type QueryResolver interface { Node(ctx context.Context, id int) (ent.Noder, error) Nodes(ctx context.Context, ids []int) ([]ent.Noder, error) + Apis(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiOrder, where *ent.ApiWhereInput) (*ent.ApiConnection, error) APIExposures(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiExposureOrder, where *ent.ApiExposureWhereInput) (*ent.ApiExposureConnection, error) APISubscriptions(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiSubscriptionOrder, where *ent.ApiSubscriptionWhereInput) (*ent.ApiSubscriptionConnection, error) 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) @@ -71,8 +84,10 @@ type QueryResolver interface { 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) + EventTypes(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventTypeOrder, where *ent.EventTypeWhereInput) (*ent.EventTypeConnection, 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) + APICategories(ctx context.Context) ([]*model1.APICategory, error) } type TeamResolver interface { TeamToken(ctx context.Context, obj *ent.Team) (*string, error) @@ -423,6 +438,60 @@ func (ec *executionContext) field_Query_apiSubscriptions_args(ctx context.Contex return args, nil } +func (ec *executionContext) field_Query_apis_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.ApiOrder, error) { + return ec.unmarshalOApiOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiOrder(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.ApiWhereInput, error) { + return ec.unmarshalOApiWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + 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{} @@ -693,6 +762,60 @@ func (ec *executionContext) field_Query_eventSubscriptions_args(ctx context.Cont return args, nil } +func (ec *executionContext) field_Query_eventTypes_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.EventTypeOrder, error) { + return ec.unmarshalOEventTypeOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeOrder(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.EventTypeWhereInput, error) { + return ec.unmarshalOEventTypeWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + 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{} @@ -775,6 +898,60 @@ func (ec *executionContext) field_Query_teams_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Team_apis_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.ApiOrder, error) { + return ec.unmarshalOApiOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiOrder(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.ApiWhereInput, error) { + return ec.unmarshalOApiWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + 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{} @@ -829,6 +1006,60 @@ func (ec *executionContext) field_Team_applications_args(ctx context.Context, ra return args, nil } +func (ec *executionContext) field_Team_eventTypes_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.EventTypeOrder, error) { + return ec.unmarshalOEventTypeOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeOrder(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.EventTypeWhereInput, error) { + return ec.unmarshalOEventTypeWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + // endregion ***************************** args.gotpl ***************************** // region ************************** directives.gotpl ************************** @@ -837,13 +1068,13 @@ func (ec *executionContext) field_Team_applications_args(ctx context.Context, ra // region **************************** field.gotpl ***************************** -func (ec *executionContext) _ApiExposure_id(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _Api_id(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_id(ctx, field) + return ec.fieldContext_Api_id(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ID, nil @@ -856,17 +1087,17 @@ func (ec *executionContext) _ApiExposure_id(ctx context.Context, field graphql.C true, ) } -func (ec *executionContext) fieldContext_ApiExposure_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type ID does not have child fields")) +func (ec *executionContext) fieldContext_Api_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", 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) { +func (ec *executionContext) _Api_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_createdAt(ctx, field) + return ec.fieldContext_Api_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil @@ -879,17 +1110,17 @@ func (ec *executionContext) _ApiExposure_createdAt(ctx context.Context, field gr true, ) } -func (ec *executionContext) fieldContext_ApiExposure_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type Time does not have child fields")) +func (ec *executionContext) fieldContext_Api_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", 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) { +func (ec *executionContext) _Api_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_lastModifiedAt(ctx, field) + return ec.fieldContext_Api_lastModifiedAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil @@ -902,40 +1133,40 @@ func (ec *executionContext) _ApiExposure_lastModifiedAt(ctx context.Context, fie true, ) } -func (ec *executionContext) fieldContext_ApiExposure_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type Time does not have child fields")) +func (ec *executionContext) fieldContext_Api_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", 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) { +func (ec *executionContext) _Api_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_statusPhase(ctx, field) + return ec.fieldContext_Api_statusPhase(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusPhase, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v *api.StatusPhase) graphql.Marshaler { + return ec.marshalOApiStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhase(ctx, selections, v) }, true, false, ) } -func (ec *executionContext) fieldContext_ApiExposure_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type ApiExposureStatusPhase does not have child fields")) +func (ec *executionContext) fieldContext_Api_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", field, false, false, errors.New("field of type ApiStatusPhase does not have child fields")) } -func (ec *executionContext) _ApiExposure_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _Api_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_statusMessage(ctx, field) + return ec.fieldContext_Api_statusMessage(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil @@ -948,43 +1179,43 @@ func (ec *executionContext) _ApiExposure_statusMessage(ctx context.Context, fiel false, ) } -func (ec *executionContext) fieldContext_ApiExposure_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_Api_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", 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) { +func (ec *executionContext) _Api_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_environment(ctx, field) + return ec.fieldContext_Api_namespace(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Environment, nil + return obj.Namespace, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, - false, + true, ) } -func (ec *executionContext) fieldContext_ApiExposure_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_Api_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", 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) { +func (ec *executionContext) _Api_basePath(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_namespace(ctx, field) + return ec.fieldContext_Api_basePath(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Namespace, nil + return obj.BasePath, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -994,20 +1225,20 @@ func (ec *executionContext) _ApiExposure_namespace(ctx context.Context, field gr true, ) } -func (ec *executionContext) fieldContext_ApiExposure_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_Api_basePath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", 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) { +func (ec *executionContext) _Api_version(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_basePath(ctx, field) + return ec.fieldContext_Api_version(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.BasePath, nil + return obj.Version, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -1017,153 +1248,112 @@ func (ec *executionContext) _ApiExposure_basePath(ctx context.Context, field gra true, ) } -func (ec *executionContext) fieldContext_ApiExposure_basePath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_Api_version(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", 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) { +func (ec *executionContext) _Api_category(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_visibility(ctx, field) + return ec.fieldContext_Api_category(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Visibility, nil + return obj.Category, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalOString2string(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_ApiExposure_visibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type ApiExposureVisibility does not have child fields")) +func (ec *executionContext) fieldContext_Api_category(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _ApiExposure_active(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _Api_oauth2Scopes(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_active(ctx, field) + return ec.fieldContext_Api_oauth2Scopes(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Active, nil + return obj.Oauth2Scopes, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *bool) graphql.Marshaler { - return ec.marshalOBoolean2ᚖbool(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalOString2ᚕstringᚄ(ctx, selections, v) }, true, false, ) } -func (ec *executionContext) fieldContext_ApiExposure_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - 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) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - 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, - 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) { - return graphql.NewScalarFieldContext("ApiExposure", field, true, true, errors.New("field of type ApiExposureFeature does not have child fields")) +func (ec *executionContext) fieldContext_Api_oauth2Scopes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _ApiExposure_upstreams(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _Api_xVendor(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_upstreams(ctx, field) + return ec.fieldContext_Api_xVendor(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Upstreams, nil + return obj.XVendor, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(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", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Upstream(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Api_xVendor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", field, false, false, errors.New("field of type Boolean does not have child fields")) } -func (ec *executionContext) _ApiExposure_approvalConfig(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _Api_active(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_approvalConfig(ctx, field) + return ec.fieldContext_Api_active(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ApprovalConfig, nil + return obj.Active, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(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", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApprovalConfig(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Api_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", field, false, false, errors.New("field of type Boolean does not have child fields")) } -func (ec *executionContext) _ApiExposure_apiVersion(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _Api_specificationUrl(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_apiVersion(ctx, field) + return ec.fieldContext_Api_specificationUrl(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.APIVersion, nil + return ec.Resolvers.Api().SpecificationURL(ctx, obj) }, nil, func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { @@ -1173,113 +1363,113 @@ func (ec *executionContext) _ApiExposure_apiVersion(ctx context.Context, field g false, ) } -func (ec *executionContext) fieldContext_ApiExposure_apiVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_Api_specificationUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Api", field, true, true, 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) { +func (ec *executionContext) _Api_activeExposure(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_owner(ctx, field) + return ec.fieldContext_Api_activeExposure(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Owner(ctx) + return ec.Resolvers.Api().ActiveExposure(ctx, obj) }, 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) + func(ctx context.Context, selections ast.SelectionSet, v *model.ApiExposureInfo) graphql.Marshaler { + return ec.marshalOApiExposureInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiExposureInfo(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_ApiExposure_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Api_activeExposure(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiExposure", + Object: "Api", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Application(ctx, field) + return ec.childFields_ApiExposureInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiExposure_subscriptions(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _Api_owner(ctx context.Context, field graphql.CollectedField, obj *ent.Api) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposure_subscriptions(ctx, field) + return ec.fieldContext_Api_owner(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.ApiExposure().Subscriptions(ctx, obj) + return ec.Resolvers.Api().Owner(ctx, obj) }, nil, - 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) + 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_ApiExposure_subscriptions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Api_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiExposure", + Object: "Api", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApiSubscriptionInfo(ctx, field) + return ec.childFields_TeamInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiExposureConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposureConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApiConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposureConnection_edges(ctx, field) + return ec.fieldContext_ApiConnection_edges(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v []*ent.ApiEdge) graphql.Marshaler { + return ec.marshalOApiEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiEdge(ctx, selections, v) }, true, false, ) } -func (ec *executionContext) fieldContext_ApiExposureConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiExposureConnection", + Object: "ApiConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApiExposureEdge(ctx, field) + return ec.childFields_ApiEdge(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiExposureConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposureConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApiConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposureConnection_pageInfo(ctx, field) + return ec.fieldContext_ApiConnection_pageInfo(ctx, field) }, func(ctx context.Context) (any, error) { return obj.PageInfo, nil @@ -1292,9 +1482,9 @@ func (ec *executionContext) _ApiExposureConnection_pageInfo(ctx context.Context, true, ) } -func (ec *executionContext) fieldContext_ApiExposureConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiExposureConnection", + Object: "ApiConnection", Field: field, IsMethod: false, IsResolver: false, @@ -1305,13 +1495,13 @@ func (ec *executionContext) fieldContext_ApiExposureConnection_pageInfo(_ contex return fc, nil } -func (ec *executionContext) _ApiExposureConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposureConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApiConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposureConnection_totalCount(ctx, field) + return ec.fieldContext_ApiConnection_totalCount(ctx, field) }, func(ctx context.Context) (any, error) { return obj.TotalCount, nil @@ -1324,49 +1514,49 @@ func (ec *executionContext) _ApiExposureConnection_totalCount(ctx context.Contex true, ) } -func (ec *executionContext) fieldContext_ApiExposureConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposureConnection", field, false, false, errors.New("field of type Int does not have child fields")) +func (ec *executionContext) fieldContext_ApiConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiConnection", 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) { +func (ec *executionContext) _ApiEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApiEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposureEdge_node(ctx, field) + return ec.fieldContext_ApiEdge_node(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v *ent.Api) graphql.Marshaler { + return ec.marshalOApi2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApi(ctx, selections, v) }, true, false, ) } -func (ec *executionContext) fieldContext_ApiExposureEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiExposureEdge", + Object: "ApiEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApiExposure(ctx, field) + return ec.childFields_Api(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiExposureEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposureEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApiEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiExposureEdge_cursor(ctx, field) + return ec.fieldContext_ApiEdge_cursor(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Cursor, nil @@ -1379,17 +1569,17 @@ func (ec *executionContext) _ApiExposureEdge_cursor(ctx context.Context, field g true, ) } -func (ec *executionContext) fieldContext_ApiExposureEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiExposureEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) +func (ec *executionContext) fieldContext_ApiEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiEdge", 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) { +func (ec *executionContext) _ApiExposure_id(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_id(ctx, field) + return ec.fieldContext_ApiExposure_id(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ID, nil @@ -1402,17 +1592,17 @@ func (ec *executionContext) _ApiSubscription_id(ctx context.Context, field graph true, ) } -func (ec *executionContext) fieldContext_ApiSubscription_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type ID does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", 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) { +func (ec *executionContext) _ApiExposure_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_createdAt(ctx, field) + return ec.fieldContext_ApiExposure_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil @@ -1425,17 +1615,17 @@ func (ec *executionContext) _ApiSubscription_createdAt(ctx context.Context, fiel true, ) } -func (ec *executionContext) fieldContext_ApiSubscription_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type Time does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", 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) { +func (ec *executionContext) _ApiExposure_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_lastModifiedAt(ctx, field) + return ec.fieldContext_ApiExposure_lastModifiedAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil @@ -1448,40 +1638,40 @@ func (ec *executionContext) _ApiSubscription_lastModifiedAt(ctx context.Context, true, ) } -func (ec *executionContext) fieldContext_ApiSubscription_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type Time does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", 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) { +func (ec *executionContext) _ApiExposure_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_statusPhase(ctx, field) + return ec.fieldContext_ApiExposure_statusPhase(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusPhase, nil }, nil, - 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) + 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_ApiSubscription_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type ApiSubscriptionStatusPhase does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type ApiExposureStatusPhase does not have child fields")) } -func (ec *executionContext) _ApiSubscription_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposure_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_statusMessage(ctx, field) + return ec.fieldContext_ApiExposure_statusMessage(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil @@ -1494,17 +1684,17 @@ func (ec *executionContext) _ApiSubscription_statusMessage(ctx context.Context, false, ) } -func (ec *executionContext) fieldContext_ApiSubscription_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", 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) { +func (ec *executionContext) _ApiExposure_environment(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_environment(ctx, field) + return ec.fieldContext_ApiExposure_environment(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Environment, nil @@ -1517,17 +1707,17 @@ func (ec *executionContext) _ApiSubscription_environment(ctx context.Context, fi false, ) } -func (ec *executionContext) fieldContext_ApiSubscription_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", 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) { +func (ec *executionContext) _ApiExposure_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_namespace(ctx, field) + return ec.fieldContext_ApiExposure_namespace(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Namespace, nil @@ -1540,20 +1730,20 @@ func (ec *executionContext) _ApiSubscription_namespace(ctx context.Context, fiel true, ) } -func (ec *executionContext) fieldContext_ApiSubscription_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", 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) { +func (ec *executionContext) _ApiExposure_basePath(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_name(ctx, field) + return ec.fieldContext_ApiExposure_basePath(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.BasePath, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -1563,278 +1753,301 @@ func (ec *executionContext) _ApiSubscription_name(ctx context.Context, field gra true, ) } -func (ec *executionContext) fieldContext_ApiSubscription_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_basePath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", 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) { +func (ec *executionContext) _ApiExposure_visibility(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_basePath(ctx, field) + return ec.fieldContext_ApiExposure_visibility(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.BasePath, nil + return obj.Visibility, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v apiexposure.Visibility) graphql.Marshaler { + return ec.marshalNApiExposureVisibility2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiexposureᚐVisibility(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_ApiSubscription_basePath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_visibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type ApiExposureVisibility does not have child fields")) } -func (ec *executionContext) _ApiSubscription_m2mAuthMethod(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposure_active(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_m2mAuthMethod(ctx, field) + return ec.fieldContext_ApiExposure_active(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.M2mAuthMethod, nil + return obj.Active, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v *bool) graphql.Marshaler { + return ec.marshalOBoolean2ᚖbool(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_ApiSubscription_m2mAuthMethod(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type ApiSubscriptionM2mAuthMethod does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", field, false, false, errors.New("field of type Boolean does not have child fields")) } -func (ec *executionContext) _ApiSubscription_approvedScopes(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposure_features(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_approvedScopes(ctx, field) + return ec.fieldContext_ApiExposure_features(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ApprovedScopes, nil + return ec.Resolvers.ApiExposure().Features(ctx, obj) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { - return ec.marshalNString2ᚕstringᚄ(ctx, selections, v) + 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_ApiSubscription_approvedScopes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposure_features(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposure", field, true, true, errors.New("field of type ApiExposureFeature does not have child fields")) } -func (ec *executionContext) _ApiSubscription_owner(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposure_upstreams(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_owner(ctx, field) + return ec.fieldContext_ApiExposure_upstreams(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Owner(ctx) + return obj.Upstreams, nil }, 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) + func(ctx context.Context, selections ast.SelectionSet, v []model.Upstream) graphql.Marshaler { + return ec.marshalNUpstream2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐUpstreamᚄ(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_ApiSubscription_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiExposure_upstreams(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiSubscription", + Object: "ApiExposure", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Application(ctx, field) + return ec.childFields_Upstream(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiSubscription_failoverZones(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposure_approvalConfig(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_failoverZones(ctx, field) + return ec.fieldContext_ApiExposure_approvalConfig(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.FailoverZones(ctx) + return obj.ApprovalConfig, nil }, nil, - 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) + 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, - false, + true, ) } -func (ec *executionContext) fieldContext_ApiSubscription_failoverZones(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiExposure_approvalConfig(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiSubscription", + Object: "ApiExposure", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Zone(ctx, field) + return ec.childFields_ApprovalConfig(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiSubscription_approval(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposure_apiVersion(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_approval(ctx, field) + return ec.fieldContext_ApiExposure_apiVersion(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Approval(ctx) + return obj.APIVersion, nil }, nil, - 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) + 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_approval(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiExposure_apiVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + 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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + 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, + 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: "ApiSubscription", + Object: "ApiExposure", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Approval(ctx, field) + return ec.childFields_Application(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiSubscription_approvalRequests(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposure_api(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_approvalRequests(ctx, field) + return ec.fieldContext_ApiExposure_api(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ApprovalRequests(ctx) + return obj.API(ctx) }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v *ent.Api) graphql.Marshaler { + return ec.marshalOApi2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApi(ctx, selections, v) }, true, false, ) } -func (ec *executionContext) fieldContext_ApiSubscription_approvalRequests(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiExposure_api(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiSubscription", + Object: "ApiExposure", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApprovalRequest(ctx, field) + return ec.childFields_Api(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiSubscription_target(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposure_subscriptions(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposure) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscription_target(ctx, field) + return ec.fieldContext_ApiExposure_subscriptions(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.ApiSubscription().Target(ctx, obj) + return ec.Resolvers.ApiExposure().Subscriptions(ctx, obj) }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v []*model.ApiSubscriptionInfo) graphql.Marshaler { + return ec.marshalNApiSubscriptionInfo2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiSubscriptionInfoᚄ(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_ApiSubscription_target(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiExposure_subscriptions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiSubscription", + Object: "ApiExposure", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApiExposureInfo(ctx, field) + return ec.childFields_ApiSubscriptionInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiSubscriptionConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscriptionConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposureConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposureConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscriptionConnection_edges(ctx, field) + return ec.fieldContext_ApiExposureConnection_edges(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - 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) + 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_ApiSubscriptionConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiExposureConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiSubscriptionConnection", + Object: "ApiExposureConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApiSubscriptionEdge(ctx, field) + return ec.childFields_ApiExposureEdge(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiSubscriptionConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscriptionConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposureConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposureConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscriptionConnection_pageInfo(ctx, field) + return ec.fieldContext_ApiExposureConnection_pageInfo(ctx, field) }, func(ctx context.Context) (any, error) { return obj.PageInfo, nil @@ -1847,9 +2060,9 @@ func (ec *executionContext) _ApiSubscriptionConnection_pageInfo(ctx context.Cont true, ) } -func (ec *executionContext) fieldContext_ApiSubscriptionConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiExposureConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiSubscriptionConnection", + Object: "ApiExposureConnection", Field: field, IsMethod: false, IsResolver: false, @@ -1860,13 +2073,13 @@ func (ec *executionContext) fieldContext_ApiSubscriptionConnection_pageInfo(_ co return fc, nil } -func (ec *executionContext) _ApiSubscriptionConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscriptionConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposureConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposureConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscriptionConnection_totalCount(ctx, field) + return ec.fieldContext_ApiExposureConnection_totalCount(ctx, field) }, func(ctx context.Context) (any, error) { return obj.TotalCount, nil @@ -1879,49 +2092,49 @@ func (ec *executionContext) _ApiSubscriptionConnection_totalCount(ctx context.Co true, ) } -func (ec *executionContext) fieldContext_ApiSubscriptionConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscriptionConnection", field, false, false, errors.New("field of type Int does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposureConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposureConnection", 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) { +func (ec *executionContext) _ApiExposureEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposureEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscriptionEdge_node(ctx, field) + return ec.fieldContext_ApiExposureEdge_node(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - 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) + 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_ApiSubscriptionEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiExposureEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApiSubscriptionEdge", + Object: "ApiExposureEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApiSubscription(ctx, field) + return ec.childFields_ApiExposure(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApiSubscriptionEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscriptionEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiExposureEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApiExposureEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApiSubscriptionEdge_cursor(ctx, field) + return ec.fieldContext_ApiExposureEdge_cursor(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Cursor, nil @@ -1934,17 +2147,17 @@ func (ec *executionContext) _ApiSubscriptionEdge_cursor(ctx context.Context, fie true, ) } -func (ec *executionContext) fieldContext_ApiSubscriptionEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApiSubscriptionEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) +func (ec *executionContext) fieldContext_ApiExposureEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiExposureEdge", 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) { +func (ec *executionContext) _ApiSubscription_id(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_id(ctx, field) + return ec.fieldContext_ApiSubscription_id(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ID, nil @@ -1957,17 +2170,17 @@ func (ec *executionContext) _Application_id(ctx context.Context, field graphql.C true, ) } -func (ec *executionContext) fieldContext_Application_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type ID does not have child fields")) +func (ec *executionContext) fieldContext_ApiSubscription_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", 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) { +func (ec *executionContext) _ApiSubscription_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_createdAt(ctx, field) + return ec.fieldContext_ApiSubscription_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil @@ -1980,17 +2193,17 @@ func (ec *executionContext) _Application_createdAt(ctx context.Context, field gr true, ) } -func (ec *executionContext) fieldContext_Application_createdAt(_ 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) fieldContext_ApiSubscription_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", 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) { +func (ec *executionContext) _ApiSubscription_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_lastModifiedAt(ctx, field) + return ec.fieldContext_ApiSubscription_lastModifiedAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil @@ -2003,40 +2216,40 @@ func (ec *executionContext) _Application_lastModifiedAt(ctx context.Context, fie true, ) } -func (ec *executionContext) fieldContext_Application_lastModifiedAt(_ 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) fieldContext_ApiSubscription_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", 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) { +func (ec *executionContext) _ApiSubscription_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_statusPhase(ctx, field) + return ec.fieldContext_ApiSubscription_statusPhase(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusPhase, nil }, nil, - 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) + 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_Application_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type ApplicationStatusPhase does not have child fields")) +func (ec *executionContext) fieldContext_ApiSubscription_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type ApiSubscriptionStatusPhase does not have child fields")) } -func (ec *executionContext) _Application_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscription_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_statusMessage(ctx, field) + return ec.fieldContext_ApiSubscription_statusMessage(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil @@ -2049,17 +2262,17 @@ func (ec *executionContext) _Application_statusMessage(ctx context.Context, fiel false, ) } -func (ec *executionContext) fieldContext_Application_statusMessage(_ 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) fieldContext_ApiSubscription_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", 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) { +func (ec *executionContext) _ApiSubscription_environment(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_environment(ctx, field) + return ec.fieldContext_ApiSubscription_environment(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Environment, nil @@ -2072,17 +2285,17 @@ func (ec *executionContext) _Application_environment(ctx context.Context, field false, ) } -func (ec *executionContext) fieldContext_Application_environment(_ 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) fieldContext_ApiSubscription_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", 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) { +func (ec *executionContext) _ApiSubscription_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_namespace(ctx, field) + return ec.fieldContext_ApiSubscription_namespace(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Namespace, nil @@ -2095,17 +2308,17 @@ func (ec *executionContext) _Application_namespace(ctx context.Context, field gr true, ) } -func (ec *executionContext) fieldContext_Application_namespace(_ 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) fieldContext_ApiSubscription_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", 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) { +func (ec *executionContext) _ApiSubscription_name(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_name(ctx, field) + return ec.fieldContext_ApiSubscription_name(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Name, nil @@ -2118,537 +2331,365 @@ func (ec *executionContext) _Application_name(ctx context.Context, field graphql true, ) } -func (ec *executionContext) fieldContext_Application_name(_ 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) fieldContext_ApiSubscription_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", 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) { +func (ec *executionContext) _ApiSubscription_basePath(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_clientID(ctx, field) + return ec.fieldContext_ApiSubscription_basePath(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ClientID, nil + return obj.BasePath, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, - false, + true, ) } -func (ec *executionContext) fieldContext_Application_clientID(_ 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) fieldContext_ApiSubscription_basePath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", 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) { +func (ec *executionContext) _ApiSubscription_m2mAuthMethod(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_clientSecret(ctx, field) + return ec.fieldContext_ApiSubscription_m2mAuthMethod(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Application().ClientSecret(ctx, obj) + return obj.M2mAuthMethod, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v apisubscription.M2mAuthMethod) graphql.Marshaler { + return ec.marshalNApiSubscriptionM2mAuthMethod2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapisubscriptionᚐM2mAuthMethod(ctx, selections, v) }, true, - false, + true, ) } -func (ec *executionContext) fieldContext_Application_clientSecret(_ 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) fieldContext_ApiSubscription_m2mAuthMethod(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type ApiSubscriptionM2mAuthMethod does not have child fields")) } -func (ec *executionContext) _Application_rotatedClientSecret(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscription_approvedScopes(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_rotatedClientSecret(ctx, field) + return ec.fieldContext_ApiSubscription_approvedScopes(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Application().RotatedClientSecret(ctx, obj) + return obj.ApprovedScopes, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalNString2ᚕstringᚄ(ctx, selections, v) }, true, - false, + true, ) } -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) fieldContext_ApiSubscription_approvedScopes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscription", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Application_rotatedExpiresAt(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscription_owner(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_rotatedExpiresAt(ctx, field) + return ec.fieldContext_ApiSubscription_owner(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.RotatedExpiresAt, nil + return obj.Owner(ctx) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *time.Time) graphql.Marshaler { - return ec.marshalOTime2ᚖtimeᚐTime(ctx, selections, v) + 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, - false, + true, ) } -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_currentExpiresAt(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_currentExpiresAt(ctx, field) - }, - func(ctx context.Context) (any, error) { - return obj.CurrentExpiresAt, nil - }, - nil, - 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_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_secretRotationPhase(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_secretRotationPhase(ctx, field) - }, - func(ctx context.Context) (any, error) { - return obj.SecretRotationPhase, nil - }, - nil, - 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) +func (ec *executionContext) fieldContext_ApiSubscription_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ApiSubscription", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Application(ctx, field) }, - 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")) + } + return fc, nil } -func (ec *executionContext) _Application_secretRotationMessage(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscription_failoverZones(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (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) + return ec.fieldContext_ApiSubscription_failoverZones(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.SecretRotationMessage, nil + return obj.FailoverZones(ctx) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v []*ent.Zone) graphql.Marshaler { + return ec.marshalOZone2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐZoneᚄ(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) fieldContext_ApiSubscription_failoverZones(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ApiSubscription", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Zone(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _Application_zone(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscription_approval(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_zone(ctx, field) + return ec.fieldContext_ApiSubscription_approval(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Zone(ctx) + return obj.Approval(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) + 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, - true, + false, ) } -func (ec *executionContext) fieldContext_Application_zone(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiSubscription_approval(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Application", + Object: "ApiSubscription", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Zone(ctx, field) + return ec.childFields_Approval(ctx, field) }, } return fc, nil } -func (ec *executionContext) _Application_exposedApis(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscription_approvalRequests(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_exposedApis(ctx, field) + return ec.fieldContext_ApiSubscription_approvalRequests(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.ApprovalRequests(ctx) }, nil, - 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) + 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, - true, + false, ) } -func (ec *executionContext) fieldContext_Application_exposedApis(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiSubscription_approvalRequests(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Application", + Object: "ApiSubscription", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApiExposureConnection(ctx, field) + return ec.childFields_ApprovalRequest(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) _Application_subscribedApis(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscription_target(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_subscribedApis(ctx, field) + return ec.fieldContext_ApiSubscription_target(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 ec.Resolvers.ApiSubscription().Target(ctx, obj) }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v *model.ApiExposureInfo) graphql.Marshaler { + return ec.marshalNApiExposureInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiExposureInfo(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_Application_subscribedApis(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiSubscription_target(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Application", + Object: "ApiSubscription", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApiSubscriptionConnection(ctx, field) + return ec.childFields_ApiExposureInfo(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) _Application_exposedEvents(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscriptionConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscriptionConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_exposedEvents(ctx, field) + return ec.fieldContext_ApiSubscriptionConnection_edges(ctx, field) }, func(ctx context.Context) (any, error) { - 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)) + return obj.Edges, nil }, 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) + 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, - true, + false, ) } -func (ec *executionContext) fieldContext_Application_exposedEvents(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiSubscriptionConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Application", + Object: "ApiSubscriptionConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_EventExposureConnection(ctx, field) + return ec.childFields_ApiSubscriptionEdge(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) _Application_subscribedEvents(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscriptionConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscriptionConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_subscribedEvents(ctx, field) + return ec.fieldContext_ApiSubscriptionConnection_pageInfo(ctx, field) }, func(ctx context.Context) (any, error) { - 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)) + return obj.PageInfo, nil }, 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) + 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_Application_subscribedEvents(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiSubscriptionConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Application", + Object: "ApiSubscriptionConnection", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_EventSubscriptionConnection(ctx, field) + return ec.childFields_PageInfo(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) _Application_ownerTeam(ctx context.Context, field graphql.CollectedField, obj *ent.Application) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscriptionConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscriptionConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Application_ownerTeam(ctx, field) + return ec.fieldContext_ApiSubscriptionConnection_totalCount(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Application().OwnerTeam(ctx, obj) + return obj.TotalCount, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_Application_ownerTeam(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Application", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_TeamInfo(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_ApiSubscriptionConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscriptionConnection", field, false, false, errors.New("field of type Int does not have child fields")) } -func (ec *executionContext) _ApplicationConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscriptionEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscriptionEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApplicationConnection_edges(ctx, field) + return ec.fieldContext_ApiSubscriptionEdge_node(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.Node, nil }, nil, - 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) + 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_ApplicationConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApiSubscriptionEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApplicationConnection", + Object: "ApiSubscriptionEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApplicationEdge(ctx, field) + return ec.childFields_ApiSubscription(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApplicationConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApiSubscriptionEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApiSubscriptionEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, 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.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_ApplicationConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApplicationConnection", - 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) _ApplicationConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationConnection) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - 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.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_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) _ApplicationEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationEdge) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - 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.Node, 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_ApplicationEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ApplicationEdge", - Field: field, - IsMethod: false, - 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) _ApplicationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationEdge) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApplicationEdge_cursor(ctx, field) + return ec.fieldContext_ApiSubscriptionEdge_cursor(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Cursor, nil @@ -2661,17 +2702,17 @@ func (ec *executionContext) _ApplicationEdge_cursor(ctx context.Context, field g true, ) } -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) fieldContext_ApiSubscriptionEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiSubscriptionEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } -func (ec *executionContext) _Approval_id(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_id(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_Approval_id(ctx, field) + return ec.fieldContext_Application_id(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ID, nil @@ -2684,17 +2725,17 @@ func (ec *executionContext) _Approval_id(ctx context.Context, field graphql.Coll true, ) } -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) fieldContext_Application_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _Approval_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_createdAt(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_Approval_createdAt(ctx, field) + return ec.fieldContext_Application_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil @@ -2707,17 +2748,17 @@ func (ec *executionContext) _Approval_createdAt(ctx context.Context, field graph 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_Application_createdAt(_ 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) _Approval_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_lastModifiedAt(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_Approval_lastModifiedAt(ctx, field) + return ec.fieldContext_Application_lastModifiedAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil @@ -2730,40 +2771,40 @@ func (ec *executionContext) _Approval_lastModifiedAt(ctx context.Context, field 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) fieldContext_Application_lastModifiedAt(_ 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) _Approval_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_statusPhase(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_Approval_statusPhase(ctx, field) + return ec.fieldContext_Application_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) + 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_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) fieldContext_Application_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Application", field, false, false, errors.New("field of type ApplicationStatusPhase does not have child fields")) } -func (ec *executionContext) _Approval_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_statusMessage(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_Approval_statusMessage(ctx, field) + return ec.fieldContext_Application_statusMessage(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil @@ -2776,17 +2817,17 @@ func (ec *executionContext) _Approval_statusMessage(ctx context.Context, field g 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) fieldContext_Application_statusMessage(_ 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) _Approval_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_environment(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_Approval_environment(ctx, field) + return ec.fieldContext_Application_environment(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Environment, nil @@ -2799,17 +2840,17 @@ func (ec *executionContext) _Approval_environment(ctx context.Context, field gra 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) fieldContext_Application_environment(_ 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) _Approval_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_namespace(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_Approval_namespace(ctx, field) + return ec.fieldContext_Application_namespace(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Namespace, nil @@ -2822,20 +2863,20 @@ func (ec *executionContext) _Approval_namespace(ctx context.Context, field graph 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) fieldContext_Application_namespace(_ 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) _Approval_action(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_name(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_Approval_action(ctx, field) + return ec.fieldContext_Application_name(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Action, nil + return obj.Name, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -2845,425 +2886,583 @@ func (ec *executionContext) _Approval_action(ctx context.Context, field graphql. true, ) } -func (ec *executionContext) fieldContext_Approval_action(_ 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) fieldContext_Application_name(_ 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) _Approval_strategy(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_clientID(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_Approval_strategy(ctx, field) + return ec.fieldContext_Application_clientID(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Strategy, nil + return obj.ClientID, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_Approval_strategy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type ApprovalStrategy does not have child fields")) +func (ec *executionContext) fieldContext_Application_clientID(_ 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) _Approval_requester(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +func (ec *executionContext) _Application_clientSecret(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_Approval_requester(ctx, field) + return ec.fieldContext_Application_clientSecret(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Requester, nil + return ec.Resolvers.Application().ClientSecret(ctx, obj) }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_Approval_requester(_ 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 ec.childFields_RequesterInfo(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_Application_clientSecret(_ 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) _Approval_decider(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Approval_decider(ctx, field) + return ec.fieldContext_Application_rotatedClientSecret(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Decider, nil + return ec.Resolvers.Application().RotatedClientSecret(ctx, obj) }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_Approval_decider(_ 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 ec.childFields_DeciderInfo(ctx, field) - }, - } - 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) _Approval_deciderTeamName(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Approval_deciderTeamName(ctx, field) + return ec.fieldContext_Application_rotatedExpiresAt(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.DeciderTeamName, nil + return obj.RotatedExpiresAt, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *time.Time) graphql.Marshaler { + return ec.marshalOTime2ᚖtimeᚐTime(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_Approval_deciderTeamName(_ 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) 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) _Approval_decisions(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Approval_decisions(ctx, field) + return ec.fieldContext_Application_currentExpiresAt(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Decisions, nil + return obj.CurrentExpiresAt, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v *time.Time) graphql.Marshaler { + return ec.marshalOTime2ᚖtimeᚐTime(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_Approval_decisions(_ 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 ec.childFields_Decision(ctx, field) - }, - } - 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) _Approval_availableTransitions(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Approval_availableTransitions(ctx, field) + return ec.fieldContext_Application_secretRotationPhase(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.AvailableTransitions, nil + return obj.SecretRotationPhase, nil }, nil, - 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) + 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, - false, + true, ) } -func (ec *executionContext) fieldContext_Approval_availableTransitions(_ 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 ec.childFields_AvailableTransition(ctx, field) - }, - } - return fc, nil +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) _Approval_name(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (ret graphql.Marshaler) { +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_Approval_name(ctx, field) + return ec.fieldContext_Application_secretRotationMessage(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.SecretRotationMessage, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_Approval_name(_ 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) 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) _Approval_state(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Approval_state(ctx, field) + return ec.fieldContext_Application_zone(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.State, nil + return obj.Zone(ctx) }, nil, - 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) + 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_Approval_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type ApprovalState does not have child fields")) +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) { + return ec.childFields_Zone(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _Approval_subscription(ctx context.Context, field graphql.CollectedField, obj *ent.Approval) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Approval_subscription(ctx, field) + return ec.fieldContext_Application_exposedApis(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Approval().Subscription(ctx, obj) + 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, - 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) + 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, ) } -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) 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) { + 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) _ApprovalConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalConnection) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalConnection_edges(ctx, field) + return ec.fieldContext_Application_subscribedApis(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Edges, 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, - 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) + 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, - false, + true, ) } -func (ec *executionContext) fieldContext_ApprovalConnection_edges(_ 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: "ApprovalConnection", + Object: "Application", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApprovalEdge(ctx, field) + 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) _ApprovalConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalConnection) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalConnection_pageInfo(ctx, field) + return ec.fieldContext_Application_exposedEvents(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.PageInfo, 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, - func(ctx context.Context, selections ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { - return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, selections, v) + 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_ApprovalConnection_pageInfo(_ 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: "ApprovalConnection", + Object: "Application", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PageInfo(ctx, field) + 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) _ApprovalConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalConnection) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalConnection_totalCount(ctx, field) + return ec.fieldContext_Application_subscribedEvents(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.TotalCount, 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, - func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { - return ec.marshalNInt2int(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventSubscriptionConnection) graphql.Marshaler { + return ec.marshalNEventSubscriptionConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionConnection(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_ApprovalConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalConnection", field, false, false, errors.New("field of type Int does not have child fields")) +func (ec *executionContext) fieldContext_Application_subscribedEvents(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) { + 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) _ApprovalEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalEdge) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalEdge_node(ctx, field) + return ec.fieldContext_Application_ownerTeam(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Node, nil + return ec.Resolvers.Application().OwnerTeam(ctx, obj) }, nil, - 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) + 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, - false, + true, ) } -func (ec *executionContext) fieldContext_ApprovalEdge_node(_ 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: "ApprovalEdge", + Object: "Application", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Approval(ctx, field) + return ec.childFields_TeamInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApprovalEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalEdge) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalEdge_cursor(ctx, field) + return ec.fieldContext_ApplicationConnection_edges(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.Edges, 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) + 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, - true, + false, ) } -func (ec *executionContext) fieldContext_ApprovalEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) +func (ec *executionContext) fieldContext_ApplicationConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ApplicationConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_ApplicationEdge(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _ApprovalRequest_id(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalRequest_id(ctx, field) + return ec.fieldContext_ApplicationConnection_pageInfo(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.PageInfo, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + 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_ApplicationConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ApplicationConnection", + 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) _ApplicationConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + 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.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_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) _ApplicationEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationEdge) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + 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.Node, 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_ApplicationEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ApplicationEdge", + Field: field, + IsMethod: false, + 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) _ApplicationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApplicationEdge) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + 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.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_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_id(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_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_ApprovalRequest_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ID does not have child fields")) +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) _ApprovalRequest_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalRequest_createdAt(ctx, field) + return ec.fieldContext_Approval_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil @@ -3276,17 +3475,17 @@ func (ec *executionContext) _ApprovalRequest_createdAt(ctx context.Context, fiel true, ) } -func (ec *executionContext) fieldContext_ApprovalRequest_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type Time does not have child fields")) +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) _ApprovalRequest_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +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_ApprovalRequest_lastModifiedAt(ctx, field) + return ec.fieldContext_Approval_lastModifiedAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil @@ -3299,40 +3498,40 @@ func (ec *executionContext) _ApprovalRequest_lastModifiedAt(ctx context.Context, true, ) } -func (ec *executionContext) fieldContext_ApprovalRequest_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type Time does not have child fields")) +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) _ApprovalRequest_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +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_ApprovalRequest_statusPhase(ctx, field) + 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 *approvalrequest.StatusPhase) graphql.Marshaler { - return ec.marshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhase(ctx, selections, v) + 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_ApprovalRequest_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ApprovalRequestStatusPhase does not have child fields")) +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) _ApprovalRequest_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +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_ApprovalRequest_statusMessage(ctx, field) + return ec.fieldContext_Approval_statusMessage(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil @@ -3345,17 +3544,17 @@ func (ec *executionContext) _ApprovalRequest_statusMessage(ctx context.Context, false, ) } -func (ec *executionContext) fieldContext_ApprovalRequest_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) +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) _ApprovalRequest_environment(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +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_ApprovalRequest_environment(ctx, field) + return ec.fieldContext_Approval_environment(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Environment, nil @@ -3368,17 +3567,17 @@ func (ec *executionContext) _ApprovalRequest_environment(ctx context.Context, fi false, ) } -func (ec *executionContext) fieldContext_ApprovalRequest_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) +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) _ApprovalRequest_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +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_ApprovalRequest_namespace(ctx, field) + return ec.fieldContext_Approval_namespace(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Namespace, nil @@ -3391,17 +3590,17 @@ func (ec *executionContext) _ApprovalRequest_namespace(ctx context.Context, fiel true, ) } -func (ec *executionContext) fieldContext_ApprovalRequest_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) +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) _ApprovalRequest_action(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_action(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_ApprovalRequest_action(ctx, field) + return ec.fieldContext_Approval_action(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Action, nil @@ -3414,55 +3613,55 @@ func (ec *executionContext) _ApprovalRequest_action(ctx context.Context, field g true, ) } -func (ec *executionContext) fieldContext_ApprovalRequest_action(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_Approval_action(_ 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) _ApprovalRequest_strategy(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_strategy(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_ApprovalRequest_strategy(ctx, field) + return ec.fieldContext_Approval_strategy(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Strategy, nil }, nil, - 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) + 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_ApprovalRequest_strategy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ApprovalRequestStrategy does not have child fields")) +func (ec *executionContext) fieldContext_Approval_strategy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type ApprovalStrategy does not have child fields")) } -func (ec *executionContext) _ApprovalRequest_requester(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_requester(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_ApprovalRequest_requester(ctx, field) + return ec.fieldContext_Approval_requester(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Requester, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v model1.RequesterInfo) graphql.Marshaler { + func(ctx context.Context, selections ast.SelectionSet, v model.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) { +func (ec *executionContext) fieldContext_Approval_requester(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalRequest", + Object: "Approval", Field: field, IsMethod: false, IsResolver: false, @@ -3473,28 +3672,28 @@ func (ec *executionContext) fieldContext_ApprovalRequest_requester(_ context.Con return fc, nil } -func (ec *executionContext) _ApprovalRequest_decider(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_decider(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_ApprovalRequest_decider(ctx, field) + return ec.fieldContext_Approval_decider(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Decider, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v model1.DeciderInfo) graphql.Marshaler { + func(ctx context.Context, selections ast.SelectionSet, v model.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) { +func (ec *executionContext) fieldContext_Approval_decider(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalRequest", + Object: "Approval", Field: field, IsMethod: false, IsResolver: false, @@ -3505,13 +3704,13 @@ func (ec *executionContext) fieldContext_ApprovalRequest_decider(_ context.Conte return fc, nil } -func (ec *executionContext) _ApprovalRequest_deciderTeamName(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_deciderTeamName(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_ApprovalRequest_deciderTeamName(ctx, field) + return ec.fieldContext_Approval_deciderTeamName(ctx, field) }, func(ctx context.Context) (any, error) { return obj.DeciderTeamName, nil @@ -3524,32 +3723,32 @@ func (ec *executionContext) _ApprovalRequest_deciderTeamName(ctx context.Context true, ) } -func (ec *executionContext) fieldContext_ApprovalRequest_deciderTeamName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_Approval_deciderTeamName(_ 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) _ApprovalRequest_decisions(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_decisions(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_ApprovalRequest_decisions(ctx, field) + return ec.fieldContext_Approval_decisions(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Decisions, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []model1.Decision) graphql.Marshaler { + func(ctx context.Context, selections ast.SelectionSet, v []model.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) { +func (ec *executionContext) fieldContext_Approval_decisions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalRequest", + Object: "Approval", Field: field, IsMethod: false, IsResolver: false, @@ -3560,28 +3759,28 @@ func (ec *executionContext) fieldContext_ApprovalRequest_decisions(_ context.Con return fc, nil } -func (ec *executionContext) _ApprovalRequest_availableTransitions(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_availableTransitions(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_ApprovalRequest_availableTransitions(ctx, field) + return ec.fieldContext_Approval_availableTransitions(ctx, field) }, func(ctx context.Context) (any, error) { return obj.AvailableTransitions, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []model1.AvailableTransition) graphql.Marshaler { + func(ctx context.Context, selections ast.SelectionSet, v []model.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) { +func (ec *executionContext) fieldContext_Approval_availableTransitions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalRequest", + Object: "Approval", Field: field, IsMethod: false, IsResolver: false, @@ -3592,13 +3791,13 @@ func (ec *executionContext) fieldContext_ApprovalRequest_availableTransitions(_ return fc, nil } -func (ec *executionContext) _ApprovalRequest_name(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_name(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_ApprovalRequest_name(ctx, field) + return ec.fieldContext_Approval_name(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Name, nil @@ -3611,127 +3810,95 @@ func (ec *executionContext) _ApprovalRequest_name(ctx context.Context, field gra true, ) } -func (ec *executionContext) fieldContext_ApprovalRequest_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_Approval_name(_ 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) _ApprovalRequest_state(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { +func (ec *executionContext) _Approval_state(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_ApprovalRequest_state(ctx, field) + return ec.fieldContext_Approval_state(ctx, field) }, func(ctx context.Context) (any, error) { return obj.State, nil }, nil, - 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) + 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_ApprovalRequest_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ApprovalRequestState does not have child fields")) +func (ec *executionContext) fieldContext_Approval_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Approval", field, false, false, errors.New("field of type ApprovalState does not have child fields")) } -func (ec *executionContext) _ApprovalRequest_subscription(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalRequest_subscription(ctx, field) + return ec.fieldContext_Approval_subscription(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.ApprovalRequest().Subscription(ctx, obj) + return ec.Resolvers.Approval().Subscription(ctx, obj) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v model.SubscriptionInfo) graphql.Marshaler { + func(ctx context.Context, selections ast.SelectionSet, v model1.SubscriptionInfo) graphql.Marshaler { return ec.marshalNSubscriptionInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐSubscriptionInfo(ctx, selections, v) }, true, true, ) } -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) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - 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, - 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", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Approval(ctx, field) - }, - } - 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) _ApprovalRequestConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequestConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalRequestConnection_edges(ctx, field) + return ec.fieldContext_ApprovalConnection_edges(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - 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) + 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_ApprovalRequestConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApprovalConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalRequestConnection", + Object: "ApprovalConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApprovalRequestEdge(ctx, field) + return ec.childFields_ApprovalEdge(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApprovalRequestConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequestConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalRequestConnection_pageInfo(ctx, field) + return ec.fieldContext_ApprovalConnection_pageInfo(ctx, field) }, func(ctx context.Context) (any, error) { return obj.PageInfo, nil @@ -3744,9 +3911,9 @@ func (ec *executionContext) _ApprovalRequestConnection_pageInfo(ctx context.Cont true, ) } -func (ec *executionContext) fieldContext_ApprovalRequestConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApprovalConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalRequestConnection", + Object: "ApprovalConnection", Field: field, IsMethod: false, IsResolver: false, @@ -3757,13 +3924,13 @@ func (ec *executionContext) fieldContext_ApprovalRequestConnection_pageInfo(_ co return fc, nil } -func (ec *executionContext) _ApprovalRequestConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequestConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalRequestConnection_totalCount(ctx, field) + return ec.fieldContext_ApprovalConnection_totalCount(ctx, field) }, func(ctx context.Context) (any, error) { return obj.TotalCount, nil @@ -3776,49 +3943,49 @@ func (ec *executionContext) _ApprovalRequestConnection_totalCount(ctx context.Co true, ) } -func (ec *executionContext) fieldContext_ApprovalRequestConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequestConnection", field, false, false, errors.New("field of type Int does not have child fields")) +func (ec *executionContext) fieldContext_ApprovalConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalConnection", 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) { +func (ec *executionContext) _ApprovalEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalRequestEdge_node(ctx, field) + return ec.fieldContext_ApprovalEdge_node(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - 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) + 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_ApprovalRequestEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApprovalEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ApprovalRequestEdge", + Object: "ApprovalEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApprovalRequest(ctx, field) + return ec.childFields_Approval(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ApprovalRequestEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequestEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ApprovalRequestEdge_cursor(ctx, field) + return ec.fieldContext_ApprovalEdge_cursor(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Cursor, nil @@ -3831,17 +3998,17 @@ func (ec *executionContext) _ApprovalRequestEdge_cursor(ctx context.Context, fie true, ) } -func (ec *executionContext) fieldContext_ApprovalRequestEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ApprovalRequestEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) +func (ec *executionContext) fieldContext_ApprovalEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } -func (ec *executionContext) _EventExposure_id(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_id(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_id(ctx, field) + return ec.fieldContext_ApprovalRequest_id(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ID, nil @@ -3854,17 +4021,17 @@ func (ec *executionContext) _EventExposure_id(ctx context.Context, field graphql true, ) } -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) fieldContext_ApprovalRequest_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _EventExposure_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_createdAt(ctx, field) + return ec.fieldContext_ApprovalRequest_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil @@ -3877,17 +4044,17 @@ func (ec *executionContext) _EventExposure_createdAt(ctx context.Context, field true, ) } -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) fieldContext_ApprovalRequest_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _EventExposure_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_lastModifiedAt(ctx, field) + return ec.fieldContext_ApprovalRequest_lastModifiedAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil @@ -3900,40 +4067,40 @@ func (ec *executionContext) _EventExposure_lastModifiedAt(ctx context.Context, f true, ) } -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) fieldContext_ApprovalRequest_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _EventExposure_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_statusPhase(ctx, field) + return ec.fieldContext_ApprovalRequest_statusPhase(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusPhase, nil }, nil, - 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) + 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_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) fieldContext_ApprovalRequest_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ApprovalRequestStatusPhase does not have child fields")) } -func (ec *executionContext) _EventExposure_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_statusMessage(ctx, field) + return ec.fieldContext_ApprovalRequest_statusMessage(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil @@ -3946,17 +4113,17 @@ func (ec *executionContext) _EventExposure_statusMessage(ctx context.Context, fi 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_ApprovalRequest_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, 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) { +func (ec *executionContext) _ApprovalRequest_environment(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (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 ec.fieldContext_ApprovalRequest_environment(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Environment, nil @@ -3969,17 +4136,17 @@ func (ec *executionContext) _EventExposure_environment(ctx context.Context, fiel 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) fieldContext_ApprovalRequest_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _EventExposure_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_namespace(ctx, field) + return ec.fieldContext_ApprovalRequest_namespace(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Namespace, nil @@ -3992,20 +4159,20 @@ func (ec *executionContext) _EventExposure_namespace(ctx context.Context, field true, ) } -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) fieldContext_ApprovalRequest_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _EventExposure_eventType(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_action(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_eventType(ctx, field) + return ec.fieldContext_ApprovalRequest_action(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.EventType, nil + return obj.Action, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -4015,191 +4182,324 @@ func (ec *executionContext) _EventExposure_eventType(ctx context.Context, field true, ) } -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) fieldContext_ApprovalRequest_action(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _EventExposure_visibility(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_strategy(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_visibility(ctx, field) + return ec.fieldContext_ApprovalRequest_strategy(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Visibility, nil + return obj.Strategy, nil }, 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) + 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_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) fieldContext_ApprovalRequest_strategy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ApprovalRequestStrategy does not have child fields")) } -func (ec *executionContext) _EventExposure_active(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_requester(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_active(ctx, field) + return ec.fieldContext_ApprovalRequest_requester(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Active, nil + return obj.Requester, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *bool) graphql.Marshaler { - return ec.marshalOBoolean2ᚖbool(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v model.RequesterInfo) graphql.Marshaler { + return ec.marshalNRequesterInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐRequesterInfo(ctx, selections, v) }, true, - false, + true, ) } -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) fieldContext_ApprovalRequest_requester(_ 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 ec.childFields_RequesterInfo(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _EventExposure_approvalConfig(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_decider(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_approvalConfig(ctx, field) + return ec.fieldContext_ApprovalRequest_decider(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ApprovalConfig, nil + return obj.Decider, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v model.DeciderInfo) graphql.Marshaler { + return ec.marshalNDeciderInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐDeciderInfo(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_EventExposure_approvalConfig(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApprovalRequest_decider(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "EventExposure", + Object: "ApprovalRequest", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApprovalConfig(ctx, field) + return ec.childFields_DeciderInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _EventExposure_owner(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_deciderTeamName(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_owner(ctx, field) + return ec.fieldContext_ApprovalRequest_deciderTeamName(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Owner(ctx) + return obj.DeciderTeamName, nil }, 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) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_EventExposure_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "EventExposure", - 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) fieldContext_ApprovalRequest_deciderTeamName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _EventExposure_subscriptions(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposure) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_decisions(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposure_subscriptions(ctx, field) + return ec.fieldContext_ApprovalRequest_decisions(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.EventExposure().Subscriptions(ctx, obj) + return obj.Decisions, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v []model.Decision) graphql.Marshaler { + return ec.marshalNDecision2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐDecisionᚄ(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_EventExposure_subscriptions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApprovalRequest_decisions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "EventExposure", + Object: "ApprovalRequest", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_EventSubscriptionInfo(ctx, field) + return ec.childFields_Decision(ctx, field) }, } return fc, nil } -func (ec *executionContext) _EventExposureConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposureConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_availableTransitions(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposureConnection_edges(ctx, field) + return ec.fieldContext_ApprovalRequest_availableTransitions(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.AvailableTransitions, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v []model.AvailableTransition) graphql.Marshaler { + return ec.marshalOAvailableTransition2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐAvailableTransitionᚄ(ctx, selections, v) }, true, false, ) } -func (ec *executionContext) fieldContext_EventExposureConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApprovalRequest_availableTransitions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "EventExposureConnection", + Object: "ApprovalRequest", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_EventExposureEdge(ctx, field) + return ec.childFields_AvailableTransition(ctx, field) }, } return fc, nil } -func (ec *executionContext) _EventExposureConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposureConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequest_name(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposureConnection_pageInfo(ctx, field) + return ec.fieldContext_ApprovalRequest_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_ApprovalRequest_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + 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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + 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, + 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) { + return graphql.NewScalarFieldContext("ApprovalRequest", field, false, false, errors.New("field of type ApprovalRequestState does not have child fields")) +} + +func (ec *executionContext) _ApprovalRequest_subscription(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequest) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + 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().Subscription(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v model1.SubscriptionInfo) graphql.Marshaler { + return ec.marshalNSubscriptionInfo2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐSubscriptionInfo(ctx, selections, v) + }, + true, + true, + ) +} +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + 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, + 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", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Approval(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _ApprovalRequestConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequestConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + 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, + 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", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_ApprovalRequestEdge(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _ApprovalRequestConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequestConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + 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 @@ -4212,9 +4512,9 @@ func (ec *executionContext) _EventExposureConnection_pageInfo(ctx context.Contex true, ) } -func (ec *executionContext) fieldContext_EventExposureConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApprovalRequestConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "EventExposureConnection", + Object: "ApprovalRequestConnection", Field: field, IsMethod: false, IsResolver: false, @@ -4225,13 +4525,13 @@ func (ec *executionContext) fieldContext_EventExposureConnection_pageInfo(_ cont return fc, nil } -func (ec *executionContext) _EventExposureConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposureConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequestConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequestConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposureConnection_totalCount(ctx, field) + return ec.fieldContext_ApprovalRequestConnection_totalCount(ctx, field) }, func(ctx context.Context) (any, error) { return obj.TotalCount, nil @@ -4244,49 +4544,49 @@ func (ec *executionContext) _EventExposureConnection_totalCount(ctx context.Cont true, ) } -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) fieldContext_ApprovalRequestConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequestConnection", field, false, false, errors.New("field of type Int does not have child fields")) } -func (ec *executionContext) _EventExposureEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposureEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequestEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequestEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposureEdge_node(ctx, field) + return ec.fieldContext_ApprovalRequestEdge_node(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - 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) + 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_EventExposureEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ApprovalRequestEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "EventExposureEdge", + Object: "ApprovalRequestEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_EventExposure(ctx, field) + return ec.childFields_ApprovalRequest(ctx, field) }, } return fc, nil } -func (ec *executionContext) _EventExposureEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.EventExposureEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ApprovalRequestEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ApprovalRequestEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventExposureEdge_cursor(ctx, field) + return ec.fieldContext_ApprovalRequestEdge_cursor(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Cursor, nil @@ -4299,17 +4599,17 @@ func (ec *executionContext) _EventExposureEdge_cursor(ctx context.Context, field true, ) } -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) fieldContext_ApprovalRequestEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApprovalRequestEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } -func (ec *executionContext) _EventSubscription_id(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_id(ctx, field) + return ec.fieldContext_EventExposure_id(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ID, nil @@ -4322,17 +4622,17 @@ func (ec *executionContext) _EventSubscription_id(ctx context.Context, field gra true, ) } -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) 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) _EventSubscription_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_createdAt(ctx, field) + return ec.fieldContext_EventExposure_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil @@ -4345,17 +4645,17 @@ func (ec *executionContext) _EventSubscription_createdAt(ctx context.Context, fi true, ) } -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) 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) _EventSubscription_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_lastModifiedAt(ctx, field) + return ec.fieldContext_EventExposure_lastModifiedAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.LastModifiedAt, nil @@ -4368,40 +4668,40 @@ func (ec *executionContext) _EventSubscription_lastModifiedAt(ctx context.Contex 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_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) _EventSubscription_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_statusPhase(ctx, field) + return ec.fieldContext_EventExposure_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) + 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_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) 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) _EventSubscription_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_statusMessage(ctx, field) + return ec.fieldContext_EventExposure_statusMessage(ctx, field) }, func(ctx context.Context) (any, error) { return obj.StatusMessage, nil @@ -4414,17 +4714,17 @@ func (ec *executionContext) _EventSubscription_statusMessage(ctx context.Context 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_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) _EventSubscription_environment(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { +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_EventSubscription_environment(ctx, field) + return ec.fieldContext_EventExposure_environment(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Environment, nil @@ -4437,17 +4737,17 @@ func (ec *executionContext) _EventSubscription_environment(ctx context.Context, 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) 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) _EventSubscription_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_namespace(ctx, field) + return ec.fieldContext_EventExposure_namespace(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Namespace, nil @@ -4460,20 +4760,20 @@ func (ec *executionContext) _EventSubscription_namespace(ctx context.Context, fi true, ) } -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) 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) _EventSubscription_name(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_name(ctx, field) + return ec.fieldContext_EventExposure_eventType(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.EventType, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -4483,246 +4783,223 @@ func (ec *executionContext) _EventSubscription_name(ctx context.Context, field g true, ) } -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) 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) _EventSubscription_eventType(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_eventType(ctx, field) + return ec.fieldContext_EventExposure_visibility(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.EventType, nil + return obj.Visibility, 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_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) _EventSubscription_deliveryType(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_deliveryType(ctx, field) - }, - func(ctx context.Context) (any, error) { - return obj.DeliveryType, nil - }, - nil, - 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) + 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_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) 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) _EventSubscription_callbackURL(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_callbackURL(ctx, field) + return ec.fieldContext_EventExposure_active(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.CallbackURL, nil + return obj.Active, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *bool) graphql.Marshaler { + return ec.marshalOBoolean2ᚖbool(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_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) _EventSubscription_owner(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_owner(ctx, field) + return ec.fieldContext_EventExposure_approvalConfig(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Owner(ctx) + return obj.ApprovalConfig, nil }, 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) + 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_EventSubscription_owner(_ 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: "EventSubscription", + Object: "EventExposure", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Application(ctx, field) + return ec.childFields_ApprovalConfig(ctx, field) }, } return fc, nil } -func (ec *executionContext) _EventSubscription_approval(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_approval(ctx, field) + return ec.fieldContext_EventExposure_owner(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Approval(ctx) + return obj.Owner(ctx) }, nil, - 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) + 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, - false, + true, ) } -func (ec *executionContext) fieldContext_EventSubscription_approval(_ 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: "EventSubscription", + Object: "EventExposure", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Approval(ctx, field) + return ec.childFields_Application(ctx, field) }, } return fc, nil } -func (ec *executionContext) _EventSubscription_approvalRequests(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (ret graphql.Marshaler) { +func (ec *executionContext) _EventExposure_eventTypeDef(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_EventSubscription_approvalRequests(ctx, field) + return ec.fieldContext_EventExposure_eventTypeDef(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ApprovalRequests(ctx) + return obj.EventTypeDef(ctx) }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventType) graphql.Marshaler { + return ec.marshalOEventType2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventType(ctx, selections, v) }, true, false, ) } -func (ec *executionContext) fieldContext_EventSubscription_approvalRequests(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventExposure_eventTypeDef(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "EventSubscription", + Object: "EventExposure", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApprovalRequest(ctx, field) + return ec.childFields_EventType(ctx, field) }, } return fc, nil } -func (ec *executionContext) _EventSubscription_target(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscription) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscription_target(ctx, field) + return ec.fieldContext_EventExposure_subscriptions(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.EventSubscription().Target(ctx, obj) + return ec.Resolvers.EventExposure().Subscriptions(ctx, obj) }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v []*model.EventSubscriptionInfo) graphql.Marshaler { + return ec.marshalNEventSubscriptionInfo2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventSubscriptionInfoᚄ(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_EventSubscription_target(_ 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: "EventSubscription", + Object: "EventExposure", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_EventExposureInfo(ctx, field) + return ec.childFields_EventSubscriptionInfo(ctx, field) }, } return fc, nil } -func (ec *executionContext) _EventSubscriptionConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscriptionConnection) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscriptionConnection_edges(ctx, field) + return ec.fieldContext_EventExposureConnection_edges(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Edges, nil }, nil, - 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) + 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_EventSubscriptionConnection_edges(_ 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: "EventSubscriptionConnection", + Object: "EventExposureConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_EventSubscriptionEdge(ctx, field) + return ec.childFields_EventExposureEdge(ctx, field) }, } return fc, nil } -func (ec *executionContext) _EventSubscriptionConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscriptionConnection) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscriptionConnection_pageInfo(ctx, field) + return ec.fieldContext_EventExposureConnection_pageInfo(ctx, field) }, func(ctx context.Context) (any, error) { return obj.PageInfo, nil @@ -4735,9 +5012,9 @@ func (ec *executionContext) _EventSubscriptionConnection_pageInfo(ctx context.Co true, ) } -func (ec *executionContext) fieldContext_EventSubscriptionConnection_pageInfo(_ 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: "EventSubscriptionConnection", + Object: "EventExposureConnection", Field: field, IsMethod: false, IsResolver: false, @@ -4748,13 +5025,13 @@ func (ec *executionContext) fieldContext_EventSubscriptionConnection_pageInfo(_ return fc, nil } -func (ec *executionContext) _EventSubscriptionConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscriptionConnection) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscriptionConnection_totalCount(ctx, field) + return ec.fieldContext_EventExposureConnection_totalCount(ctx, field) }, func(ctx context.Context) (any, error) { return obj.TotalCount, nil @@ -4767,49 +5044,49 @@ func (ec *executionContext) _EventSubscriptionConnection_totalCount(ctx context. true, ) } -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) 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) _EventSubscriptionEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscriptionEdge) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscriptionEdge_node(ctx, field) + return ec.fieldContext_EventExposureEdge_node(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Node, nil }, nil, - 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) + 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_EventSubscriptionEdge_node(_ 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: "EventSubscriptionEdge", + Object: "EventExposureEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_EventSubscription(ctx, field) + return ec.childFields_EventExposure(ctx, field) }, } return fc, nil } -func (ec *executionContext) _EventSubscriptionEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.EventSubscriptionEdge) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_EventSubscriptionEdge_cursor(ctx, field) + return ec.fieldContext_EventExposureEdge_cursor(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Cursor, nil @@ -4822,17 +5099,17 @@ func (ec *executionContext) _EventSubscriptionEdge_cursor(ctx context.Context, f true, ) } -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) 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) _Group_id(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Group_id(ctx, field) + return ec.fieldContext_EventSubscription_id(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ID, nil @@ -4845,1393 +5122,1131 @@ func (ec *executionContext) _Group_id(ctx context.Context, field graphql.Collect 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_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) _Group_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Group_environment(ctx, field) + return ec.fieldContext_EventSubscription_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Environment, nil + return obj.CreatedAt, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) }, true, - false, + true, ) } -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) 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) _Group_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Group_namespace(ctx, field) + return ec.fieldContext_EventSubscription_lastModifiedAt(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Namespace, nil + return obj.LastModifiedAt, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_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) 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) _Group_name(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { +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_Group_name(ctx, field) + return ec.fieldContext_EventSubscription_statusPhase(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.StatusPhase, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *eventsubscription.StatusPhase) graphql.Marshaler { + return ec.marshalOEventSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx, selections, v) }, true, - true, + false, ) } -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) 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) _Group_displayName(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Group_displayName(ctx, field) + return ec.fieldContext_EventSubscription_statusMessage(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.DisplayName, nil + return obj.StatusMessage, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_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) 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) _Group_description(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (ret graphql.Marshaler) { +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_Group_description(ctx, field) + return ec.fieldContext_EventSubscription_environment(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Description, nil + return obj.Environment, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_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) 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) _Group_teams(ctx context.Context, field graphql.CollectedField, obj *ent.Group) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Group_teams(ctx, field) + return ec.fieldContext_EventSubscription_namespace(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Teams(ctx) + return obj.Namespace, 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) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, - false, + true, ) } -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) { - return ec.childFields_Team(ctx, field) - }, - } - 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) _Member_id(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Member_id(ctx, field) + return ec.fieldContext_EventSubscription_name(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Name, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { - return ec.marshalNID2int(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_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) 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) _Member_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Member_environment(ctx, field) + return ec.fieldContext_EventSubscription_eventType(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Environment, nil + return obj.EventType, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, - false, + true, ) } -func (ec *executionContext) fieldContext_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) 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) _Member_name(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Member_name(ctx, field) + return ec.fieldContext_EventSubscription_deliveryType(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.DeliveryType, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v eventsubscription.DeliveryType) graphql.Marshaler { + return ec.marshalNEventSubscriptionDeliveryType2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐDeliveryType(ctx, selections, v) }, true, true, ) } -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) 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) _Member_email(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Member_email(ctx, field) + return ec.fieldContext_EventSubscription_callbackURL(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Email, nil + return obj.CallbackURL, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_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) 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) _Member_team(ctx context.Context, field graphql.CollectedField, obj *ent.Member) (ret graphql.Marshaler) { +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_Member_team(ctx, field) + return ec.fieldContext_EventSubscription_owner(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Team(ctx) + return obj.Owner(ctx) }, 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) + 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, - false, + true, ) } -func (ec *executionContext) fieldContext_Member_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_EventSubscription_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Member", + Object: "EventSubscription", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Team(ctx, field) + return ec.childFields_Application(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) _EventSubscription_approval(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_PageInfo_hasNextPage(ctx, field) + return ec.fieldContext_EventSubscription_approval(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.HasNextPage, nil + return obj.Approval(ctx) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { - return ec.marshalNBoolean2bool(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *ent.Approval) graphql.Marshaler { + return ec.marshalOApproval2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApproval(ctx, selections, v) }, true, - true, + false, ) } -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) _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) +func (ec *executionContext) fieldContext_EventSubscription_approval(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EventSubscription", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Approval(ctx, field) }, - 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")) + } + return fc, nil } -func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PageInfo_startCursor(ctx, field) + return ec.fieldContext_EventSubscription_approvalRequests(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.StartCursor, nil + return obj.ApprovalRequests(ctx) }, 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) + 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_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) fieldContext_EventSubscription_approvalRequests(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EventSubscription", + Field: field, + IsMethod: true, + 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) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[int]) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PageInfo_endCursor(ctx, field) + return ec.fieldContext_EventSubscription_target(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.EndCursor, nil + return ec.Resolvers.EventSubscription().Target(ctx, obj) }, 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) + func(ctx context.Context, selections ast.SelectionSet, v *model.EventExposureInfo) graphql.Marshaler { + return ec.marshalNEventExposureInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventExposureInfo(ctx, selections, v) }, true, - false, + true, ) } -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) fieldContext_EventSubscription_target(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EventSubscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_EventExposureInfo(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _Query_node(ctx context.Context, field graphql.CollectedField) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Query_node(ctx, field) + return ec.fieldContext_EventSubscriptionConnection_edges(ctx, field) }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().Node(ctx, fc.Args["id"].(int)) + return obj.Edges, nil }, 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) + 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_Query_node(ctx 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: "Query", + Object: "EventSubscriptionConnection", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + return ec.childFields_EventSubscriptionEdge(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_node_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_nodes(ctx context.Context, field graphql.CollectedField) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Query_nodes(ctx, field) + return ec.fieldContext_EventSubscriptionConnection_pageInfo(ctx, field) }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().Nodes(ctx, fc.Args["ids"].([]int)) + return obj.PageInfo, nil }, nil, - 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) + 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_Query_nodes(ctx 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: "Query", + Object: "EventSubscriptionConnection", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + return ec.childFields_PageInfo(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_nodes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_apiExposures(ctx context.Context, field graphql.CollectedField) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Query_apiExposures(ctx, field) + return ec.fieldContext_EventSubscriptionConnection_totalCount(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.TotalCount, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(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) { - 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) 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) _Query_apiSubscriptions(ctx context.Context, field graphql.CollectedField) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Query_apiSubscriptions(ctx, field) + return ec.fieldContext_EventSubscriptionEdge_node(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.Node, nil }, nil, - 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) + 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, - true, + false, ) } -func (ec *executionContext) fieldContext_Query_apiSubscriptions(ctx 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: "Query", + Object: "EventSubscriptionEdge", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ApiSubscriptionConnection(ctx, field) + return ec.childFields_EventSubscription(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) _Query_applications(ctx context.Context, field graphql.CollectedField) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Query_applications(ctx, field) + return ec.fieldContext_EventSubscriptionEdge_cursor(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.Cursor, nil }, 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) + 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_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) { - 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) 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) _Query_approvals(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_id(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Query_approvals(ctx, field) + return ec.fieldContext_EventType_id(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.ID, nil }, nil, - 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) + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(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) { - 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) fieldContext_EventType_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", field, false, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _Query_approvalRequests(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Query_approvalRequests(ctx, field) + return ec.fieldContext_EventType_createdAt(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.CreatedAt, nil }, nil, - 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) + 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_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) { - return ec.childFields_ApprovalRequestConnection(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_approvalRequests_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) fieldContext_EventType_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _Query_eventExposures(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_lastModifiedAt(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)) + return obj.LastModifiedAt, nil }, 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) + 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_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) - }, - } - 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 +func (ec *executionContext) fieldContext_EventType_lastModifiedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _Query_eventSubscriptions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_statusPhase(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)) + return obj.StatusPhase, nil }, 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) + func(ctx context.Context, selections ast.SelectionSet, v *eventtype.StatusPhase) graphql.Marshaler { + return ec.marshalOEventTypeStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhase(ctx, selections, v) }, true, - true, + false, ) } -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) - }, - } - 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 fc, nil +func (ec *executionContext) fieldContext_EventType_statusPhase(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", field, false, false, errors.New("field of type EventTypeStatusPhase does not have child fields")) } -func (ec *executionContext) _Query_teams(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_statusMessage(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_statusMessage(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.StatusMessage, nil }, 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) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_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 +func (ec *executionContext) fieldContext_EventType_statusMessage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", 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) _EventType_namespace(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_namespace(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Query().Zones(ctx) + return obj.Namespace, nil }, 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) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(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 +func (ec *executionContext) fieldContext_EventType_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_eventType(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_eventType(ctx, field) }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.IntrospectType(fc.Args["name"].(string)) + return obj.EventType, nil }, 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) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, - false, + true, ) } -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) - } - }() - 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) fieldContext_EventType_eventType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_version(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_version(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.IntrospectSchema() + return obj.Version, nil }, 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) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, - false, + true, ) } -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) fieldContext_EventType_version(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Team_id(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_description(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_description(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Description, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { - return ec.marshalNID2int(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalOString2string(ctx, selections, v) }, true, - true, + false, ) } -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) fieldContext_EventType_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Team_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_active(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_active(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.Active, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { - return ec.marshalNTime2timeᚐTime(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(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) fieldContext_EventType_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", field, false, false, errors.New("field of type Boolean does not have child fields")) } -func (ec *executionContext) _Team_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_specificationUrl(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_specificationUrl(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.LastModifiedAt, nil + return ec.Resolvers.EventType().SpecificationURL(ctx, obj) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { - return ec.marshalNTime2timeᚐTime(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -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) fieldContext_EventType_specificationUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventType", field, true, true, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _Team_statusPhase(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventType_activeExposure(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_activeExposure(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.StatusPhase, nil + return ec.Resolvers.EventType().ActiveExposure(ctx, obj) }, 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) + func(ctx context.Context, selections ast.SelectionSet, v *model.EventExposureInfo) graphql.Marshaler { + return ec.marshalOEventExposureInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventExposureInfo(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) fieldContext_EventType_activeExposure(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EventType", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_EventExposureInfo(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) _EventType_owner(ctx context.Context, field graphql.CollectedField, obj *ent.EventType) (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) + return ec.fieldContext_EventType_owner(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.StatusMessage, nil + return ec.Resolvers.EventType().Owner(ctx, obj) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *model.TeamInfo) graphql.Marshaler { + return ec.marshalNTeamInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐTeamInfo(ctx, selections, v) }, true, - false, + true, ) } -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) fieldContext_EventType_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EventType", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_TeamInfo(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _Team_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.EventTypeConnection) (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) + return ec.fieldContext_EventTypeConnection_edges(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Environment, nil + return obj.Edges, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v []*ent.EventTypeEdge) graphql.Marshaler { + return ec.marshalOEventTypeEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeEdge(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) fieldContext_EventTypeConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EventTypeConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_EventTypeEdge(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) _EventTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.EventTypeConnection) (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) + return ec.fieldContext_EventTypeConnection_pageInfo(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Namespace, nil + return obj.PageInfo, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v entgql.PageInfo[int]) graphql.Marshaler { + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(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) fieldContext_EventTypeConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EventTypeConnection", + 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) _Team_name(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventTypeConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.EventTypeConnection) (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) + return ec.fieldContext_EventTypeConnection_totalCount(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.TotalCount, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(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) fieldContext_EventTypeConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventTypeConnection", field, false, false, errors.New("field of type Int 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) _EventTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.EventTypeEdge) (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) + return ec.fieldContext_EventTypeEdge_node(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Email, nil + return obj.Node, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventType) graphql.Marshaler { + return ec.marshalOEventType2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventType(ctx, selections, v) }, true, - true, + false, ) } -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) fieldContext_EventTypeEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EventTypeEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_EventType(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _Team_category(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +func (ec *executionContext) _EventTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.EventTypeEdge) (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) + return ec.fieldContext_EventTypeEdge_cursor(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Category, nil + return obj.Cursor, 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) + 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_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) fieldContext_EventTypeEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("EventTypeEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) } -func (ec *executionContext) _Team_teamToken(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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Team_teamToken(ctx, field) + return ec.fieldContext_Group_id(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Team().TeamToken(ctx, obj) + return obj.ID, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(ctx, selections, v) }, true, - false, + true, ) } -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) 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) _Team_group(ctx context.Context, field graphql.CollectedField, obj *ent.Team) (ret graphql.Marshaler) { +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_Team_group(ctx, field) + return ec.fieldContext_Group_environment(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Group(ctx) + return obj.Environment, nil }, 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) + 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_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) 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_members(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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Team_members(ctx, field) + return ec.fieldContext_Group_namespace(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Members(ctx) + return obj.Namespace, nil }, 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) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, - false, + true, ) } -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) 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_applications(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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Team_applications(ctx, field) + return ec.fieldContext_Group_name(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.Name, nil }, 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) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(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) 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) _TeamConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TeamConnection) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_TeamConnection_pageInfo(ctx, field) + return ec.fieldContext_Group_displayName(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.DisplayName, 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) + 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) { - return ec.childFields_PageInfo(ctx, field) - }, - } - 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) _TeamConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TeamConnection) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_TeamConnection_totalCount(ctx, field) + return ec.fieldContext_Group_description(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.Description, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { - return ec.marshalNInt2int(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v 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) { - return graphql.NewScalarFieldContext("TeamConnection", field, false, false, errors.New("field of type Int does not have child fields")) +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) _TeamEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TeamEdge) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_TeamEdge_node(ctx, field) + return ec.fieldContext_Group_teams(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Node, nil + return obj.Teams(ctx) }, 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) + 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_Group_teams(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TeamEdge", + Object: "Group", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return ec.childFields_Team(ctx, field) @@ -6240,85 +6255,85 @@ func (ec *executionContext) fieldContext_TeamEdge_node(_ context.Context, field return fc, nil } -func (ec *executionContext) _TeamEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TeamEdge) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_TeamEdge_cursor(ctx, field) + return ec.fieldContext_Member_id(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.ID, 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) + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNID2int(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) 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) _Zone_id(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Zone_id(ctx, field) + return ec.fieldContext_Member_environment(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Environment, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { - return ec.marshalNID2int(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_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) 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) _Zone_environment(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Zone_environment(ctx, field) + return ec.fieldContext_Member_name(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Environment, nil + return obj.Name, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, - false, + true, ) } -func (ec *executionContext) fieldContext_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) 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) _Zone_name(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Zone_name(ctx, field) + return ec.fieldContext_Member_email(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.Email, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -6328,1892 +6343,5487 @@ func (ec *executionContext) _Zone_name(ctx context.Context, field graphql.Collec 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) 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) _Zone_gatewayURL(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Zone_gatewayURL(ctx, field) + return ec.fieldContext_Member_team(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.GatewayURL, nil + return obj.Team(ctx) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *ent.Team) graphql.Marshaler { + return ec.marshalOTeam2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeam(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) fieldContext_Member_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Member", + Field: field, + IsMethod: true, + 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) _Zone_issuerURL(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (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, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_Zone_issuerURL(ctx, field) + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.IssuerURL, nil + return obj.HasNextPage, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) }, true, - false, + true, ) } -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) 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) _Zone_visibility(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { +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_Zone_visibility(ctx, field) + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Visibility, nil + return obj.HasPreviousPage, 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) + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(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) 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) _Zone_applications(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { +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_Zone_applications(ctx, field) + return ec.fieldContext_PageInfo_startCursor(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Applications(ctx) + return obj.StartCursor, 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) + 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_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) 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) _Zone_tokenURL(ctx context.Context, field graphql.CollectedField, obj *ent.Zone) (ret graphql.Marshaler) { +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_Zone_tokenURL(ctx, field) + return ec.fieldContext_PageInfo_endCursor(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Zone().TokenURL(ctx, obj) + return obj.EndCursor, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *entgql.Cursor[int]) graphql.Marshaler { + return ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(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")) +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")) } -// 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_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: "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") + }, } - - 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_node_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_nodes(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_nodes(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().Nodes(ctx, fc.Args["ids"].([]int)) + }, + nil, + 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_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") + }, } - - 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_nodes_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_apis(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_apis(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().Apis(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.ApiOrder), fc.Args["where"].(*ent.ApiWhereInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApiConnection) graphql.Marshaler { + return ec.marshalNApiConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_apis(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_ApiConnection(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_apis_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err } + 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_apiExposures(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_apiExposures(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)) + }, + nil, + 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, + ) +} +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) { + return ec.childFields_ApiExposureConnection(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) + }() + 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) _Query_apiSubscriptions(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_apiSubscriptions(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)) + }, + nil, + 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_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) { + 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) _Query_applications(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_applications(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)) + }, + 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_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) { + 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) _Query_approvals(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_approvals(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)) + }, + nil, + 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_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) { + 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) _Query_approvalRequests(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_approvalRequests(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)) + }, + nil, + 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, + ) +} +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) { + return ec.childFields_ApprovalRequestConnection(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_approvalRequests_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, 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) + }, + } + 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 +} + +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) + }, + } + 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 fc, nil +} + +func (ec *executionContext) _Query_eventTypes(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_eventTypes(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().EventTypes(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.EventTypeOrder), fc.Args["where"].(*ent.EventTypeWhereInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventTypeConnection) graphql.Marshaler { + return ec.marshalNEventTypeConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_eventTypes(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_EventTypeConnection(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_eventTypes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, 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 +} + +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 +} + +func (ec *executionContext) _Query_apiCategories(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_apiCategories(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Query().APICategories(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*model1.APICategory) graphql.Marshaler { + return ec.marshalNApiCategory2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAPICategoryᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_apiCategories(_ 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_ApiCategory(ctx, field) + }, + } + return fc, nil +} + +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) + } + }() + 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) _Team_apis(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_apis(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.Apis(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.ApiOrder), fc.Args["where"].(*ent.ApiWhereInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.ApiConnection) graphql.Marshaler { + return ec.marshalNApiConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Team_apis(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_ApiConnection(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_apis_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Team_eventTypes(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_eventTypes(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.EventTypes(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.EventTypeOrder), fc.Args["where"].(*ent.EventTypeWhereInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *ent.EventTypeConnection) graphql.Marshaler { + return ec.marshalNEventTypeConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Team_eventTypes(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_EventTypeConnection(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_eventTypes_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", "hasAPI", "hasAPIWith", "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 "hasAPI": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPI")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasAPI = data + case "hasAPIWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPIWith")) + data, err := ec.unmarshalOApiWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasAPIWith = 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) unmarshalInputApiOrder(ctx context.Context, obj any) (ent.ApiOrder, error) { + var it ent.ApiOrder + 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.unmarshalNApiOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = 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) unmarshalInputApiWhereInput(ctx context.Context, obj any) (ent.ApiWhereInput, error) { + var it ent.ApiWhereInput + 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", "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", "version", "versionNEQ", "versionIn", "versionNotIn", "versionGT", "versionGTE", "versionLT", "versionLTE", "versionContains", "versionHasPrefix", "versionHasSuffix", "versionEqualFold", "versionContainsFold", "category", "categoryNEQ", "categoryIn", "categoryNotIn", "categoryGT", "categoryGTE", "categoryLT", "categoryLTE", "categoryContains", "categoryHasPrefix", "categoryHasSuffix", "categoryIsNil", "categoryNotNil", "categoryEqualFold", "categoryContainsFold", "xVendor", "xVendorNEQ", "specification", "specificationNEQ", "specificationIn", "specificationNotIn", "specificationGT", "specificationGTE", "specificationLT", "specificationLTE", "specificationContains", "specificationHasPrefix", "specificationHasSuffix", "specificationIsNil", "specificationNotNil", "specificationEqualFold", "specificationContainsFold", "active", "activeNEQ", "hasOwner", "hasOwnerWith", "hasExposures", "hasExposuresWith"} + 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.unmarshalOApiWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + case "and": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOApiWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "or": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOApiWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInputᚄ(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.unmarshalOApiStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhase(ctx, v) + if err != nil { + return it, err + } + it.StatusPhase = data + case "statusPhaseNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) + data, err := ec.unmarshalOApiStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhase(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseNEQ = data + case "statusPhaseIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) + data, err := ec.unmarshalOApiStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhaseᚄ(ctx, v) + if err != nil { + return it, err + } + it.StatusPhaseIn = data + case "statusPhaseNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) + data, err := ec.unmarshalOApiStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐ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.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) + 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.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) + 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.Or = data - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + 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.ID = data - case "idNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(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.IDNEQ = data - case "idIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(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.IDIn = data - case "idNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(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.IDNotIn = data - case "idGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(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.IDGT = data - case "idGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(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.IDGTE = data - case "idLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + it.StatusMessageContainsFold = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + 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.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.IDLTE = data - case "createdAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - 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.CreatedAt = data - case "createdAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - 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.CreatedAtNEQ = data - case "createdAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - 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.CreatedAtIn = data - case "createdAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - 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.CreatedAtNotIn = data - case "createdAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) - 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.CreatedAtGT = data - case "createdAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) - 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.CreatedAtGTE = data - case "createdAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - 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.CreatedAtLT = data - case "createdAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - 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.CreatedAtLTE = data - case "lastModifiedAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) - 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.LastModifiedAt = data - case "lastModifiedAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.LastModifiedAtNEQ = data - case "lastModifiedAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(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.LastModifiedAtIn = data - case "lastModifiedAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + 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.LastModifiedAtNotIn = data - case "lastModifiedAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + 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.LastModifiedAtGT = data - case "lastModifiedAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + 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.LastModifiedAtGTE = data - case "lastModifiedAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + 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.LastModifiedAtLT = data - case "lastModifiedAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + 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.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) + 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.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) + 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.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) + 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.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) + 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.StatusPhaseNotIn = data - case "statusPhaseIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + 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.StatusPhaseIsNil = data - case "statusPhaseNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + 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.StatusPhaseNotNil = data - case "statusMessage": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessage")) + 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.StatusMessage = data - case "statusMessageNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNEQ")) + it.BasePathContainsFold = data + case "version": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("version")) 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.Version = data + case "versionNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionNEQ")) + 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")) + it.VersionNEQ = data + case "versionIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionIn")) 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) + it.VersionIn = data + case "versionNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionNotIn")) + 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.VersionNotIn = data + case "versionGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionGT")) 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.VersionGT = data + case "versionGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionGTE")) 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.VersionGTE = data + case "versionLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionLT")) 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.VersionLT = data + case "versionLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionLTE")) 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.VersionLTE = data + case "versionContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionContains")) 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.VersionContains = data + case "versionHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionHasPrefix")) 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) + it.VersionHasPrefix = data + case "versionHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionHasSuffix")) + 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.VersionHasSuffix = data + case "versionEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionEqualFold")) 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.VersionEqualFold = data + case "versionContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionContainsFold")) 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.VersionContainsFold = data + case "category": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("category")) 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.Category = data + case "categoryNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryNEQ")) 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.CategoryNEQ = data + case "categoryIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryIn")) 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.CategoryIn = data + case "categoryNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryNotIn")) 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.CategoryNotIn = data + case "categoryGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryGT")) 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.CategoryGT = data + case "categoryGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryGTE")) 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.CategoryGTE = data + case "categoryLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryLT")) 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.CategoryLT = data + case "categoryLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryLTE")) 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.CategoryLTE = data + case "categoryContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryContains")) 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.CategoryContains = data + case "categoryHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryHasPrefix")) 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.CategoryHasPrefix = data + case "categoryHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryHasSuffix")) 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.CategoryHasSuffix = data + case "categoryIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryIsNil")) 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.CategoryIsNil = data + case "categoryNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryNotNil")) 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.CategoryNotNil = data + case "categoryEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryEqualFold")) 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.CategoryEqualFold = data + case "categoryContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categoryContainsFold")) 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.CategoryContainsFold = data + case "xVendor": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("xVendor")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.XVendor = data + case "xVendorNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("xVendorNEQ")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.XVendorNEQ = data + case "specification": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specification")) 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.Specification = data + case "specificationNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationNEQ")) 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")) + it.SpecificationNEQ = data + case "specificationIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationIn")) 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")) + it.SpecificationIn = data + case "specificationNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationNotIn")) 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.SpecificationNotIn = data + case "specificationGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationGT")) 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")) + it.SpecificationGT = data + case "specificationGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationGTE")) 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")) + it.SpecificationGTE = data + case "specificationLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationLT")) 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.SpecificationLT = data + case "specificationLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationLTE")) 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.SpecificationLTE = data + case "specificationContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationContains")) 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")) + it.SpecificationContains = data + case "specificationHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationHasPrefix")) 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")) + it.SpecificationHasPrefix = data + case "specificationHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationHasSuffix")) 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) + it.SpecificationHasSuffix = data + case "specificationIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NamespaceEqualFold = data - case "namespaceContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) + it.SpecificationIsNil = data + case "specificationNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.SpecificationNotNil = data + case "specificationEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationEqualFold")) 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")) + it.SpecificationEqualFold = data + case "specificationContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationContainsFold")) 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) + it.SpecificationContainsFold = 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 "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.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasOwnerWith = data + case "hasExposures": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposures")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasExposures = data + case "hasExposuresWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposuresWith")) + data, err := ec.unmarshalOApiExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiExposureWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasExposuresWith = 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.BasePathNEQ = data - case "basePathIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + 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.BasePathIn = data - case "basePathNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + 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.BasePathNotIn = data - case "basePathGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGT")) - 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.BasePathGT = data - case "basePathGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGTE")) - 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.BasePathGTE = data - case "basePathLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLT")) - 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.BasePathLT = data - case "basePathLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLTE")) - 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.BasePathLTE = data - case "basePathContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContains")) - 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.BasePathContains = data - case "basePathHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasPrefix")) - 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.BasePathHasPrefix = data - case "basePathHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasSuffix")) - 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.BasePathHasSuffix = data - case "basePathEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathEqualFold")) - 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.BasePathEqualFold = data - case "basePathContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContainsFold")) - 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.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) + 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.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.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.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.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.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.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.VisibilityNotIn = data - case "active": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("active")) - data, err := ec.unmarshalOBoolean2ᚖbool(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.Active = data - case "activeNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNEQ")) - data, err := ec.unmarshalOBoolean2ᚖbool(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.ActiveNEQ = data - case "activeIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeIsNil")) - data, err := ec.unmarshalOBoolean2bool(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.ActiveIsNil = data - case "activeNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNotNil")) - data, err := ec.unmarshalOBoolean2bool(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.ActiveNotNil = data - case "apiVersion": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersion")) - 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.APIVersion = data - case "apiVersionNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionNEQ")) - 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.APIVersionNEQ = data - case "apiVersionIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionIn")) - 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.APIVersionIn = data - case "apiVersionNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionNotIn")) - 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.APIVersionNotIn = data - case "apiVersionGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionGT")) - 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.APIVersionGT = data - case "apiVersionGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionGTE")) - 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.APIVersionGTE = data - case "apiVersionLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionLT")) - 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.APIVersionLT = data - case "apiVersionLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.APIVersionLTE = data - case "apiVersionContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.APIVersionContains = data - case "apiVersionHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.APIVersionHasPrefix = data - case "apiVersionHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.APIVersionHasSuffix = data - case "apiVersionIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionIsNil")) + 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.APIVersionIsNil = data - case "apiVersionNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionNotNil")) + 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.APIVersionNotNil = data - case "apiVersionEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionEqualFold")) + 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.APIVersionEqualFold = data - case "apiVersionContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersionContainsFold")) + 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.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) + 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.HasOwnerWith = data - case "hasSubscriptions": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscriptions")) - data, err := ec.unmarshalOBoolean2ᚖbool(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.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) + 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.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.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.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.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.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) + 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.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) + 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.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) + 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.Or = data - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(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.ID = data - case "idNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(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.IDNEQ = data - case "idIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(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.IDIn = data - case "idNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(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.IDNotIn = data - case "idGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(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.IDGT = data - case "idGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(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.IDGTE = data - case "idLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(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.IDLT = data - case "idLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - 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.IDLTE = data - case "createdAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.CreatedAt = data - case "createdAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.CreatedAtNEQ = data - case "createdAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(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.CreatedAtIn = data - case "createdAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(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.CreatedAtNotIn = data - case "createdAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.CreatedAtGT = data - case "createdAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.CreatedAtGTE = data - case "createdAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.CreatedAtLT = data - case "createdAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - 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.CreatedAtLTE = data - case "lastModifiedAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) - 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.LastModifiedAt = data - case "lastModifiedAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) - 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.LastModifiedAtNEQ = data - case "lastModifiedAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) - 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.LastModifiedAtIn = data - case "lastModifiedAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) - 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.LastModifiedAtNotIn = data - case "lastModifiedAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) - 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.LastModifiedAtGT = data - case "lastModifiedAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) - 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.LastModifiedAtGTE = data - case "lastModifiedAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) - 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.LastModifiedAtLT = data - case "lastModifiedAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) - 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.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) + 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.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) + 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.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) + 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.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) + 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.StatusPhaseNotIn = data - case "statusPhaseIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIsNil")) - data, err := ec.unmarshalOBoolean2bool(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.StatusPhaseIsNil = data - case "statusPhaseNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotNil")) - data, err := ec.unmarshalOBoolean2bool(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.StatusPhaseNotNil = data - case "statusMessage": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessage")) + 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.StatusMessage = data - case "statusMessageNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNEQ")) + 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.StatusMessageNEQ = data - case "statusMessageIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(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.StatusMessageIn = data - case "statusMessageNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(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.StatusMessageNotIn = data - case "statusMessageGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGT")) + 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.StatusMessageGT = data - case "statusMessageGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageGTE")) - data, err := ec.unmarshalOString2ᚖstring(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.StatusMessageGTE = data - case "statusMessageLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLT")) - data, err := ec.unmarshalOString2ᚖstring(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.StatusMessageLT = data - case "statusMessageLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageLTE")) + 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.StatusMessageLTE = data - case "statusMessageContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContains")) + 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.StatusMessageContains = data - case "statusMessageHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasPrefix")) + 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.StatusMessageHasPrefix = data - case "statusMessageHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageHasSuffix")) + 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.StatusMessageHasSuffix = data - case "statusMessageIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + 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.StatusMessageIsNil = data - case "statusMessageNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + 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.StatusMessageNotNil = data - case "statusMessageEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageEqualFold")) + 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.StatusMessageEqualFold = data - case "statusMessageContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusMessageContainsFold")) + 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.StatusMessageContainsFold = data - case "environment": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) + 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.Environment = data - case "environmentNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNEQ")) + 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.EnvironmentNEQ = data - case "environmentIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIn")) + 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.EnvironmentIn = data - case "environmentNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotIn")) + 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.EnvironmentNotIn = data - case "environmentGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGT")) + 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.EnvironmentGT = data - case "environmentGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentGTE")) + 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.EnvironmentGTE = data - case "environmentLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLT")) + 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.EnvironmentLT = data - case "environmentLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentLTE")) + 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.EnvironmentLTE = data - case "environmentContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentContains")) + 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.EnvironmentContains = data - case "environmentHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasPrefix")) + 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.EnvironmentHasPrefix = data - case "environmentHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentHasSuffix")) + 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.EnvironmentHasSuffix = data - case "environmentIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentIsNil")) + 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.EnvironmentIsNil = data - case "environmentNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentNotNil")) + 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.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")) + 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.EnvironmentContainsFold = data - case "namespace": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + 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.Namespace = data - case "namespaceNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NamespaceNEQ = data - case "namespaceIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + 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.NamespaceIn = data - case "namespaceNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + 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.NamespaceNotIn = data - case "namespaceGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NamespaceGT = data - case "namespaceGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NamespaceGTE = data - case "namespaceLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NamespaceLT = data - case "namespaceLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NamespaceLTE = data - case "namespaceContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NamespaceContains = data - case "namespaceHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NamespaceHasPrefix = data - case "namespaceHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NamespaceHasSuffix = data - case "namespaceEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NamespaceEqualFold = data - case "namespaceContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespaceContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NamespaceContainsFold = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.Name = data - case "nameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NameNEQ = data - case "nameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + 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.NameIn = data - case "nameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + 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.NameNotIn = data - case "nameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + 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.NameContainsFold = data - case "basePath": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePath")) + 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.BasePath = data - case "basePathNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.BasePathNEQ = data - case "basePathIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathIn")) + 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.BasePathIn = data - case "basePathNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + 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.BasePathNotIn = data - case "basePathGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGT")) + 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.BasePathGT = data - case "basePathGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathGTE")) + 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.BasePathGTE = data - case "basePathLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLT")) + 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.BasePathLT = data - case "basePathLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathLTE")) + 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.BasePathLTE = data - case "basePathContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContains")) + 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.BasePathContains = data - case "basePathHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasPrefix")) + 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.BasePathHasPrefix = data - case "basePathHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + 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.BasePathHasSuffix = data - case "basePathEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathEqualFold")) + 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.BasePathEqualFold = data - case "basePathContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basePathContainsFold")) + 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.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.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.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.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.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.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.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.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.M2mAuthMethodNotIn = data - case "hasOwner": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) + 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.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.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.HasOwnerWith = data - case "hasTarget": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTarget")) + 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.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.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.HasTargetWith = data - case "hasFailoverZones": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFailoverZones")) + 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.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.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.HasFailoverZonesWith = data - case "hasApproval": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApproval")) + 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.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.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.HasApprovalWith = data - case "hasApprovalRequests": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalRequests")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + 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.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.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.HasApprovalRequestsWith = data + it.Field = data } } return it, nil } -func (ec *executionContext) unmarshalInputApplicationOrder(ctx context.Context, obj any) (ent.ApplicationOrder, error) { - var it ent.ApplicationOrder +func (ec *executionContext) unmarshalInputApprovalRequestOrder(ctx context.Context, obj any) (ent.ApprovalRequestOrder, error) { + var it ent.ApprovalRequestOrder if obj == nil { return it, nil } @@ -8243,7 +11853,7 @@ func (ec *executionContext) unmarshalInputApplicationOrder(ctx context.Context, 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) + data, err := ec.unmarshalNApprovalRequestOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderField(ctx, v) if err != nil { return it, err } @@ -8253,8 +11863,8 @@ func (ec *executionContext) unmarshalInputApplicationOrder(ctx context.Context, return it, nil } -func (ec *executionContext) unmarshalInputApplicationWhereInput(ctx context.Context, obj any) (ent.ApplicationWhereInput, error) { - var it ent.ApplicationWhereInput +func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context.Context, obj any) (ent.ApprovalRequestWhereInput, error) { + var it ent.ApprovalRequestWhereInput if obj == nil { return it, nil } @@ -8264,7 +11874,7 @@ func (ec *executionContext) unmarshalInputApplicationWhereInput(ctx context.Cont 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"} + 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 { @@ -8273,21 +11883,21 @@ func (ec *executionContext) unmarshalInputApplicationWhereInput(ctx context.Cont 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) + 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.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + 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.unmarshalOApplicationWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApplicationWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -8462,28 +12072,28 @@ func (ec *executionContext) unmarshalInputApplicationWhereInput(ctx context.Cont 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) + 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.unmarshalOApplicationStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐ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.unmarshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐ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.unmarshalOApplicationStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapplicationᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } @@ -8795,656 +12405,378 @@ func (ec *executionContext) unmarshalInputApplicationWhereInput(ctx context.Cont 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) + 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.RotatedExpiresAtNotIn = data - case "rotatedExpiresAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.RotatedExpiresAtGT = data - case "rotatedExpiresAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.RotatedExpiresAtGTE = data - case "rotatedExpiresAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.RotatedExpiresAtLT = data - case "rotatedExpiresAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.RotatedExpiresAtLTE = data - case "rotatedExpiresAtIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtIsNil")) - data, err := ec.unmarshalOBoolean2bool(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.RotatedExpiresAtIsNil = data - case "rotatedExpiresAtNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rotatedExpiresAtNotNil")) - data, err := ec.unmarshalOBoolean2bool(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.RotatedExpiresAtNotNil = data - case "currentExpiresAt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.CurrentExpiresAt = data - case "currentExpiresAtNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + 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.CurrentExpiresAtNEQ = data - case "currentExpiresAtIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(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.CurrentExpiresAtIn = data - case "currentExpiresAtNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(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.CurrentExpiresAtNotIn = data - case "currentExpiresAtGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.CurrentExpiresAtGT = data - case "currentExpiresAtGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.CurrentExpiresAtGTE = data - case "currentExpiresAtLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(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.CurrentExpiresAtLT = data - case "currentExpiresAtLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + 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.CurrentExpiresAtLTE = data - case "currentExpiresAtIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + 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.CurrentExpiresAtIsNil = data - case "currentExpiresAtNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentExpiresAtNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + 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.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) + 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.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) + 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.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) + 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.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) + 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.SecretRotationPhaseNotIn = data - case "secretRotationMessage": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessage")) - data, err := ec.unmarshalOString2ᚖstring(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.SecretRotationMessage = data - case "secretRotationMessageNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageNEQ")) + 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.SecretRotationMessageNEQ = data - case "secretRotationMessageIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(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.SecretRotationMessageIn = data - case "secretRotationMessageNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(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.SecretRotationMessageNotIn = data - case "secretRotationMessageGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageGT")) + 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.SecretRotationMessageGT = data - case "secretRotationMessageGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageGTE")) + 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.SecretRotationMessageGTE = data - case "secretRotationMessageLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageLT")) + 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.SecretRotationMessageLT = data - case "secretRotationMessageLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageLTE")) + 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.SecretRotationMessageLTE = data - case "secretRotationMessageContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageContains")) + 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.SecretRotationMessageContains = data - case "secretRotationMessageHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageHasPrefix")) + 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.SecretRotationMessageHasPrefix = data - case "secretRotationMessageHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageHasSuffix")) + 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.SecretRotationMessageHasSuffix = data - case "secretRotationMessageIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageIsNil")) - data, err := ec.unmarshalOBoolean2bool(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.SecretRotationMessageIsNil = data - case "secretRotationMessageNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageNotNil")) - 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.SecretRotationMessageNotNil = data - case "secretRotationMessageEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(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.SecretRotationMessageEqualFold = data - case "secretRotationMessageContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRotationMessageContainsFold")) + 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.SecretRotationMessageContainsFold = data - case "hasZone": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasZone")) - data, err := ec.unmarshalOBoolean2ᚖbool(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.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.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.HasZoneWith = data - case "hasOwnerTeam": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerTeam")) - data, err := ec.unmarshalOBoolean2ᚖbool(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.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.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.HasOwnerTeamWith = data - case "hasExposedApis": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposedApis")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + 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.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) + 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.HasExposedApisWith = data - case "hasSubscribedApis": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscribedApis")) - data, err := ec.unmarshalOBoolean2ᚖbool(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.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.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.HasSubscribedApisWith = data - case "hasExposedEvents": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposedEvents")) - data, err := ec.unmarshalOBoolean2ᚖbool(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.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) + 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.HasExposedEventsWith = data - case "hasSubscribedEvents": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscribedEvents")) - 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.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) + 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.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) + 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.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.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.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) + 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.unmarshalNApprovalRequestOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestOrderField(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) unmarshalInputApprovalRequestWhereInput(ctx context.Context, obj any) (ent.ApprovalRequestWhereInput, error) { - var it ent.ApprovalRequestWhereInput +func (ec *executionContext) unmarshalInputApprovalWhereInput(ctx context.Context, obj any) (ent.ApprovalWhereInput, error) { + var it ent.ApprovalWhereInput if obj == nil { return it, nil } @@ -9463,21 +12795,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.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.unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(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.unmarshalOApprovalRequestWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalRequestWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOApprovalWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApprovalWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -9652,28 +12984,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.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.unmarshalOApprovalRequestStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐ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.unmarshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐ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.unmarshalOApprovalRequestStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOApprovalStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } @@ -10086,28 +13418,28 @@ func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context. 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) + 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.unmarshalOApprovalRequestStrategy2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategy(ctx, v) + 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.unmarshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategyᚄ(ctx, v) + 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.unmarshalOApprovalRequestStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalrequestᚐStrategyᚄ(ctx, v) + data, err := ec.unmarshalOApprovalStrategy2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStrategyᚄ(ctx, v) if err != nil { return it, err } @@ -10296,28 +13628,28 @@ func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context. 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) + data, err := ec.unmarshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐ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) + data, err := ec.unmarshalOApprovalState2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐ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) + data, err := ec.unmarshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐ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) + data, err := ec.unmarshalOApprovalState2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapprovalᚐStateᚄ(ctx, v) if err != nil { return it, err } @@ -10342,21 +13674,62 @@ func (ec *executionContext) unmarshalInputApprovalRequestWhereInput(ctx context. if err != nil { return it, err } - 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) + 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.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.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.HasEventSubscriptionWith = data + it.Field = data } } return it, nil } -func (ec *executionContext) unmarshalInputApprovalWhereInput(ctx context.Context, obj any) (ent.ApprovalWhereInput, error) { - var it ent.ApprovalWhereInput +func (ec *executionContext) unmarshalInputEventExposureWhereInput(ctx context.Context, obj any) (ent.EventExposureWhereInput, error) { + var it ent.EventExposureWhereInput if obj == nil { return it, nil } @@ -10366,7 +13739,7 @@ func (ec *executionContext) unmarshalInputApprovalWhereInput(ctx context.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", "hasEventSubscription", "hasEventSubscriptionWith"} + 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", "hasEventTypeDef", "hasEventTypeDefWith", "hasSubscriptions", "hasSubscriptionsWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -10375,21 +13748,21 @@ func (ec *executionContext) unmarshalInputApprovalWhereInput(ctx context.Context 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) + data, err := ec.unmarshalOEventExposureWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInput(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) + data, err := ec.unmarshalOEventExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInputᚄ(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) + data, err := ec.unmarshalOEventExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -10564,28 +13937,28 @@ func (ec *executionContext) unmarshalInputApprovalWhereInput(ctx context.Context 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) + data, err := ec.unmarshalOEventExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(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) + data, err := ec.unmarshalOEventExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhase(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) + data, err := ec.unmarshalOEventExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhaseᚄ(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) + data, err := ec.unmarshalOEventExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } @@ -10806,469 +14179,301 @@ func (ec *executionContext) unmarshalInputApprovalWhereInput(ctx context.Context 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) - 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) - if err != nil { - return it, err - } - 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.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.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.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.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) + 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 - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + 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.Name = data - case "nameNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + 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.NameNEQ = data - case "nameIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + 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.NameIn = data - case "nameNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + 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.NameNotIn = data - case "nameGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + 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.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + 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.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + 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.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + 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.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + 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.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + 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.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + 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.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + 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.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + 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.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.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.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.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.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.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.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.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.StateNotIn = data - case "hasAPISubscription": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAPISubscription")) + 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.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.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.HasAPISubscriptionWith = data - case "hasEventSubscription": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventSubscription")) + 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 "hasOwner": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasEventSubscription = data - case "hasEventSubscriptionWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventSubscriptionWith")) + 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 "hasEventTypeDef": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventTypeDef")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasEventTypeDef = data + case "hasEventTypeDefWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventTypeDefWith")) + data, err := ec.unmarshalOEventTypeWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasEventTypeDefWith = 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.HasEventSubscriptionWith = data + it.HasSubscriptionsWith = data } } return it, nil } -func (ec *executionContext) unmarshalInputEventExposureOrder(ctx context.Context, obj any) (ent.EventExposureOrder, error) { - var it ent.EventExposureOrder +func (ec *executionContext) unmarshalInputEventSubscriptionOrder(ctx context.Context, obj any) (ent.EventSubscriptionOrder, error) { + var it ent.EventSubscriptionOrder if obj == nil { return it, nil } @@ -11298,7 +14503,7 @@ func (ec *executionContext) unmarshalInputEventExposureOrder(ctx context.Context 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) + data, err := ec.unmarshalNEventSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionOrderField(ctx, v) if err != nil { return it, err } @@ -11308,8 +14513,8 @@ func (ec *executionContext) unmarshalInputEventExposureOrder(ctx context.Context return it, nil } -func (ec *executionContext) unmarshalInputEventExposureWhereInput(ctx context.Context, obj any) (ent.EventExposureWhereInput, error) { - var it ent.EventExposureWhereInput +func (ec *executionContext) unmarshalInputEventSubscriptionWhereInput(ctx context.Context, obj any) (ent.EventSubscriptionWhereInput, error) { + var it ent.EventSubscriptionWhereInput if obj == nil { return it, nil } @@ -11319,7 +14524,7 @@ func (ec *executionContext) unmarshalInputEventExposureWhereInput(ctx context.Co 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"} + 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 { @@ -11328,21 +14533,21 @@ func (ec *executionContext) unmarshalInputEventExposureWhereInput(ctx context.Co 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) + 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.unmarshalOEventExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInputᚄ(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.unmarshalOEventExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -11517,28 +14722,28 @@ func (ec *executionContext) unmarshalInputEventExposureWhereInput(ctx context.Co 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) + 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.unmarshalOEventExposureStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐ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.unmarshalOEventExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐ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.unmarshalOEventExposureStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventexposureᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOEventSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } @@ -11858,6 +15063,97 @@ func (ec *executionContext) unmarshalInputEventExposureWhereInput(ctx context.Co 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 "eventType": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventType")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -11949,62 +15245,139 @@ func (ec *executionContext) unmarshalInputEventExposureWhereInput(ctx context.Co return it, err } 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) + 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.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) + 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.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) + 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.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) + 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.VisibilityNotIn = data - case "active": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("active")) - data, err := ec.unmarshalOBoolean2ᚖbool(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.Active = data - case "activeNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNEQ")) - data, err := ec.unmarshalOBoolean2ᚖbool(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.ActiveNEQ = data - case "activeIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeIsNil")) + 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.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.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.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.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.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.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.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.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.ActiveIsNil = data - case "activeNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNotNil")) + 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.ActiveNotNil = data + 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.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.CallbackURLContainsFold = data case "hasOwner": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) @@ -12019,27 +15392,55 @@ func (ec *executionContext) unmarshalInputEventExposureWhereInput(ctx context.Co return it, err } it.HasOwnerWith = data - case "hasSubscriptions": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubscriptions")) + case "hasTarget": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTarget")) 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) + 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.HasSubscriptionsWith = data + 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) unmarshalInputEventSubscriptionOrder(ctx context.Context, obj any) (ent.EventSubscriptionOrder, error) { - var it ent.EventSubscriptionOrder +func (ec *executionContext) unmarshalInputEventTypeOrder(ctx context.Context, obj any) (ent.EventTypeOrder, error) { + var it ent.EventTypeOrder if obj == nil { return it, nil } @@ -12069,7 +15470,7 @@ func (ec *executionContext) unmarshalInputEventSubscriptionOrder(ctx context.Con it.Direction = data case "field": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNEventSubscriptionOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionOrderField(ctx, v) + data, err := ec.unmarshalNEventTypeOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeOrderField(ctx, v) if err != nil { return it, err } @@ -12079,8 +15480,8 @@ func (ec *executionContext) unmarshalInputEventSubscriptionOrder(ctx context.Con return it, nil } -func (ec *executionContext) unmarshalInputEventSubscriptionWhereInput(ctx context.Context, obj any) (ent.EventSubscriptionWhereInput, error) { - var it ent.EventSubscriptionWhereInput +func (ec *executionContext) unmarshalInputEventTypeWhereInput(ctx context.Context, obj any) (ent.EventTypeWhereInput, error) { + var it ent.EventTypeWhereInput if obj == nil { return it, nil } @@ -12090,7 +15491,7 @@ func (ec *executionContext) unmarshalInputEventSubscriptionWhereInput(ctx contex 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", "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"} + 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", "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", "version", "versionNEQ", "versionIn", "versionNotIn", "versionGT", "versionGTE", "versionLT", "versionLTE", "versionContains", "versionHasPrefix", "versionHasSuffix", "versionEqualFold", "versionContainsFold", "description", "descriptionNEQ", "descriptionIn", "descriptionNotIn", "descriptionGT", "descriptionGTE", "descriptionLT", "descriptionLTE", "descriptionContains", "descriptionHasPrefix", "descriptionHasSuffix", "descriptionIsNil", "descriptionNotNil", "descriptionEqualFold", "descriptionContainsFold", "specification", "specificationNEQ", "specificationIn", "specificationNotIn", "specificationGT", "specificationGTE", "specificationLT", "specificationLTE", "specificationContains", "specificationHasPrefix", "specificationHasSuffix", "specificationIsNil", "specificationNotNil", "specificationEqualFold", "specificationContainsFold", "active", "activeNEQ", "hasOwner", "hasOwnerWith", "hasExposures", "hasExposuresWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -12099,21 +15500,21 @@ func (ec *executionContext) unmarshalInputEventSubscriptionWhereInput(ctx contex switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInput(ctx, v) + data, err := ec.unmarshalOEventTypeWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOEventTypeWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOEventSubscriptionWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventSubscriptionWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOEventTypeWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -12288,28 +15689,28 @@ func (ec *executionContext) unmarshalInputEventSubscriptionWhereInput(ctx contex it.LastModifiedAtLTE = data case "statusPhase": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhase")) - data, err := ec.unmarshalOEventSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx, v) + data, err := ec.unmarshalOEventTypeStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhase(ctx, v) if err != nil { return it, err } it.StatusPhase = data case "statusPhaseNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNEQ")) - data, err := ec.unmarshalOEventSubscriptionStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhase(ctx, v) + data, err := ec.unmarshalOEventTypeStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhase(ctx, v) if err != nil { return it, err } it.StatusPhaseNEQ = data case "statusPhaseIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseIn")) - data, err := ec.unmarshalOEventSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOEventTypeStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } it.StatusPhaseIn = data case "statusPhaseNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusPhaseNotIn")) - data, err := ec.unmarshalOEventSubscriptionStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventsubscriptionᚐStatusPhaseᚄ(ctx, v) + data, err := ec.unmarshalOEventTypeStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhaseᚄ(ctx, v) if err != nil { return it, err } @@ -12433,111 +15834,6 @@ func (ec *executionContext) unmarshalInputEventSubscriptionWhereInput(ctx contex 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) @@ -12563,163 +15859,72 @@ func (ec *executionContext) unmarshalInputEventSubscriptionWhereInput(ctx contex 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")) + 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.NameGT = data - case "nameGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + 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.NameGTE = data - case "nameLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + 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.NameLT = data - case "nameLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + 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.NameLTE = data - case "nameContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + 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.NameContains = data - case "nameHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + 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.NameHasPrefix = data - case "nameHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + 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.NameHasSuffix = data - case "nameEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + 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.NameEqualFold = data - case "nameContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + 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.NameContainsFold = data + it.NamespaceContainsFold = data case "eventType": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventType")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -12811,195 +16016,349 @@ func (ec *executionContext) unmarshalInputEventSubscriptionWhereInput(ctx contex return it, err } 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) + case "version": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("version")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - 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) + it.Version = data + case "versionNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - 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) + it.VersionNEQ = data + case "versionIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - 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) + it.VersionIn = data + case "versionNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.DeliveryTypeNotIn = data - case "callbackURL": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURL")) + it.VersionNotIn = data + case "versionGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CallbackURL = data - case "callbackURLNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLNEQ")) + it.VersionGT = data + case "versionGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CallbackURLNEQ = data - case "callbackURLIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLIn")) + it.VersionGTE = data + case "versionLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.VersionLT = data + case "versionLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.VersionLTE = data + case "versionContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.VersionContains = data + case "versionHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.VersionHasPrefix = data + case "versionHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.VersionHasSuffix = data + case "versionEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.VersionEqualFold = data + case "versionContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("versionContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.VersionContainsFold = data + case "description": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) + 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")) + 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.CallbackURLIn = data - case "callbackURLNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLNotIn")) + 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.CallbackURLNotIn = data - case "callbackURLGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLGT")) + 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.CallbackURLGT = data - case "callbackURLGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLGTE")) + 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.CallbackURLGTE = data - case "callbackURLLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLLT")) + 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.CallbackURLLT = data - case "callbackURLLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLLTE")) + 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.CallbackURLLTE = data - case "callbackURLContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLContains")) + 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.CallbackURLContains = data - case "callbackURLHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLHasPrefix")) + 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.CallbackURLHasPrefix = data - case "callbackURLHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLHasSuffix")) + 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.CallbackURLHasSuffix = data - case "callbackURLIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLIsNil")) + it.DescriptionHasSuffix = data + case "descriptionIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionIsNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CallbackURLIsNil = data - case "callbackURLNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLNotNil")) + it.DescriptionIsNil = data + case "descriptionNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionNotNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CallbackURLNotNil = data - case "callbackURLEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLEqualFold")) + it.DescriptionNotNil = data + case "descriptionEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("descriptionEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CallbackURLEqualFold = data - case "callbackURLContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("callbackURLContainsFold")) + 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.CallbackURLContainsFold = data - case "hasOwner": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.DescriptionContainsFold = data + case "specification": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specification")) + 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.Specification = data + case "specificationNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SpecificationNEQ = data + case "specificationIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.SpecificationIn = data + case "specificationNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.SpecificationNotIn = data + case "specificationGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SpecificationGT = data + case "specificationGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SpecificationGTE = data + case "specificationLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SpecificationLT = data + case "specificationLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SpecificationLTE = data + case "specificationContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SpecificationContains = data + case "specificationHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SpecificationHasPrefix = data + case "specificationHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SpecificationHasSuffix = data + case "specificationIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.SpecificationIsNil = data + case "specificationNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.SpecificationNotNil = data + case "specificationEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SpecificationEqualFold = data + case "specificationContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specificationContainsFold")) + 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")) + it.SpecificationContainsFold = data + case "active": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("active")) 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) + 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.HasTargetWith = data - case "hasApproval": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApproval")) + it.ActiveNEQ = data + case "hasOwner": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) 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) + it.HasOwner = data + case "hasOwnerWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerWith")) + data, err := ec.unmarshalOTeamWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐTeamWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasApprovalWith = data - case "hasApprovalRequests": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApprovalRequests")) + it.HasOwnerWith = data + case "hasExposures": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposures")) 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) + it.HasExposures = data + case "hasExposuresWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasExposuresWith")) + data, err := ec.unmarshalOEventExposureWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventExposureWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasApprovalRequestsWith = data + it.HasExposuresWith = data } } return it, nil @@ -14041,7 +17400,7 @@ func (ec *executionContext) unmarshalInputTeamWhereInput(ctx context.Context, ob 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", "teamToken", "teamTokenNEQ", "teamTokenIn", "teamTokenNotIn", "teamTokenGT", "teamTokenGTE", "teamTokenLT", "teamTokenLTE", "teamTokenContains", "teamTokenHasPrefix", "teamTokenHasSuffix", "teamTokenIsNil", "teamTokenNotNil", "teamTokenEqualFold", "teamTokenContainsFold", "hasGroup", "hasGroupWith", "hasMembers", "hasMembersWith", "hasApplications", "hasApplicationsWith"} + 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", "hasApis", "hasApisWith", "hasEventTypes", "hasEventTypesWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -14937,6 +18296,34 @@ func (ec *executionContext) unmarshalInputTeamWhereInput(ctx context.Context, ob return it, err } it.HasApplicationsWith = data + case "hasApis": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApis")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasApis = data + case "hasApisWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApisWith")) + data, err := ec.unmarshalOApiWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasApisWith = data + case "hasEventTypes": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventTypes")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasEventTypes = data + case "hasEventTypesWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventTypesWith")) + data, err := ec.unmarshalOEventTypeWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasEventTypesWith = data } } return it, nil @@ -15456,115 +18843,396 @@ func (ec *executionContext) unmarshalInputZoneWhereInput(ctx context.Context, ob 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.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.EventType: + if obj == nil { + return graphql.Null + } + return ec._EventType(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) + case *ent.Api: + if obj == nil { + return graphql.Null + } + return ec._Api(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 apiImplementors = []string{"Api", "Node"} + +func (ec *executionContext) _Api(ctx context.Context, sel ast.SelectionSet, obj *ent.Api) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, apiImplementors) + + 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("Api") + case "id": + out.Values[i] = ec._Api_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "createdAt": + out.Values[i] = ec._Api_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "lastModifiedAt": + out.Values[i] = ec._Api_lastModifiedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "statusPhase": + out.Values[i] = ec._Api_statusPhase(ctx, field, obj) + case "statusMessage": + out.Values[i] = ec._Api_statusMessage(ctx, field, obj) + case "namespace": + out.Values[i] = ec._Api_namespace(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "basePath": + out.Values[i] = ec._Api_basePath(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "version": + out.Values[i] = ec._Api_version(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "category": + out.Values[i] = ec._Api_category(ctx, field, obj) + case "oauth2Scopes": + out.Values[i] = ec._Api_oauth2Scopes(ctx, field, obj) + case "xVendor": + out.Values[i] = ec._Api_xVendor(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "active": + out.Values[i] = ec._Api_active(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "specificationUrl": + 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._Api_specificationUrl(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 "activeExposure": + 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._Api_activeExposure(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 "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._Api_owner(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - 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 + + 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.VisibilityNotIn = data - case "hasApplications": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasApplications")) - data, err := ec.unmarshalOBoolean2ᚖbool(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 apiConnectionImplementors = []string{"ApiConnection"} + +func (ec *executionContext) _ApiConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, apiConnectionImplementors) + + 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("ApiConnection") + case "edges": + out.Values[i] = ec._ApiConnection_edges(ctx, field, obj) + case "pageInfo": + out.Values[i] = ec._ApiConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - 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 + case "totalCount": + out.Values[i] = ec._ApiConnection_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.HasApplicationsWith = 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 apiEdgeImplementors = []string{"ApiEdge"} -// region ************************** interface.gotpl *************************** +func (ec *executionContext) _ApiEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ApiEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, apiEdgeImplementors) -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)) + 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("ApiEdge") + case "node": + out.Values[i] = ec._ApiEdge_node(ctx, field, obj) + case "cursor": + out.Values[i] = ec._ApiEdge_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, + }) + } + + return out +} var apiExposureImplementors = []string{"ApiExposure", "Node"} @@ -15698,6 +19366,39 @@ func (ec *executionContext) _ApiExposure(ctx context.Context, sel ast.SelectionS continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "api": + 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._ApiExposure_api(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 "subscriptions": field := field @@ -16768,26 +20469,284 @@ func (ec *executionContext) _Approval(ctx context.Context, sel ast.SelectionSet, return out } -var approvalConnectionImplementors = []string{"ApprovalConnection"} +var approvalConnectionImplementors = []string{"ApprovalConnection"} + +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("ApprovalConnection") + case "edges": + out.Values[i] = ec._ApprovalConnection_edges(ctx, field, obj) + case "pageInfo": + out.Values[i] = ec._ApprovalConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "totalCount": + out.Values[i] = ec._ApprovalConnection_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 approvalEdgeImplementors = []string{"ApprovalEdge"} + +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("ApprovalEdge") + case "node": + out.Values[i] = ec._ApprovalEdge_node(ctx, field, obj) + case "cursor": + out.Values[i] = ec._ApprovalEdge_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 approvalRequestImplementors = []string{"ApprovalRequest", "Node"} + +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("ApprovalRequest") + case "id": + 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._ApprovalRequest_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) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "statusPhase": + out.Values[i] = ec._ApprovalRequest_statusPhase(ctx, field, obj) + case "statusMessage": + out.Values[i] = ec._ApprovalRequest_statusMessage(ctx, field, obj) + case "environment": + out.Values[i] = ec._ApprovalRequest_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) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "strategy": + out.Values[i] = ec._ApprovalRequest_strategy(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) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "decider": + out.Values[i] = ec._ApprovalRequest_decider(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 "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) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ApprovalRequest_subscription(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 "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._ApprovalRequest_approval(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) }) + 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 approvalRequestConnectionImplementors = []string{"ApprovalRequestConnection"} -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) _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("ApprovalConnection") + out.Values[i] = graphql.MarshalString("ApprovalRequestConnection") case "edges": - out.Values[i] = ec._ApprovalConnection_edges(ctx, field, obj) + out.Values[i] = ec._ApprovalRequestConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._ApprovalConnection_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._ApprovalConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._ApprovalRequestConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -16814,21 +20773,21 @@ func (ec *executionContext) _ApprovalConnection(ctx context.Context, sel ast.Sel return out } -var approvalEdgeImplementors = []string{"ApprovalEdge"} +var approvalRequestEdgeImplementors = []string{"ApprovalRequestEdge"} -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) _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("ApprovalEdge") + out.Values[i] = graphql.MarshalString("ApprovalRequestEdge") case "node": - out.Values[i] = ec._ApprovalEdge_node(ctx, field, obj) + out.Values[i] = ec._ApprovalRequestEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._ApprovalEdge_cursor(ctx, field, obj) + out.Values[i] = ec._ApprovalRequestEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -16855,86 +20814,61 @@ func (ec *executionContext) _ApprovalEdge(ctx context.Context, sel ast.Selection return out } -var approvalRequestImplementors = []string{"ApprovalRequest", "Node"} +var eventExposureImplementors = []string{"EventExposure", "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) _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("ApprovalRequest") + out.Values[i] = graphql.MarshalString("EventExposure") case "id": - out.Values[i] = ec._ApprovalRequest_id(ctx, field, obj) + out.Values[i] = ec._EventExposure_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._EventExposure_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._EventExposure_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._EventExposure_statusPhase(ctx, field, obj) case "statusMessage": - out.Values[i] = ec._ApprovalRequest_statusMessage(ctx, field, obj) + out.Values[i] = ec._EventExposure_statusMessage(ctx, field, obj) case "environment": - out.Values[i] = ec._ApprovalRequest_environment(ctx, field, obj) + out.Values[i] = ec._EventExposure_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) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "strategy": - out.Values[i] = ec._ApprovalRequest_strategy(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) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "decider": - out.Values[i] = ec._ApprovalRequest_decider(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) + out.Values[i] = ec._EventExposure_namespace(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "decisions": - out.Values[i] = ec._ApprovalRequest_decisions(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 "availableTransitions": - out.Values[i] = ec._ApprovalRequest_availableTransitions(ctx, field, obj) - case "name": - out.Values[i] = ec._ApprovalRequest_name(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 "state": - out.Values[i] = ec._ApprovalRequest_state(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 "subscription": + case "owner": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -16943,7 +20877,7 @@ func (ec *executionContext) _ApprovalRequest(ctx context.Context, sel ast.Select ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ApprovalRequest_subscription(ctx, field, obj) + res = ec._EventExposure_owner(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -16970,7 +20904,7 @@ 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 "eventTypeDef": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -16979,7 +20913,43 @@ func (ec *executionContext) _ApprovalRequest(ctx context.Context, sel ast.Select ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ApprovalRequest_approval(ctx, field, obj) + res = ec._EventExposure_eventTypeDef(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 "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._EventExposure_subscriptions(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } return res } @@ -17026,26 +20996,26 @@ func (ec *executionContext) _ApprovalRequest(ctx context.Context, sel ast.Select return out } -var approvalRequestConnectionImplementors = []string{"ApprovalRequestConnection"} +var eventExposureConnectionImplementors = []string{"EventExposureConnection"} -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) _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("ApprovalRequestConnection") + out.Values[i] = graphql.MarshalString("EventExposureConnection") case "edges": - out.Values[i] = ec._ApprovalRequestConnection_edges(ctx, field, obj) + out.Values[i] = ec._EventExposureConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._ApprovalRequestConnection_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._ApprovalRequestConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._EventExposureConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -17072,21 +21042,21 @@ func (ec *executionContext) _ApprovalRequestConnection(ctx context.Context, sel return out } -var approvalRequestEdgeImplementors = []string{"ApprovalRequestEdge"} +var eventExposureEdgeImplementors = []string{"EventExposureEdge"} -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) _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("ApprovalRequestEdge") + out.Values[i] = graphql.MarshalString("EventExposureEdge") case "node": - out.Values[i] = ec._ApprovalRequestEdge_node(ctx, field, obj) + out.Values[i] = ec._EventExposureEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._ApprovalRequestEdge_cursor(ctx, field, obj) + out.Values[i] = ec._EventExposureEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -17113,73 +21083,139 @@ func (ec *executionContext) _ApprovalRequestEdge(ctx context.Context, sel ast.Se return out } -var eventExposureImplementors = []string{"EventExposure", "Node"} +var eventSubscriptionImplementors = []string{"EventSubscription", "Node"} -func (ec *executionContext) _EventExposure(ctx context.Context, sel ast.SelectionSet, obj *ent.EventExposure) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, eventExposureImplementors) +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("EventExposure") + out.Values[i] = graphql.MarshalString("EventSubscription") case "id": - out.Values[i] = ec._EventExposure_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._EventExposure_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._EventExposure_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._EventExposure_statusPhase(ctx, field, obj) + out.Values[i] = ec._EventSubscription_statusPhase(ctx, field, obj) case "statusMessage": - out.Values[i] = ec._EventExposure_statusMessage(ctx, field, obj) + out.Values[i] = ec._EventSubscription_statusMessage(ctx, field, obj) case "environment": - out.Values[i] = ec._EventExposure_environment(ctx, field, obj) + out.Values[i] = ec._EventSubscription_environment(ctx, field, obj) case "namespace": - out.Values[i] = ec._EventExposure_namespace(ctx, field, obj) + out.Values[i] = ec._EventSubscription_namespace(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "eventType": - out.Values[i] = ec._EventExposure_eventType(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 "visibility": - out.Values[i] = ec._EventExposure_visibility(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 "active": - out.Values[i] = ec._EventExposure_active(ctx, field, obj) - case "approvalConfig": - out.Values[i] = ec._EventExposure_approvalConfig(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 "owner": + 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 + } + + 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._EventSubscription_approval(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 "approvalRequests": 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._EventExposure_owner(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } + res = ec._EventSubscription_approvalRequests(ctx, field, obj) return res } @@ -17203,7 +21239,7 @@ func (ec *executionContext) _EventExposure(ctx context.Context, sel ast.Selectio } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "subscriptions": + case "target": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -17212,7 +21248,7 @@ func (ec *executionContext) _EventExposure(ctx context.Context, sel ast.Selectio ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._EventExposure_subscriptions(ctx, field, obj) + res = ec._EventSubscription_target(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -17262,26 +21298,26 @@ func (ec *executionContext) _EventExposure(ctx context.Context, sel ast.Selectio return out } -var eventExposureConnectionImplementors = []string{"EventExposureConnection"} +var eventSubscriptionConnectionImplementors = []string{"EventSubscriptionConnection"} -func (ec *executionContext) _EventExposureConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.EventExposureConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, eventExposureConnectionImplementors) +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("EventExposureConnection") + out.Values[i] = graphql.MarshalString("EventSubscriptionConnection") case "edges": - out.Values[i] = ec._EventExposureConnection_edges(ctx, field, obj) + out.Values[i] = ec._EventSubscriptionConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._EventExposureConnection_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._EventExposureConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._EventSubscriptionConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -17308,21 +21344,21 @@ func (ec *executionContext) _EventExposureConnection(ctx context.Context, sel as return out } -var eventExposureEdgeImplementors = []string{"EventExposureEdge"} +var eventSubscriptionEdgeImplementors = []string{"EventSubscriptionEdge"} -func (ec *executionContext) _EventExposureEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.EventExposureEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, eventExposureEdgeImplementors) +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("EventExposureEdge") + out.Values[i] = graphql.MarshalString("EventSubscriptionEdge") case "node": - out.Values[i] = ec._EventExposureEdge_node(ctx, field, obj) + out.Values[i] = ec._EventSubscriptionEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._EventExposureEdge_cursor(ctx, field, obj) + out.Values[i] = ec._EventSubscriptionEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -17349,97 +21385,59 @@ func (ec *executionContext) _EventExposureEdge(ctx context.Context, sel ast.Sele return out } -var eventSubscriptionImplementors = []string{"EventSubscription", "Node"} +var eventTypeImplementors = []string{"EventType", "Node"} -func (ec *executionContext) _EventSubscription(ctx context.Context, sel ast.SelectionSet, obj *ent.EventSubscription) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, eventSubscriptionImplementors) +func (ec *executionContext) _EventType(ctx context.Context, sel ast.SelectionSet, obj *ent.EventType) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventTypeImplementors) 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("EventSubscription") + out.Values[i] = graphql.MarshalString("EventType") case "id": - out.Values[i] = ec._EventSubscription_id(ctx, field, obj) + out.Values[i] = ec._EventType_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "createdAt": - out.Values[i] = ec._EventSubscription_createdAt(ctx, field, obj) + out.Values[i] = ec._EventType_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "lastModifiedAt": - out.Values[i] = ec._EventSubscription_lastModifiedAt(ctx, field, obj) + out.Values[i] = ec._EventType_lastModifiedAt(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "statusPhase": - out.Values[i] = ec._EventSubscription_statusPhase(ctx, field, obj) + out.Values[i] = ec._EventType_statusPhase(ctx, field, obj) case "statusMessage": - out.Values[i] = ec._EventSubscription_statusMessage(ctx, field, obj) - case "environment": - out.Values[i] = ec._EventSubscription_environment(ctx, field, obj) + out.Values[i] = ec._EventType_statusMessage(ctx, field, obj) case "namespace": - out.Values[i] = ec._EventSubscription_namespace(ctx, field, obj) + out.Values[i] = ec._EventType_namespace(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "name": - out.Values[i] = ec._EventSubscription_name(ctx, field, obj) + case "eventType": + out.Values[i] = ec._EventType_eventType(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "eventType": - out.Values[i] = ec._EventSubscription_eventType(ctx, field, obj) + case "version": + out.Values[i] = ec._EventType_version(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "deliveryType": - out.Values[i] = ec._EventSubscription_deliveryType(ctx, field, obj) + case "description": + out.Values[i] = ec._EventType_description(ctx, field, obj) + case "active": + out.Values[i] = ec._EventType_active(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 - } - - 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": + case "specificationUrl": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -17448,7 +21446,7 @@ func (ec *executionContext) _EventSubscription(ctx context.Context, sel ast.Sele ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._EventSubscription_approval(ctx, field, obj) + res = ec._EventType_specificationUrl(ctx, field, obj) return res } @@ -17472,7 +21470,7 @@ func (ec *executionContext) _EventSubscription(ctx context.Context, sel ast.Sele } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "approvalRequests": + case "activeExposure": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -17481,7 +21479,7 @@ func (ec *executionContext) _EventSubscription(ctx context.Context, sel ast.Sele ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._EventSubscription_approvalRequests(ctx, field, obj) + res = ec._EventType_activeExposure(ctx, field, obj) return res } @@ -17505,7 +21503,7 @@ func (ec *executionContext) _EventSubscription(ctx context.Context, sel ast.Sele } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "target": + case "owner": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -17514,7 +21512,7 @@ func (ec *executionContext) _EventSubscription(ctx context.Context, sel ast.Sele ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._EventSubscription_target(ctx, field, obj) + res = ec._EventType_owner(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -17564,26 +21562,26 @@ func (ec *executionContext) _EventSubscription(ctx context.Context, sel ast.Sele return out } -var eventSubscriptionConnectionImplementors = []string{"EventSubscriptionConnection"} +var eventTypeConnectionImplementors = []string{"EventTypeConnection"} -func (ec *executionContext) _EventSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.EventSubscriptionConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, eventSubscriptionConnectionImplementors) +func (ec *executionContext) _EventTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.EventTypeConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventTypeConnectionImplementors) 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("EventSubscriptionConnection") + out.Values[i] = graphql.MarshalString("EventTypeConnection") case "edges": - out.Values[i] = ec._EventSubscriptionConnection_edges(ctx, field, obj) + out.Values[i] = ec._EventTypeConnection_edges(ctx, field, obj) case "pageInfo": - out.Values[i] = ec._EventSubscriptionConnection_pageInfo(ctx, field, obj) + out.Values[i] = ec._EventTypeConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": - out.Values[i] = ec._EventSubscriptionConnection_totalCount(ctx, field, obj) + out.Values[i] = ec._EventTypeConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -17610,21 +21608,21 @@ func (ec *executionContext) _EventSubscriptionConnection(ctx context.Context, se return out } -var eventSubscriptionEdgeImplementors = []string{"EventSubscriptionEdge"} +var eventTypeEdgeImplementors = []string{"EventTypeEdge"} -func (ec *executionContext) _EventSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.EventSubscriptionEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, eventSubscriptionEdgeImplementors) +func (ec *executionContext) _EventTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.EventTypeEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, eventTypeEdgeImplementors) 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("EventSubscriptionEdge") + out.Values[i] = graphql.MarshalString("EventTypeEdge") case "node": - out.Values[i] = ec._EventSubscriptionEdge_node(ctx, field, obj) + out.Values[i] = ec._EventTypeEdge_node(ctx, field, obj) case "cursor": - out.Values[i] = ec._EventSubscriptionEdge_cursor(ctx, field, obj) + out.Values[i] = ec._EventTypeEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -17936,6 +21934,28 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "apis": + 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_apis(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 @@ -18090,6 +22110,28 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "eventTypes": + 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_eventTypes(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 "teams": field := field @@ -18134,6 +22176,28 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "apiCategories": + 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_apiCategories(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 "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -18317,7 +22381,79 @@ 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 "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) }) + case "apis": + 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_apis(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 "eventTypes": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -18326,7 +22462,7 @@ func (ec *executionContext) _Team(ctx context.Context, sel ast.SelectionSet, obj ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Team_applications(ctx, field, obj) + res = ec._Team_eventTypes(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -18588,6 +22724,20 @@ func (ec *executionContext) _Zone(ctx context.Context, sel ast.SelectionSet, obj // region ***************************** type.gotpl ***************************** +func (ec *executionContext) marshalNApiConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiConnection(ctx context.Context, sel ast.SelectionSet, v ent.ApiConnection) graphql.Marshaler { + return ec._ApiConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNApiConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ApiConnection) 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._ApiConnection(ctx, sel, v) +} + 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) } @@ -18643,6 +22793,32 @@ func (ec *executionContext) unmarshalNApiExposureWhereInput2ᚖgithubᚗcomᚋte return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNApiOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiOrderField(ctx context.Context, v any) (*ent.ApiOrderField, error) { + var res = new(ent.ApiOrderField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApiOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.ApiOrderField) 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) unmarshalNApiStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhase(ctx context.Context, v any) (api.StatusPhase, error) { + var res api.StatusPhase + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNApiStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v api.StatusPhase) graphql.Marshaler { + return v +} + 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) } @@ -18698,6 +22874,11 @@ func (ec *executionContext) unmarshalNApiSubscriptionWhereInput2ᚖgithubᚗcom return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNApiWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInput(ctx context.Context, v any) (*ent.ApiWhereInput, error) { + res, err := ec.unmarshalInputApiWhereInput(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)) { @@ -19038,6 +23219,51 @@ func (ec *executionContext) unmarshalNEventSubscriptionWhereInput2ᚖgithubᚗco return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNEventTypeConnection2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeConnection(ctx context.Context, sel ast.SelectionSet, v ent.EventTypeConnection) graphql.Marshaler { + return ec._EventTypeConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEventTypeConnection2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeConnection(ctx context.Context, sel ast.SelectionSet, v *ent.EventTypeConnection) 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._EventTypeConnection(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNEventTypeOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeOrderField(ctx context.Context, v any) (*ent.EventTypeOrderField, error) { + var res = new(ent.EventTypeOrderField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNEventTypeOrderField2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.EventTypeOrderField) 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) unmarshalNEventTypeStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhase(ctx context.Context, v any) (eventtype.StatusPhase, error) { + var res eventtype.StatusPhase + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNEventTypeStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v eventtype.StatusPhase) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNEventTypeWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInput(ctx context.Context, v any) (*ent.EventTypeWhereInput, error) { + res, err := ec.unmarshalInputEventTypeWhereInput(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) @@ -19209,6 +23435,33 @@ func (ec *executionContext) unmarshalNZoneWhereInput2ᚖgithubᚗcomᚋtelekom return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalOApi2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApi(ctx context.Context, sel ast.SelectionSet, v *ent.Api) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Api(ctx, sel, v) +} + +func (ec *executionContext) marshalOApiEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.ApiEdge) 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.marshalOApiEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiEdge(ctx, sel, v[i]) + }) + + return ret +} + +func (ec *executionContext) marshalOApiEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ApiEdge) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ApiEdge(ctx, sel, v) +} + 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 { return graphql.Null @@ -19376,6 +23629,67 @@ func (ec *executionContext) unmarshalOApiExposureWhereInput2ᚖgithubᚗcomᚋte return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalOApiOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiOrder(ctx context.Context, v any) (*ent.ApiOrder, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputApiOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOApiStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhaseᚄ(ctx context.Context, v any) ([]api.StatusPhase, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]api.StatusPhase, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApiStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhase(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOApiStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []api.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.marshalNApiStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhase(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOApiStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhase(ctx context.Context, v any) (*api.StatusPhase, error) { + if v == nil { + return nil, nil + } + var res = new(api.StatusPhase) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOApiStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋapiᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *api.StatusPhase) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + 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 @@ -19543,6 +23857,32 @@ func (ec *executionContext) unmarshalOApiSubscriptionWhereInput2ᚖgithubᚗcom return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalOApiWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInputᚄ(ctx context.Context, v any) ([]*ent.ApiWhereInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*ent.ApiWhereInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNApiWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOApiWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐApiWhereInput(ctx context.Context, v any) (*ent.ApiWhereInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputApiWhereInput(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 { if v == nil { return graphql.Null @@ -20568,6 +24908,120 @@ func (ec *executionContext) unmarshalOEventSubscriptionWhereInput2ᚖgithubᚗco return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalOEventType2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventType(ctx context.Context, sel ast.SelectionSet, v *ent.EventType) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._EventType(ctx, sel, v) +} + +func (ec *executionContext) marshalOEventTypeEdge2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.EventTypeEdge) 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.marshalOEventTypeEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeEdge(ctx, sel, v[i]) + }) + + return ret +} + +func (ec *executionContext) marshalOEventTypeEdge2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeEdge(ctx context.Context, sel ast.SelectionSet, v *ent.EventTypeEdge) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._EventTypeEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOEventTypeOrder2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeOrder(ctx context.Context, v any) (*ent.EventTypeOrder, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputEventTypeOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOEventTypeStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhaseᚄ(ctx context.Context, v any) ([]eventtype.StatusPhase, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]eventtype.StatusPhase, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNEventTypeStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhase(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOEventTypeStatusPhase2ᚕgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhaseᚄ(ctx context.Context, sel ast.SelectionSet, v []eventtype.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.marshalNEventTypeStatusPhase2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhase(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOEventTypeStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhase(ctx context.Context, v any) (*eventtype.StatusPhase, error) { + if v == nil { + return nil, nil + } + var res = new(eventtype.StatusPhase) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOEventTypeStatusPhase2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚋeventtypeᚐStatusPhase(ctx context.Context, sel ast.SelectionSet, v *eventtype.StatusPhase) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func (ec *executionContext) unmarshalOEventTypeWhereInput2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInputᚄ(ctx context.Context, v any) ([]*ent.EventTypeWhereInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*ent.EventTypeWhereInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNEventTypeWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOEventTypeWhereInput2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋentᚐEventTypeWhereInput(ctx context.Context, v any) (*ent.EventTypeWhereInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputEventTypeWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + 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 fbbd08d77..582f86eee 100644 --- a/controlplane-api/internal/resolvers/ent.resolvers.go +++ b/controlplane-api/internal/resolvers/ent.resolvers.go @@ -49,6 +49,15 @@ func (r *queryResolver) Nodes(ctx context.Context, ids []int) ([]ent.Noder, erro return r.client.Noders(ctx, ids) } +// Apis is the resolver for the apis field. +func (r *queryResolver) Apis(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiOrder, where *ent.ApiWhereInput) (*ent.ApiConnection, error) { + return r.client.Api.Query(). + Paginate(ctx, after, first, before, last, + ent.WithApiOrder(orderBy), + ent.WithApiFilter(where.Filter), + ) +} + // APIExposures is the resolver for the apiExposures field. func (r *queryResolver) APIExposures(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiExposureOrder, where *ent.ApiExposureWhereInput) (*ent.ApiExposureConnection, error) { return r.client.ApiExposure.Query(). @@ -112,6 +121,15 @@ func (r *queryResolver) EventSubscriptions(ctx context.Context, after *entgql.Cu ) } +// EventTypes is the resolver for the eventTypes field. +func (r *queryResolver) EventTypes(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventTypeOrder, where *ent.EventTypeWhereInput) (*ent.EventTypeConnection, error) { + return r.client.EventType.Query(). + Paginate(ctx, after, first, before, last, + ent.WithEventTypeOrder(orderBy), + ent.WithEventTypeFilter(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(). @@ -133,6 +151,9 @@ func (r *teamResolver) TeamToken(ctx context.Context, obj *ent.Team) (*string, e return r.secrets.Resolve(ctx, obj.TeamToken, "teamToken") } +// Api returns ApiResolver implementation. +func (r *Resolver) Api() ApiResolver { return &apiResolver{r} } + // ApiExposure returns ApiExposureResolver implementation. func (r *Resolver) ApiExposure() ApiExposureResolver { return &apiExposureResolver{r} } @@ -156,6 +177,9 @@ func (r *Resolver) EventSubscription() EventSubscriptionResolver { return &eventSubscriptionResolver{r} } +// EventType returns EventTypeResolver implementation. +func (r *Resolver) EventType() EventTypeResolver { return &eventTypeResolver{r} } + // Query returns QueryResolver implementation. func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } @@ -165,6 +189,7 @@ func (r *Resolver) Team() TeamResolver { return &teamResolver{r} } // Zone returns ZoneResolver implementation. func (r *Resolver) Zone() ZoneResolver { return &zoneResolver{r} } +type apiResolver struct{ *Resolver } type apiExposureResolver struct{ *Resolver } type apiSubscriptionResolver struct{ *Resolver } type applicationResolver struct{ *Resolver } @@ -172,6 +197,7 @@ type approvalResolver struct{ *Resolver } type approvalRequestResolver struct{ *Resolver } type eventExposureResolver struct{ *Resolver } type eventSubscriptionResolver struct{ *Resolver } +type eventTypeResolver struct{ *Resolver } type queryResolver struct{ *Resolver } type teamResolver struct{ *Resolver } type zoneResolver struct{ *Resolver } diff --git a/controlplane-api/internal/resolvers/mapper_test.go b/controlplane-api/internal/resolvers/mapper_test.go index 811d29bf3..739ed5b15 100644 --- a/controlplane-api/internal/resolvers/mapper_test.go +++ b/controlplane-api/internal/resolvers/mapper_test.go @@ -27,7 +27,7 @@ var _ = Describe("Subscriptions resolver (cross-tenant)", func() { BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client, service.Services{}, nil) + r = resolvers.NewResolver(client, service.Services{}, nil, "") s = testutil.SeedStandard(client) }) @@ -64,7 +64,7 @@ var _ = Describe("Target resolver (cross-tenant)", func() { BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client, service.Services{}, nil) + r = resolvers.NewResolver(client, service.Services{}, nil, "") s = testutil.SeedStandard(client) }) @@ -94,7 +94,7 @@ var _ = Describe("Approval.APISubscription resolver (cross-tenant)", func() { BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client, service.Services{}, nil) + r = resolvers.NewResolver(client, service.Services{}, nil, "") s = testutil.SeedStandard(client) }) @@ -124,7 +124,7 @@ var _ = Describe("ApprovalRequest.APISubscription resolver (cross-tenant)", func BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client, service.Services{}, nil) + r = resolvers.NewResolver(client, service.Services{}, nil, "") s = testutil.SeedStandard(client) }) @@ -146,7 +146,7 @@ var _ = Describe("ApprovalRequest.APISubscription resolver (cross-tenant)", func }) var _ = Describe("ApiExposureInfo resolvers", func() { - r := resolvers.NewResolver(nil, service.Services{}, 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"}) @@ -180,7 +180,7 @@ var _ = Describe("EventExposure.Subscriptions resolver (cross-tenant)", func() { BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client, service.Services{}, nil) + r = resolvers.NewResolver(client, service.Services{}, nil, "") s = testutil.SeedStandard(client) }) @@ -210,7 +210,7 @@ var _ = Describe("EventSubscription.Target resolver (cross-tenant)", func() { BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client, service.Services{}, nil) + r = resolvers.NewResolver(client, service.Services{}, nil, "") s = testutil.SeedStandard(client) }) @@ -232,7 +232,7 @@ var _ = Describe("EventSubscription.Target resolver (cross-tenant)", func() { }) var _ = Describe("EventExposureInfo.Visibility resolver", func() { - r := resolvers.NewResolver(nil, service.Services{}, nil) + 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"}) @@ -242,7 +242,7 @@ var _ = Describe("EventExposureInfo.Visibility resolver", func() { }) var _ = Describe("ApiSubscriptionInfo.StatusPhase resolver", func() { - r := resolvers.NewResolver(nil, service.Services{}, 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 f20b4f12c..eb1db5320 100644 --- a/controlplane-api/internal/resolvers/model/models.generated.go +++ b/controlplane-api/internal/resolvers/model/models.generated.go @@ -17,6 +17,12 @@ type SubscriptionInfo interface { IsSubscriptionInfo() } +// A category that APIs can be classified under. +type APICategory struct { + // The category identifier/name. + Name string `json:"name"` +} + type APIExposureFeature string const ( diff --git a/controlplane-api/internal/resolvers/prelude.generated.go b/controlplane-api/internal/resolvers/prelude.generated.go index e2d1c7b3f..0d8516786 100644 --- a/controlplane-api/internal/resolvers/prelude.generated.go +++ b/controlplane-api/internal/resolvers/prelude.generated.go @@ -1878,6 +1878,18 @@ func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.Sele return res } +func (ec *executionContext) unmarshalOString2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + _ = sel + _ = ctx + res := graphql.MarshalString(v) + return res +} + func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { if v == nil { return nil, nil diff --git a/controlplane-api/internal/resolvers/resolver.go b/controlplane-api/internal/resolvers/resolver.go index 204e35fd7..947cbc86f 100644 --- a/controlplane-api/internal/resolvers/resolver.go +++ b/controlplane-api/internal/resolvers/resolver.go @@ -5,6 +5,8 @@ package resolvers import ( + "fmt" + "github.com/99designs/gqlgen/graphql" "github.com/telekom/controlplane/controlplane-api/ent" @@ -14,24 +16,36 @@ import ( // Resolver is the root resolver for the GraphQL API. type Resolver struct { - client *ent.Client - services service.Services - secrets *secrets.Resolver + client *ent.Client + services service.Services + secrets *secrets.Resolver + fileManagerBaseURL string } // 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 { +// secret resolver, and file-manager base URL for specification URL construction. +func NewResolver(client *ent.Client, services service.Services, secretResolver *secrets.Resolver, fileManagerBaseURL string) *Resolver { return &Resolver{ - client: client, - services: services, - secrets: secretResolver, + client: client, + services: services, + secrets: secretResolver, + fileManagerBaseURL: fileManagerBaseURL, } } // NewSchema creates a graphql executable schema. -func NewSchema(client *ent.Client, services service.Services, secretResolver *secrets.Resolver) graphql.ExecutableSchema { +func NewSchema(client *ent.Client, services service.Services, secretResolver *secrets.Resolver, fileManagerBaseURL string) graphql.ExecutableSchema { return NewExecutableSchema(Config{ - Resolvers: NewResolver(client, services, secretResolver), + Resolvers: NewResolver(client, services, secretResolver, fileManagerBaseURL), }) } + +// buildSpecificationURL constructs a download URL for a file-manager file ID. +// Returns nil if the specification is empty or the file-manager base URL is not configured. +func (r *Resolver) buildSpecificationURL(specification string) (*string, error) { + if specification == "" || r.fileManagerBaseURL == "" { + return nil, nil + } + url := fmt.Sprintf("%s/files/%s", r.fileManagerBaseURL, specification) + return &url, nil +} diff --git a/controlplane-api/internal/resolvers/root_.generated.go b/controlplane-api/internal/resolvers/root_.generated.go index 1106c9db5..803c36fc6 100644 --- a/controlplane-api/internal/resolvers/root_.generated.go +++ b/controlplane-api/internal/resolvers/root_.generated.go @@ -27,6 +27,7 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { type Config = graphql.Config[ResolverRoot, DirectiveRoot, ComplexityRoot] type ResolverRoot interface { + Api() ApiResolver ApiExposure() ApiExposureResolver ApiExposureInfo() ApiExposureInfoResolver ApiSubscription() ApiSubscriptionResolver @@ -41,6 +42,7 @@ type ResolverRoot interface { EventExposureInfo() EventExposureInfoResolver EventSubscription() EventSubscriptionResolver EventSubscriptionInfo() EventSubscriptionInfoResolver + EventType() EventTypeResolver Mutation() MutationResolver Query() QueryResolver Team() TeamResolver @@ -56,7 +58,41 @@ type ComplexityRoot struct { Team func(childComplexity int) int } + Api struct { + Active func(childComplexity int) int + ActiveExposure func(childComplexity int) int + BasePath func(childComplexity int) int + Category func(childComplexity int) int + CreatedAt func(childComplexity int) int + ID func(childComplexity int) int + LastModifiedAt func(childComplexity int) int + Namespace func(childComplexity int) int + Oauth2Scopes func(childComplexity int) int + Owner func(childComplexity int) int + SpecificationURL func(childComplexity int) int + StatusMessage func(childComplexity int) int + StatusPhase func(childComplexity int) int + Version func(childComplexity int) int + XVendor func(childComplexity int) int + } + + ApiCategory struct { + Name func(childComplexity int) int + } + + ApiConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + TotalCount func(childComplexity int) int + } + + ApiEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + ApiExposure struct { + API func(childComplexity int) int APIVersion func(childComplexity int) int Active func(childComplexity int) int ApprovalConfig func(childComplexity int) int @@ -282,6 +318,7 @@ type ComplexityRoot struct { CreatedAt func(childComplexity int) int Environment func(childComplexity int) int EventType func(childComplexity int) int + EventTypeDef func(childComplexity int) int ID func(childComplexity int) int LastModifiedAt func(childComplexity int) int Namespace func(childComplexity int) int @@ -352,6 +389,33 @@ type ComplexityRoot struct { StatusPhase func(childComplexity int) int } + EventType struct { + Active func(childComplexity int) int + ActiveExposure func(childComplexity int) int + CreatedAt func(childComplexity int) int + Description 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 + SpecificationURL func(childComplexity int) int + StatusMessage func(childComplexity int) int + StatusPhase func(childComplexity int) int + Version func(childComplexity int) int + } + + EventTypeConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + TotalCount func(childComplexity int) int + } + + EventTypeEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + Group struct { Description func(childComplexity int) int DisplayName func(childComplexity int) int @@ -395,13 +459,16 @@ type ComplexityRoot struct { } Query struct { + APICategories 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 + Apis func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiOrder, where *ent.ApiWhereInput) 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 + EventTypes func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventTypeOrder, where *ent.EventTypeWhereInput) 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 @@ -433,11 +500,13 @@ type ComplexityRoot struct { } Team struct { + Apis func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.ApiOrder, where *ent.ApiWhereInput) int Applications func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ApplicationOrder, where *ent.ApplicationWhereInput) int Category func(childComplexity int) int CreatedAt func(childComplexity int) int Email func(childComplexity int) int Environment func(childComplexity int) int + EventTypes func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.EventTypeOrder, where *ent.EventTypeWhereInput) int Group func(childComplexity int) int ID func(childComplexity int) int LastModifiedAt func(childComplexity int) int @@ -518,6 +587,160 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.AddTeamMemberPayload.Team(childComplexity), true + case "Api.active": + if e.ComplexityRoot.Api.Active == nil { + break + } + + return e.ComplexityRoot.Api.Active(childComplexity), true + + case "Api.activeExposure": + if e.ComplexityRoot.Api.ActiveExposure == nil { + break + } + + return e.ComplexityRoot.Api.ActiveExposure(childComplexity), true + + case "Api.basePath": + if e.ComplexityRoot.Api.BasePath == nil { + break + } + + return e.ComplexityRoot.Api.BasePath(childComplexity), true + + case "Api.category": + if e.ComplexityRoot.Api.Category == nil { + break + } + + return e.ComplexityRoot.Api.Category(childComplexity), true + + case "Api.createdAt": + if e.ComplexityRoot.Api.CreatedAt == nil { + break + } + + return e.ComplexityRoot.Api.CreatedAt(childComplexity), true + + case "Api.id": + if e.ComplexityRoot.Api.ID == nil { + break + } + + return e.ComplexityRoot.Api.ID(childComplexity), true + + case "Api.lastModifiedAt": + if e.ComplexityRoot.Api.LastModifiedAt == nil { + break + } + + return e.ComplexityRoot.Api.LastModifiedAt(childComplexity), true + + case "Api.namespace": + if e.ComplexityRoot.Api.Namespace == nil { + break + } + + return e.ComplexityRoot.Api.Namespace(childComplexity), true + + case "Api.oauth2Scopes": + if e.ComplexityRoot.Api.Oauth2Scopes == nil { + break + } + + return e.ComplexityRoot.Api.Oauth2Scopes(childComplexity), true + + case "Api.owner": + if e.ComplexityRoot.Api.Owner == nil { + break + } + + return e.ComplexityRoot.Api.Owner(childComplexity), true + + case "Api.specificationUrl": + if e.ComplexityRoot.Api.SpecificationURL == nil { + break + } + + return e.ComplexityRoot.Api.SpecificationURL(childComplexity), true + + case "Api.statusMessage": + if e.ComplexityRoot.Api.StatusMessage == nil { + break + } + + return e.ComplexityRoot.Api.StatusMessage(childComplexity), true + + case "Api.statusPhase": + if e.ComplexityRoot.Api.StatusPhase == nil { + break + } + + return e.ComplexityRoot.Api.StatusPhase(childComplexity), true + + case "Api.version": + if e.ComplexityRoot.Api.Version == nil { + break + } + + return e.ComplexityRoot.Api.Version(childComplexity), true + + case "Api.xVendor": + if e.ComplexityRoot.Api.XVendor == nil { + break + } + + return e.ComplexityRoot.Api.XVendor(childComplexity), true + + case "ApiCategory.name": + if e.ComplexityRoot.ApiCategory.Name == nil { + break + } + + return e.ComplexityRoot.ApiCategory.Name(childComplexity), true + + case "ApiConnection.edges": + if e.ComplexityRoot.ApiConnection.Edges == nil { + break + } + + return e.ComplexityRoot.ApiConnection.Edges(childComplexity), true + + case "ApiConnection.pageInfo": + if e.ComplexityRoot.ApiConnection.PageInfo == nil { + break + } + + return e.ComplexityRoot.ApiConnection.PageInfo(childComplexity), true + + case "ApiConnection.totalCount": + if e.ComplexityRoot.ApiConnection.TotalCount == nil { + break + } + + return e.ComplexityRoot.ApiConnection.TotalCount(childComplexity), true + + case "ApiEdge.cursor": + if e.ComplexityRoot.ApiEdge.Cursor == nil { + break + } + + return e.ComplexityRoot.ApiEdge.Cursor(childComplexity), true + + case "ApiEdge.node": + if e.ComplexityRoot.ApiEdge.Node == nil { + break + } + + return e.ComplexityRoot.ApiEdge.Node(childComplexity), true + + case "ApiExposure.api": + if e.ComplexityRoot.ApiExposure.API == nil { + break + } + + return e.ComplexityRoot.ApiExposure.API(childComplexity), true + case "ApiExposure.apiVersion": if e.ComplexityRoot.ApiExposure.APIVersion == nil { break @@ -1609,6 +1832,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.EventExposure.EventType(childComplexity), true + case "EventExposure.eventTypeDef": + if e.ComplexityRoot.EventExposure.EventTypeDef == nil { + break + } + + return e.ComplexityRoot.EventExposure.EventTypeDef(childComplexity), true + case "EventExposure.id": if e.ComplexityRoot.EventExposure.ID == nil { break @@ -1938,6 +2168,132 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.EventSubscriptionInfo.StatusPhase(childComplexity), true + case "EventType.active": + if e.ComplexityRoot.EventType.Active == nil { + break + } + + return e.ComplexityRoot.EventType.Active(childComplexity), true + + case "EventType.activeExposure": + if e.ComplexityRoot.EventType.ActiveExposure == nil { + break + } + + return e.ComplexityRoot.EventType.ActiveExposure(childComplexity), true + + case "EventType.createdAt": + if e.ComplexityRoot.EventType.CreatedAt == nil { + break + } + + return e.ComplexityRoot.EventType.CreatedAt(childComplexity), true + + case "EventType.description": + if e.ComplexityRoot.EventType.Description == nil { + break + } + + return e.ComplexityRoot.EventType.Description(childComplexity), true + + case "EventType.eventType": + if e.ComplexityRoot.EventType.EventType == nil { + break + } + + return e.ComplexityRoot.EventType.EventType(childComplexity), true + + case "EventType.id": + if e.ComplexityRoot.EventType.ID == nil { + break + } + + return e.ComplexityRoot.EventType.ID(childComplexity), true + + case "EventType.lastModifiedAt": + if e.ComplexityRoot.EventType.LastModifiedAt == nil { + break + } + + return e.ComplexityRoot.EventType.LastModifiedAt(childComplexity), true + + case "EventType.namespace": + if e.ComplexityRoot.EventType.Namespace == nil { + break + } + + return e.ComplexityRoot.EventType.Namespace(childComplexity), true + + case "EventType.owner": + if e.ComplexityRoot.EventType.Owner == nil { + break + } + + return e.ComplexityRoot.EventType.Owner(childComplexity), true + + case "EventType.specificationUrl": + if e.ComplexityRoot.EventType.SpecificationURL == nil { + break + } + + return e.ComplexityRoot.EventType.SpecificationURL(childComplexity), true + + case "EventType.statusMessage": + if e.ComplexityRoot.EventType.StatusMessage == nil { + break + } + + return e.ComplexityRoot.EventType.StatusMessage(childComplexity), true + + case "EventType.statusPhase": + if e.ComplexityRoot.EventType.StatusPhase == nil { + break + } + + return e.ComplexityRoot.EventType.StatusPhase(childComplexity), true + + case "EventType.version": + if e.ComplexityRoot.EventType.Version == nil { + break + } + + return e.ComplexityRoot.EventType.Version(childComplexity), true + + case "EventTypeConnection.edges": + if e.ComplexityRoot.EventTypeConnection.Edges == nil { + break + } + + return e.ComplexityRoot.EventTypeConnection.Edges(childComplexity), true + + case "EventTypeConnection.pageInfo": + if e.ComplexityRoot.EventTypeConnection.PageInfo == nil { + break + } + + return e.ComplexityRoot.EventTypeConnection.PageInfo(childComplexity), true + + case "EventTypeConnection.totalCount": + if e.ComplexityRoot.EventTypeConnection.TotalCount == nil { + break + } + + return e.ComplexityRoot.EventTypeConnection.TotalCount(childComplexity), true + + case "EventTypeEdge.cursor": + if e.ComplexityRoot.EventTypeEdge.Cursor == nil { + break + } + + return e.ComplexityRoot.EventTypeEdge.Cursor(childComplexity), true + + case "EventTypeEdge.node": + if e.ComplexityRoot.EventTypeEdge.Node == nil { + break + } + + return e.ComplexityRoot.EventTypeEdge.Node(childComplexity), true + case "Group.description": if e.ComplexityRoot.Group.Description == nil { break @@ -2167,6 +2523,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.PageInfo.StartCursor(childComplexity), true + case "Query.apiCategories": + if e.ComplexityRoot.Query.APICategories == nil { + break + } + + return e.ComplexityRoot.Query.APICategories(childComplexity), true + case "Query.apiExposures": if e.ComplexityRoot.Query.APIExposures == nil { break @@ -2191,6 +2554,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin 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.apis": + if e.ComplexityRoot.Query.Apis == nil { + break + } + + args, err := ec.field_Query_apis_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.Apis(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.ApiOrder), args["where"].(*ent.ApiWhereInput)), true + case "Query.applications": if e.ComplexityRoot.Query.Applications == nil { break @@ -2251,6 +2626,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin 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.eventTypes": + if e.ComplexityRoot.Query.EventTypes == nil { + break + } + + args, err := ec.field_Query_eventTypes_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.EventTypes(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.EventTypeOrder), args["where"].(*ent.EventTypeWhereInput)), true + case "Query.node": if e.ComplexityRoot.Query.Node == nil { break @@ -2378,6 +2765,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.RotateTeamTokenPayload.Team(childComplexity), true + case "Team.apis": + if e.ComplexityRoot.Team.Apis == nil { + break + } + + args, err := ec.field_Team_apis_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Team.Apis(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.ApiOrder), args["where"].(*ent.ApiWhereInput)), true + case "Team.applications": if e.ComplexityRoot.Team.Applications == nil { break @@ -2418,6 +2817,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Team.Environment(childComplexity), true + case "Team.eventTypes": + if e.ComplexityRoot.Team.EventTypes == nil { + break + } + + args, err := ec.field_Team_eventTypes_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Team.EventTypes(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].(*ent.EventTypeOrder), args["where"].(*ent.EventTypeWhereInput)), true + case "Team.group": if e.ComplexityRoot.Team.Group == nil { break @@ -2645,8 +3056,10 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputApiExposureOrder, ec.unmarshalInputApiExposureWhereInput, + ec.unmarshalInputApiOrder, ec.unmarshalInputApiSubscriptionOrder, ec.unmarshalInputApiSubscriptionWhereInput, + ec.unmarshalInputApiWhereInput, ec.unmarshalInputApplicationOrder, ec.unmarshalInputApplicationWhereInput, ec.unmarshalInputApprovalOrder, @@ -2659,6 +3072,8 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputEventExposureWhereInput, ec.unmarshalInputEventSubscriptionOrder, ec.unmarshalInputEventSubscriptionWhereInput, + ec.unmarshalInputEventTypeOrder, + ec.unmarshalInputEventTypeWhereInput, ec.unmarshalInputGroupWhereInput, ec.unmarshalInputMemberInput, ec.unmarshalInputMemberWhereInput, @@ -2743,31 +3158,28 @@ func newExecutionContext( 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 { +type Api implements Node { id: ID! createdAt: Time! lastModifiedAt: Time! - statusPhase: ApiExposureStatusPhase + statusPhase: ApiStatusPhase statusMessage: String - environment: String namespace: String! basePath: String! - visibility: ApiExposureVisibility! - active: Boolean - features: [ApiExposureFeature!]! - upstreams: [Upstream!]! - approvalConfig: ApprovalConfig! - apiVersion: String - owner: Application! + version: String! + category: String + oauth2Scopes: [String!] + xVendor: Boolean! + active: Boolean! } """ A connection to a list of items. """ -type ApiExposureConnection { +type ApiConnection { """ A list of edges. """ - edges: [ApiExposureEdge] + edges: [ApiEdge] """ Information to aid in pagination. """ @@ -2780,18 +3192,66 @@ type ApiExposureConnection { """ An edge in a connection. """ -type ApiExposureEdge { +type ApiEdge { """ The item at the end of the edge. """ - node: ApiExposure + node: Api """ A cursor for use in pagination. """ cursor: Cursor! } -""" -Ordering options for ApiExposure connections +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! + api: Api +} +""" +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 { """ @@ -2983,11 +3443,45 @@ input ApiExposureWhereInput { hasOwner: Boolean hasOwnerWith: [ApplicationWhereInput!] """ + api edge predicates + """ + hasAPI: Boolean + hasAPIWith: [ApiWhereInput!] + """ subscriptions edge predicates """ hasSubscriptions: Boolean hasSubscriptionsWith: [ApiSubscriptionWhereInput!] } +""" +Ordering options for Api connections +""" +input ApiOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order Apis. + """ + field: ApiOrderField! +} +""" +Properties by which Api connections can be ordered. +""" +enum ApiOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +ApiStatusPhase is enum for the field status_phase +""" +enum ApiStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/api.StatusPhase") { + READY + PENDING + ERROR + UNKNOWN +} type ApiSubscription implements Node { id: ID! createdAt: Time! @@ -3240,6 +3734,179 @@ input ApiSubscriptionWhereInput { hasApprovalRequests: Boolean hasApprovalRequestsWith: [ApprovalRequestWhereInput!] } +""" +ApiWhereInput is used for filtering Api objects. +Input was generated by ent. +""" +input ApiWhereInput { + not: ApiWhereInput + and: [ApiWhereInput!] + or: [ApiWhereInput!] + """ + 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: ApiStatusPhase + statusPhaseNEQ: ApiStatusPhase + statusPhaseIn: [ApiStatusPhase!] + statusPhaseNotIn: [ApiStatusPhase!] + 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 + """ + 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 + """ + version field predicates + """ + version: String + versionNEQ: String + versionIn: [String!] + versionNotIn: [String!] + versionGT: String + versionGTE: String + versionLT: String + versionLTE: String + versionContains: String + versionHasPrefix: String + versionHasSuffix: String + versionEqualFold: String + versionContainsFold: String + """ + category field predicates + """ + category: String + categoryNEQ: String + categoryIn: [String!] + categoryNotIn: [String!] + categoryGT: String + categoryGTE: String + categoryLT: String + categoryLTE: String + categoryContains: String + categoryHasPrefix: String + categoryHasSuffix: String + categoryIsNil: Boolean + categoryNotNil: Boolean + categoryEqualFold: String + categoryContainsFold: String + """ + x_vendor field predicates + """ + xVendor: Boolean + xVendorNEQ: Boolean + """ + specification field predicates + """ + specification: String + specificationNEQ: String + specificationIn: [String!] + specificationNotIn: [String!] + specificationGT: String + specificationGTE: String + specificationLT: String + specificationLTE: String + specificationContains: String + specificationHasPrefix: String + specificationHasSuffix: String + specificationIsNil: Boolean + specificationNotNil: Boolean + specificationEqualFold: String + specificationContainsFold: String + """ + active field predicates + """ + active: Boolean + activeNEQ: Boolean + """ + owner edge predicates + """ + hasOwner: Boolean + hasOwnerWith: [TeamWhereInput!] + """ + exposures edge predicates + """ + hasExposures: Boolean + hasExposuresWith: [ApiExposureWhereInput!] +} type Application implements Node { id: ID! createdAt: Time! @@ -4228,6 +4895,7 @@ type EventExposure implements Node { active: Boolean approvalConfig: ApprovalConfig! owner: Application! + eventTypeDef: EventType } """ A connection to a list of items. @@ -4434,6 +5102,11 @@ input EventExposureWhereInput { hasOwner: Boolean hasOwnerWith: [ApplicationWhereInput!] """ + event_type_def edge predicates + """ + hasEventTypeDef: Boolean + hasEventTypeDefWith: [EventTypeWhereInput!] + """ subscriptions edge predicates """ hasSubscriptions: Boolean @@ -4701,23 +5374,85 @@ input EventSubscriptionWhereInput { hasApprovalRequests: Boolean hasApprovalRequestsWith: [ApprovalRequestWhereInput!] } -type Group implements Node { +type EventType implements Node { id: ID! - environment: String + createdAt: Time! + lastModifiedAt: Time! + statusPhase: EventTypeStatusPhase + statusMessage: String namespace: String! - name: String! - displayName: String! - description: String! - teams: [Team!] + eventType: String! + version: String! + description: String + active: Boolean! } """ -GroupWhereInput is used for filtering Group objects. +A connection to a list of items. +""" +type EventTypeConnection { + """ + A list of edges. + """ + edges: [EventTypeEdge] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} +""" +An edge in a connection. +""" +type EventTypeEdge { + """ + The item at the end of the edge. + """ + node: EventType + """ + A cursor for use in pagination. + """ + cursor: Cursor! +} +""" +Ordering options for EventType connections +""" +input EventTypeOrder { + """ + The ordering direction. + """ + direction: OrderDirection! = ASC + """ + The field by which to order EventTypes. + """ + field: EventTypeOrderField! +} +""" +Properties by which EventType connections can be ordered. +""" +enum EventTypeOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +EventTypeStatusPhase is enum for the field status_phase +""" +enum EventTypeStatusPhase @goModel(model: "github.com/telekom/controlplane/controlplane-api/ent/eventtype.StatusPhase") { + READY + PENDING + ERROR + UNKNOWN +} +""" +EventTypeWhereInput is used for filtering EventType objects. Input was generated by ent. """ -input GroupWhereInput { - not: GroupWhereInput - and: [GroupWhereInput!] - or: [GroupWhereInput!] +input EventTypeWhereInput { + not: EventTypeWhereInput + and: [EventTypeWhereInput!] + or: [EventTypeWhereInput!] """ id field predicates """ @@ -4730,18 +5465,195 @@ input GroupWhereInput { idLT: ID idLTE: ID """ - environment field predicates + created_at field predicates """ - environment: String - environmentNEQ: String - environmentIn: [String!] - environmentNotIn: [String!] - environmentGT: String - environmentGTE: String - environmentLT: String - environmentLTE: String - environmentContains: String - environmentHasPrefix: String + 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: EventTypeStatusPhase + statusPhaseNEQ: EventTypeStatusPhase + statusPhaseIn: [EventTypeStatusPhase!] + statusPhaseNotIn: [EventTypeStatusPhase!] + 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 + """ + 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 + """ + version field predicates + """ + version: String + versionNEQ: String + versionIn: [String!] + versionNotIn: [String!] + versionGT: String + versionGTE: String + versionLT: String + versionLTE: String + versionContains: String + versionHasPrefix: String + versionHasSuffix: String + versionEqualFold: String + versionContainsFold: 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 + descriptionIsNil: Boolean + descriptionNotNil: Boolean + descriptionEqualFold: String + descriptionContainsFold: String + """ + specification field predicates + """ + specification: String + specificationNEQ: String + specificationIn: [String!] + specificationNotIn: [String!] + specificationGT: String + specificationGTE: String + specificationLT: String + specificationLTE: String + specificationContains: String + specificationHasPrefix: String + specificationHasSuffix: String + specificationIsNil: Boolean + specificationNotNil: Boolean + specificationEqualFold: String + specificationContainsFold: String + """ + active field predicates + """ + active: Boolean + activeNEQ: Boolean + """ + owner edge predicates + """ + hasOwner: Boolean + hasOwnerWith: [TeamWhereInput!] + """ + exposures edge predicates + """ + hasExposures: Boolean + hasExposuresWith: [EventExposureWhereInput!] +} +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 @@ -4963,6 +5875,37 @@ type Query { """ ids: [ID!]! ): [Node]! + apis( + """ + 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 Apis returned from the connection. + """ + orderBy: ApiOrder + + """ + Filtering options for Apis returned from the connection. + """ + where: ApiWhereInput + ): ApiConnection! apiExposures( """ Returns the elements in the list that come after the specified cursor. @@ -5180,6 +6123,37 @@ type Query { """ where: EventSubscriptionWhereInput ): EventSubscriptionConnection! + eventTypes( + """ + 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 EventTypes returned from the connection. + """ + orderBy: EventTypeOrder + + """ + Filtering options for EventTypes returned from the connection. + """ + where: EventTypeWhereInput + ): EventTypeConnection! teams( """ Returns the elements in the list that come after the specified cursor. @@ -5258,6 +6232,68 @@ type Team implements Node { """ where: ApplicationWhereInput ): ApplicationConnection! + apis( + """ + 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 Apis returned from the connection. + """ + orderBy: ApiOrder + + """ + Filtering options for Apis returned from the connection. + """ + where: ApiWhereInput + ): ApiConnection! + eventTypes( + """ + 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 EventTypes returned from the connection. + """ + orderBy: EventTypeOrder + + """ + Filtering options for EventTypes returned from the connection. + """ + where: EventTypeWhereInput + ): EventTypeConnection! } """ TeamCategory is enum for the field category @@ -5500,6 +6536,16 @@ input TeamWhereInput { """ hasApplications: Boolean hasApplicationsWith: [ApplicationWhereInput!] + """ + apis edge predicates + """ + hasApis: Boolean + hasApisWith: [ApiWhereInput!] + """ + event_types edge predicates + """ + hasEventTypes: Boolean + hasEventTypesWith: [EventTypeWhereInput!] } """ The builtin Time type @@ -5936,6 +6982,37 @@ extend type ApprovalRequest { approval: Approval @goField(forceResolver: true) } +# -- Catalogue extensions -- + +extend type Api { + "URL to download the OpenAPI specification from the file-manager. Null if no specification is associated." + specificationUrl: String @goField(forceResolver: true) + "The currently active exposure of this API, or null if no exposure is active." + activeExposure: ApiExposureInfo @goField(forceResolver: true) + "The team that owns this API." + owner: TeamInfo! @goField(forceResolver: true) +} + +extend type EventType { + "URL to download the JSON schema from the file-manager. Null if no specification is associated." + specificationUrl: String @goField(forceResolver: true) + "The currently active exposure of this event type, or null if no exposure is active." + activeExposure: EventExposureInfo @goField(forceResolver: true) + "The team that owns this event type." + owner: TeamInfo! @goField(forceResolver: true) +} + +extend type Query { + "Returns all distinct API categories currently in use." + apiCategories: [ApiCategory!]! @goField(forceResolver: true) +} + +"A category that APIs can be classified under." +type ApiCategory { + "The category identifier/name." + name: String! +} + `, BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) @@ -5954,6 +7031,72 @@ func (ec *executionContext) childFields_AddTeamMemberPayload(ctx context.Context return nil, fmt.Errorf("no field named %q was found under type AddTeamMemberPayload", field.Name) } +func (ec *executionContext) childFields_Api(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Api_id(ctx, field) + case "createdAt": + return ec.fieldContext_Api_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Api_lastModifiedAt(ctx, field) + case "statusPhase": + return ec.fieldContext_Api_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_Api_statusMessage(ctx, field) + case "namespace": + return ec.fieldContext_Api_namespace(ctx, field) + case "basePath": + return ec.fieldContext_Api_basePath(ctx, field) + case "version": + return ec.fieldContext_Api_version(ctx, field) + case "category": + return ec.fieldContext_Api_category(ctx, field) + case "oauth2Scopes": + return ec.fieldContext_Api_oauth2Scopes(ctx, field) + case "xVendor": + return ec.fieldContext_Api_xVendor(ctx, field) + case "active": + return ec.fieldContext_Api_active(ctx, field) + case "specificationUrl": + return ec.fieldContext_Api_specificationUrl(ctx, field) + case "activeExposure": + return ec.fieldContext_Api_activeExposure(ctx, field) + case "owner": + return ec.fieldContext_Api_owner(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Api", field.Name) +} + +func (ec *executionContext) childFields_ApiCategory(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_ApiCategory_name(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiCategory", field.Name) +} + +func (ec *executionContext) childFields_ApiConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_ApiConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ApiConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ApiConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiConnection", field.Name) +} + +func (ec *executionContext) childFields_ApiEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_ApiEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_ApiEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ApiEdge", field.Name) +} + func (ec *executionContext) childFields_ApiExposure(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": @@ -5986,6 +7129,8 @@ func (ec *executionContext) childFields_ApiExposure(ctx context.Context, field g return ec.fieldContext_ApiExposure_apiVersion(ctx, field) case "owner": return ec.fieldContext_ApiExposure_owner(ctx, field) + case "api": + return ec.fieldContext_ApiExposure_api(ctx, field) case "subscriptions": return ec.fieldContext_ApiExposure_subscriptions(ctx, field) } @@ -6420,6 +7565,8 @@ func (ec *executionContext) childFields_EventExposure(ctx context.Context, field return ec.fieldContext_EventExposure_approvalConfig(ctx, field) case "owner": return ec.fieldContext_EventExposure_owner(ctx, field) + case "eventTypeDef": + return ec.fieldContext_EventExposure_eventTypeDef(ctx, field) case "subscriptions": return ec.fieldContext_EventExposure_subscriptions(ctx, field) } @@ -6546,6 +7693,60 @@ func (ec *executionContext) childFields_EventSubscriptionInfo(ctx context.Contex return nil, fmt.Errorf("no field named %q was found under type EventSubscriptionInfo", field.Name) } +func (ec *executionContext) childFields_EventType(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_EventType_id(ctx, field) + case "createdAt": + return ec.fieldContext_EventType_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_EventType_lastModifiedAt(ctx, field) + case "statusPhase": + return ec.fieldContext_EventType_statusPhase(ctx, field) + case "statusMessage": + return ec.fieldContext_EventType_statusMessage(ctx, field) + case "namespace": + return ec.fieldContext_EventType_namespace(ctx, field) + case "eventType": + return ec.fieldContext_EventType_eventType(ctx, field) + case "version": + return ec.fieldContext_EventType_version(ctx, field) + case "description": + return ec.fieldContext_EventType_description(ctx, field) + case "active": + return ec.fieldContext_EventType_active(ctx, field) + case "specificationUrl": + return ec.fieldContext_EventType_specificationUrl(ctx, field) + case "activeExposure": + return ec.fieldContext_EventType_activeExposure(ctx, field) + case "owner": + return ec.fieldContext_EventType_owner(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventType", field.Name) +} + +func (ec *executionContext) childFields_EventTypeConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_EventTypeConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_EventTypeConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_EventTypeConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventTypeConnection", field.Name) +} + +func (ec *executionContext) childFields_EventTypeEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "node": + return ec.fieldContext_EventTypeEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_EventTypeEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EventTypeEdge", field.Name) +} + func (ec *executionContext) childFields_Group(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": @@ -6686,6 +7887,10 @@ func (ec *executionContext) childFields_Team(ctx context.Context, field graphql. return ec.fieldContext_Team_members(ctx, field) case "applications": return ec.fieldContext_Team_applications(ctx, field) + case "apis": + return ec.fieldContext_Team_apis(ctx, field) + case "eventTypes": + return ec.fieldContext_Team_eventTypes(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) } diff --git a/controlplane-api/internal/resolvers/schema.generated.go b/controlplane-api/internal/resolvers/schema.generated.go index 38d00e3d2..1698f305a 100644 --- a/controlplane-api/internal/resolvers/schema.generated.go +++ b/controlplane-api/internal/resolvers/schema.generated.go @@ -64,6 +64,29 @@ type EventSubscriptionInfoResolver interface { // region **************************** field.gotpl ***************************** +func (ec *executionContext) _ApiCategory_name(ctx context.Context, field graphql.CollectedField, obj *model1.APICategory) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ApiCategory_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_ApiCategory_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ApiCategory", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _ApiExposureInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.ApiExposureInfo) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -1307,6 +1330,45 @@ func (ec *executionContext) _SubscriptionInfo(ctx context.Context, sel ast.Selec // region **************************** object.gotpl **************************** +var apiCategoryImplementors = []string{"ApiCategory"} + +func (ec *executionContext) _ApiCategory(ctx context.Context, sel ast.SelectionSet, obj *model1.APICategory) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, apiCategoryImplementors) + + 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("ApiCategory") + case "name": + out.Values[i] = ec._ApiCategory_name(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 apiExposureInfoImplementors = []string{"ApiExposureInfo"} func (ec *executionContext) _ApiExposureInfo(ctx context.Context, sel ast.SelectionSet, obj *model.ApiExposureInfo) graphql.Marshaler { @@ -2200,6 +2262,32 @@ func (ec *executionContext) _Upstream(ctx context.Context, sel ast.SelectionSet, // region ***************************** type.gotpl ***************************** +func (ec *executionContext) marshalNApiCategory2ᚕᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAPICategoryᚄ(ctx context.Context, sel ast.SelectionSet, v []*model1.APICategory) 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.marshalNApiCategory2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAPICategory(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNApiCategory2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAPICategory(ctx context.Context, sel ast.SelectionSet, v *model1.APICategory) 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._ApiCategory(ctx, sel, v) +} + func (ec *executionContext) unmarshalNApiExposureFeature2githubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋinternalᚋresolversᚋmodelᚐAPIExposureFeature(ctx context.Context, v any) (model1.APIExposureFeature, error) { var res model1.APIExposureFeature err := res.UnmarshalGQL(v) @@ -2411,6 +2499,13 @@ func (ec *executionContext) marshalNUpstream2ᚕgithubᚗcomᚋtelekomᚋcontrol return ret } +func (ec *executionContext) marshalOApiExposureInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐApiExposureInfo(ctx context.Context, sel ast.SelectionSet, v *model.ApiExposureInfo) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ApiExposureInfo(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 @@ -2430,4 +2525,11 @@ func (ec *executionContext) marshalOAvailableTransition2ᚕgithubᚗcomᚋteleko return ret } +func (ec *executionContext) marshalOEventExposureInfo2ᚖgithubᚗcomᚋtelekomᚋcontrolplaneᚋcontrolplaneᚑapiᚋpkgᚋmodelᚐEventExposureInfo(ctx context.Context, sel ast.SelectionSet, v *model.EventExposureInfo) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._EventExposureInfo(ctx, sel, v) +} + // endregion ***************************** type.gotpl ***************************** diff --git a/controlplane-api/internal/resolvers/schema.resolvers.go b/controlplane-api/internal/resolvers/schema.resolvers.go index 7b638fad0..836d66ce6 100644 --- a/controlplane-api/internal/resolvers/schema.resolvers.go +++ b/controlplane-api/internal/resolvers/schema.resolvers.go @@ -11,8 +11,11 @@ package resolvers import ( "context" "fmt" + "sort" + "github.com/go-logr/logr" "github.com/telekom/controlplane/controlplane-api/ent" + "github.com/telekom/controlplane/controlplane-api/ent/api" "github.com/telekom/controlplane/controlplane-api/ent/apiexposure" "github.com/telekom/controlplane/controlplane-api/ent/apisubscription" "github.com/telekom/controlplane/controlplane-api/ent/approval" @@ -23,6 +26,75 @@ import ( "github.com/telekom/controlplane/controlplane-api/pkg/model" ) +// SpecificationURL is the resolver for the specificationUrl field. +func (r *apiResolver) SpecificationURL(ctx context.Context, obj *ent.Api) (*string, error) { + return r.buildSpecificationURL(obj.Specification) +} + +// ActiveExposure is the resolver for the activeExposure field. +// Returns the active exposure for this API, or nil if none is active. +func (r *apiResolver) ActiveExposure(ctx context.Context, obj *ent.Api) (*model.ApiExposureInfo, error) { + // SystemContext: The exposure may belong to another tenant; privacy rules would + // block the cross-tenant traversal. We return a reduced Info type to limit exposure. + sysCtx := viewer.SystemContext(ctx) + exp, err := obj.QueryExposures(). + Where(apiexposure.Active(true)). + WithOwner(func(q *ent.ApplicationQuery) { + q.WithOwnerTeam(func(q *ent.TeamQuery) { + q.WithGroup() + }) + }). + Only(sysCtx) + if err != nil { + if ent.IsNotFound(err) { + return nil, nil + } + return nil, fmt.Errorf("loading active exposure for api %d: %w", obj.ID, err) + } + + app := exp.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 + } + return mapApiExposureInfo(exp, app, team, group), nil +} + +// Owner is the resolver for the owner field. +func (r *apiResolver) Owner(ctx context.Context, obj *ent.Api) (*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) + log := logr.FromContextOrDiscard(ctx) + + team, err := obj.Edges.OwnerOrErr() + if ent.IsNotLoaded(err) { + team, err = obj.QueryOwner().Only(sysCtx) + } + if err != nil { + log.Info("Failed to resolve owner team for api", + "apiID", obj.ID, "namespace", obj.Namespace, "basePath", obj.BasePath, "error", err) + return nil, fmt.Errorf("resolving owner team for api %d: %w", obj.ID, err) + } + + group, err := team.Edges.GroupOrErr() + if ent.IsNotLoaded(err) { + group, err = team.QueryGroup().Only(sysCtx) + } + 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 +} + // 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) { @@ -333,6 +405,98 @@ func (r *eventSubscriptionInfoResolver) StatusPhase(ctx context.Context, obj *mo return &s, nil } +// SpecificationURL is the resolver for the specificationUrl field. +func (r *eventTypeResolver) SpecificationURL(ctx context.Context, obj *ent.EventType) (*string, error) { + return r.buildSpecificationURL(obj.Specification) +} + +// ActiveExposure is the resolver for the activeExposure field. +// Returns the active exposure for this event type, or nil if none is active. +func (r *eventTypeResolver) ActiveExposure(ctx context.Context, obj *ent.EventType) (*model.EventExposureInfo, error) { + // SystemContext: The exposure may belong to another tenant; privacy rules would + // block the cross-tenant traversal. We return a reduced Info type to limit exposure. + sysCtx := viewer.SystemContext(ctx) + exp, err := obj.QueryExposures(). + Where(eventexposure.Active(true)). + WithOwner(func(q *ent.ApplicationQuery) { + q.WithOwnerTeam(func(q *ent.TeamQuery) { + q.WithGroup() + }) + }). + Only(sysCtx) + if err != nil { + if ent.IsNotFound(err) { + return nil, nil + } + return nil, fmt.Errorf("loading active exposure for event type %d: %w", obj.ID, err) + } + + app := exp.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 + } + return mapEventExposureInfo(exp, app, team, group), nil +} + +// Owner is the resolver for the owner field. +func (r *eventTypeResolver) Owner(ctx context.Context, obj *ent.EventType) (*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) + log := logr.FromContextOrDiscard(ctx) + + team, err := obj.Edges.OwnerOrErr() + if ent.IsNotLoaded(err) { + team, err = obj.QueryOwner().Only(sysCtx) + } + if err != nil { + log.Info("Failed to resolve owner team for event type", + "eventTypeID", obj.ID, "namespace", obj.Namespace, "eventType", obj.EventType, "error", err) + return nil, fmt.Errorf("resolving owner team for event type %d: %w", obj.ID, err) + } + + group, err := team.Edges.GroupOrErr() + if ent.IsNotLoaded(err) { + group, err = team.QueryGroup().Only(sysCtx) + } + 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 +} + +// APICategories is the resolver for the apiCategories field. +func (r *queryResolver) APICategories(ctx context.Context) ([]*gqlmodel.APICategory, error) { + // SystemContext: Categories are visible to all authenticated users regardless of tenant. + sysCtx := viewer.SystemContext(ctx) + names, err := r.client.Api.Query(). + Where( + api.CategoryNotNil(), + api.CategoryNEQ(""), + ). + Unique(true). + Select(api.FieldCategory). + Strings(sysCtx) + if err != nil { + return nil, fmt.Errorf("querying distinct api categories: %w", err) + } + sort.Strings(names) + categories := make([]*gqlmodel.APICategory, len(names)) + for i, name := range names { + categories[i] = &gqlmodel.APICategory{Name: name} + } + return categories, 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 { diff --git a/controlplane-api/internal/resolvers/schema_resolvers_test.go b/controlplane-api/internal/resolvers/schema_resolvers_test.go index dbe1af5b8..599ebeb96 100644 --- a/controlplane-api/internal/resolvers/schema_resolvers_test.go +++ b/controlplane-api/internal/resolvers/schema_resolvers_test.go @@ -28,7 +28,7 @@ var _ = Describe("OwnerTeam resolver", func() { BeforeEach(func() { client = testutil.NewTestClient(GinkgoT()) - r = resolvers.NewResolver(client, service.Services{}, nil) + r = resolvers.NewResolver(client, service.Services{}, nil, "") }) AfterEach(func() { @@ -146,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, service.Services{}, 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)) @@ -282,7 +282,7 @@ var _ = Describe("ApprovalConfig.TrustedTeams", func() { }) var _ = Describe("AvailableTransition resolvers", func() { - r := resolvers.NewResolver(nil, service.Services{}, 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"}) @@ -298,7 +298,7 @@ var _ = Describe("AvailableTransition resolvers", func() { }) var _ = Describe("Decision.ResultingState resolver", func() { - r := resolvers.NewResolver(nil, service.Services{}, 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/schema.graphql b/controlplane-api/schema.graphql index cd476267d..7c8b79d88 100644 --- a/controlplane-api/schema.graphql +++ b/controlplane-api/schema.graphql @@ -176,3 +176,34 @@ extend type ApprovalRequest { approval: Approval @goField(forceResolver: true) } +# -- Catalogue extensions -- + +extend type Api { + "URL to download the OpenAPI specification from the file-manager. Null if no specification is associated." + specificationUrl: String @goField(forceResolver: true) + "The currently active exposure of this API, or null if no exposure is active." + activeExposure: ApiExposureInfo @goField(forceResolver: true) + "The team that owns this API." + owner: TeamInfo! @goField(forceResolver: true) +} + +extend type EventType { + "URL to download the JSON schema from the file-manager. Null if no specification is associated." + specificationUrl: String @goField(forceResolver: true) + "The currently active exposure of this event type, or null if no exposure is active." + activeExposure: EventExposureInfo @goField(forceResolver: true) + "The team that owns this event type." + owner: TeamInfo! @goField(forceResolver: true) +} + +extend type Query { + "Returns all distinct API categories currently in use." + apiCategories: [ApiCategory!]! @goField(forceResolver: true) +} + +"A category that APIs can be classified under." +type ApiCategory { + "The category identifier/name." + name: String! +} + diff --git a/projector/internal/bootstrap/bootstrap.go b/projector/internal/bootstrap/bootstrap.go index 41e6c6ea7..913f08fdb 100644 --- a/projector/internal/bootstrap/bootstrap.go +++ b/projector/internal/bootstrap/bootstrap.go @@ -37,6 +37,7 @@ import ( orgv1 "github.com/telekom/controlplane/organization/api/v1" "github.com/telekom/controlplane/projector/internal/config" + "github.com/telekom/controlplane/projector/internal/domain/api" "github.com/telekom/controlplane/projector/internal/domain/apiexposure" "github.com/telekom/controlplane/projector/internal/domain/apisubscription" "github.com/telekom/controlplane/projector/internal/domain/application" @@ -44,6 +45,7 @@ import ( "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/eventtype" "github.com/telekom/controlplane/projector/internal/domain/group" "github.com/telekom/controlplane/projector/internal/domain/team" "github.com/telekom/controlplane/projector/internal/domain/zone" @@ -62,6 +64,7 @@ var modules = []module.Module{ group.Module, team.Module, application.Module, + api.Module, apiexposure.Module, apisubscription.Module, approval.Module, @@ -78,7 +81,7 @@ func init() { if cconfig.FeaturePubSub.IsEnabled() { _ = eventv1.AddToScheme(scheme) - modules = append(modules, eventexposure.Module, eventsubscription.Module) + modules = append(modules, eventtype.Module, eventexposure.Module, eventsubscription.Module) } } diff --git a/projector/internal/domain/api/deps.go b/projector/internal/domain/api/deps.go new file mode 100644 index 000000000..fa3e0b5c0 --- /dev/null +++ b/projector/internal/domain/api/deps.go @@ -0,0 +1,16 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package api + +import "context" + +// ApiDeps declares the FK resolution interface required by the Api repository. +// Team is a required dependency — if the owner Team is missing, the upsert +// fails with ErrDependencyMissing. +// +// Satisfied by *infrastructure.IDResolver at wiring time. +type ApiDeps interface { + FindTeamID(ctx context.Context, name string) (int, error) +} diff --git a/projector/internal/domain/api/module.go b/projector/internal/domain/api/module.go new file mode 100644 index 000000000..ca91d508b --- /dev/null +++ b/projector/internal/domain/api/module.go @@ -0,0 +1,28 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package api + +import ( + apiv1 "github.com/telekom/controlplane/api/api/v1" + "github.com/telekom/controlplane/projector/internal/module" + "github.com/telekom/controlplane/projector/internal/runtime" +) + +// Module is the Api catalogue module registration variable. It wires the +// Api translator and repository into the generic pipeline via TypedModule. +// +// Api is a Level 2 entity with a required FK dependency on Team. +var Module = &module.TypedModule[*apiv1.Api, *ApiData, ApiKey]{ + ModuleName: "api", + NewObj: func() *apiv1.Api { return &apiv1.Api{} }, + Translator: &Translator{}, + RepoFactory: func(deps module.ModuleDeps) runtime.Repository[ApiKey, *ApiData] { + return NewRepository( + deps.EntClient, + deps.EdgeCache, + deps.IDResolver, + ) + }, +} diff --git a/projector/internal/domain/api/repository.go b/projector/internal/domain/api/repository.go new file mode 100644 index 000000000..a0e38e966 --- /dev/null +++ b/projector/internal/domain/api/repository.go @@ -0,0 +1,139 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package api + +import ( + "context" + "errors" + "fmt" + "time" + + "github.com/telekom/controlplane/controlplane-api/ent" + entapi "github.com/telekom/controlplane/controlplane-api/ent/api" + "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 Api entities in the EdgeCache. +const entityType = "api" + +// Repository performs typed persistence operations for Api catalogue entities. +// It implements runtime.Repository[ApiKey, *ApiData]. +// +// Api has a required FK dependency on Team. If the owner Team is missing, +// Upsert returns ErrDependencyMissing. +type Repository struct { + client *ent.Client + cache *infrastructure.EdgeCache + deps ApiDeps +} + +// compile-time interface check. +var _ runtime.Repository[ApiKey, *ApiData] = (*Repository)(nil) + +// NewRepository creates an Api repository wired with the given ent client, +// edge cache, and dependency resolver. +func NewRepository(client *ent.Client, cache *infrastructure.EdgeCache, deps ApiDeps) *Repository { + return &Repository{ + client: client, + cache: cache, + deps: deps, + } +} + +// Upsert creates or updates an Api catalogue entity in the database. +// Resolves the owner Team FK (required) via deps, then upserts on the +// composite unique constraint (base_path, owner). +func (r *Repository) Upsert(ctx context.Context, data *ApiData) error { + start := time.Now() + defer func() { + metrics.DBOperationDuration.WithLabelValues(entityType, metrics.OperationUpsert).Observe(time.Since(start).Seconds()) + }() + + teamID, err := r.deps.FindTeamID(ctx, data.TeamName) + if err != nil { + if errors.Is(err, infrastructure.ErrEntityNotFound) { + return runtime.WrapDependencyMissing("team", data.TeamName) + } + return fmt.Errorf("find team %q: %w", data.TeamName, err) + } + + create := r.client.Api.Create(). + SetBasePath(data.BasePath). + SetVersion(data.Version). + SetActive(data.Active). + SetStatusPhase(entapi.StatusPhase(data.StatusPhase)). + SetStatusMessage(data.StatusMessage). + SetNamespace(data.Meta.Namespace). + SetXVendor(data.XVendor). + SetOauth2Scopes(data.Oauth2Scopes). + SetOwnerID(teamID) + + if data.Category != "" { + create.SetCategory(data.Category) + } + + if data.Specification != "" { + create.SetSpecification(data.Specification) + } + + apiID, upsertErr := create. + OnConflictColumns(entapi.FieldBasePath, entapi.OwnerColumn). + UpdateNewValues(). + ID(ctx) + if upsertErr != nil { + return fmt.Errorf("upsert api %q (team %q): %w", + data.BasePath, data.TeamName, upsertErr) + } + + et, lk := cachekeys.Api(data.BasePath, data.TeamName) + r.cache.Set(et, lk, apiID) + + // Update the active-api cache entry so that ApiExposure FK resolution + // can find the active Api by base path alone. + if data.Active { + aet, alk := cachekeys.ActiveApi(data.BasePath) + r.cache.Set(aet, alk, apiID) + } else { + // If this Api is not active, clear the active cache in case it was + // previously active (should not happen in practice due to oldest-wins, + // but handles edge cases during resync). + aet, alk := cachekeys.ActiveApi(data.BasePath) + r.cache.Del(aet, alk) + } + return nil +} + +// Delete removes an Api catalogue entity from the database by base path and +// team name. Returns nil if the entity does not exist (idempotent delete). +func (r *Repository) Delete(ctx context.Context, key ApiKey) error { + start := time.Now() + defer func() { + metrics.DBOperationDuration.WithLabelValues(entityType, metrics.OperationDelete).Observe(time.Since(start).Seconds()) + }() + + count, err := r.client.Api.Delete(). + Where( + entapi.BasePathEQ(key.BasePath), + entapi.HasOwnerWith(team.NameEQ(key.TeamName)), + ). + Exec(ctx) + if err != nil { + return fmt.Errorf("delete api %q (team %q): %w", + key.BasePath, key.TeamName, err) + } + if count > 0 { + et, lk := cachekeys.Api(key.BasePath, key.TeamName) + r.cache.Del(et, lk) + // Also clear the active-api cache — if this was the active Api, + // the cache entry is now stale. + aet, alk := cachekeys.ActiveApi(key.BasePath) + r.cache.Del(aet, alk) + } + return nil +} diff --git a/projector/internal/domain/api/translator.go b/projector/internal/domain/api/translator.go new file mode 100644 index 000000000..32308b74e --- /dev/null +++ b/projector/internal/domain/api/translator.go @@ -0,0 +1,73 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package api + +import ( + "context" + + apiv1 "github.com/telekom/controlplane/api/api/v1" + "github.com/telekom/controlplane/projector/internal/domain/shared" + "github.com/telekom/controlplane/projector/internal/runtime" + "k8s.io/apimachinery/pkg/types" +) + +// Translator maps an Api CR to an ApiData DTO and derives identity keys. +type Translator struct{} + +// compile-time interface check. +var _ runtime.Translator[*apiv1.Api, *ApiData, ApiKey] = (*Translator)(nil) + +// ShouldSkip returns false — Api CRs are always syncable. +func (t *Translator) ShouldSkip(_ *apiv1.Api) (bool, string) { + return false, "" +} + +// Translate converts an Api CR into an ApiData DTO. +func (t *Translator) Translate(_ context.Context, obj *apiv1.Api) (*ApiData, error) { + phase, message := shared.StatusFromConditions(obj.Status.Conditions) + + scopes := obj.Spec.Oauth2Scopes + if scopes == nil { + scopes = []string{} + } + + return &ApiData{ + Meta: shared.NewMetadata(obj.Namespace, obj.Name, obj.Labels), + StatusPhase: phase, + StatusMessage: message, + BasePath: obj.Spec.BasePath, + Version: obj.Spec.Version, + Category: obj.Spec.Category, + Oauth2Scopes: scopes, + XVendor: obj.Spec.XVendor, + Specification: obj.Spec.Specification, + Active: obj.Status.Active, + TeamName: shared.TeamNameFromNamespace(obj.Namespace), + }, nil +} + +// KeyFromObject derives the composite identity key from a live Api CR. +func (t *Translator) KeyFromObject(obj *apiv1.Api) ApiKey { + return ApiKey{ + BasePath: obj.Spec.BasePath, + TeamName: shared.TeamNameFromNamespace(obj.Namespace), + } +} + +// KeyFromDelete derives the identity key for a delete operation. +// If lastKnown is available, uses Spec.BasePath and namespace-derived team. +// Otherwise, falls back to req.Name as basePath and namespace-derived team. +func (t *Translator) KeyFromDelete(req types.NamespacedName, lastKnown *apiv1.Api) (ApiKey, error) { + if lastKnown != nil { + return ApiKey{ + BasePath: lastKnown.Spec.BasePath, + TeamName: shared.TeamNameFromNamespace(lastKnown.Namespace), + }, nil + } + return ApiKey{ + BasePath: req.Name, + TeamName: shared.TeamNameFromNamespace(req.Namespace), + }, nil +} diff --git a/projector/internal/domain/api/types.go b/projector/internal/domain/api/types.go new file mode 100644 index 000000000..e15d76688 --- /dev/null +++ b/projector/internal/domain/api/types.go @@ -0,0 +1,31 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +// Package api implements the Api catalogue resource module for the projector. +// Api is a Level 2 entity with a required FK dependency on Team. +package api + +import "github.com/telekom/controlplane/projector/internal/domain/shared" + +// ApiKey is the composite identity key for Api catalogue entities. +// Api base paths are unique per team, so both components are needed. +type ApiKey struct { + BasePath string + TeamName string +} + +// ApiData carries the transformed data for an Api catalogue entity. +type ApiData struct { + Meta shared.Metadata + StatusPhase string // "READY", "PENDING", "ERROR", "UNKNOWN" + StatusMessage string + BasePath string + Version string + Category string + Oauth2Scopes []string + XVendor bool + Specification string // file-manager file ID (optional) + Active bool // cluster-wide active singleton flag + TeamName string // resolved to owner Team FK +} diff --git a/projector/internal/domain/apiexposure/deps.go b/projector/internal/domain/apiexposure/deps.go index 6a3eeb0a3..98766a384 100644 --- a/projector/internal/domain/apiexposure/deps.go +++ b/projector/internal/domain/apiexposure/deps.go @@ -9,8 +9,11 @@ import "context" // APIExposureDeps declares the FK resolution interface required by the // ApiExposure repository. Application is a required dependency — if the // owner Application is missing, the upsert fails with ErrDependencyMissing. +// Api is an optional dependency — if no active Api entry exists for the +// base path, the FK is left null. // // Satisfied by *infrastructure.IDResolver at wiring time. type APIExposureDeps interface { FindApplicationID(ctx context.Context, name, teamName string) (int, error) + FindActiveApiID(ctx context.Context, basePath string) (int, error) } diff --git a/projector/internal/domain/apiexposure/repository.go b/projector/internal/domain/apiexposure/repository.go index 7b8eeb0fb..55a25e18b 100644 --- a/projector/internal/domain/apiexposure/repository.go +++ b/projector/internal/domain/apiexposure/repository.go @@ -69,6 +69,18 @@ func (r *Repository) Upsert(ctx context.Context, data *APIExposureData) error { return fmt.Errorf("find application %q (team %q): %w", data.AppName, data.TeamName, err) } + // Resolve optional Api catalogue FK. Only link to the active Api when this + // exposure itself is active. The lookup is team-independent because only one + // Api is active cluster-wide for a given base path (oldest-wins). + var apiID *int + if data.Active { + if resolvedApiID, apiErr := r.deps.FindActiveApiID(ctx, data.BasePath); apiErr == nil { + apiID = &resolvedApiID + } else if !errors.Is(apiErr, infrastructure.ErrEntityNotFound) { + return fmt.Errorf("find active api %q: %w", data.BasePath, apiErr) + } + } + create := r.client.ApiExposure.Create(). SetBasePath(data.BasePath). SetVisibility(apiexposure.Visibility(data.Visibility)). @@ -86,6 +98,10 @@ func (r *Repository) Upsert(ctx context.Context, data *APIExposureData) error { create.SetAPIVersion(*data.APIVersion) } + if apiID != nil { + create.SetNillableAPIID(apiID) + } + exposureID, upsertErr := create. OnConflictColumns(apiexposure.FieldBasePath, apiexposure.OwnerColumn). UpdateNewValues(). diff --git a/projector/internal/domain/apiexposure/repository_test.go b/projector/internal/domain/apiexposure/repository_test.go index 52512bca4..3206314a2 100644 --- a/projector/internal/domain/apiexposure/repository_test.go +++ b/projector/internal/domain/apiexposure/repository_test.go @@ -31,6 +31,7 @@ import ( type mockExposureDeps struct { appIDs map[string]int // key: "appName:teamName" appErr error // if non-nil, FindApplicationID always returns this error + apiIDs map[string]int // key: basePath (active api lookup) } func (m *mockExposureDeps) FindApplicationID(_ context.Context, name, teamName string) (int, error) { @@ -44,6 +45,15 @@ func (m *mockExposureDeps) FindApplicationID(_ context.Context, name, teamName s return 0, fmt.Errorf("application %q (team %q): %w", name, teamName, infrastructure.ErrEntityNotFound) } +func (m *mockExposureDeps) FindActiveApiID(_ context.Context, basePath string) (int, error) { + if m.apiIDs != nil { + if id, ok := m.apiIDs[basePath]; ok { + return id, nil + } + } + return 0, fmt.Errorf("active api %q: %w", basePath, infrastructure.ErrEntityNotFound) +} + var _ = Describe("ApiExposure Repository", func() { var ( client *ent.Client diff --git a/projector/internal/domain/eventexposure/deps.go b/projector/internal/domain/eventexposure/deps.go index e5c3190fa..d0a0ef1f1 100644 --- a/projector/internal/domain/eventexposure/deps.go +++ b/projector/internal/domain/eventexposure/deps.go @@ -9,8 +9,11 @@ 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. +// EventType is an optional dependency — if no active EventType entry exists +// for the type identifier, the FK is left null. // // Satisfied by *infrastructure.IDResolver at wiring time. type EventExposureDeps interface { FindApplicationID(ctx context.Context, name, teamName string) (int, error) + FindActiveEventTypeID(ctx context.Context, eventType string) (int, error) } diff --git a/projector/internal/domain/eventexposure/repository.go b/projector/internal/domain/eventexposure/repository.go index 2391ac46f..64b5de68f 100644 --- a/projector/internal/domain/eventexposure/repository.go +++ b/projector/internal/domain/eventexposure/repository.go @@ -65,6 +65,18 @@ func (r *Repository) Upsert(ctx context.Context, data *EventExposureData) error return fmt.Errorf("find application %q (team %q): %w", data.AppName, data.TeamName, err) } + // Resolve optional EventType catalogue FK. Only link to the active EventType + // when this exposure itself is active. The lookup is team-independent because + // only one EventType is active cluster-wide for a given type string (oldest-wins). + var eventTypeDefID *int + if data.Active { + if resolvedID, etErr := r.deps.FindActiveEventTypeID(ctx, data.EventType); etErr == nil { + eventTypeDefID = &resolvedID + } else if !errors.Is(etErr, infrastructure.ErrEntityNotFound) { + return fmt.Errorf("find active event_type %q: %w", data.EventType, etErr) + } + } + exposureID, upsertErr := r.client.EventExposure.Create(). SetEventType(data.EventType). SetVisibility(eventexposure.Visibility(data.Visibility)). @@ -75,6 +87,7 @@ func (r *Repository) Upsert(ctx context.Context, data *EventExposureData) error SetNamespace(data.Meta.Namespace). SetOwnerID(appID). SetApprovalConfig(data.ApprovalConfig). + SetNillableEventTypeDefID(eventTypeDefID). OnConflictColumns(eventexposure.FieldEventType, eventexposure.OwnerColumn). UpdateNewValues(). ID(ctx) diff --git a/projector/internal/domain/eventexposure/repository_test.go b/projector/internal/domain/eventexposure/repository_test.go index 5031c5d6e..2471f77e7 100644 --- a/projector/internal/domain/eventexposure/repository_test.go +++ b/projector/internal/domain/eventexposure/repository_test.go @@ -29,8 +29,9 @@ import ( // mockExposureDeps implements eventexposure.EventExposureDeps for testing. type mockExposureDeps struct { - appIDs map[string]int - appErr error + appIDs map[string]int + appErr error + activeEvtTypeID map[string]int // key: eventType } func (m *mockExposureDeps) FindApplicationID(_ context.Context, name, teamName string) (int, error) { @@ -44,6 +45,15 @@ func (m *mockExposureDeps) FindApplicationID(_ context.Context, name, teamName s return 0, fmt.Errorf("application %q (team %q): %w", name, teamName, infrastructure.ErrEntityNotFound) } +func (m *mockExposureDeps) FindActiveEventTypeID(_ context.Context, eventType string) (int, error) { + if m.activeEvtTypeID != nil { + if id, ok := m.activeEvtTypeID[eventType]; ok { + return id, nil + } + } + return 0, fmt.Errorf("active event_type %q: %w", eventType, infrastructure.ErrEntityNotFound) +} + var _ = Describe("EventExposure Repository", func() { var ( client *ent.Client diff --git a/projector/internal/domain/eventtype/deps.go b/projector/internal/domain/eventtype/deps.go new file mode 100644 index 000000000..09ade858b --- /dev/null +++ b/projector/internal/domain/eventtype/deps.go @@ -0,0 +1,16 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventtype + +import "context" + +// EventTypeDeps declares the FK resolution interface required by the EventType +// repository. Team is a required dependency — if the owner Team is missing, +// the upsert fails with ErrDependencyMissing. +// +// Satisfied by *infrastructure.IDResolver at wiring time. +type EventTypeDeps interface { + FindTeamID(ctx context.Context, name string) (int, error) +} diff --git a/projector/internal/domain/eventtype/module.go b/projector/internal/domain/eventtype/module.go new file mode 100644 index 000000000..9594cd239 --- /dev/null +++ b/projector/internal/domain/eventtype/module.go @@ -0,0 +1,29 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventtype + +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 EventType catalogue module registration variable. It wires the +// EventType translator and repository into the generic pipeline via TypedModule. +// +// EventType is a Level 2 entity with a required FK dependency on Team. +// Registered behind the FeaturePubSub feature flag. +var Module = &module.TypedModule[*eventv1.EventType, *EventTypeData, EventTypeKey]{ + ModuleName: "eventtype", + NewObj: func() *eventv1.EventType { return &eventv1.EventType{} }, + Translator: &Translator{}, + RepoFactory: func(deps module.ModuleDeps) runtime.Repository[EventTypeKey, *EventTypeData] { + return NewRepository( + deps.EntClient, + deps.EdgeCache, + deps.IDResolver, + ) + }, +} diff --git a/projector/internal/domain/eventtype/repository.go b/projector/internal/domain/eventtype/repository.go new file mode 100644 index 000000000..f7ee2b02f --- /dev/null +++ b/projector/internal/domain/eventtype/repository.go @@ -0,0 +1,132 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventtype + +import ( + "context" + "errors" + "fmt" + "time" + + "github.com/telekom/controlplane/controlplane-api/ent" + enteventtype "github.com/telekom/controlplane/controlplane-api/ent/eventtype" + "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 EventType entities in the EdgeCache. +const entityType = "eventtype" + +// Repository performs typed persistence operations for EventType catalogue entities. +// It implements runtime.Repository[EventTypeKey, *EventTypeData]. +// +// EventType has a required FK dependency on Team. If the owner Team is missing, +// Upsert returns ErrDependencyMissing. +type Repository struct { + client *ent.Client + cache *infrastructure.EdgeCache + deps EventTypeDeps +} + +// compile-time interface check. +var _ runtime.Repository[EventTypeKey, *EventTypeData] = (*Repository)(nil) + +// NewRepository creates an EventType repository wired with the given ent client, +// edge cache, and dependency resolver. +func NewRepository(client *ent.Client, cache *infrastructure.EdgeCache, deps EventTypeDeps) *Repository { + return &Repository{ + client: client, + cache: cache, + deps: deps, + } +} + +// Upsert creates or updates an EventType catalogue entity in the database. +// Resolves the owner Team FK (required) via deps, then upserts on the +// composite unique constraint (event_type, owner). +func (r *Repository) Upsert(ctx context.Context, data *EventTypeData) error { + start := time.Now() + defer func() { + metrics.DBOperationDuration.WithLabelValues(entityType, metrics.OperationUpsert).Observe(time.Since(start).Seconds()) + }() + + teamID, err := r.deps.FindTeamID(ctx, data.TeamName) + if err != nil { + if errors.Is(err, infrastructure.ErrEntityNotFound) { + return runtime.WrapDependencyMissing("team", data.TeamName) + } + return fmt.Errorf("find team %q: %w", data.TeamName, err) + } + + create := r.client.EventType.Create(). + SetEventType(data.EventType). + SetVersion(data.Version). + SetActive(data.Active). + SetStatusPhase(enteventtype.StatusPhase(data.StatusPhase)). + SetStatusMessage(data.StatusMessage). + SetNamespace(data.Meta.Namespace). + SetOwnerID(teamID) + + if data.Description != "" { + create.SetDescription(data.Description) + } + + if data.Specification != "" { + create.SetSpecification(data.Specification) + } + + eventTypeID, upsertErr := create. + OnConflictColumns(enteventtype.FieldEventType, enteventtype.OwnerColumn). + UpdateNewValues(). + ID(ctx) + if upsertErr != nil { + return fmt.Errorf("upsert event_type %q (team %q): %w", + data.EventType, data.TeamName, upsertErr) + } + + et, lk := cachekeys.EventTypeDef(data.EventType, data.TeamName) + r.cache.Set(et, lk, eventTypeID) + + // Update the active-eventtype cache entry so that EventExposure FK resolution + // can find the active EventType by type string alone. + if data.Active { + aet, alk := cachekeys.ActiveEventType(data.EventType) + r.cache.Set(aet, alk, eventTypeID) + } else { + aet, alk := cachekeys.ActiveEventType(data.EventType) + r.cache.Del(aet, alk) + } + return nil +} + +// Delete removes an EventType catalogue entity from the database by event type +// and team name. Returns nil if the entity does not exist (idempotent delete). +func (r *Repository) Delete(ctx context.Context, key EventTypeKey) error { + start := time.Now() + defer func() { + metrics.DBOperationDuration.WithLabelValues(entityType, metrics.OperationDelete).Observe(time.Since(start).Seconds()) + }() + + count, err := r.client.EventType.Delete(). + Where( + enteventtype.EventTypeEQ(key.EventType), + enteventtype.HasOwnerWith(team.NameEQ(key.TeamName)), + ). + Exec(ctx) + if err != nil { + return fmt.Errorf("delete event_type %q (team %q): %w", + key.EventType, key.TeamName, err) + } + if count > 0 { + et, lk := cachekeys.EventTypeDef(key.EventType, key.TeamName) + r.cache.Del(et, lk) + aet, alk := cachekeys.ActiveEventType(key.EventType) + r.cache.Del(aet, alk) + } + return nil +} diff --git a/projector/internal/domain/eventtype/translator.go b/projector/internal/domain/eventtype/translator.go new file mode 100644 index 000000000..13bd35068 --- /dev/null +++ b/projector/internal/domain/eventtype/translator.go @@ -0,0 +1,67 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package eventtype + +import ( + "context" + + 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" +) + +// Translator maps an EventType CR to an EventTypeData DTO and derives +// identity keys. +type Translator struct{} + +// compile-time interface check. +var _ runtime.Translator[*eventv1.EventType, *EventTypeData, EventTypeKey] = (*Translator)(nil) + +// ShouldSkip returns false — EventType CRs are always syncable. +func (t *Translator) ShouldSkip(_ *eventv1.EventType) (bool, string) { + return false, "" +} + +// Translate converts an EventType CR into an EventTypeData DTO. +func (t *Translator) Translate(_ context.Context, obj *eventv1.EventType) (*EventTypeData, error) { + phase, message := shared.StatusFromConditions(obj.Status.Conditions) + + return &EventTypeData{ + Meta: shared.NewMetadata(obj.Namespace, obj.Name, obj.Labels), + StatusPhase: phase, + StatusMessage: message, + EventType: obj.Spec.Type, + Version: obj.Spec.Version, + Description: obj.Spec.Description, + Specification: obj.Spec.Specification, + Active: obj.Status.Active, + TeamName: shared.TeamNameFromNamespace(obj.Namespace), + }, nil +} + +// KeyFromObject derives the composite identity key from a live EventType CR. +func (t *Translator) KeyFromObject(obj *eventv1.EventType) EventTypeKey { + return EventTypeKey{ + EventType: obj.Spec.Type, + TeamName: shared.TeamNameFromNamespace(obj.Namespace), + } +} + +// KeyFromDelete derives the identity key for a delete operation. +// If lastKnown is available, uses Spec.Type and namespace-derived team. +// Otherwise, falls back to req.Name as event type and namespace-derived team. +func (t *Translator) KeyFromDelete(req types.NamespacedName, lastKnown *eventv1.EventType) (EventTypeKey, error) { + if lastKnown != nil { + return EventTypeKey{ + EventType: lastKnown.Spec.Type, + TeamName: shared.TeamNameFromNamespace(lastKnown.Namespace), + }, nil + } + return EventTypeKey{ + EventType: req.Name, + TeamName: shared.TeamNameFromNamespace(req.Namespace), + }, nil +} diff --git a/projector/internal/domain/eventtype/types.go b/projector/internal/domain/eventtype/types.go new file mode 100644 index 000000000..7e7ef861c --- /dev/null +++ b/projector/internal/domain/eventtype/types.go @@ -0,0 +1,29 @@ +// Copyright 2026 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +// Package eventtype implements the EventType catalogue resource module for the +// projector. EventType is a Level 2 entity with a required FK dependency on Team. +package eventtype + +import "github.com/telekom/controlplane/projector/internal/domain/shared" + +// EventTypeKey is the composite identity key for EventType catalogue entities. +// Event type identifiers are unique per team, so both components are needed. +type EventTypeKey struct { + EventType string + TeamName string +} + +// EventTypeData carries the transformed data for an EventType catalogue entity. +type EventTypeData struct { + Meta shared.Metadata + StatusPhase string // "READY", "PENDING", "ERROR", "UNKNOWN" + StatusMessage string + EventType string + Version string + Description string + Specification string // file-manager file ID (optional) + Active bool // cluster-wide active singleton flag + TeamName string // resolved to owner Team FK +} diff --git a/projector/internal/infrastructure/cachekeys/cachekeys.go b/projector/internal/infrastructure/cachekeys/cachekeys.go index 97b426b15..605541429 100644 --- a/projector/internal/infrastructure/cachekeys/cachekeys.go +++ b/projector/internal/infrastructure/cachekeys/cachekeys.go @@ -85,3 +85,31 @@ func EventExposureByEventType(eventType string) (entityType, lookupKey string) { func EventSubscriptionMeta(namespace, name string) (entityType, lookupKey string) { return "eventsubscription", "meta:" + namespace + ":" + name } + +// Api returns the cache key components for an Api catalogue entity. +// Api base paths are unique per team (composite unique index on +// base_path + owner), so both are required. +func Api(basePath, teamName string) (entityType, lookupKey string) { + return "api", basePath + ":" + teamName +} + +// ActiveApi returns the cache key components for the cluster-wide active Api +// for a given base path. Only one Api is active at a time per base path +// (oldest-wins), so the team is not part of the key. +func ActiveApi(basePath string) (entityType, lookupKey string) { + return "api_active", basePath +} + +// EventTypeDef returns the cache key components for an EventType catalogue +// entity. Event type identifiers are unique per team (composite unique index +// on event_type + owner), so both are required. +func EventTypeDef(eventType, teamName string) (entityType, lookupKey string) { + return "eventtype", eventType + ":" + teamName +} + +// ActiveEventType returns the cache key components for the cluster-wide active +// EventType for a given type identifier. Only one EventType is active at a time +// per type string (oldest-wins), so the team is not part of the key. +func ActiveEventType(eventType string) (entityType, lookupKey string) { + return "eventtype_active", eventType +} diff --git a/projector/internal/infrastructure/idresolver.go b/projector/internal/infrastructure/idresolver.go index 403d5ffd8..84ee74ba0 100644 --- a/projector/internal/infrastructure/idresolver.go +++ b/projector/internal/infrastructure/idresolver.go @@ -14,11 +14,13 @@ import ( "golang.org/x/sync/singleflight" "github.com/telekom/controlplane/controlplane-api/ent" + entapi "github.com/telekom/controlplane/controlplane-api/ent/api" "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/eventtype" 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" @@ -472,3 +474,119 @@ func (r *IDResolver) FindEventExposureByEventType(ctx context.Context, eventType return exposure.ID, nil }) } + +// FindApiID looks up the DB primary key for an Api catalogue entry by base path +// and team name. Api base paths are unique per team (composite unique index on +// base_path + owner), so both are required. +// Returns ErrEntityNotFound (wrapped) if no matching row exists. +func (r *IDResolver) FindApiID(ctx context.Context, basePath, teamName string) (int, error) { + et, lk := cachekeys.Api(basePath, teamName) + fullKey := et + ":" + lk + return r.resolve(ctx, et, lk, fmt.Sprintf("api %q (team %q)", basePath, teamName), func() (int, error) { + a, err := r.client.Api.Query(). + Where( + entapi.BasePathEQ(basePath), + entapi.HasOwnerWith(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("api %q (team %q): %w", basePath, teamName, ErrEntityNotFound) + } + return 0, fmt.Errorf("find api %q (team %q): %w", basePath, teamName, err) + } + r.clearNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBHit).Inc() + r.cache.Set(et, lk, a.ID) + return a.ID, nil + }) +} + +// FindActiveApiID looks up the DB primary key for the cluster-wide active Api +// for a given base path. Only one Api is active at a time per base path +// (oldest-wins), so the lookup is team-independent. +// Returns ErrEntityNotFound (wrapped) if no active Api exists for the base path. +func (r *IDResolver) FindActiveApiID(ctx context.Context, basePath string) (int, error) { + et, lk := cachekeys.ActiveApi(basePath) + fullKey := et + ":" + lk + return r.resolve(ctx, et, lk, fmt.Sprintf("active api %q", basePath), func() (int, error) { + a, err := r.client.Api.Query(). + Where( + entapi.BasePathEQ(basePath), + entapi.ActiveEQ(true), + ). + Only(ctx) + if err != nil { + if ent.IsNotFound(err) { + r.setNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBMiss).Inc() + return 0, fmt.Errorf("active api %q: %w", basePath, ErrEntityNotFound) + } + return 0, fmt.Errorf("find active api %q: %w", basePath, err) + } + r.clearNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBHit).Inc() + r.cache.Set(et, lk, a.ID) + return a.ID, nil + }) +} + +// FindEventTypeID looks up the DB primary key for an EventType catalogue entry +// by event type identifier and team name. Event type identifiers are unique per +// team (composite unique index on event_type + owner), so both are required. +// Returns ErrEntityNotFound (wrapped) if no matching row exists. +func (r *IDResolver) FindEventTypeID(ctx context.Context, evtType, teamName string) (int, error) { + et, lk := cachekeys.EventTypeDef(evtType, teamName) + fullKey := et + ":" + lk + return r.resolve(ctx, et, lk, fmt.Sprintf("event_type %q (team %q)", evtType, teamName), func() (int, error) { + e, err := r.client.EventType.Query(). + Where( + eventtype.EventTypeEQ(evtType), + eventtype.HasOwnerWith(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_type %q (team %q): %w", evtType, teamName, ErrEntityNotFound) + } + return 0, fmt.Errorf("find event_type %q (team %q): %w", evtType, teamName, err) + } + r.clearNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBHit).Inc() + r.cache.Set(et, lk, e.ID) + return e.ID, nil + }) +} + +// FindActiveEventTypeID looks up the DB primary key for the cluster-wide active +// EventType for a given type identifier. Only one EventType is active at a time +// per type string (oldest-wins), so the lookup is team-independent. +// Returns ErrEntityNotFound (wrapped) if no active EventType exists. +func (r *IDResolver) FindActiveEventTypeID(ctx context.Context, evtType string) (int, error) { + et, lk := cachekeys.ActiveEventType(evtType) + fullKey := et + ":" + lk + return r.resolve(ctx, et, lk, fmt.Sprintf("active event_type %q", evtType), func() (int, error) { + e, err := r.client.EventType.Query(). + Where( + eventtype.EventTypeEQ(evtType), + eventtype.ActiveEQ(true), + ). + Only(ctx) + if err != nil { + if ent.IsNotFound(err) { + r.setNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBMiss).Inc() + return 0, fmt.Errorf("active event_type %q: %w", evtType, ErrEntityNotFound) + } + return 0, fmt.Errorf("find active event_type %q: %w", evtType, err) + } + r.clearNegCache(fullKey) + metrics.IDResolverLookups.WithLabelValues(et, metrics.ResultDBHit).Inc() + r.cache.Set(et, lk, e.ID) + return e.ID, nil + }) +} diff --git a/rover/internal/handler/apispecification/handler.go b/rover/internal/handler/apispecification/handler.go index c76ba553b..65bc30fcf 100644 --- a/rover/internal/handler/apispecification/handler.go +++ b/rover/internal/handler/apispecification/handler.go @@ -48,11 +48,12 @@ func (h *ApiSpecificationHandler) CreateOrUpdate(ctx context.Context, apiSpec *r } api.Spec = apiapi.ApiSpec{ - Version: apiSpec.Spec.Version, - BasePath: apiSpec.Spec.BasePath, - Category: apiSpec.Spec.Category, - Oauth2Scopes: apiSpec.Spec.Oauth2Scopes, - XVendor: apiSpec.Spec.XVendor, + Version: apiSpec.Spec.Version, + BasePath: apiSpec.Spec.BasePath, + Category: apiSpec.Spec.Category, + Oauth2Scopes: apiSpec.Spec.Oauth2Scopes, + XVendor: apiSpec.Spec.XVendor, + Specification: apiSpec.Spec.Specification, } return nil From 9baf2cad344c341f6e0fabfd6f47d4254a9b5e41 Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Wed, 20 May 2026 12:43:11 +0200 Subject: [PATCH 08/11] chore(controlplane-api): organized gomod --- controlplane-api/go.mod | 33 +++++++++++++++++---------------- controlplane-api/go.sum | 1 + 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/controlplane-api/go.mod b/controlplane-api/go.mod index 142d77a4b..0fa76c0be 100644 --- a/controlplane-api/go.mod +++ b/controlplane-api/go.mod @@ -6,6 +6,15 @@ module github.com/telekom/controlplane/controlplane-api go 1.26.3 +require ( + github.com/telekom/controlplane/application/api v0.0.0 + github.com/telekom/controlplane/approval/api v0.0.0 + 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 + github.com/telekom/controlplane/secret-manager v0.0.0 +) + require ( entgo.io/contrib v0.7.0 entgo.io/ent v0.14.6 @@ -19,11 +28,6 @@ require ( 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/valyala/fasthttp v1.71.0 github.com/vektah/gqlparser/v2 v2.5.33 go.uber.org/zap v1.28.0 @@ -143,14 +147,11 @@ require ( tool github.com/99designs/gqlgen -replace github.com/telekom/controlplane/common => ../common - -replace github.com/telekom/controlplane/common-server => ../common-server - -replace github.com/telekom/controlplane/application/api => ../application/api - -replace github.com/telekom/controlplane/approval/api => ../approval/api - -replace github.com/telekom/controlplane/organization/api => ../organization/api - -replace github.com/telekom/controlplane/secret-manager => ../secret-manager +replace ( + github.com/telekom/controlplane/application/api => ../application/api + github.com/telekom/controlplane/approval/api => ../approval/api + github.com/telekom/controlplane/common => ../common + github.com/telekom/controlplane/common-server => ../common-server + github.com/telekom/controlplane/organization/api => ../organization/api + github.com/telekom/controlplane/secret-manager => ../secret-manager +) diff --git a/controlplane-api/go.sum b/controlplane-api/go.sum index a165390b7..8466b644d 100644 --- a/controlplane-api/go.sum +++ b/controlplane-api/go.sum @@ -135,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.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao= github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= From b5d39ac708845f92483b28c3c3fef4eb8145d72c Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Wed, 20 May 2026 13:12:45 +0200 Subject: [PATCH 09/11] fix(api): generated manifests --- api/config/crd/bases/api.cp.ei.telekom.de_apis.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/config/crd/bases/api.cp.ei.telekom.de_apis.yaml b/api/config/crd/bases/api.cp.ei.telekom.de_apis.yaml index 342f910dd..337357209 100644 --- a/api/config/crd/bases/api.cp.ei.telekom.de_apis.yaml +++ b/api/config/crd/bases/api.cp.ei.telekom.de_apis.yaml @@ -55,6 +55,11 @@ spec: items: type: string type: array + specification: + description: |- + Specification contains the file ID reference from the file manager for + the optional OpenAPI specification document that describes this API. + type: string version: type: string xVendor: From 3450a5ec550bfe7167f4b01bc56ddf40045d0fb9 Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Wed, 20 May 2026 14:12:38 +0200 Subject: [PATCH 10/11] fix(projector): added missing rbac roles --- controlplane-api/cmd/config/config.go | 3 +++ projector/config/rbac/role.yaml | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/controlplane-api/cmd/config/config.go b/controlplane-api/cmd/config/config.go index 5ee20f3b8..6788307b0 100644 --- a/controlplane-api/cmd/config/config.go +++ b/controlplane-api/cmd/config/config.go @@ -87,6 +87,9 @@ func DefaultConfig() *ServerConfig { Enabled: true, Environment: "poc", // TODO: for now, this is fine. Needs to be refined later }, + FileManager: FileManagerConfig{ + BaseURL: "file-manager.controlplane-system.svc", + }, } } diff --git a/projector/config/rbac/role.yaml b/projector/config/rbac/role.yaml index df957d5a9..b05deff31 100644 --- a/projector/config/rbac/role.yaml +++ b/projector/config/rbac/role.yaml @@ -45,6 +45,17 @@ rules: resources: - apiexposures - apisubscriptions + - apis + verbs: + - get + - list + - watch +- apiGroups: + - event.cp.ei.telekom.de + resources: + - eventexposures + - eventsubscriptions + - eventtypes verbs: - get - list From 1a5daad8136f0b258035988c745d5515a3443a08 Mon Sep 17 00:00:00 2001 From: Ron Gummich Date: Fri, 22 May 2026 09:14:03 +0200 Subject: [PATCH 11/11] fix(controlplane-api): decode user-identity headers --- .../internal/graphql/controller.go | 18 ++++++++-- .../internal/graphql/controller_test.go | 33 +++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 controlplane-api/internal/graphql/controller_test.go diff --git a/controlplane-api/internal/graphql/controller.go b/controlplane-api/internal/graphql/controller.go index 396a50194..b9f02c08c 100644 --- a/controlplane-api/internal/graphql/controller.go +++ b/controlplane-api/internal/graphql/controller.go @@ -6,6 +6,7 @@ package graphql import ( "net/http" + "net/url" "strings" "github.com/99designs/gqlgen/graphql/handler" @@ -61,13 +62,15 @@ func httpHandlerWithUserContext(h http.Handler) fiber.Handler { 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 != "" { + // Values may be percent-encoded (encodeURIComponent) by the UI to support + // non-ASCII characters in HTTP header values; decode them transparently. + if name, email := decodeHeader(c.Get("X-Forwarded-User-Name")), decodeHeader(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 != "" { + if roles := decodeHeader(c.Get("X-Forwarded-User-Roles")); roles != "" { fu.Roles = strings.Split(roles, ",") } - if groups := c.Get("X-Forwarded-User-Groups"); groups != "" { + if groups := decodeHeader(c.Get("X-Forwarded-User-Groups")); groups != "" { fu.Groups = strings.Split(groups, ",") } ctx = viewer.NewForwardedUserContext(ctx, fu) @@ -97,3 +100,12 @@ func (r *responseRecorder) Write(b []byte) (int, error) { func (r *responseRecorder) WriteHeader(statusCode int) { r.ctx.Status(statusCode) } + +// decodeHeader decodes a potentially percent-encoded header value. +// If decoding fails (e.g. the value was never encoded), it returns the original value. +func decodeHeader(value string) string { + if decoded, err := url.QueryUnescape(value); err == nil { + return decoded + } + return value +} diff --git a/controlplane-api/internal/graphql/controller_test.go b/controlplane-api/internal/graphql/controller_test.go new file mode 100644 index 000000000..09bba5405 --- /dev/null +++ b/controlplane-api/internal/graphql/controller_test.go @@ -0,0 +1,33 @@ +// Copyright 2025 Deutsche Telekom IT GmbH +// +// SPDX-License-Identifier: Apache-2.0 + +package graphql + +import ( + "testing" +) + +func Test_decodeHeader(t *testing.T) { + tests := []struct { + name string + input string + want string + }{ + {"plain ASCII", "John Doe", "John Doe"}, + {"encoded space", "John%20Doe", "John Doe"}, + {"encoded non-ASCII", "John%20D%C3%B6e", "John Döe"}, + {"fully encoded email", "user%40example.com", "user@example.com"}, + {"empty string", "", ""}, + {"invalid encoding falls back", "%zz-invalid", "%zz-invalid"}, + {"encoded comma-separated roles", "role%20one,role%20two", "role one,role two"}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := decodeHeader(tt.input) + if got != tt.want { + t.Errorf("decodeHeader(%q) = %q, want %q", tt.input, got, tt.want) + } + }) + } +}