From 6a98ebe047a745c28aa8b8d2eb8fb684a28799fd Mon Sep 17 00:00:00 2001 From: Tyler Auerbeck Date: Wed, 7 Feb 2024 09:27:34 -0500 Subject: [PATCH 1/7] Add audit fields Signed-off-by: Tyler Auerbeck --- db/migrations/20240207142600_audit-fields.sql | 7 + db/migrations/atlas.sum | 5 +- go.sum | 8 + internal/ent/generated/client.go | 3 +- internal/ent/generated/gql_collection.go | 10 + internal/ent/generated/gql_mutation_input.go | 24 +- internal/ent/generated/gql_where_input.go | 124 +++++ internal/ent/generated/loadbalancer.go | 24 +- .../generated/loadbalancer/loadbalancer.go | 23 + internal/ent/generated/loadbalancer/where.go | 160 ++++++ internal/ent/generated/loadbalancer_create.go | 52 +- internal/ent/generated/loadbalancer_update.go | 78 ++- internal/ent/generated/migrate/schema.go | 10 +- internal/ent/generated/mutation.go | 153 +++++- internal/ent/generated/runtime.go | 220 +------- internal/ent/generated/runtime/runtime.go | 222 +++++++- internal/ent/schema/audit/errors.go | 18 + internal/ent/schema/audit/mixin.go | 69 +++ internal/ent/schema/loadbalancer.go | 2 + internal/graphapi/gen_server.go | 476 +++++++++++++++++- internal/graphapi/loadbalancer.resolvers.go | 8 +- internal/graphapi/origin.resolvers.go | 5 +- internal/graphapi/pool.resolvers.go | 7 +- internal/graphapi/port.resolvers.go | 5 +- internal/graphclient/gen_models.go | 38 ++ internal/graphclient/schema/schema.graphql | 38 ++ schema.graphql | 38 ++ schema/ent.graphql | 38 ++ 28 files changed, 1608 insertions(+), 257 deletions(-) create mode 100644 db/migrations/20240207142600_audit-fields.sql create mode 100644 internal/ent/schema/audit/errors.go create mode 100644 internal/ent/schema/audit/mixin.go diff --git a/db/migrations/20240207142600_audit-fields.sql b/db/migrations/20240207142600_audit-fields.sql new file mode 100644 index 000000000..b27bb5406 --- /dev/null +++ b/db/migrations/20240207142600_audit-fields.sql @@ -0,0 +1,7 @@ +-- +goose Up +-- modify "load_balancers" table +ALTER TABLE "load_balancers" ADD COLUMN "created_by" character varying NULL, ADD COLUMN "updated_by" character varying NULL; + +-- +goose Down +-- reverse: modify "load_balancers" table +ALTER TABLE "load_balancers" DROP COLUMN "updated_by", DROP COLUMN "created_by"; diff --git a/db/migrations/atlas.sum b/db/migrations/atlas.sum index ff1077165..f40f77b81 100644 --- a/db/migrations/atlas.sum +++ b/db/migrations/atlas.sum @@ -1,5 +1,6 @@ -h1:C2ooKhLvT6ZWxsvbhzwIlh+LWFh+wU+nRN1onsCHlkw= +h1:bAkj0ukIXBVQjqVcBhf5MOM7PUprniStduLKnCAouxg= 20230503185445_initial-migration.sql h1:4pqNp2MDBBRdGxU/H5mmZui9oi1SyjIiMVGatajrBeY= 20230615194819_drop_tenant_add_owner.sql h1:KGCsItU0NYhxYEkhZOaMQjfIrBMnek5rxC6D/LhnyCk= 20230629085916_drop_status_and_annotations.sql h1:kvDMoaMEjyoj/aRi6rw4XvCLxGH09vGGLbL0/p5tpPo= -20231017005257_add_origin_weight.sql h1:G0SKQBweZg4S9IvpnoIeVJ05aLSiNb3PWnJcZyo+2fg= +20231017005257_add_origin_weight.sql h1:NuorUbcydDqcyPK8wgwlkQxaH+zGWfVtJW9UPL1Vn+E= +20240207142600_audit-fields.sql h1:V4Pn+5bsH6ZMdNnTew+twztCRWbZjoWlN1e1vOxoMac= diff --git a/go.sum b/go.sum index 18fd7efc8..e14c36188 100644 --- a/go.sum +++ b/go.sum @@ -116,6 +116,7 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= +github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= @@ -471,6 +472,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= @@ -539,6 +542,9 @@ github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFA github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/urfave/cli v1.22.12 h1:igJgVw1JdKH+trcLWLeLwZjU9fEfPesQ+9/e4MQ44S8= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= @@ -559,6 +565,8 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd h1:dzWP1Lu+A40W883dK/Mr3xyDSM/2MggS8GtHT0qgAnE= github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I= github.com/ydb-platform/ydb-go-sdk/v3 v3.54.2 h1:E0yUuuX7UmPxXm92+yQCjMveLFO3zfvYFIJVuAqsVRA= diff --git a/internal/ent/generated/client.go b/internal/ent/generated/client.go index bd6e5d41e..3d868881e 100644 --- a/internal/ent/generated/client.go +++ b/internal/ent/generated/client.go @@ -398,7 +398,8 @@ func (c *LoadBalancerClient) QueryProvider(lb *LoadBalancer) *ProviderQuery { // Hooks returns the client hooks. func (c *LoadBalancerClient) Hooks() []Hook { - return c.hooks.LoadBalancer + hooks := c.hooks.LoadBalancer + return append(hooks[:len(hooks):len(hooks)], loadbalancer.Hooks[:]...) } // Interceptors returns the client interceptors. diff --git a/internal/ent/generated/gql_collection.go b/internal/ent/generated/gql_collection.go index 9547396c8..20ed5c782 100644 --- a/internal/ent/generated/gql_collection.go +++ b/internal/ent/generated/gql_collection.go @@ -161,6 +161,16 @@ func (lb *LoadBalancerQuery) collectField(ctx context.Context, opCtx *graphql.Op selectedFields = append(selectedFields, loadbalancer.FieldUpdatedAt) fieldSeen[loadbalancer.FieldUpdatedAt] = struct{}{} } + case "createdBy": + if _, ok := fieldSeen[loadbalancer.FieldCreatedBy]; !ok { + selectedFields = append(selectedFields, loadbalancer.FieldCreatedBy) + fieldSeen[loadbalancer.FieldCreatedBy] = struct{}{} + } + case "updatedBy": + if _, ok := fieldSeen[loadbalancer.FieldUpdatedBy]; !ok { + selectedFields = append(selectedFields, loadbalancer.FieldUpdatedBy) + fieldSeen[loadbalancer.FieldUpdatedBy] = struct{}{} + } case "name": if _, ok := fieldSeen[loadbalancer.FieldName]; !ok { selectedFields = append(selectedFields, loadbalancer.FieldName) diff --git a/internal/ent/generated/gql_mutation_input.go b/internal/ent/generated/gql_mutation_input.go index ede04cd8c..80bff2578 100644 --- a/internal/ent/generated/gql_mutation_input.go +++ b/internal/ent/generated/gql_mutation_input.go @@ -23,6 +23,8 @@ import ( // CreateLoadBalancerInput represents a mutation input for creating loadbalancers. type CreateLoadBalancerInput struct { + CreatedBy *string + UpdatedBy *string Name string OwnerID gidx.PrefixedID LocationID gidx.PrefixedID @@ -32,6 +34,12 @@ type CreateLoadBalancerInput struct { // Mutate applies the CreateLoadBalancerInput on the LoadBalancerMutation builder. func (i *CreateLoadBalancerInput) Mutate(m *LoadBalancerMutation) { + if v := i.CreatedBy; v != nil { + m.SetCreatedBy(*v) + } + if v := i.UpdatedBy; v != nil { + m.SetUpdatedBy(*v) + } m.SetName(i.Name) m.SetOwnerID(i.OwnerID) m.SetLocationID(i.LocationID) @@ -49,14 +57,22 @@ func (c *LoadBalancerCreate) SetInput(i CreateLoadBalancerInput) *LoadBalancerCr // UpdateLoadBalancerInput represents a mutation input for updating loadbalancers. type UpdateLoadBalancerInput struct { - Name *string - ClearPorts bool - AddPortIDs []gidx.PrefixedID - RemovePortIDs []gidx.PrefixedID + ClearUpdatedBy bool + UpdatedBy *string + Name *string + ClearPorts bool + AddPortIDs []gidx.PrefixedID + RemovePortIDs []gidx.PrefixedID } // Mutate applies the UpdateLoadBalancerInput on the LoadBalancerMutation builder. func (i *UpdateLoadBalancerInput) Mutate(m *LoadBalancerMutation) { + if i.ClearUpdatedBy { + m.ClearUpdatedBy() + } + if v := i.UpdatedBy; v != nil { + m.SetUpdatedBy(*v) + } if v := i.Name; v != nil { m.SetName(*v) } diff --git a/internal/ent/generated/gql_where_input.go b/internal/ent/generated/gql_where_input.go index 631c26348..a74990181 100644 --- a/internal/ent/generated/gql_where_input.go +++ b/internal/ent/generated/gql_where_input.go @@ -67,6 +67,40 @@ type LoadBalancerWhereInput struct { UpdatedAtLT *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLTE *time.Time `json:"updatedAtLTE,omitempty"` + // "created_by" field predicates. + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByNEQ *string `json:"createdByNEQ,omitempty"` + CreatedByIn []string `json:"createdByIn,omitempty"` + CreatedByNotIn []string `json:"createdByNotIn,omitempty"` + CreatedByGT *string `json:"createdByGT,omitempty"` + CreatedByGTE *string `json:"createdByGTE,omitempty"` + CreatedByLT *string `json:"createdByLT,omitempty"` + CreatedByLTE *string `json:"createdByLTE,omitempty"` + CreatedByContains *string `json:"createdByContains,omitempty"` + CreatedByHasPrefix *string `json:"createdByHasPrefix,omitempty"` + CreatedByHasSuffix *string `json:"createdByHasSuffix,omitempty"` + CreatedByIsNil bool `json:"createdByIsNil,omitempty"` + CreatedByNotNil bool `json:"createdByNotNil,omitempty"` + CreatedByEqualFold *string `json:"createdByEqualFold,omitempty"` + CreatedByContainsFold *string `json:"createdByContainsFold,omitempty"` + + // "updated_by" field predicates. + UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedByNEQ *string `json:"updatedByNEQ,omitempty"` + UpdatedByIn []string `json:"updatedByIn,omitempty"` + UpdatedByNotIn []string `json:"updatedByNotIn,omitempty"` + UpdatedByGT *string `json:"updatedByGT,omitempty"` + UpdatedByGTE *string `json:"updatedByGTE,omitempty"` + UpdatedByLT *string `json:"updatedByLT,omitempty"` + UpdatedByLTE *string `json:"updatedByLTE,omitempty"` + UpdatedByContains *string `json:"updatedByContains,omitempty"` + UpdatedByHasPrefix *string `json:"updatedByHasPrefix,omitempty"` + UpdatedByHasSuffix *string `json:"updatedByHasSuffix,omitempty"` + UpdatedByIsNil bool `json:"updatedByIsNil,omitempty"` + UpdatedByNotNil bool `json:"updatedByNotNil,omitempty"` + UpdatedByEqualFold *string `json:"updatedByEqualFold,omitempty"` + UpdatedByContainsFold *string `json:"updatedByContainsFold,omitempty"` + // "name" field predicates. Name *string `json:"name,omitempty"` NameNEQ *string `json:"nameNEQ,omitempty"` @@ -234,6 +268,96 @@ func (i *LoadBalancerWhereInput) P() (predicate.LoadBalancer, error) { if i.UpdatedAtLTE != nil { predicates = append(predicates, loadbalancer.UpdatedAtLTE(*i.UpdatedAtLTE)) } + if i.CreatedBy != nil { + predicates = append(predicates, loadbalancer.CreatedByEQ(*i.CreatedBy)) + } + if i.CreatedByNEQ != nil { + predicates = append(predicates, loadbalancer.CreatedByNEQ(*i.CreatedByNEQ)) + } + if len(i.CreatedByIn) > 0 { + predicates = append(predicates, loadbalancer.CreatedByIn(i.CreatedByIn...)) + } + if len(i.CreatedByNotIn) > 0 { + predicates = append(predicates, loadbalancer.CreatedByNotIn(i.CreatedByNotIn...)) + } + if i.CreatedByGT != nil { + predicates = append(predicates, loadbalancer.CreatedByGT(*i.CreatedByGT)) + } + if i.CreatedByGTE != nil { + predicates = append(predicates, loadbalancer.CreatedByGTE(*i.CreatedByGTE)) + } + if i.CreatedByLT != nil { + predicates = append(predicates, loadbalancer.CreatedByLT(*i.CreatedByLT)) + } + if i.CreatedByLTE != nil { + predicates = append(predicates, loadbalancer.CreatedByLTE(*i.CreatedByLTE)) + } + if i.CreatedByContains != nil { + predicates = append(predicates, loadbalancer.CreatedByContains(*i.CreatedByContains)) + } + if i.CreatedByHasPrefix != nil { + predicates = append(predicates, loadbalancer.CreatedByHasPrefix(*i.CreatedByHasPrefix)) + } + if i.CreatedByHasSuffix != nil { + predicates = append(predicates, loadbalancer.CreatedByHasSuffix(*i.CreatedByHasSuffix)) + } + if i.CreatedByIsNil { + predicates = append(predicates, loadbalancer.CreatedByIsNil()) + } + if i.CreatedByNotNil { + predicates = append(predicates, loadbalancer.CreatedByNotNil()) + } + if i.CreatedByEqualFold != nil { + predicates = append(predicates, loadbalancer.CreatedByEqualFold(*i.CreatedByEqualFold)) + } + if i.CreatedByContainsFold != nil { + predicates = append(predicates, loadbalancer.CreatedByContainsFold(*i.CreatedByContainsFold)) + } + if i.UpdatedBy != nil { + predicates = append(predicates, loadbalancer.UpdatedByEQ(*i.UpdatedBy)) + } + if i.UpdatedByNEQ != nil { + predicates = append(predicates, loadbalancer.UpdatedByNEQ(*i.UpdatedByNEQ)) + } + if len(i.UpdatedByIn) > 0 { + predicates = append(predicates, loadbalancer.UpdatedByIn(i.UpdatedByIn...)) + } + if len(i.UpdatedByNotIn) > 0 { + predicates = append(predicates, loadbalancer.UpdatedByNotIn(i.UpdatedByNotIn...)) + } + if i.UpdatedByGT != nil { + predicates = append(predicates, loadbalancer.UpdatedByGT(*i.UpdatedByGT)) + } + if i.UpdatedByGTE != nil { + predicates = append(predicates, loadbalancer.UpdatedByGTE(*i.UpdatedByGTE)) + } + if i.UpdatedByLT != nil { + predicates = append(predicates, loadbalancer.UpdatedByLT(*i.UpdatedByLT)) + } + if i.UpdatedByLTE != nil { + predicates = append(predicates, loadbalancer.UpdatedByLTE(*i.UpdatedByLTE)) + } + if i.UpdatedByContains != nil { + predicates = append(predicates, loadbalancer.UpdatedByContains(*i.UpdatedByContains)) + } + if i.UpdatedByHasPrefix != nil { + predicates = append(predicates, loadbalancer.UpdatedByHasPrefix(*i.UpdatedByHasPrefix)) + } + if i.UpdatedByHasSuffix != nil { + predicates = append(predicates, loadbalancer.UpdatedByHasSuffix(*i.UpdatedByHasSuffix)) + } + if i.UpdatedByIsNil { + predicates = append(predicates, loadbalancer.UpdatedByIsNil()) + } + if i.UpdatedByNotNil { + predicates = append(predicates, loadbalancer.UpdatedByNotNil()) + } + if i.UpdatedByEqualFold != nil { + predicates = append(predicates, loadbalancer.UpdatedByEqualFold(*i.UpdatedByEqualFold)) + } + if i.UpdatedByContainsFold != nil { + predicates = append(predicates, loadbalancer.UpdatedByContainsFold(*i.UpdatedByContainsFold)) + } if i.Name != nil { predicates = append(predicates, loadbalancer.NameEQ(*i.Name)) } diff --git a/internal/ent/generated/loadbalancer.go b/internal/ent/generated/loadbalancer.go index bd5682a9b..aa0a934a1 100644 --- a/internal/ent/generated/loadbalancer.go +++ b/internal/ent/generated/loadbalancer.go @@ -38,6 +38,10 @@ type LoadBalancer struct { CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` + // CreatedBy holds the value of the "created_by" field. + CreatedBy string `json:"created_by,omitempty"` + // UpdatedBy holds the value of the "updated_by" field. + UpdatedBy string `json:"updated_by,omitempty"` // The name of the load balancer. Name string `json:"name,omitempty"` // The ID for the owner for this load balancer. @@ -96,7 +100,7 @@ func (*LoadBalancer) scanValues(columns []string) ([]any, error) { switch columns[i] { case loadbalancer.FieldID, loadbalancer.FieldOwnerID, loadbalancer.FieldLocationID, loadbalancer.FieldProviderID: values[i] = new(gidx.PrefixedID) - case loadbalancer.FieldName: + case loadbalancer.FieldCreatedBy, loadbalancer.FieldUpdatedBy, loadbalancer.FieldName: values[i] = new(sql.NullString) case loadbalancer.FieldCreatedAt, loadbalancer.FieldUpdatedAt: values[i] = new(sql.NullTime) @@ -133,6 +137,18 @@ func (lb *LoadBalancer) assignValues(columns []string, values []any) error { } else if value.Valid { lb.UpdatedAt = value.Time } + case loadbalancer.FieldCreatedBy: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field created_by", values[i]) + } else if value.Valid { + lb.CreatedBy = value.String + } + case loadbalancer.FieldUpdatedBy: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field updated_by", values[i]) + } else if value.Valid { + lb.UpdatedBy = value.String + } case loadbalancer.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) @@ -209,6 +225,12 @@ func (lb *LoadBalancer) String() string { builder.WriteString("updated_at=") builder.WriteString(lb.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") + builder.WriteString("created_by=") + builder.WriteString(lb.CreatedBy) + builder.WriteString(", ") + builder.WriteString("updated_by=") + builder.WriteString(lb.UpdatedBy) + builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(lb.Name) builder.WriteString(", ") diff --git a/internal/ent/generated/loadbalancer/loadbalancer.go b/internal/ent/generated/loadbalancer/loadbalancer.go index 9f1f03a1e..20378cab3 100644 --- a/internal/ent/generated/loadbalancer/loadbalancer.go +++ b/internal/ent/generated/loadbalancer/loadbalancer.go @@ -19,6 +19,7 @@ package loadbalancer import ( "time" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "go.infratographer.com/x/gidx" @@ -33,6 +34,10 @@ const ( FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" + // FieldCreatedBy holds the string denoting the created_by field in the database. + FieldCreatedBy = "created_by" + // FieldUpdatedBy holds the string denoting the updated_by field in the database. + FieldUpdatedBy = "updated_by" // FieldName holds the string denoting the name field in the database. FieldName = "name" // FieldOwnerID holds the string denoting the owner_id field in the database. @@ -68,6 +73,8 @@ var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, + FieldCreatedBy, + FieldUpdatedBy, FieldName, FieldOwnerID, FieldLocationID, @@ -84,7 +91,13 @@ func ValidColumn(column string) bool { 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 _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" var ( + Hooks [1]ent.Hook // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. @@ -121,6 +134,16 @@ func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() } +// ByCreatedBy orders the results by the created_by field. +func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCreatedBy, opts...).ToFunc() +} + +// ByUpdatedBy orders the results by the updated_by field. +func ByUpdatedBy(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldUpdatedBy, opts...).ToFunc() +} + // ByName orders the results by the name field. func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() diff --git a/internal/ent/generated/loadbalancer/where.go b/internal/ent/generated/loadbalancer/where.go index 0e5fab52e..6945df04b 100644 --- a/internal/ent/generated/loadbalancer/where.go +++ b/internal/ent/generated/loadbalancer/where.go @@ -80,6 +80,16 @@ func UpdatedAt(v time.Time) predicate.LoadBalancer { return predicate.LoadBalancer(sql.FieldEQ(FieldUpdatedAt, v)) } +// CreatedBy applies equality check predicate on the "created_by" field. It's identical to CreatedByEQ. +func CreatedBy(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldEQ(FieldCreatedBy, v)) +} + +// UpdatedBy applies equality check predicate on the "updated_by" field. It's identical to UpdatedByEQ. +func UpdatedBy(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldEQ(FieldUpdatedBy, v)) +} + // Name applies equality check predicate on the "name" field. It's identical to NameEQ. func Name(v string) predicate.LoadBalancer { return predicate.LoadBalancer(sql.FieldEQ(FieldName, v)) @@ -180,6 +190,156 @@ func UpdatedAtLTE(v time.Time) predicate.LoadBalancer { return predicate.LoadBalancer(sql.FieldLTE(FieldUpdatedAt, v)) } +// CreatedByEQ applies the EQ predicate on the "created_by" field. +func CreatedByEQ(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldEQ(FieldCreatedBy, v)) +} + +// CreatedByNEQ applies the NEQ predicate on the "created_by" field. +func CreatedByNEQ(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldNEQ(FieldCreatedBy, v)) +} + +// CreatedByIn applies the In predicate on the "created_by" field. +func CreatedByIn(vs ...string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldIn(FieldCreatedBy, vs...)) +} + +// CreatedByNotIn applies the NotIn predicate on the "created_by" field. +func CreatedByNotIn(vs ...string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldNotIn(FieldCreatedBy, vs...)) +} + +// CreatedByGT applies the GT predicate on the "created_by" field. +func CreatedByGT(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldGT(FieldCreatedBy, v)) +} + +// CreatedByGTE applies the GTE predicate on the "created_by" field. +func CreatedByGTE(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldGTE(FieldCreatedBy, v)) +} + +// CreatedByLT applies the LT predicate on the "created_by" field. +func CreatedByLT(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldLT(FieldCreatedBy, v)) +} + +// CreatedByLTE applies the LTE predicate on the "created_by" field. +func CreatedByLTE(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldLTE(FieldCreatedBy, v)) +} + +// CreatedByContains applies the Contains predicate on the "created_by" field. +func CreatedByContains(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldContains(FieldCreatedBy, v)) +} + +// CreatedByHasPrefix applies the HasPrefix predicate on the "created_by" field. +func CreatedByHasPrefix(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldHasPrefix(FieldCreatedBy, v)) +} + +// CreatedByHasSuffix applies the HasSuffix predicate on the "created_by" field. +func CreatedByHasSuffix(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldHasSuffix(FieldCreatedBy, v)) +} + +// CreatedByIsNil applies the IsNil predicate on the "created_by" field. +func CreatedByIsNil() predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldIsNull(FieldCreatedBy)) +} + +// CreatedByNotNil applies the NotNil predicate on the "created_by" field. +func CreatedByNotNil() predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldNotNull(FieldCreatedBy)) +} + +// CreatedByEqualFold applies the EqualFold predicate on the "created_by" field. +func CreatedByEqualFold(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldEqualFold(FieldCreatedBy, v)) +} + +// CreatedByContainsFold applies the ContainsFold predicate on the "created_by" field. +func CreatedByContainsFold(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldContainsFold(FieldCreatedBy, v)) +} + +// UpdatedByEQ applies the EQ predicate on the "updated_by" field. +func UpdatedByEQ(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldEQ(FieldUpdatedBy, v)) +} + +// UpdatedByNEQ applies the NEQ predicate on the "updated_by" field. +func UpdatedByNEQ(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldNEQ(FieldUpdatedBy, v)) +} + +// UpdatedByIn applies the In predicate on the "updated_by" field. +func UpdatedByIn(vs ...string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldIn(FieldUpdatedBy, vs...)) +} + +// UpdatedByNotIn applies the NotIn predicate on the "updated_by" field. +func UpdatedByNotIn(vs ...string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldNotIn(FieldUpdatedBy, vs...)) +} + +// UpdatedByGT applies the GT predicate on the "updated_by" field. +func UpdatedByGT(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldGT(FieldUpdatedBy, v)) +} + +// UpdatedByGTE applies the GTE predicate on the "updated_by" field. +func UpdatedByGTE(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldGTE(FieldUpdatedBy, v)) +} + +// UpdatedByLT applies the LT predicate on the "updated_by" field. +func UpdatedByLT(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldLT(FieldUpdatedBy, v)) +} + +// UpdatedByLTE applies the LTE predicate on the "updated_by" field. +func UpdatedByLTE(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldLTE(FieldUpdatedBy, v)) +} + +// UpdatedByContains applies the Contains predicate on the "updated_by" field. +func UpdatedByContains(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldContains(FieldUpdatedBy, v)) +} + +// UpdatedByHasPrefix applies the HasPrefix predicate on the "updated_by" field. +func UpdatedByHasPrefix(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldHasPrefix(FieldUpdatedBy, v)) +} + +// UpdatedByHasSuffix applies the HasSuffix predicate on the "updated_by" field. +func UpdatedByHasSuffix(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldHasSuffix(FieldUpdatedBy, v)) +} + +// UpdatedByIsNil applies the IsNil predicate on the "updated_by" field. +func UpdatedByIsNil() predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldIsNull(FieldUpdatedBy)) +} + +// UpdatedByNotNil applies the NotNil predicate on the "updated_by" field. +func UpdatedByNotNil() predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldNotNull(FieldUpdatedBy)) +} + +// UpdatedByEqualFold applies the EqualFold predicate on the "updated_by" field. +func UpdatedByEqualFold(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldEqualFold(FieldUpdatedBy, v)) +} + +// UpdatedByContainsFold applies the ContainsFold predicate on the "updated_by" field. +func UpdatedByContainsFold(v string) predicate.LoadBalancer { + return predicate.LoadBalancer(sql.FieldContainsFold(FieldUpdatedBy, v)) +} + // NameEQ applies the EQ predicate on the "name" field. func NameEQ(v string) predicate.LoadBalancer { return predicate.LoadBalancer(sql.FieldEQ(FieldName, v)) diff --git a/internal/ent/generated/loadbalancer_create.go b/internal/ent/generated/loadbalancer_create.go index 1418d874b..04154c7e7 100644 --- a/internal/ent/generated/loadbalancer_create.go +++ b/internal/ent/generated/loadbalancer_create.go @@ -65,6 +65,34 @@ func (lbc *LoadBalancerCreate) SetNillableUpdatedAt(t *time.Time) *LoadBalancerC return lbc } +// SetCreatedBy sets the "created_by" field. +func (lbc *LoadBalancerCreate) SetCreatedBy(s string) *LoadBalancerCreate { + lbc.mutation.SetCreatedBy(s) + return lbc +} + +// SetNillableCreatedBy sets the "created_by" field if the given value is not nil. +func (lbc *LoadBalancerCreate) SetNillableCreatedBy(s *string) *LoadBalancerCreate { + if s != nil { + lbc.SetCreatedBy(*s) + } + return lbc +} + +// SetUpdatedBy sets the "updated_by" field. +func (lbc *LoadBalancerCreate) SetUpdatedBy(s string) *LoadBalancerCreate { + lbc.mutation.SetUpdatedBy(s) + return lbc +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (lbc *LoadBalancerCreate) SetNillableUpdatedBy(s *string) *LoadBalancerCreate { + if s != nil { + lbc.SetUpdatedBy(*s) + } + return lbc +} + // SetName sets the "name" field. func (lbc *LoadBalancerCreate) SetName(s string) *LoadBalancerCreate { lbc.mutation.SetName(s) @@ -130,7 +158,9 @@ func (lbc *LoadBalancerCreate) Mutation() *LoadBalancerMutation { // Save creates the LoadBalancer in the database. func (lbc *LoadBalancerCreate) Save(ctx context.Context) (*LoadBalancer, error) { - lbc.defaults() + if err := lbc.defaults(); err != nil { + return nil, err + } return withHooks(ctx, lbc.sqlSave, lbc.mutation, lbc.hooks) } @@ -157,19 +187,29 @@ func (lbc *LoadBalancerCreate) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (lbc *LoadBalancerCreate) defaults() { +func (lbc *LoadBalancerCreate) defaults() error { if _, ok := lbc.mutation.CreatedAt(); !ok { + if loadbalancer.DefaultCreatedAt == nil { + return fmt.Errorf("generated: uninitialized loadbalancer.DefaultCreatedAt (forgotten import generated/runtime?)") + } v := loadbalancer.DefaultCreatedAt() lbc.mutation.SetCreatedAt(v) } if _, ok := lbc.mutation.UpdatedAt(); !ok { + if loadbalancer.DefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized loadbalancer.DefaultUpdatedAt (forgotten import generated/runtime?)") + } v := loadbalancer.DefaultUpdatedAt() lbc.mutation.SetUpdatedAt(v) } if _, ok := lbc.mutation.ID(); !ok { + if loadbalancer.DefaultID == nil { + return fmt.Errorf("generated: uninitialized loadbalancer.DefaultID (forgotten import generated/runtime?)") + } v := loadbalancer.DefaultID() lbc.mutation.SetID(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -258,6 +298,14 @@ func (lbc *LoadBalancerCreate) createSpec() (*LoadBalancer, *sqlgraph.CreateSpec _spec.SetField(loadbalancer.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } + if value, ok := lbc.mutation.CreatedBy(); ok { + _spec.SetField(loadbalancer.FieldCreatedBy, field.TypeString, value) + _node.CreatedBy = value + } + if value, ok := lbc.mutation.UpdatedBy(); ok { + _spec.SetField(loadbalancer.FieldUpdatedBy, field.TypeString, value) + _node.UpdatedBy = value + } if value, ok := lbc.mutation.Name(); ok { _spec.SetField(loadbalancer.FieldName, field.TypeString, value) _node.Name = value diff --git a/internal/ent/generated/loadbalancer_update.go b/internal/ent/generated/loadbalancer_update.go index ac741b4ce..02dd0d9ef 100644 --- a/internal/ent/generated/loadbalancer_update.go +++ b/internal/ent/generated/loadbalancer_update.go @@ -43,6 +43,26 @@ func (lbu *LoadBalancerUpdate) Where(ps ...predicate.LoadBalancer) *LoadBalancer return lbu } +// SetUpdatedBy sets the "updated_by" field. +func (lbu *LoadBalancerUpdate) SetUpdatedBy(s string) *LoadBalancerUpdate { + lbu.mutation.SetUpdatedBy(s) + return lbu +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (lbu *LoadBalancerUpdate) SetNillableUpdatedBy(s *string) *LoadBalancerUpdate { + if s != nil { + lbu.SetUpdatedBy(*s) + } + return lbu +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (lbu *LoadBalancerUpdate) ClearUpdatedBy() *LoadBalancerUpdate { + lbu.mutation.ClearUpdatedBy() + return lbu +} + // SetName sets the "name" field. func (lbu *LoadBalancerUpdate) SetName(s string) *LoadBalancerUpdate { lbu.mutation.SetName(s) @@ -92,7 +112,9 @@ func (lbu *LoadBalancerUpdate) RemovePorts(p ...*Port) *LoadBalancerUpdate { // Save executes the query and returns the number of nodes affected by the update operation. func (lbu *LoadBalancerUpdate) Save(ctx context.Context) (int, error) { - lbu.defaults() + if err := lbu.defaults(); err != nil { + return 0, err + } return withHooks(ctx, lbu.sqlSave, lbu.mutation, lbu.hooks) } @@ -119,11 +141,15 @@ func (lbu *LoadBalancerUpdate) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (lbu *LoadBalancerUpdate) defaults() { +func (lbu *LoadBalancerUpdate) defaults() error { if _, ok := lbu.mutation.UpdatedAt(); !ok { + if loadbalancer.UpdateDefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized loadbalancer.UpdateDefaultUpdatedAt (forgotten import generated/runtime?)") + } v := loadbalancer.UpdateDefaultUpdatedAt() lbu.mutation.SetUpdatedAt(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -154,6 +180,15 @@ func (lbu *LoadBalancerUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := lbu.mutation.UpdatedAt(); ok { _spec.SetField(loadbalancer.FieldUpdatedAt, field.TypeTime, value) } + if lbu.mutation.CreatedByCleared() { + _spec.ClearField(loadbalancer.FieldCreatedBy, field.TypeString) + } + if value, ok := lbu.mutation.UpdatedBy(); ok { + _spec.SetField(loadbalancer.FieldUpdatedBy, field.TypeString, value) + } + if lbu.mutation.UpdatedByCleared() { + _spec.ClearField(loadbalancer.FieldUpdatedBy, field.TypeString) + } if value, ok := lbu.mutation.Name(); ok { _spec.SetField(loadbalancer.FieldName, field.TypeString, value) } @@ -222,6 +257,26 @@ type LoadBalancerUpdateOne struct { mutation *LoadBalancerMutation } +// SetUpdatedBy sets the "updated_by" field. +func (lbuo *LoadBalancerUpdateOne) SetUpdatedBy(s string) *LoadBalancerUpdateOne { + lbuo.mutation.SetUpdatedBy(s) + return lbuo +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (lbuo *LoadBalancerUpdateOne) SetNillableUpdatedBy(s *string) *LoadBalancerUpdateOne { + if s != nil { + lbuo.SetUpdatedBy(*s) + } + return lbuo +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (lbuo *LoadBalancerUpdateOne) ClearUpdatedBy() *LoadBalancerUpdateOne { + lbuo.mutation.ClearUpdatedBy() + return lbuo +} + // SetName sets the "name" field. func (lbuo *LoadBalancerUpdateOne) SetName(s string) *LoadBalancerUpdateOne { lbuo.mutation.SetName(s) @@ -284,7 +339,9 @@ func (lbuo *LoadBalancerUpdateOne) Select(field string, fields ...string) *LoadB // Save executes the query and returns the updated LoadBalancer entity. func (lbuo *LoadBalancerUpdateOne) Save(ctx context.Context) (*LoadBalancer, error) { - lbuo.defaults() + if err := lbuo.defaults(); err != nil { + return nil, err + } return withHooks(ctx, lbuo.sqlSave, lbuo.mutation, lbuo.hooks) } @@ -311,11 +368,15 @@ func (lbuo *LoadBalancerUpdateOne) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (lbuo *LoadBalancerUpdateOne) defaults() { +func (lbuo *LoadBalancerUpdateOne) defaults() error { if _, ok := lbuo.mutation.UpdatedAt(); !ok { + if loadbalancer.UpdateDefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized loadbalancer.UpdateDefaultUpdatedAt (forgotten import generated/runtime?)") + } v := loadbalancer.UpdateDefaultUpdatedAt() lbuo.mutation.SetUpdatedAt(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -363,6 +424,15 @@ func (lbuo *LoadBalancerUpdateOne) sqlSave(ctx context.Context) (_node *LoadBala if value, ok := lbuo.mutation.UpdatedAt(); ok { _spec.SetField(loadbalancer.FieldUpdatedAt, field.TypeTime, value) } + if lbuo.mutation.CreatedByCleared() { + _spec.ClearField(loadbalancer.FieldCreatedBy, field.TypeString) + } + if value, ok := lbuo.mutation.UpdatedBy(); ok { + _spec.SetField(loadbalancer.FieldUpdatedBy, field.TypeString, value) + } + if lbuo.mutation.UpdatedByCleared() { + _spec.ClearField(loadbalancer.FieldUpdatedBy, field.TypeString) + } if value, ok := lbuo.mutation.Name(); ok { _spec.SetField(loadbalancer.FieldName, field.TypeString, value) } diff --git a/internal/ent/generated/migrate/schema.go b/internal/ent/generated/migrate/schema.go index 3af7f748a..89f71b083 100644 --- a/internal/ent/generated/migrate/schema.go +++ b/internal/ent/generated/migrate/schema.go @@ -27,6 +27,8 @@ var ( {Name: "id", Type: field.TypeString, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, + {Name: "created_by", Type: field.TypeString, Nullable: true}, + {Name: "updated_by", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString, Size: 2147483647}, {Name: "owner_id", Type: field.TypeString}, {Name: "location_id", Type: field.TypeString}, @@ -40,7 +42,7 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "load_balancers_providers_provider", - Columns: []*schema.Column{LoadBalancersColumns[6]}, + Columns: []*schema.Column{LoadBalancersColumns[8]}, RefColumns: []*schema.Column{ProvidersColumns[0]}, OnDelete: schema.NoAction, }, @@ -59,17 +61,17 @@ var ( { Name: "loadbalancer_provider_id", Unique: false, - Columns: []*schema.Column{LoadBalancersColumns[6]}, + Columns: []*schema.Column{LoadBalancersColumns[8]}, }, { Name: "loadbalancer_location_id", Unique: false, - Columns: []*schema.Column{LoadBalancersColumns[5]}, + Columns: []*schema.Column{LoadBalancersColumns[7]}, }, { Name: "loadbalancer_owner_id", Unique: false, - Columns: []*schema.Column{LoadBalancersColumns[4]}, + Columns: []*schema.Column{LoadBalancersColumns[6]}, }, }, } diff --git a/internal/ent/generated/mutation.go b/internal/ent/generated/mutation.go index 404173fcf..3e9fd9238 100644 --- a/internal/ent/generated/mutation.go +++ b/internal/ent/generated/mutation.go @@ -58,6 +58,8 @@ type LoadBalancerMutation struct { id *gidx.PrefixedID created_at *time.Time updated_at *time.Time + created_by *string + updated_by *string name *string owner_id *gidx.PrefixedID location_id *gidx.PrefixedID @@ -248,6 +250,104 @@ func (m *LoadBalancerMutation) ResetUpdatedAt() { m.updated_at = nil } +// SetCreatedBy sets the "created_by" field. +func (m *LoadBalancerMutation) SetCreatedBy(s string) { + m.created_by = &s +} + +// CreatedBy returns the value of the "created_by" field in the mutation. +func (m *LoadBalancerMutation) CreatedBy() (r string, exists bool) { + v := m.created_by + if v == nil { + return + } + return *v, true +} + +// OldCreatedBy returns the old "created_by" field's value of the LoadBalancer entity. +// If the LoadBalancer 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 *LoadBalancerMutation) OldCreatedBy(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCreatedBy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCreatedBy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCreatedBy: %w", err) + } + return oldValue.CreatedBy, nil +} + +// ClearCreatedBy clears the value of the "created_by" field. +func (m *LoadBalancerMutation) ClearCreatedBy() { + m.created_by = nil + m.clearedFields[loadbalancer.FieldCreatedBy] = struct{}{} +} + +// CreatedByCleared returns if the "created_by" field was cleared in this mutation. +func (m *LoadBalancerMutation) CreatedByCleared() bool { + _, ok := m.clearedFields[loadbalancer.FieldCreatedBy] + return ok +} + +// ResetCreatedBy resets all changes to the "created_by" field. +func (m *LoadBalancerMutation) ResetCreatedBy() { + m.created_by = nil + delete(m.clearedFields, loadbalancer.FieldCreatedBy) +} + +// SetUpdatedBy sets the "updated_by" field. +func (m *LoadBalancerMutation) SetUpdatedBy(s string) { + m.updated_by = &s +} + +// UpdatedBy returns the value of the "updated_by" field in the mutation. +func (m *LoadBalancerMutation) UpdatedBy() (r string, exists bool) { + v := m.updated_by + if v == nil { + return + } + return *v, true +} + +// OldUpdatedBy returns the old "updated_by" field's value of the LoadBalancer entity. +// If the LoadBalancer 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 *LoadBalancerMutation) OldUpdatedBy(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldUpdatedBy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldUpdatedBy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldUpdatedBy: %w", err) + } + return oldValue.UpdatedBy, nil +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (m *LoadBalancerMutation) ClearUpdatedBy() { + m.updated_by = nil + m.clearedFields[loadbalancer.FieldUpdatedBy] = struct{}{} +} + +// UpdatedByCleared returns if the "updated_by" field was cleared in this mutation. +func (m *LoadBalancerMutation) UpdatedByCleared() bool { + _, ok := m.clearedFields[loadbalancer.FieldUpdatedBy] + return ok +} + +// ResetUpdatedBy resets all changes to the "updated_by" field. +func (m *LoadBalancerMutation) ResetUpdatedBy() { + m.updated_by = nil + delete(m.clearedFields, loadbalancer.FieldUpdatedBy) +} + // SetName sets the "name" field. func (m *LoadBalancerMutation) SetName(s string) { m.name = &s @@ -507,13 +607,19 @@ func (m *LoadBalancerMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *LoadBalancerMutation) Fields() []string { - fields := make([]string, 0, 6) + fields := make([]string, 0, 8) if m.created_at != nil { fields = append(fields, loadbalancer.FieldCreatedAt) } if m.updated_at != nil { fields = append(fields, loadbalancer.FieldUpdatedAt) } + if m.created_by != nil { + fields = append(fields, loadbalancer.FieldCreatedBy) + } + if m.updated_by != nil { + fields = append(fields, loadbalancer.FieldUpdatedBy) + } if m.name != nil { fields = append(fields, loadbalancer.FieldName) } @@ -538,6 +644,10 @@ func (m *LoadBalancerMutation) Field(name string) (ent.Value, bool) { return m.CreatedAt() case loadbalancer.FieldUpdatedAt: return m.UpdatedAt() + case loadbalancer.FieldCreatedBy: + return m.CreatedBy() + case loadbalancer.FieldUpdatedBy: + return m.UpdatedBy() case loadbalancer.FieldName: return m.Name() case loadbalancer.FieldOwnerID: @@ -559,6 +669,10 @@ func (m *LoadBalancerMutation) OldField(ctx context.Context, name string) (ent.V return m.OldCreatedAt(ctx) case loadbalancer.FieldUpdatedAt: return m.OldUpdatedAt(ctx) + case loadbalancer.FieldCreatedBy: + return m.OldCreatedBy(ctx) + case loadbalancer.FieldUpdatedBy: + return m.OldUpdatedBy(ctx) case loadbalancer.FieldName: return m.OldName(ctx) case loadbalancer.FieldOwnerID: @@ -590,6 +704,20 @@ func (m *LoadBalancerMutation) SetField(name string, value ent.Value) error { } m.SetUpdatedAt(v) return nil + case loadbalancer.FieldCreatedBy: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedBy(v) + return nil + case loadbalancer.FieldUpdatedBy: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetUpdatedBy(v) + return nil case loadbalancer.FieldName: v, ok := value.(string) if !ok { @@ -647,7 +775,14 @@ func (m *LoadBalancerMutation) AddField(name string, value ent.Value) error { // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *LoadBalancerMutation) ClearedFields() []string { - return nil + var fields []string + if m.FieldCleared(loadbalancer.FieldCreatedBy) { + fields = append(fields, loadbalancer.FieldCreatedBy) + } + if m.FieldCleared(loadbalancer.FieldUpdatedBy) { + fields = append(fields, loadbalancer.FieldUpdatedBy) + } + return fields } // FieldCleared returns a boolean indicating if a field with the given name was @@ -660,6 +795,14 @@ func (m *LoadBalancerMutation) FieldCleared(name string) bool { // 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 *LoadBalancerMutation) ClearField(name string) error { + switch name { + case loadbalancer.FieldCreatedBy: + m.ClearCreatedBy() + return nil + case loadbalancer.FieldUpdatedBy: + m.ClearUpdatedBy() + return nil + } return fmt.Errorf("unknown LoadBalancer nullable field %s", name) } @@ -673,6 +816,12 @@ func (m *LoadBalancerMutation) ResetField(name string) error { case loadbalancer.FieldUpdatedAt: m.ResetUpdatedAt() return nil + case loadbalancer.FieldCreatedBy: + m.ResetCreatedBy() + return nil + case loadbalancer.FieldUpdatedBy: + m.ResetUpdatedBy() + return nil case loadbalancer.FieldName: m.ResetName() return nil diff --git a/internal/ent/generated/runtime.go b/internal/ent/generated/runtime.go index 40b521c21..b710d4761 100644 --- a/internal/ent/generated/runtime.go +++ b/internal/ent/generated/runtime.go @@ -16,222 +16,4 @@ package generated -import ( - "time" - - "go.infratographer.com/load-balancer-api/internal/ent/generated/loadbalancer" - "go.infratographer.com/load-balancer-api/internal/ent/generated/origin" - "go.infratographer.com/load-balancer-api/internal/ent/generated/pool" - "go.infratographer.com/load-balancer-api/internal/ent/generated/port" - "go.infratographer.com/load-balancer-api/internal/ent/generated/provider" - "go.infratographer.com/load-balancer-api/internal/ent/schema" - "go.infratographer.com/x/gidx" -) - -// The init function reads all schema descriptors with runtime code -// (default values, validators, hooks and policies) and stitches it -// to their package variables. -func init() { - loadbalancerMixin := schema.LoadBalancer{}.Mixin() - loadbalancerMixinFields0 := loadbalancerMixin[0].Fields() - _ = loadbalancerMixinFields0 - loadbalancerFields := schema.LoadBalancer{}.Fields() - _ = loadbalancerFields - // loadbalancerDescCreatedAt is the schema descriptor for created_at field. - loadbalancerDescCreatedAt := loadbalancerMixinFields0[0].Descriptor() - // loadbalancer.DefaultCreatedAt holds the default value on creation for the created_at field. - loadbalancer.DefaultCreatedAt = loadbalancerDescCreatedAt.Default.(func() time.Time) - // loadbalancerDescUpdatedAt is the schema descriptor for updated_at field. - loadbalancerDescUpdatedAt := loadbalancerMixinFields0[1].Descriptor() - // loadbalancer.DefaultUpdatedAt holds the default value on creation for the updated_at field. - loadbalancer.DefaultUpdatedAt = loadbalancerDescUpdatedAt.Default.(func() time.Time) - // loadbalancer.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. - loadbalancer.UpdateDefaultUpdatedAt = loadbalancerDescUpdatedAt.UpdateDefault.(func() time.Time) - // loadbalancerDescName is the schema descriptor for name field. - loadbalancerDescName := loadbalancerFields[1].Descriptor() - // loadbalancer.NameValidator is a validator for the "name" field. It is called by the builders before save. - loadbalancer.NameValidator = loadbalancerDescName.Validators[0].(func(string) error) - // loadbalancerDescOwnerID is the schema descriptor for owner_id field. - loadbalancerDescOwnerID := loadbalancerFields[2].Descriptor() - // loadbalancer.OwnerIDValidator is a validator for the "owner_id" field. It is called by the builders before save. - loadbalancer.OwnerIDValidator = loadbalancerDescOwnerID.Validators[0].(func(string) error) - // loadbalancerDescLocationID is the schema descriptor for location_id field. - loadbalancerDescLocationID := loadbalancerFields[3].Descriptor() - // loadbalancer.LocationIDValidator is a validator for the "location_id" field. It is called by the builders before save. - loadbalancer.LocationIDValidator = loadbalancerDescLocationID.Validators[0].(func(string) error) - // loadbalancerDescProviderID is the schema descriptor for provider_id field. - loadbalancerDescProviderID := loadbalancerFields[4].Descriptor() - // loadbalancer.ProviderIDValidator is a validator for the "provider_id" field. It is called by the builders before save. - loadbalancer.ProviderIDValidator = loadbalancerDescProviderID.Validators[0].(func(string) error) - // loadbalancerDescID is the schema descriptor for id field. - loadbalancerDescID := loadbalancerFields[0].Descriptor() - // loadbalancer.DefaultID holds the default value on creation for the id field. - loadbalancer.DefaultID = loadbalancerDescID.Default.(func() gidx.PrefixedID) - originMixin := schema.Origin{}.Mixin() - originMixinFields0 := originMixin[0].Fields() - _ = originMixinFields0 - originFields := schema.Origin{}.Fields() - _ = originFields - // originDescCreatedAt is the schema descriptor for created_at field. - originDescCreatedAt := originMixinFields0[0].Descriptor() - // origin.DefaultCreatedAt holds the default value on creation for the created_at field. - origin.DefaultCreatedAt = originDescCreatedAt.Default.(func() time.Time) - // originDescUpdatedAt is the schema descriptor for updated_at field. - originDescUpdatedAt := originMixinFields0[1].Descriptor() - // origin.DefaultUpdatedAt holds the default value on creation for the updated_at field. - origin.DefaultUpdatedAt = originDescUpdatedAt.Default.(func() time.Time) - // origin.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. - origin.UpdateDefaultUpdatedAt = originDescUpdatedAt.UpdateDefault.(func() time.Time) - // originDescName is the schema descriptor for name field. - originDescName := originFields[1].Descriptor() - // origin.NameValidator is a validator for the "name" field. It is called by the builders before save. - origin.NameValidator = originDescName.Validators[0].(func(string) error) - // originDescWeight is the schema descriptor for weight field. - originDescWeight := originFields[2].Descriptor() - // origin.DefaultWeight holds the default value on creation for the weight field. - origin.DefaultWeight = originDescWeight.Default.(int32) - // originDescTarget is the schema descriptor for target field. - originDescTarget := originFields[3].Descriptor() - // origin.TargetValidator is a validator for the "target" field. It is called by the builders before save. - origin.TargetValidator = func() func(string) error { - validators := originDescTarget.Validators - fns := [...]func(string) error{ - validators[0].(func(string) error), - validators[1].(func(string) error), - } - return func(target string) error { - for _, fn := range fns { - if err := fn(target); err != nil { - return err - } - } - return nil - } - }() - // originDescPortNumber is the schema descriptor for port_number field. - originDescPortNumber := originFields[4].Descriptor() - // origin.PortNumberValidator is a validator for the "port_number" field. It is called by the builders before save. - origin.PortNumberValidator = func() func(int) error { - validators := originDescPortNumber.Validators - fns := [...]func(int) error{ - validators[0].(func(int) error), - validators[1].(func(int) error), - } - return func(port_number int) error { - for _, fn := range fns { - if err := fn(port_number); err != nil { - return err - } - } - return nil - } - }() - // originDescActive is the schema descriptor for active field. - originDescActive := originFields[5].Descriptor() - // origin.DefaultActive holds the default value on creation for the active field. - origin.DefaultActive = originDescActive.Default.(bool) - // originDescPoolID is the schema descriptor for pool_id field. - originDescPoolID := originFields[6].Descriptor() - // origin.PoolIDValidator is a validator for the "pool_id" field. It is called by the builders before save. - origin.PoolIDValidator = originDescPoolID.Validators[0].(func(string) error) - // originDescID is the schema descriptor for id field. - originDescID := originFields[0].Descriptor() - // origin.DefaultID holds the default value on creation for the id field. - origin.DefaultID = originDescID.Default.(func() gidx.PrefixedID) - poolMixin := schema.Pool{}.Mixin() - poolMixinFields0 := poolMixin[0].Fields() - _ = poolMixinFields0 - poolFields := schema.Pool{}.Fields() - _ = poolFields - // poolDescCreatedAt is the schema descriptor for created_at field. - poolDescCreatedAt := poolMixinFields0[0].Descriptor() - // pool.DefaultCreatedAt holds the default value on creation for the created_at field. - pool.DefaultCreatedAt = poolDescCreatedAt.Default.(func() time.Time) - // poolDescUpdatedAt is the schema descriptor for updated_at field. - poolDescUpdatedAt := poolMixinFields0[1].Descriptor() - // pool.DefaultUpdatedAt holds the default value on creation for the updated_at field. - pool.DefaultUpdatedAt = poolDescUpdatedAt.Default.(func() time.Time) - // pool.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. - pool.UpdateDefaultUpdatedAt = poolDescUpdatedAt.UpdateDefault.(func() time.Time) - // poolDescName is the schema descriptor for name field. - poolDescName := poolFields[1].Descriptor() - // pool.NameValidator is a validator for the "name" field. It is called by the builders before save. - pool.NameValidator = poolDescName.Validators[0].(func(string) error) - // poolDescOwnerID is the schema descriptor for owner_id field. - poolDescOwnerID := poolFields[3].Descriptor() - // pool.OwnerIDValidator is a validator for the "owner_id" field. It is called by the builders before save. - pool.OwnerIDValidator = poolDescOwnerID.Validators[0].(func(string) error) - // poolDescID is the schema descriptor for id field. - poolDescID := poolFields[0].Descriptor() - // pool.DefaultID holds the default value on creation for the id field. - pool.DefaultID = poolDescID.Default.(func() gidx.PrefixedID) - portMixin := schema.Port{}.Mixin() - portMixinFields0 := portMixin[0].Fields() - _ = portMixinFields0 - portFields := schema.Port{}.Fields() - _ = portFields - // portDescCreatedAt is the schema descriptor for created_at field. - portDescCreatedAt := portMixinFields0[0].Descriptor() - // port.DefaultCreatedAt holds the default value on creation for the created_at field. - port.DefaultCreatedAt = portDescCreatedAt.Default.(func() time.Time) - // portDescUpdatedAt is the schema descriptor for updated_at field. - portDescUpdatedAt := portMixinFields0[1].Descriptor() - // port.DefaultUpdatedAt holds the default value on creation for the updated_at field. - port.DefaultUpdatedAt = portDescUpdatedAt.Default.(func() time.Time) - // port.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. - port.UpdateDefaultUpdatedAt = portDescUpdatedAt.UpdateDefault.(func() time.Time) - // portDescNumber is the schema descriptor for number field. - portDescNumber := portFields[1].Descriptor() - // port.NumberValidator is a validator for the "number" field. It is called by the builders before save. - port.NumberValidator = func() func(int) error { - validators := portDescNumber.Validators - fns := [...]func(int) error{ - validators[0].(func(int) error), - validators[1].(func(int) error), - validators[2].(func(int) error), - } - return func(number int) error { - for _, fn := range fns { - if err := fn(number); err != nil { - return err - } - } - return nil - } - }() - // portDescLoadBalancerID is the schema descriptor for load_balancer_id field. - portDescLoadBalancerID := portFields[3].Descriptor() - // port.LoadBalancerIDValidator is a validator for the "load_balancer_id" field. It is called by the builders before save. - port.LoadBalancerIDValidator = portDescLoadBalancerID.Validators[0].(func(string) error) - // portDescID is the schema descriptor for id field. - portDescID := portFields[0].Descriptor() - // port.DefaultID holds the default value on creation for the id field. - port.DefaultID = portDescID.Default.(func() gidx.PrefixedID) - providerMixin := schema.Provider{}.Mixin() - providerMixinFields0 := providerMixin[0].Fields() - _ = providerMixinFields0 - providerFields := schema.Provider{}.Fields() - _ = providerFields - // providerDescCreatedAt is the schema descriptor for created_at field. - providerDescCreatedAt := providerMixinFields0[0].Descriptor() - // provider.DefaultCreatedAt holds the default value on creation for the created_at field. - provider.DefaultCreatedAt = providerDescCreatedAt.Default.(func() time.Time) - // providerDescUpdatedAt is the schema descriptor for updated_at field. - providerDescUpdatedAt := providerMixinFields0[1].Descriptor() - // provider.DefaultUpdatedAt holds the default value on creation for the updated_at field. - provider.DefaultUpdatedAt = providerDescUpdatedAt.Default.(func() time.Time) - // provider.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. - provider.UpdateDefaultUpdatedAt = providerDescUpdatedAt.UpdateDefault.(func() time.Time) - // providerDescName is the schema descriptor for name field. - providerDescName := providerFields[1].Descriptor() - // provider.NameValidator is a validator for the "name" field. It is called by the builders before save. - provider.NameValidator = providerDescName.Validators[0].(func(string) error) - // providerDescOwnerID is the schema descriptor for owner_id field. - providerDescOwnerID := providerFields[2].Descriptor() - // provider.OwnerIDValidator is a validator for the "owner_id" field. It is called by the builders before save. - provider.OwnerIDValidator = providerDescOwnerID.Validators[0].(func(string) error) - // providerDescID is the schema descriptor for id field. - providerDescID := providerFields[0].Descriptor() - // provider.DefaultID holds the default value on creation for the id field. - provider.DefaultID = providerDescID.Default.(func() gidx.PrefixedID) -} +// The schema-stitching logic is generated in go.infratographer.com/load-balancer-api/internal/ent/generated/runtime/runtime.go diff --git a/internal/ent/generated/runtime/runtime.go b/internal/ent/generated/runtime/runtime.go index ca071b138..0c13decc6 100644 --- a/internal/ent/generated/runtime/runtime.go +++ b/internal/ent/generated/runtime/runtime.go @@ -16,7 +16,227 @@ package runtime -// The schema-stitching logic is generated in go.infratographer.com/load-balancer-api/internal/ent/generated/runtime.go +import ( + "time" + + "go.infratographer.com/load-balancer-api/internal/ent/generated/loadbalancer" + "go.infratographer.com/load-balancer-api/internal/ent/generated/origin" + "go.infratographer.com/load-balancer-api/internal/ent/generated/pool" + "go.infratographer.com/load-balancer-api/internal/ent/generated/port" + "go.infratographer.com/load-balancer-api/internal/ent/generated/provider" + "go.infratographer.com/load-balancer-api/internal/ent/schema" + "go.infratographer.com/x/gidx" +) + +// The init function reads all schema descriptors with runtime code +// (default values, validators, hooks and policies) and stitches it +// to their package variables. +func init() { + loadbalancerMixin := schema.LoadBalancer{}.Mixin() + loadbalancerMixinHooks1 := loadbalancerMixin[1].Hooks() + loadbalancer.Hooks[0] = loadbalancerMixinHooks1[0] + loadbalancerMixinFields0 := loadbalancerMixin[0].Fields() + _ = loadbalancerMixinFields0 + loadbalancerFields := schema.LoadBalancer{}.Fields() + _ = loadbalancerFields + // loadbalancerDescCreatedAt is the schema descriptor for created_at field. + loadbalancerDescCreatedAt := loadbalancerMixinFields0[0].Descriptor() + // loadbalancer.DefaultCreatedAt holds the default value on creation for the created_at field. + loadbalancer.DefaultCreatedAt = loadbalancerDescCreatedAt.Default.(func() time.Time) + // loadbalancerDescUpdatedAt is the schema descriptor for updated_at field. + loadbalancerDescUpdatedAt := loadbalancerMixinFields0[1].Descriptor() + // loadbalancer.DefaultUpdatedAt holds the default value on creation for the updated_at field. + loadbalancer.DefaultUpdatedAt = loadbalancerDescUpdatedAt.Default.(func() time.Time) + // loadbalancer.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. + loadbalancer.UpdateDefaultUpdatedAt = loadbalancerDescUpdatedAt.UpdateDefault.(func() time.Time) + // loadbalancerDescName is the schema descriptor for name field. + loadbalancerDescName := loadbalancerFields[1].Descriptor() + // loadbalancer.NameValidator is a validator for the "name" field. It is called by the builders before save. + loadbalancer.NameValidator = loadbalancerDescName.Validators[0].(func(string) error) + // loadbalancerDescOwnerID is the schema descriptor for owner_id field. + loadbalancerDescOwnerID := loadbalancerFields[2].Descriptor() + // loadbalancer.OwnerIDValidator is a validator for the "owner_id" field. It is called by the builders before save. + loadbalancer.OwnerIDValidator = loadbalancerDescOwnerID.Validators[0].(func(string) error) + // loadbalancerDescLocationID is the schema descriptor for location_id field. + loadbalancerDescLocationID := loadbalancerFields[3].Descriptor() + // loadbalancer.LocationIDValidator is a validator for the "location_id" field. It is called by the builders before save. + loadbalancer.LocationIDValidator = loadbalancerDescLocationID.Validators[0].(func(string) error) + // loadbalancerDescProviderID is the schema descriptor for provider_id field. + loadbalancerDescProviderID := loadbalancerFields[4].Descriptor() + // loadbalancer.ProviderIDValidator is a validator for the "provider_id" field. It is called by the builders before save. + loadbalancer.ProviderIDValidator = loadbalancerDescProviderID.Validators[0].(func(string) error) + // loadbalancerDescID is the schema descriptor for id field. + loadbalancerDescID := loadbalancerFields[0].Descriptor() + // loadbalancer.DefaultID holds the default value on creation for the id field. + loadbalancer.DefaultID = loadbalancerDescID.Default.(func() gidx.PrefixedID) + originMixin := schema.Origin{}.Mixin() + originMixinFields0 := originMixin[0].Fields() + _ = originMixinFields0 + originFields := schema.Origin{}.Fields() + _ = originFields + // originDescCreatedAt is the schema descriptor for created_at field. + originDescCreatedAt := originMixinFields0[0].Descriptor() + // origin.DefaultCreatedAt holds the default value on creation for the created_at field. + origin.DefaultCreatedAt = originDescCreatedAt.Default.(func() time.Time) + // originDescUpdatedAt is the schema descriptor for updated_at field. + originDescUpdatedAt := originMixinFields0[1].Descriptor() + // origin.DefaultUpdatedAt holds the default value on creation for the updated_at field. + origin.DefaultUpdatedAt = originDescUpdatedAt.Default.(func() time.Time) + // origin.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. + origin.UpdateDefaultUpdatedAt = originDescUpdatedAt.UpdateDefault.(func() time.Time) + // originDescName is the schema descriptor for name field. + originDescName := originFields[1].Descriptor() + // origin.NameValidator is a validator for the "name" field. It is called by the builders before save. + origin.NameValidator = originDescName.Validators[0].(func(string) error) + // originDescWeight is the schema descriptor for weight field. + originDescWeight := originFields[2].Descriptor() + // origin.DefaultWeight holds the default value on creation for the weight field. + origin.DefaultWeight = originDescWeight.Default.(int32) + // originDescTarget is the schema descriptor for target field. + originDescTarget := originFields[3].Descriptor() + // origin.TargetValidator is a validator for the "target" field. It is called by the builders before save. + origin.TargetValidator = func() func(string) error { + validators := originDescTarget.Validators + fns := [...]func(string) error{ + validators[0].(func(string) error), + validators[1].(func(string) error), + } + return func(target string) error { + for _, fn := range fns { + if err := fn(target); err != nil { + return err + } + } + return nil + } + }() + // originDescPortNumber is the schema descriptor for port_number field. + originDescPortNumber := originFields[4].Descriptor() + // origin.PortNumberValidator is a validator for the "port_number" field. It is called by the builders before save. + origin.PortNumberValidator = func() func(int) error { + validators := originDescPortNumber.Validators + fns := [...]func(int) error{ + validators[0].(func(int) error), + validators[1].(func(int) error), + } + return func(port_number int) error { + for _, fn := range fns { + if err := fn(port_number); err != nil { + return err + } + } + return nil + } + }() + // originDescActive is the schema descriptor for active field. + originDescActive := originFields[5].Descriptor() + // origin.DefaultActive holds the default value on creation for the active field. + origin.DefaultActive = originDescActive.Default.(bool) + // originDescPoolID is the schema descriptor for pool_id field. + originDescPoolID := originFields[6].Descriptor() + // origin.PoolIDValidator is a validator for the "pool_id" field. It is called by the builders before save. + origin.PoolIDValidator = originDescPoolID.Validators[0].(func(string) error) + // originDescID is the schema descriptor for id field. + originDescID := originFields[0].Descriptor() + // origin.DefaultID holds the default value on creation for the id field. + origin.DefaultID = originDescID.Default.(func() gidx.PrefixedID) + poolMixin := schema.Pool{}.Mixin() + poolMixinFields0 := poolMixin[0].Fields() + _ = poolMixinFields0 + poolFields := schema.Pool{}.Fields() + _ = poolFields + // poolDescCreatedAt is the schema descriptor for created_at field. + poolDescCreatedAt := poolMixinFields0[0].Descriptor() + // pool.DefaultCreatedAt holds the default value on creation for the created_at field. + pool.DefaultCreatedAt = poolDescCreatedAt.Default.(func() time.Time) + // poolDescUpdatedAt is the schema descriptor for updated_at field. + poolDescUpdatedAt := poolMixinFields0[1].Descriptor() + // pool.DefaultUpdatedAt holds the default value on creation for the updated_at field. + pool.DefaultUpdatedAt = poolDescUpdatedAt.Default.(func() time.Time) + // pool.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. + pool.UpdateDefaultUpdatedAt = poolDescUpdatedAt.UpdateDefault.(func() time.Time) + // poolDescName is the schema descriptor for name field. + poolDescName := poolFields[1].Descriptor() + // pool.NameValidator is a validator for the "name" field. It is called by the builders before save. + pool.NameValidator = poolDescName.Validators[0].(func(string) error) + // poolDescOwnerID is the schema descriptor for owner_id field. + poolDescOwnerID := poolFields[3].Descriptor() + // pool.OwnerIDValidator is a validator for the "owner_id" field. It is called by the builders before save. + pool.OwnerIDValidator = poolDescOwnerID.Validators[0].(func(string) error) + // poolDescID is the schema descriptor for id field. + poolDescID := poolFields[0].Descriptor() + // pool.DefaultID holds the default value on creation for the id field. + pool.DefaultID = poolDescID.Default.(func() gidx.PrefixedID) + portMixin := schema.Port{}.Mixin() + portMixinFields0 := portMixin[0].Fields() + _ = portMixinFields0 + portFields := schema.Port{}.Fields() + _ = portFields + // portDescCreatedAt is the schema descriptor for created_at field. + portDescCreatedAt := portMixinFields0[0].Descriptor() + // port.DefaultCreatedAt holds the default value on creation for the created_at field. + port.DefaultCreatedAt = portDescCreatedAt.Default.(func() time.Time) + // portDescUpdatedAt is the schema descriptor for updated_at field. + portDescUpdatedAt := portMixinFields0[1].Descriptor() + // port.DefaultUpdatedAt holds the default value on creation for the updated_at field. + port.DefaultUpdatedAt = portDescUpdatedAt.Default.(func() time.Time) + // port.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. + port.UpdateDefaultUpdatedAt = portDescUpdatedAt.UpdateDefault.(func() time.Time) + // portDescNumber is the schema descriptor for number field. + portDescNumber := portFields[1].Descriptor() + // port.NumberValidator is a validator for the "number" field. It is called by the builders before save. + port.NumberValidator = func() func(int) error { + validators := portDescNumber.Validators + fns := [...]func(int) error{ + validators[0].(func(int) error), + validators[1].(func(int) error), + validators[2].(func(int) error), + } + return func(number int) error { + for _, fn := range fns { + if err := fn(number); err != nil { + return err + } + } + return nil + } + }() + // portDescLoadBalancerID is the schema descriptor for load_balancer_id field. + portDescLoadBalancerID := portFields[3].Descriptor() + // port.LoadBalancerIDValidator is a validator for the "load_balancer_id" field. It is called by the builders before save. + port.LoadBalancerIDValidator = portDescLoadBalancerID.Validators[0].(func(string) error) + // portDescID is the schema descriptor for id field. + portDescID := portFields[0].Descriptor() + // port.DefaultID holds the default value on creation for the id field. + port.DefaultID = portDescID.Default.(func() gidx.PrefixedID) + providerMixin := schema.Provider{}.Mixin() + providerMixinFields0 := providerMixin[0].Fields() + _ = providerMixinFields0 + providerFields := schema.Provider{}.Fields() + _ = providerFields + // providerDescCreatedAt is the schema descriptor for created_at field. + providerDescCreatedAt := providerMixinFields0[0].Descriptor() + // provider.DefaultCreatedAt holds the default value on creation for the created_at field. + provider.DefaultCreatedAt = providerDescCreatedAt.Default.(func() time.Time) + // providerDescUpdatedAt is the schema descriptor for updated_at field. + providerDescUpdatedAt := providerMixinFields0[1].Descriptor() + // provider.DefaultUpdatedAt holds the default value on creation for the updated_at field. + provider.DefaultUpdatedAt = providerDescUpdatedAt.Default.(func() time.Time) + // provider.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. + provider.UpdateDefaultUpdatedAt = providerDescUpdatedAt.UpdateDefault.(func() time.Time) + // providerDescName is the schema descriptor for name field. + providerDescName := providerFields[1].Descriptor() + // provider.NameValidator is a validator for the "name" field. It is called by the builders before save. + provider.NameValidator = providerDescName.Validators[0].(func(string) error) + // providerDescOwnerID is the schema descriptor for owner_id field. + providerDescOwnerID := providerFields[2].Descriptor() + // provider.OwnerIDValidator is a validator for the "owner_id" field. It is called by the builders before save. + provider.OwnerIDValidator = providerDescOwnerID.Validators[0].(func(string) error) + // providerDescID is the schema descriptor for id field. + providerDescID := providerFields[0].Descriptor() + // provider.DefaultID holds the default value on creation for the id field. + provider.DefaultID = providerDescID.Default.(func() gidx.PrefixedID) +} const ( Version = "v0.12.4" // Version of ent codegen. diff --git a/internal/ent/schema/audit/errors.go b/internal/ent/schema/audit/errors.go new file mode 100644 index 000000000..166551d53 --- /dev/null +++ b/internal/ent/schema/audit/errors.go @@ -0,0 +1,18 @@ +package audit + +import ( + "errors" + "fmt" + + "entgo.io/ent" +) + +var ( + // errUnexpectedMutation is returned when an unexpected mutation is encountered + errUnexpectedMutation = errors.New("unexpected mutatino type") +) + +// newUnexpectedMutationErorr returns the UnexpectedAuditError in string format +func newUnexpectedMutationError(m ent.Mutation) error { + return fmt.Errorf("%s: %T", errUnexpectedMutation, m) +} diff --git a/internal/ent/schema/audit/mixin.go b/internal/ent/schema/audit/mixin.go new file mode 100644 index 000000000..e2f9cb084 --- /dev/null +++ b/internal/ent/schema/audit/mixin.go @@ -0,0 +1,69 @@ +package audit + +import ( + "context" + "errors" + "fmt" + + "entgo.io/ent" + "entgo.io/ent/schema/field" + "entgo.io/ent/schema/mixin" + "go.infratographer.com/x/echojwtx" +) + +// AuditMixin provides auditing for all records where enabled. The created_at, created_by, updated_at, and updated_by records are automatically populated when this mixin is enabled. +type AuditMixin struct { + mixin.Schema +} + +// Fields of the AuditMixin +func (AuditMixin) Fields() []ent.Field { + return []ent.Field{ + field.String("created_by"). + Immutable(). + Optional(), + field.String("updated_by"). + Optional(), + } +} + +// Hooks of the AuditMixin +func (AuditMixin) Hooks() []ent.Hook { + return []ent.Hook{ + AuditHook, + } +} + +// AuditHook sets and returns the created_at, updated_at, etc., fields +func AuditHook(next ent.Mutator) ent.Mutator { + type AuditLogger interface { + SetCreatedBy(string) + CreatedBy() (id string, exists bool) + SetUpdatedBy(string) + UpdatedBy() (id string, exists bool) + } + + return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { + ml, ok := m.(AuditLogger) + if !ok { + return nil, errors.New("unexpected mutation type") + } + actor := "unknown-actor" + id, ok := ctx.Value(echojwtx.ActorCtxKey).(string) + if ok { + actor = id + } + + switch op := m.Op(); { + case op.Is(ent.OpCreate): + ml.SetCreatedBy(actor) + ml.SetUpdatedBy(actor) + fmt.Println("chacha") + + case op.Is(ent.OpUpdateOne | ent.OpUpdate): + ml.SetUpdatedBy(actor) + } + + return next.Mutate(ctx, m) + }) +} diff --git a/internal/ent/schema/loadbalancer.go b/internal/ent/schema/loadbalancer.go index a14d53bdb..9fe99f614 100644 --- a/internal/ent/schema/loadbalancer.go +++ b/internal/ent/schema/loadbalancer.go @@ -12,6 +12,7 @@ import ( "go.infratographer.com/x/entx" "go.infratographer.com/x/gidx" + "go.infratographer.com/load-balancer-api/internal/ent/schema/audit" "go.infratographer.com/load-balancer-api/x/pubsubinfo" ) @@ -24,6 +25,7 @@ type LoadBalancer struct { func (LoadBalancer) Mixin() []ent.Mixin { return []ent.Mixin{ entx.NewTimestampMixin(), + audit.AuditMixin{}, // softdelete.Mixin{}, } } diff --git a/internal/graphapi/gen_server.go b/internal/graphapi/gen_server.go index a9a6bbd4e..dff105670 100644 --- a/internal/graphapi/gen_server.go +++ b/internal/graphapi/gen_server.go @@ -68,6 +68,7 @@ type ComplexityRoot struct { LoadBalancer struct { CreatedAt func(childComplexity int) int + CreatedBy func(childComplexity int) int ID func(childComplexity int) int Location func(childComplexity int) int Name func(childComplexity int) int @@ -75,6 +76,7 @@ type ComplexityRoot struct { Ports func(childComplexity int, after *entgql.Cursor[gidx.PrefixedID], first *int, before *entgql.Cursor[gidx.PrefixedID], last *int, orderBy *generated.LoadBalancerPortOrder, where *generated.LoadBalancerPortWhereInput) int Provider func(childComplexity int) int UpdatedAt func(childComplexity int) int + UpdatedBy func(childComplexity int) int } LoadBalancerConnection struct { @@ -445,6 +447,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LoadBalancer.CreatedAt(childComplexity), true + case "LoadBalancer.createdBy": + if e.complexity.LoadBalancer.CreatedBy == nil { + break + } + + return e.complexity.LoadBalancer.CreatedBy(childComplexity), true + case "LoadBalancer.id": if e.complexity.LoadBalancer.ID == nil { break @@ -499,6 +508,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LoadBalancer.UpdatedAt(childComplexity), true + case "LoadBalancer.updatedBy": + if e.complexity.LoadBalancer.UpdatedBy == nil { + break + } + + return e.complexity.LoadBalancer.UpdatedBy(childComplexity), true + case "LoadBalancerConnection.edges": if e.complexity.LoadBalancerConnection.Edges == nil { break @@ -1493,6 +1509,8 @@ var sources = []*ast.Source{ directive @goModel(model: String, models: [String!]) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION """Input information to create a load balancer.""" input CreateLoadBalancerInput { + createdBy: String + updatedBy: String """The name of the load balancer.""" name: String! """The ID for the owner for this load balancer.""" @@ -1554,6 +1572,8 @@ type LoadBalancer implements Node & IPAddressable & MetadataNode @key(fields: "i id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String """The name of the load balancer.""" name: String! ports( @@ -2117,6 +2137,38 @@ input LoadBalancerWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -2192,6 +2244,8 @@ type Query { scalar Time """Input information to update a load balancer.""" input UpdateLoadBalancerInput { + updatedBy: String + clearUpdatedBy: Boolean """The name of the load balancer.""" name: String addPortIDs: [ID!] @@ -3789,6 +3843,10 @@ func (ec *executionContext) fieldContext_Entity_findLoadBalancerByID(ctx context return ec.fieldContext_LoadBalancer_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancer_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancer_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancer_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancer_name(ctx, field) case "ports": @@ -4369,6 +4427,88 @@ func (ec *executionContext) fieldContext_LoadBalancer_updatedAt(ctx context.Cont return fc, nil } +func (ec *executionContext) _LoadBalancer_createdBy(ctx context.Context, field graphql.CollectedField, obj *generated.LoadBalancer) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancer_createdBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoadBalancer_createdBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoadBalancer", + 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) _LoadBalancer_updatedBy(ctx context.Context, field graphql.CollectedField, obj *generated.LoadBalancer) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancer_updatedBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoadBalancer_updatedBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoadBalancer", + 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) _LoadBalancer_name(ctx context.Context, field graphql.CollectedField, obj *generated.LoadBalancer) (ret graphql.Marshaler) { fc, err := ec.fieldContext_LoadBalancer_name(ctx, field) if err != nil { @@ -4828,6 +4968,10 @@ func (ec *executionContext) fieldContext_LoadBalancerCreatePayload_loadBalancer( return ec.fieldContext_LoadBalancer_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancer_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancer_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancer_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancer_name(ctx, field) case "ports": @@ -4931,6 +5075,10 @@ func (ec *executionContext) fieldContext_LoadBalancerEdge_node(ctx context.Conte return ec.fieldContext_LoadBalancer_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancer_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancer_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancer_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancer_name(ctx, field) case "ports": @@ -7109,6 +7257,10 @@ func (ec *executionContext) fieldContext_LoadBalancerPort_loadBalancer(ctx conte return ec.fieldContext_LoadBalancer_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancer_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancer_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancer_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancer_name(ctx, field) case "ports": @@ -8284,6 +8436,10 @@ func (ec *executionContext) fieldContext_LoadBalancerUpdatePayload_loadBalancer( return ec.fieldContext_LoadBalancer_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancer_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancer_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancer_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancer_name(ctx, field) case "ports": @@ -9571,6 +9727,10 @@ func (ec *executionContext) fieldContext_Query_loadBalancer(ctx context.Context, return ec.fieldContext_LoadBalancer_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancer_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancer_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancer_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancer_name(ctx, field) case "ports": @@ -12029,13 +12189,31 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerInput(ctx context.Co asMap[k] = v } - fieldsInOrder := [...]string{"name", "ownerID", "locationID", "portIDs", "providerID"} + fieldsInOrder := [...]string{"createdBy", "updatedBy", "name", "ownerID", "locationID", "portIDs", "providerID"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "createdBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedBy = data + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data case "name": var err error @@ -14552,7 +14730,7 @@ func (ec *executionContext) unmarshalInputLoadBalancerWhereInput(ctx context.Con asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "hasPorts", "hasPortsWith", "hasProvider", "hasProviderWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "hasPorts", "hasPortsWith", "hasProvider", "hasProviderWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -14802,6 +14980,276 @@ func (ec *executionContext) unmarshalInputLoadBalancerWhereInput(ctx context.Con return it, err } it.UpdatedAtLTE = data + case "createdBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedBy = data + case "createdByNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByNEQ = data + case "createdByIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedByIn = data + case "createdByNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedByNotIn = data + case "createdByGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByGT = data + case "createdByGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByGTE = data + case "createdByLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByLT = data + case "createdByLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByLTE = data + case "createdByContains": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByContains = data + case "createdByHasPrefix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByHasPrefix = data + case "createdByHasSuffix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByHasSuffix = data + case "createdByIsNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.CreatedByIsNil = data + case "createdByNotNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.CreatedByNotNil = data + case "createdByEqualFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByEqualFold = data + case "createdByContainsFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByContainsFold = data + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data + case "updatedByNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByNEQ = data + case "updatedByIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByIn = data + case "updatedByNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByNotIn = data + case "updatedByGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByGT = data + case "updatedByGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByGTE = data + case "updatedByLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByLT = data + case "updatedByLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByLTE = data + case "updatedByContains": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByContains = data + case "updatedByHasPrefix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByHasPrefix = data + case "updatedByHasSuffix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByHasSuffix = data + case "updatedByIsNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByIsNil = data + case "updatedByNotNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByNotNil = data + case "updatedByEqualFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByEqualFold = data + case "updatedByContainsFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByContainsFold = data case "name": var err error @@ -14968,13 +15416,31 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerInput(ctx context.Co asMap[k] = v } - fieldsInOrder := [...]string{"name", "addPortIDs", "removePortIDs", "clearPorts"} + fieldsInOrder := [...]string{"updatedBy", "clearUpdatedBy", "name", "addPortIDs", "removePortIDs", "clearPorts"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data + case "clearUpdatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearUpdatedBy")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClearUpdatedBy = data case "name": var err error @@ -15622,6 +16088,10 @@ func (ec *executionContext) _LoadBalancer(ctx context.Context, sel ast.Selection if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } + case "createdBy": + out.Values[i] = ec._LoadBalancer_createdBy(ctx, field, obj) + case "updatedBy": + out.Values[i] = ec._LoadBalancer_updatedBy(ctx, field, obj) case "name": out.Values[i] = ec._LoadBalancer_name(ctx, field, obj) if out.Values[i] == graphql.Null { diff --git a/internal/graphapi/loadbalancer.resolvers.go b/internal/graphapi/loadbalancer.resolvers.go index b151fa407..6586b1522 100644 --- a/internal/graphapi/loadbalancer.resolvers.go +++ b/internal/graphapi/loadbalancer.resolvers.go @@ -8,16 +8,16 @@ import ( "context" "database/sql" - "go.infratographer.com/permissions-api/pkg/permissions" - "go.infratographer.com/x/events" - "go.infratographer.com/x/gidx" - "go.infratographer.com/load-balancer-api/internal/config" "go.infratographer.com/load-balancer-api/internal/ent/generated" "go.infratographer.com/load-balancer-api/internal/ent/generated/loadbalancer" "go.infratographer.com/load-balancer-api/internal/ent/generated/port" "go.infratographer.com/load-balancer-api/internal/ent/generated/predicate" + _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" "go.infratographer.com/load-balancer-api/pkg/metadata" + "go.infratographer.com/permissions-api/pkg/permissions" + "go.infratographer.com/x/events" + "go.infratographer.com/x/gidx" ) // LoadBalancerCreate is the resolver for the loadBalancerCreate field. diff --git a/internal/graphapi/origin.resolvers.go b/internal/graphapi/origin.resolvers.go index 71e1c4a25..0b8c03cdf 100644 --- a/internal/graphapi/origin.resolvers.go +++ b/internal/graphapi/origin.resolvers.go @@ -7,14 +7,13 @@ package graphapi import ( "context" - "go.infratographer.com/permissions-api/pkg/permissions" - "go.infratographer.com/x/gidx" - "go.infratographer.com/load-balancer-api/internal/ent/generated" "go.infratographer.com/load-balancer-api/internal/ent/generated/origin" "go.infratographer.com/load-balancer-api/internal/ent/generated/pool" "go.infratographer.com/load-balancer-api/internal/ent/generated/port" "go.infratographer.com/load-balancer-api/pkg/metadata" + "go.infratographer.com/permissions-api/pkg/permissions" + "go.infratographer.com/x/gidx" ) // LoadBalancerOriginCreate is the resolver for the loadBalancerOriginCreate field. diff --git a/internal/graphapi/pool.resolvers.go b/internal/graphapi/pool.resolvers.go index 12c295439..6e1d1f847 100644 --- a/internal/graphapi/pool.resolvers.go +++ b/internal/graphapi/pool.resolvers.go @@ -8,10 +8,6 @@ import ( "context" "database/sql" - "go.infratographer.com/permissions-api/pkg/permissions" - "go.infratographer.com/x/gidx" - "golang.org/x/exp/slices" - "go.infratographer.com/load-balancer-api/internal/ent/generated" "go.infratographer.com/load-balancer-api/internal/ent/generated/loadbalancer" "go.infratographer.com/load-balancer-api/internal/ent/generated/origin" @@ -19,6 +15,9 @@ import ( "go.infratographer.com/load-balancer-api/internal/ent/generated/port" "go.infratographer.com/load-balancer-api/internal/ent/generated/predicate" "go.infratographer.com/load-balancer-api/pkg/metadata" + "go.infratographer.com/permissions-api/pkg/permissions" + "go.infratographer.com/x/gidx" + "golang.org/x/exp/slices" ) // LoadBalancerPoolCreate is the resolver for the LoadBalancerPoolCreate field. diff --git a/internal/graphapi/port.resolvers.go b/internal/graphapi/port.resolvers.go index 1724c8d80..9222a4afe 100644 --- a/internal/graphapi/port.resolvers.go +++ b/internal/graphapi/port.resolvers.go @@ -8,13 +8,12 @@ import ( "context" "strings" - "go.infratographer.com/permissions-api/pkg/permissions" - "go.infratographer.com/x/gidx" - "go.infratographer.com/load-balancer-api/internal/ent/generated" "go.infratographer.com/load-balancer-api/internal/ent/generated/pool" "go.infratographer.com/load-balancer-api/internal/ent/generated/port" "go.infratographer.com/load-balancer-api/pkg/metadata" + "go.infratographer.com/permissions-api/pkg/permissions" + "go.infratographer.com/x/gidx" ) // LoadBalancerPortCreate is the resolver for the loadBalancerPortCreate field. diff --git a/internal/graphclient/gen_models.go b/internal/graphclient/gen_models.go index f05f180d9..447aec221 100644 --- a/internal/graphclient/gen_models.go +++ b/internal/graphclient/gen_models.go @@ -35,6 +35,8 @@ type Entity interface { // Input information to create a load balancer. type CreateLoadBalancerInput struct { + CreatedBy *string `json:"createdBy,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` // The name of the load balancer. Name string `json:"name"` // The ID for the owner for this load balancer. @@ -88,6 +90,8 @@ type LoadBalancer struct { ID gidx.PrefixedID `json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` + CreatedBy *string `json:"createdBy,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` // The name of the load balancer. Name string `json:"name"` Ports LoadBalancerPortConnection `json:"ports"` @@ -703,6 +707,38 @@ type LoadBalancerWhereInput struct { UpdatedAtGte *time.Time `json:"updatedAtGTE,omitempty"` UpdatedAtLt *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLte *time.Time `json:"updatedAtLTE,omitempty"` + // created_by field predicates + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByNeq *string `json:"createdByNEQ,omitempty"` + CreatedByIn []string `json:"createdByIn,omitempty"` + CreatedByNotIn []string `json:"createdByNotIn,omitempty"` + CreatedByGt *string `json:"createdByGT,omitempty"` + CreatedByGte *string `json:"createdByGTE,omitempty"` + CreatedByLt *string `json:"createdByLT,omitempty"` + CreatedByLte *string `json:"createdByLTE,omitempty"` + CreatedByContains *string `json:"createdByContains,omitempty"` + CreatedByHasPrefix *string `json:"createdByHasPrefix,omitempty"` + CreatedByHasSuffix *string `json:"createdByHasSuffix,omitempty"` + CreatedByIsNil *bool `json:"createdByIsNil,omitempty"` + CreatedByNotNil *bool `json:"createdByNotNil,omitempty"` + CreatedByEqualFold *string `json:"createdByEqualFold,omitempty"` + CreatedByContainsFold *string `json:"createdByContainsFold,omitempty"` + // updated_by field predicates + UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedByNeq *string `json:"updatedByNEQ,omitempty"` + UpdatedByIn []string `json:"updatedByIn,omitempty"` + UpdatedByNotIn []string `json:"updatedByNotIn,omitempty"` + UpdatedByGt *string `json:"updatedByGT,omitempty"` + UpdatedByGte *string `json:"updatedByGTE,omitempty"` + UpdatedByLt *string `json:"updatedByLT,omitempty"` + UpdatedByLte *string `json:"updatedByLTE,omitempty"` + UpdatedByContains *string `json:"updatedByContains,omitempty"` + UpdatedByHasPrefix *string `json:"updatedByHasPrefix,omitempty"` + UpdatedByHasSuffix *string `json:"updatedByHasSuffix,omitempty"` + UpdatedByIsNil *bool `json:"updatedByIsNil,omitempty"` + UpdatedByNotNil *bool `json:"updatedByNotNil,omitempty"` + UpdatedByEqualFold *string `json:"updatedByEqualFold,omitempty"` + UpdatedByContainsFold *string `json:"updatedByContainsFold,omitempty"` // name field predicates Name *string `json:"name,omitempty"` NameNeq *string `json:"nameNEQ,omitempty"` @@ -756,6 +792,8 @@ func (ResourceOwner) IsEntity() {} // Input information to update a load balancer. type UpdateLoadBalancerInput struct { + UpdatedBy *string `json:"updatedBy,omitempty"` + ClearUpdatedBy *bool `json:"clearUpdatedBy,omitempty"` // The name of the load balancer. Name *string `json:"name,omitempty"` AddPortIDs []gidx.PrefixedID `json:"addPortIDs,omitempty"` diff --git a/internal/graphclient/schema/schema.graphql b/internal/graphclient/schema/schema.graphql index 654c61ad1..4191abffd 100644 --- a/internal/graphclient/schema/schema.graphql +++ b/internal/graphclient/schema/schema.graphql @@ -13,6 +13,8 @@ directive @shareable repeatable on FIELD_DEFINITION | OBJECT directive @tag(name: String!) repeatable on ARGUMENT_DEFINITION | ENUM | ENUM_VALUE | FIELD_DEFINITION | INPUT_FIELD_DEFINITION | INPUT_OBJECT | INTERFACE | OBJECT | SCALAR | UNION """Input information to create a load balancer.""" input CreateLoadBalancerInput { + createdBy: String + updatedBy: String """The name of the load balancer.""" name: String! """The ID for the owner for this load balancer.""" @@ -78,6 +80,8 @@ type LoadBalancer implements Node & IPAddressable & MetadataNode @key(fields: "i id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String """The name of the load balancer.""" name: String! ports( @@ -724,6 +728,38 @@ input LoadBalancerWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -933,6 +969,8 @@ type ResourceOwner @interfaceObject @key(fields: "id") { scalar Time """Input information to update a load balancer.""" input UpdateLoadBalancerInput { + updatedBy: String + clearUpdatedBy: Boolean """The name of the load balancer.""" name: String addPortIDs: [ID!] diff --git a/schema.graphql b/schema.graphql index 8fef4e101..889710069 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1,6 +1,8 @@ directive @prefixedID(prefix: String!) on OBJECT """Input information to create a load balancer.""" input CreateLoadBalancerInput { + createdBy: String + updatedBy: String """The name of the load balancer.""" name: String! """The ID for the owner for this load balancer.""" @@ -65,6 +67,8 @@ type LoadBalancer implements Node & IPAddressable & MetadataNode @key(fields: "i id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String """The name of the load balancer.""" name: String! ports( @@ -711,6 +715,38 @@ input LoadBalancerWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -920,6 +956,8 @@ type ResourceOwner @interfaceObject @key(fields: "id") { scalar Time """Input information to update a load balancer.""" input UpdateLoadBalancerInput { + updatedBy: String + clearUpdatedBy: Boolean """The name of the load balancer.""" name: String addPortIDs: [ID!] diff --git a/schema/ent.graphql b/schema/ent.graphql index 29c303ef2..622ef6bb9 100644 --- a/schema/ent.graphql +++ b/schema/ent.graphql @@ -2,6 +2,8 @@ directive @goField(forceResolver: Boolean, name: String) on FIELD_DEFINITION | I directive @goModel(model: String, models: [String!]) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION """Input information to create a load balancer.""" input CreateLoadBalancerInput { + createdBy: String + updatedBy: String """The name of the load balancer.""" name: String! """The ID for the owner for this load balancer.""" @@ -63,6 +65,8 @@ type LoadBalancer implements Node & IPAddressable & MetadataNode @key(fields: "i id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String """The name of the load balancer.""" name: String! ports( @@ -626,6 +630,38 @@ input LoadBalancerWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -701,6 +737,8 @@ type Query { scalar Time """Input information to update a load balancer.""" input UpdateLoadBalancerInput { + updatedBy: String + clearUpdatedBy: Boolean """The name of the load balancer.""" name: String addPortIDs: [ID!] From 5887e1eaf122d02aca7edc842c802f75500a0c2e Mon Sep 17 00:00:00 2001 From: Tyler Auerbeck Date: Wed, 7 Feb 2024 10:08:54 -0500 Subject: [PATCH 2/7] Add audit to the rest of schemas; Update resolvers Signed-off-by: Tyler Auerbeck --- internal/ent/generated/client.go | 12 +- internal/ent/generated/gql_collection.go | 40 + internal/ent/generated/gql_mutation_input.go | 90 +- internal/ent/generated/gql_where_input.go | 496 +++ internal/ent/generated/migrate/schema.go | 22 +- internal/ent/generated/mutation.go | 612 ++- internal/ent/generated/origin.go | 24 +- internal/ent/generated/origin/origin.go | 23 + internal/ent/generated/origin/where.go | 160 + internal/ent/generated/origin_create.go | 52 +- internal/ent/generated/origin_update.go | 78 +- internal/ent/generated/pool.go | 24 +- internal/ent/generated/pool/pool.go | 23 + internal/ent/generated/pool/where.go | 160 + internal/ent/generated/pool_create.go | 52 +- internal/ent/generated/pool_update.go | 78 +- internal/ent/generated/port.go | 24 +- internal/ent/generated/port/port.go | 23 + internal/ent/generated/port/where.go | 160 + internal/ent/generated/port_create.go | 52 +- internal/ent/generated/port_update.go | 78 +- internal/ent/generated/provider.go | 24 +- internal/ent/generated/provider/provider.go | 23 + internal/ent/generated/provider/where.go | 160 + internal/ent/generated/provider_create.go | 52 +- internal/ent/generated/provider_update.go | 78 +- internal/ent/generated/runtime/runtime.go | 8 + internal/ent/schema/origin.go | 2 + internal/ent/schema/pool.go | 2 + internal/ent/schema/port.go | 2 + internal/ent/schema/provider.go | 2 + internal/graphapi/gen_server.go | 3740 +++++++++++++----- internal/graphapi/location.resolvers.go | 1 + internal/graphapi/metadata.go | 2 + internal/graphapi/origin.resolvers.go | 1 + internal/graphapi/owner.resolvers.go | 1 + internal/graphapi/pool.resolvers.go | 1 + internal/graphapi/port.resolvers.go | 1 + internal/graphapi/provider.resolvers.go | 1 + internal/graphclient/gen_models.go | 172 +- internal/graphclient/schema/schema.graphql | 152 + schema.graphql | 152 + schema/ent.graphql | 152 + 43 files changed, 6008 insertions(+), 1004 deletions(-) diff --git a/internal/ent/generated/client.go b/internal/ent/generated/client.go index 3d868881e..e54c947e7 100644 --- a/internal/ent/generated/client.go +++ b/internal/ent/generated/client.go @@ -548,7 +548,8 @@ func (c *OriginClient) QueryPool(o *Origin) *PoolQuery { // Hooks returns the client hooks. func (c *OriginClient) Hooks() []Hook { - return c.hooks.Origin + hooks := c.hooks.Origin + return append(hooks[:len(hooks):len(hooks)], origin.Hooks[:]...) } // Interceptors returns the client interceptors. @@ -713,7 +714,8 @@ func (c *PoolClient) QueryOrigins(po *Pool) *OriginQuery { // Hooks returns the client hooks. func (c *PoolClient) Hooks() []Hook { - return c.hooks.Pool + hooks := c.hooks.Pool + return append(hooks[:len(hooks):len(hooks)], pool.Hooks[:]...) } // Interceptors returns the client interceptors. @@ -878,7 +880,8 @@ func (c *PortClient) QueryLoadBalancer(po *Port) *LoadBalancerQuery { // Hooks returns the client hooks. func (c *PortClient) Hooks() []Hook { - return c.hooks.Port + hooks := c.hooks.Port + return append(hooks[:len(hooks):len(hooks)], port.Hooks[:]...) } // Interceptors returns the client interceptors. @@ -1027,7 +1030,8 @@ func (c *ProviderClient) QueryLoadBalancers(pr *Provider) *LoadBalancerQuery { // Hooks returns the client hooks. func (c *ProviderClient) Hooks() []Hook { - return c.hooks.Provider + hooks := c.hooks.Provider + return append(hooks[:len(hooks):len(hooks)], provider.Hooks[:]...) } // Interceptors returns the client interceptors. diff --git a/internal/ent/generated/gql_collection.go b/internal/ent/generated/gql_collection.go index 20ed5c782..7ddb9e52d 100644 --- a/internal/ent/generated/gql_collection.go +++ b/internal/ent/generated/gql_collection.go @@ -284,6 +284,16 @@ func (o *OriginQuery) collectField(ctx context.Context, opCtx *graphql.Operation selectedFields = append(selectedFields, origin.FieldUpdatedAt) fieldSeen[origin.FieldUpdatedAt] = struct{}{} } + case "createdBy": + if _, ok := fieldSeen[origin.FieldCreatedBy]; !ok { + selectedFields = append(selectedFields, origin.FieldCreatedBy) + fieldSeen[origin.FieldCreatedBy] = struct{}{} + } + case "updatedBy": + if _, ok := fieldSeen[origin.FieldUpdatedBy]; !ok { + selectedFields = append(selectedFields, origin.FieldUpdatedBy) + fieldSeen[origin.FieldUpdatedBy] = struct{}{} + } case "name": if _, ok := fieldSeen[origin.FieldName]; !ok { selectedFields = append(selectedFields, origin.FieldName) @@ -504,6 +514,16 @@ func (po *PoolQuery) collectField(ctx context.Context, opCtx *graphql.OperationC selectedFields = append(selectedFields, pool.FieldUpdatedAt) fieldSeen[pool.FieldUpdatedAt] = struct{}{} } + case "createdBy": + if _, ok := fieldSeen[pool.FieldCreatedBy]; !ok { + selectedFields = append(selectedFields, pool.FieldCreatedBy) + fieldSeen[pool.FieldCreatedBy] = struct{}{} + } + case "updatedBy": + if _, ok := fieldSeen[pool.FieldUpdatedBy]; !ok { + selectedFields = append(selectedFields, pool.FieldUpdatedBy) + fieldSeen[pool.FieldUpdatedBy] = struct{}{} + } case "name": if _, ok := fieldSeen[pool.FieldName]; !ok { selectedFields = append(selectedFields, pool.FieldName) @@ -639,6 +659,16 @@ func (po *PortQuery) collectField(ctx context.Context, opCtx *graphql.OperationC selectedFields = append(selectedFields, port.FieldUpdatedAt) fieldSeen[port.FieldUpdatedAt] = struct{}{} } + case "createdBy": + if _, ok := fieldSeen[port.FieldCreatedBy]; !ok { + selectedFields = append(selectedFields, port.FieldCreatedBy) + fieldSeen[port.FieldCreatedBy] = struct{}{} + } + case "updatedBy": + if _, ok := fieldSeen[port.FieldUpdatedBy]; !ok { + selectedFields = append(selectedFields, port.FieldUpdatedBy) + fieldSeen[port.FieldUpdatedBy] = struct{}{} + } case "number": if _, ok := fieldSeen[port.FieldNumber]; !ok { selectedFields = append(selectedFields, port.FieldNumber) @@ -832,6 +862,16 @@ func (pr *ProviderQuery) collectField(ctx context.Context, opCtx *graphql.Operat selectedFields = append(selectedFields, provider.FieldUpdatedAt) fieldSeen[provider.FieldUpdatedAt] = struct{}{} } + case "createdBy": + if _, ok := fieldSeen[provider.FieldCreatedBy]; !ok { + selectedFields = append(selectedFields, provider.FieldCreatedBy) + fieldSeen[provider.FieldCreatedBy] = struct{}{} + } + case "updatedBy": + if _, ok := fieldSeen[provider.FieldUpdatedBy]; !ok { + selectedFields = append(selectedFields, provider.FieldUpdatedBy) + fieldSeen[provider.FieldUpdatedBy] = struct{}{} + } case "name": if _, ok := fieldSeen[provider.FieldName]; !ok { selectedFields = append(selectedFields, provider.FieldName) diff --git a/internal/ent/generated/gql_mutation_input.go b/internal/ent/generated/gql_mutation_input.go index 80bff2578..b0a039a17 100644 --- a/internal/ent/generated/gql_mutation_input.go +++ b/internal/ent/generated/gql_mutation_input.go @@ -101,6 +101,8 @@ func (c *LoadBalancerUpdateOne) SetInput(i UpdateLoadBalancerInput) *LoadBalance // CreateLoadBalancerOriginInput represents a mutation input for creating loadbalancerorigins. type CreateLoadBalancerOriginInput struct { + CreatedBy *string + UpdatedBy *string Name string Weight *int32 Target string @@ -111,6 +113,12 @@ type CreateLoadBalancerOriginInput struct { // Mutate applies the CreateLoadBalancerOriginInput on the OriginMutation builder. func (i *CreateLoadBalancerOriginInput) Mutate(m *OriginMutation) { + if v := i.CreatedBy; v != nil { + m.SetCreatedBy(*v) + } + if v := i.UpdatedBy; v != nil { + m.SetUpdatedBy(*v) + } m.SetName(i.Name) if v := i.Weight; v != nil { m.SetWeight(*v) @@ -131,15 +139,23 @@ func (c *OriginCreate) SetInput(i CreateLoadBalancerOriginInput) *OriginCreate { // UpdateLoadBalancerOriginInput represents a mutation input for updating loadbalancerorigins. type UpdateLoadBalancerOriginInput struct { - Name *string - Weight *int32 - Target *string - PortNumber *int - Active *bool + ClearUpdatedBy bool + UpdatedBy *string + Name *string + Weight *int32 + Target *string + PortNumber *int + Active *bool } // Mutate applies the UpdateLoadBalancerOriginInput on the OriginMutation builder. func (i *UpdateLoadBalancerOriginInput) Mutate(m *OriginMutation) { + if i.ClearUpdatedBy { + m.ClearUpdatedBy() + } + if v := i.UpdatedBy; v != nil { + m.SetUpdatedBy(*v) + } if v := i.Name; v != nil { m.SetName(*v) } @@ -171,6 +187,8 @@ func (c *OriginUpdateOne) SetInput(i UpdateLoadBalancerOriginInput) *OriginUpdat // CreateLoadBalancerPoolInput represents a mutation input for creating loadbalancerpools. type CreateLoadBalancerPoolInput struct { + CreatedBy *string + UpdatedBy *string Name string Protocol pool.Protocol OwnerID gidx.PrefixedID @@ -180,6 +198,12 @@ type CreateLoadBalancerPoolInput struct { // Mutate applies the CreateLoadBalancerPoolInput on the PoolMutation builder. func (i *CreateLoadBalancerPoolInput) Mutate(m *PoolMutation) { + if v := i.CreatedBy; v != nil { + m.SetCreatedBy(*v) + } + if v := i.UpdatedBy; v != nil { + m.SetUpdatedBy(*v) + } m.SetName(i.Name) m.SetProtocol(i.Protocol) m.SetOwnerID(i.OwnerID) @@ -199,6 +223,8 @@ func (c *PoolCreate) SetInput(i CreateLoadBalancerPoolInput) *PoolCreate { // UpdateLoadBalancerPoolInput represents a mutation input for updating loadbalancerpools. type UpdateLoadBalancerPoolInput struct { + ClearUpdatedBy bool + UpdatedBy *string Name *string Protocol *pool.Protocol ClearPorts bool @@ -211,6 +237,12 @@ type UpdateLoadBalancerPoolInput struct { // Mutate applies the UpdateLoadBalancerPoolInput on the PoolMutation builder. func (i *UpdateLoadBalancerPoolInput) Mutate(m *PoolMutation) { + if i.ClearUpdatedBy { + m.ClearUpdatedBy() + } + if v := i.UpdatedBy; v != nil { + m.SetUpdatedBy(*v) + } if v := i.Name; v != nil { m.SetName(*v) } @@ -251,6 +283,8 @@ func (c *PoolUpdateOne) SetInput(i UpdateLoadBalancerPoolInput) *PoolUpdateOne { // CreateLoadBalancerPortInput represents a mutation input for creating loadbalancerports. type CreateLoadBalancerPortInput struct { + CreatedBy *string + UpdatedBy *string Number int Name string PoolIDs []gidx.PrefixedID @@ -259,6 +293,12 @@ type CreateLoadBalancerPortInput struct { // Mutate applies the CreateLoadBalancerPortInput on the PortMutation builder. func (i *CreateLoadBalancerPortInput) Mutate(m *PortMutation) { + if v := i.CreatedBy; v != nil { + m.SetCreatedBy(*v) + } + if v := i.UpdatedBy; v != nil { + m.SetUpdatedBy(*v) + } m.SetNumber(i.Number) m.SetName(i.Name) if v := i.PoolIDs; len(v) > 0 { @@ -275,15 +315,23 @@ func (c *PortCreate) SetInput(i CreateLoadBalancerPortInput) *PortCreate { // UpdateLoadBalancerPortInput represents a mutation input for updating loadbalancerports. type UpdateLoadBalancerPortInput struct { - Number *int - Name *string - ClearPools bool - AddPoolIDs []gidx.PrefixedID - RemovePoolIDs []gidx.PrefixedID + ClearUpdatedBy bool + UpdatedBy *string + Number *int + Name *string + ClearPools bool + AddPoolIDs []gidx.PrefixedID + RemovePoolIDs []gidx.PrefixedID } // Mutate applies the UpdateLoadBalancerPortInput on the PortMutation builder. func (i *UpdateLoadBalancerPortInput) Mutate(m *PortMutation) { + if i.ClearUpdatedBy { + m.ClearUpdatedBy() + } + if v := i.UpdatedBy; v != nil { + m.SetUpdatedBy(*v) + } if v := i.Number; v != nil { m.SetNumber(*v) } @@ -315,12 +363,20 @@ func (c *PortUpdateOne) SetInput(i UpdateLoadBalancerPortInput) *PortUpdateOne { // CreateLoadBalancerProviderInput represents a mutation input for creating loadbalancerproviders. type CreateLoadBalancerProviderInput struct { - Name string - OwnerID gidx.PrefixedID + CreatedBy *string + UpdatedBy *string + Name string + OwnerID gidx.PrefixedID } // Mutate applies the CreateLoadBalancerProviderInput on the ProviderMutation builder. func (i *CreateLoadBalancerProviderInput) Mutate(m *ProviderMutation) { + if v := i.CreatedBy; v != nil { + m.SetCreatedBy(*v) + } + if v := i.UpdatedBy; v != nil { + m.SetUpdatedBy(*v) + } m.SetName(i.Name) m.SetOwnerID(i.OwnerID) } @@ -333,11 +389,19 @@ func (c *ProviderCreate) SetInput(i CreateLoadBalancerProviderInput) *ProviderCr // UpdateLoadBalancerProviderInput represents a mutation input for updating loadbalancerproviders. type UpdateLoadBalancerProviderInput struct { - Name *string + ClearUpdatedBy bool + UpdatedBy *string + Name *string } // Mutate applies the UpdateLoadBalancerProviderInput on the ProviderMutation builder. func (i *UpdateLoadBalancerProviderInput) Mutate(m *ProviderMutation) { + if i.ClearUpdatedBy { + m.ClearUpdatedBy() + } + if v := i.UpdatedBy; v != nil { + m.SetUpdatedBy(*v) + } if v := i.Name; v != nil { m.SetName(*v) } diff --git a/internal/ent/generated/gql_where_input.go b/internal/ent/generated/gql_where_input.go index a74990181..a081e9619 100644 --- a/internal/ent/generated/gql_where_input.go +++ b/internal/ent/generated/gql_where_input.go @@ -481,6 +481,40 @@ type LoadBalancerOriginWhereInput struct { UpdatedAtLT *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLTE *time.Time `json:"updatedAtLTE,omitempty"` + // "created_by" field predicates. + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByNEQ *string `json:"createdByNEQ,omitempty"` + CreatedByIn []string `json:"createdByIn,omitempty"` + CreatedByNotIn []string `json:"createdByNotIn,omitempty"` + CreatedByGT *string `json:"createdByGT,omitempty"` + CreatedByGTE *string `json:"createdByGTE,omitempty"` + CreatedByLT *string `json:"createdByLT,omitempty"` + CreatedByLTE *string `json:"createdByLTE,omitempty"` + CreatedByContains *string `json:"createdByContains,omitempty"` + CreatedByHasPrefix *string `json:"createdByHasPrefix,omitempty"` + CreatedByHasSuffix *string `json:"createdByHasSuffix,omitempty"` + CreatedByIsNil bool `json:"createdByIsNil,omitempty"` + CreatedByNotNil bool `json:"createdByNotNil,omitempty"` + CreatedByEqualFold *string `json:"createdByEqualFold,omitempty"` + CreatedByContainsFold *string `json:"createdByContainsFold,omitempty"` + + // "updated_by" field predicates. + UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedByNEQ *string `json:"updatedByNEQ,omitempty"` + UpdatedByIn []string `json:"updatedByIn,omitempty"` + UpdatedByNotIn []string `json:"updatedByNotIn,omitempty"` + UpdatedByGT *string `json:"updatedByGT,omitempty"` + UpdatedByGTE *string `json:"updatedByGTE,omitempty"` + UpdatedByLT *string `json:"updatedByLT,omitempty"` + UpdatedByLTE *string `json:"updatedByLTE,omitempty"` + UpdatedByContains *string `json:"updatedByContains,omitempty"` + UpdatedByHasPrefix *string `json:"updatedByHasPrefix,omitempty"` + UpdatedByHasSuffix *string `json:"updatedByHasSuffix,omitempty"` + UpdatedByIsNil bool `json:"updatedByIsNil,omitempty"` + UpdatedByNotNil bool `json:"updatedByNotNil,omitempty"` + UpdatedByEqualFold *string `json:"updatedByEqualFold,omitempty"` + UpdatedByContainsFold *string `json:"updatedByContainsFold,omitempty"` + // "name" field predicates. Name *string `json:"name,omitempty"` NameNEQ *string `json:"nameNEQ,omitempty"` @@ -683,6 +717,96 @@ func (i *LoadBalancerOriginWhereInput) P() (predicate.Origin, error) { if i.UpdatedAtLTE != nil { predicates = append(predicates, origin.UpdatedAtLTE(*i.UpdatedAtLTE)) } + if i.CreatedBy != nil { + predicates = append(predicates, origin.CreatedByEQ(*i.CreatedBy)) + } + if i.CreatedByNEQ != nil { + predicates = append(predicates, origin.CreatedByNEQ(*i.CreatedByNEQ)) + } + if len(i.CreatedByIn) > 0 { + predicates = append(predicates, origin.CreatedByIn(i.CreatedByIn...)) + } + if len(i.CreatedByNotIn) > 0 { + predicates = append(predicates, origin.CreatedByNotIn(i.CreatedByNotIn...)) + } + if i.CreatedByGT != nil { + predicates = append(predicates, origin.CreatedByGT(*i.CreatedByGT)) + } + if i.CreatedByGTE != nil { + predicates = append(predicates, origin.CreatedByGTE(*i.CreatedByGTE)) + } + if i.CreatedByLT != nil { + predicates = append(predicates, origin.CreatedByLT(*i.CreatedByLT)) + } + if i.CreatedByLTE != nil { + predicates = append(predicates, origin.CreatedByLTE(*i.CreatedByLTE)) + } + if i.CreatedByContains != nil { + predicates = append(predicates, origin.CreatedByContains(*i.CreatedByContains)) + } + if i.CreatedByHasPrefix != nil { + predicates = append(predicates, origin.CreatedByHasPrefix(*i.CreatedByHasPrefix)) + } + if i.CreatedByHasSuffix != nil { + predicates = append(predicates, origin.CreatedByHasSuffix(*i.CreatedByHasSuffix)) + } + if i.CreatedByIsNil { + predicates = append(predicates, origin.CreatedByIsNil()) + } + if i.CreatedByNotNil { + predicates = append(predicates, origin.CreatedByNotNil()) + } + if i.CreatedByEqualFold != nil { + predicates = append(predicates, origin.CreatedByEqualFold(*i.CreatedByEqualFold)) + } + if i.CreatedByContainsFold != nil { + predicates = append(predicates, origin.CreatedByContainsFold(*i.CreatedByContainsFold)) + } + if i.UpdatedBy != nil { + predicates = append(predicates, origin.UpdatedByEQ(*i.UpdatedBy)) + } + if i.UpdatedByNEQ != nil { + predicates = append(predicates, origin.UpdatedByNEQ(*i.UpdatedByNEQ)) + } + if len(i.UpdatedByIn) > 0 { + predicates = append(predicates, origin.UpdatedByIn(i.UpdatedByIn...)) + } + if len(i.UpdatedByNotIn) > 0 { + predicates = append(predicates, origin.UpdatedByNotIn(i.UpdatedByNotIn...)) + } + if i.UpdatedByGT != nil { + predicates = append(predicates, origin.UpdatedByGT(*i.UpdatedByGT)) + } + if i.UpdatedByGTE != nil { + predicates = append(predicates, origin.UpdatedByGTE(*i.UpdatedByGTE)) + } + if i.UpdatedByLT != nil { + predicates = append(predicates, origin.UpdatedByLT(*i.UpdatedByLT)) + } + if i.UpdatedByLTE != nil { + predicates = append(predicates, origin.UpdatedByLTE(*i.UpdatedByLTE)) + } + if i.UpdatedByContains != nil { + predicates = append(predicates, origin.UpdatedByContains(*i.UpdatedByContains)) + } + if i.UpdatedByHasPrefix != nil { + predicates = append(predicates, origin.UpdatedByHasPrefix(*i.UpdatedByHasPrefix)) + } + if i.UpdatedByHasSuffix != nil { + predicates = append(predicates, origin.UpdatedByHasSuffix(*i.UpdatedByHasSuffix)) + } + if i.UpdatedByIsNil { + predicates = append(predicates, origin.UpdatedByIsNil()) + } + if i.UpdatedByNotNil { + predicates = append(predicates, origin.UpdatedByNotNil()) + } + if i.UpdatedByEqualFold != nil { + predicates = append(predicates, origin.UpdatedByEqualFold(*i.UpdatedByEqualFold)) + } + if i.UpdatedByContainsFold != nil { + predicates = append(predicates, origin.UpdatedByContainsFold(*i.UpdatedByContainsFold)) + } if i.Name != nil { predicates = append(predicates, origin.NameEQ(*i.Name)) } @@ -881,6 +1005,40 @@ type LoadBalancerPoolWhereInput struct { UpdatedAtLT *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLTE *time.Time `json:"updatedAtLTE,omitempty"` + // "created_by" field predicates. + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByNEQ *string `json:"createdByNEQ,omitempty"` + CreatedByIn []string `json:"createdByIn,omitempty"` + CreatedByNotIn []string `json:"createdByNotIn,omitempty"` + CreatedByGT *string `json:"createdByGT,omitempty"` + CreatedByGTE *string `json:"createdByGTE,omitempty"` + CreatedByLT *string `json:"createdByLT,omitempty"` + CreatedByLTE *string `json:"createdByLTE,omitempty"` + CreatedByContains *string `json:"createdByContains,omitempty"` + CreatedByHasPrefix *string `json:"createdByHasPrefix,omitempty"` + CreatedByHasSuffix *string `json:"createdByHasSuffix,omitempty"` + CreatedByIsNil bool `json:"createdByIsNil,omitempty"` + CreatedByNotNil bool `json:"createdByNotNil,omitempty"` + CreatedByEqualFold *string `json:"createdByEqualFold,omitempty"` + CreatedByContainsFold *string `json:"createdByContainsFold,omitempty"` + + // "updated_by" field predicates. + UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedByNEQ *string `json:"updatedByNEQ,omitempty"` + UpdatedByIn []string `json:"updatedByIn,omitempty"` + UpdatedByNotIn []string `json:"updatedByNotIn,omitempty"` + UpdatedByGT *string `json:"updatedByGT,omitempty"` + UpdatedByGTE *string `json:"updatedByGTE,omitempty"` + UpdatedByLT *string `json:"updatedByLT,omitempty"` + UpdatedByLTE *string `json:"updatedByLTE,omitempty"` + UpdatedByContains *string `json:"updatedByContains,omitempty"` + UpdatedByHasPrefix *string `json:"updatedByHasPrefix,omitempty"` + UpdatedByHasSuffix *string `json:"updatedByHasSuffix,omitempty"` + UpdatedByIsNil bool `json:"updatedByIsNil,omitempty"` + UpdatedByNotNil bool `json:"updatedByNotNil,omitempty"` + UpdatedByEqualFold *string `json:"updatedByEqualFold,omitempty"` + UpdatedByContainsFold *string `json:"updatedByContainsFold,omitempty"` + // "name" field predicates. Name *string `json:"name,omitempty"` NameNEQ *string `json:"nameNEQ,omitempty"` @@ -1054,6 +1212,96 @@ func (i *LoadBalancerPoolWhereInput) P() (predicate.Pool, error) { if i.UpdatedAtLTE != nil { predicates = append(predicates, pool.UpdatedAtLTE(*i.UpdatedAtLTE)) } + if i.CreatedBy != nil { + predicates = append(predicates, pool.CreatedByEQ(*i.CreatedBy)) + } + if i.CreatedByNEQ != nil { + predicates = append(predicates, pool.CreatedByNEQ(*i.CreatedByNEQ)) + } + if len(i.CreatedByIn) > 0 { + predicates = append(predicates, pool.CreatedByIn(i.CreatedByIn...)) + } + if len(i.CreatedByNotIn) > 0 { + predicates = append(predicates, pool.CreatedByNotIn(i.CreatedByNotIn...)) + } + if i.CreatedByGT != nil { + predicates = append(predicates, pool.CreatedByGT(*i.CreatedByGT)) + } + if i.CreatedByGTE != nil { + predicates = append(predicates, pool.CreatedByGTE(*i.CreatedByGTE)) + } + if i.CreatedByLT != nil { + predicates = append(predicates, pool.CreatedByLT(*i.CreatedByLT)) + } + if i.CreatedByLTE != nil { + predicates = append(predicates, pool.CreatedByLTE(*i.CreatedByLTE)) + } + if i.CreatedByContains != nil { + predicates = append(predicates, pool.CreatedByContains(*i.CreatedByContains)) + } + if i.CreatedByHasPrefix != nil { + predicates = append(predicates, pool.CreatedByHasPrefix(*i.CreatedByHasPrefix)) + } + if i.CreatedByHasSuffix != nil { + predicates = append(predicates, pool.CreatedByHasSuffix(*i.CreatedByHasSuffix)) + } + if i.CreatedByIsNil { + predicates = append(predicates, pool.CreatedByIsNil()) + } + if i.CreatedByNotNil { + predicates = append(predicates, pool.CreatedByNotNil()) + } + if i.CreatedByEqualFold != nil { + predicates = append(predicates, pool.CreatedByEqualFold(*i.CreatedByEqualFold)) + } + if i.CreatedByContainsFold != nil { + predicates = append(predicates, pool.CreatedByContainsFold(*i.CreatedByContainsFold)) + } + if i.UpdatedBy != nil { + predicates = append(predicates, pool.UpdatedByEQ(*i.UpdatedBy)) + } + if i.UpdatedByNEQ != nil { + predicates = append(predicates, pool.UpdatedByNEQ(*i.UpdatedByNEQ)) + } + if len(i.UpdatedByIn) > 0 { + predicates = append(predicates, pool.UpdatedByIn(i.UpdatedByIn...)) + } + if len(i.UpdatedByNotIn) > 0 { + predicates = append(predicates, pool.UpdatedByNotIn(i.UpdatedByNotIn...)) + } + if i.UpdatedByGT != nil { + predicates = append(predicates, pool.UpdatedByGT(*i.UpdatedByGT)) + } + if i.UpdatedByGTE != nil { + predicates = append(predicates, pool.UpdatedByGTE(*i.UpdatedByGTE)) + } + if i.UpdatedByLT != nil { + predicates = append(predicates, pool.UpdatedByLT(*i.UpdatedByLT)) + } + if i.UpdatedByLTE != nil { + predicates = append(predicates, pool.UpdatedByLTE(*i.UpdatedByLTE)) + } + if i.UpdatedByContains != nil { + predicates = append(predicates, pool.UpdatedByContains(*i.UpdatedByContains)) + } + if i.UpdatedByHasPrefix != nil { + predicates = append(predicates, pool.UpdatedByHasPrefix(*i.UpdatedByHasPrefix)) + } + if i.UpdatedByHasSuffix != nil { + predicates = append(predicates, pool.UpdatedByHasSuffix(*i.UpdatedByHasSuffix)) + } + if i.UpdatedByIsNil { + predicates = append(predicates, pool.UpdatedByIsNil()) + } + if i.UpdatedByNotNil { + predicates = append(predicates, pool.UpdatedByNotNil()) + } + if i.UpdatedByEqualFold != nil { + predicates = append(predicates, pool.UpdatedByEqualFold(*i.UpdatedByEqualFold)) + } + if i.UpdatedByContainsFold != nil { + predicates = append(predicates, pool.UpdatedByContainsFold(*i.UpdatedByContainsFold)) + } if i.Name != nil { predicates = append(predicates, pool.NameEQ(*i.Name)) } @@ -1189,6 +1437,40 @@ type LoadBalancerPortWhereInput struct { UpdatedAtLT *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLTE *time.Time `json:"updatedAtLTE,omitempty"` + // "created_by" field predicates. + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByNEQ *string `json:"createdByNEQ,omitempty"` + CreatedByIn []string `json:"createdByIn,omitempty"` + CreatedByNotIn []string `json:"createdByNotIn,omitempty"` + CreatedByGT *string `json:"createdByGT,omitempty"` + CreatedByGTE *string `json:"createdByGTE,omitempty"` + CreatedByLT *string `json:"createdByLT,omitempty"` + CreatedByLTE *string `json:"createdByLTE,omitempty"` + CreatedByContains *string `json:"createdByContains,omitempty"` + CreatedByHasPrefix *string `json:"createdByHasPrefix,omitempty"` + CreatedByHasSuffix *string `json:"createdByHasSuffix,omitempty"` + CreatedByIsNil bool `json:"createdByIsNil,omitempty"` + CreatedByNotNil bool `json:"createdByNotNil,omitempty"` + CreatedByEqualFold *string `json:"createdByEqualFold,omitempty"` + CreatedByContainsFold *string `json:"createdByContainsFold,omitempty"` + + // "updated_by" field predicates. + UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedByNEQ *string `json:"updatedByNEQ,omitempty"` + UpdatedByIn []string `json:"updatedByIn,omitempty"` + UpdatedByNotIn []string `json:"updatedByNotIn,omitempty"` + UpdatedByGT *string `json:"updatedByGT,omitempty"` + UpdatedByGTE *string `json:"updatedByGTE,omitempty"` + UpdatedByLT *string `json:"updatedByLT,omitempty"` + UpdatedByLTE *string `json:"updatedByLTE,omitempty"` + UpdatedByContains *string `json:"updatedByContains,omitempty"` + UpdatedByHasPrefix *string `json:"updatedByHasPrefix,omitempty"` + UpdatedByHasSuffix *string `json:"updatedByHasSuffix,omitempty"` + UpdatedByIsNil bool `json:"updatedByIsNil,omitempty"` + UpdatedByNotNil bool `json:"updatedByNotNil,omitempty"` + UpdatedByEqualFold *string `json:"updatedByEqualFold,omitempty"` + UpdatedByContainsFold *string `json:"updatedByContainsFold,omitempty"` + // "number" field predicates. Number *int `json:"number,omitempty"` NumberNEQ *int `json:"numberNEQ,omitempty"` @@ -1366,6 +1648,96 @@ func (i *LoadBalancerPortWhereInput) P() (predicate.Port, error) { if i.UpdatedAtLTE != nil { predicates = append(predicates, port.UpdatedAtLTE(*i.UpdatedAtLTE)) } + if i.CreatedBy != nil { + predicates = append(predicates, port.CreatedByEQ(*i.CreatedBy)) + } + if i.CreatedByNEQ != nil { + predicates = append(predicates, port.CreatedByNEQ(*i.CreatedByNEQ)) + } + if len(i.CreatedByIn) > 0 { + predicates = append(predicates, port.CreatedByIn(i.CreatedByIn...)) + } + if len(i.CreatedByNotIn) > 0 { + predicates = append(predicates, port.CreatedByNotIn(i.CreatedByNotIn...)) + } + if i.CreatedByGT != nil { + predicates = append(predicates, port.CreatedByGT(*i.CreatedByGT)) + } + if i.CreatedByGTE != nil { + predicates = append(predicates, port.CreatedByGTE(*i.CreatedByGTE)) + } + if i.CreatedByLT != nil { + predicates = append(predicates, port.CreatedByLT(*i.CreatedByLT)) + } + if i.CreatedByLTE != nil { + predicates = append(predicates, port.CreatedByLTE(*i.CreatedByLTE)) + } + if i.CreatedByContains != nil { + predicates = append(predicates, port.CreatedByContains(*i.CreatedByContains)) + } + if i.CreatedByHasPrefix != nil { + predicates = append(predicates, port.CreatedByHasPrefix(*i.CreatedByHasPrefix)) + } + if i.CreatedByHasSuffix != nil { + predicates = append(predicates, port.CreatedByHasSuffix(*i.CreatedByHasSuffix)) + } + if i.CreatedByIsNil { + predicates = append(predicates, port.CreatedByIsNil()) + } + if i.CreatedByNotNil { + predicates = append(predicates, port.CreatedByNotNil()) + } + if i.CreatedByEqualFold != nil { + predicates = append(predicates, port.CreatedByEqualFold(*i.CreatedByEqualFold)) + } + if i.CreatedByContainsFold != nil { + predicates = append(predicates, port.CreatedByContainsFold(*i.CreatedByContainsFold)) + } + if i.UpdatedBy != nil { + predicates = append(predicates, port.UpdatedByEQ(*i.UpdatedBy)) + } + if i.UpdatedByNEQ != nil { + predicates = append(predicates, port.UpdatedByNEQ(*i.UpdatedByNEQ)) + } + if len(i.UpdatedByIn) > 0 { + predicates = append(predicates, port.UpdatedByIn(i.UpdatedByIn...)) + } + if len(i.UpdatedByNotIn) > 0 { + predicates = append(predicates, port.UpdatedByNotIn(i.UpdatedByNotIn...)) + } + if i.UpdatedByGT != nil { + predicates = append(predicates, port.UpdatedByGT(*i.UpdatedByGT)) + } + if i.UpdatedByGTE != nil { + predicates = append(predicates, port.UpdatedByGTE(*i.UpdatedByGTE)) + } + if i.UpdatedByLT != nil { + predicates = append(predicates, port.UpdatedByLT(*i.UpdatedByLT)) + } + if i.UpdatedByLTE != nil { + predicates = append(predicates, port.UpdatedByLTE(*i.UpdatedByLTE)) + } + if i.UpdatedByContains != nil { + predicates = append(predicates, port.UpdatedByContains(*i.UpdatedByContains)) + } + if i.UpdatedByHasPrefix != nil { + predicates = append(predicates, port.UpdatedByHasPrefix(*i.UpdatedByHasPrefix)) + } + if i.UpdatedByHasSuffix != nil { + predicates = append(predicates, port.UpdatedByHasSuffix(*i.UpdatedByHasSuffix)) + } + if i.UpdatedByIsNil { + predicates = append(predicates, port.UpdatedByIsNil()) + } + if i.UpdatedByNotNil { + predicates = append(predicates, port.UpdatedByNotNil()) + } + if i.UpdatedByEqualFold != nil { + predicates = append(predicates, port.UpdatedByEqualFold(*i.UpdatedByEqualFold)) + } + if i.UpdatedByContainsFold != nil { + predicates = append(predicates, port.UpdatedByContainsFold(*i.UpdatedByContainsFold)) + } if i.Number != nil { predicates = append(predicates, port.NumberEQ(*i.Number)) } @@ -1513,6 +1885,40 @@ type LoadBalancerProviderWhereInput struct { UpdatedAtLT *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLTE *time.Time `json:"updatedAtLTE,omitempty"` + // "created_by" field predicates. + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByNEQ *string `json:"createdByNEQ,omitempty"` + CreatedByIn []string `json:"createdByIn,omitempty"` + CreatedByNotIn []string `json:"createdByNotIn,omitempty"` + CreatedByGT *string `json:"createdByGT,omitempty"` + CreatedByGTE *string `json:"createdByGTE,omitempty"` + CreatedByLT *string `json:"createdByLT,omitempty"` + CreatedByLTE *string `json:"createdByLTE,omitempty"` + CreatedByContains *string `json:"createdByContains,omitempty"` + CreatedByHasPrefix *string `json:"createdByHasPrefix,omitempty"` + CreatedByHasSuffix *string `json:"createdByHasSuffix,omitempty"` + CreatedByIsNil bool `json:"createdByIsNil,omitempty"` + CreatedByNotNil bool `json:"createdByNotNil,omitempty"` + CreatedByEqualFold *string `json:"createdByEqualFold,omitempty"` + CreatedByContainsFold *string `json:"createdByContainsFold,omitempty"` + + // "updated_by" field predicates. + UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedByNEQ *string `json:"updatedByNEQ,omitempty"` + UpdatedByIn []string `json:"updatedByIn,omitempty"` + UpdatedByNotIn []string `json:"updatedByNotIn,omitempty"` + UpdatedByGT *string `json:"updatedByGT,omitempty"` + UpdatedByGTE *string `json:"updatedByGTE,omitempty"` + UpdatedByLT *string `json:"updatedByLT,omitempty"` + UpdatedByLTE *string `json:"updatedByLTE,omitempty"` + UpdatedByContains *string `json:"updatedByContains,omitempty"` + UpdatedByHasPrefix *string `json:"updatedByHasPrefix,omitempty"` + UpdatedByHasSuffix *string `json:"updatedByHasSuffix,omitempty"` + UpdatedByIsNil bool `json:"updatedByIsNil,omitempty"` + UpdatedByNotNil bool `json:"updatedByNotNil,omitempty"` + UpdatedByEqualFold *string `json:"updatedByEqualFold,omitempty"` + UpdatedByContainsFold *string `json:"updatedByContainsFold,omitempty"` + // "name" field predicates. Name *string `json:"name,omitempty"` NameNEQ *string `json:"nameNEQ,omitempty"` @@ -1676,6 +2082,96 @@ func (i *LoadBalancerProviderWhereInput) P() (predicate.Provider, error) { if i.UpdatedAtLTE != nil { predicates = append(predicates, provider.UpdatedAtLTE(*i.UpdatedAtLTE)) } + if i.CreatedBy != nil { + predicates = append(predicates, provider.CreatedByEQ(*i.CreatedBy)) + } + if i.CreatedByNEQ != nil { + predicates = append(predicates, provider.CreatedByNEQ(*i.CreatedByNEQ)) + } + if len(i.CreatedByIn) > 0 { + predicates = append(predicates, provider.CreatedByIn(i.CreatedByIn...)) + } + if len(i.CreatedByNotIn) > 0 { + predicates = append(predicates, provider.CreatedByNotIn(i.CreatedByNotIn...)) + } + if i.CreatedByGT != nil { + predicates = append(predicates, provider.CreatedByGT(*i.CreatedByGT)) + } + if i.CreatedByGTE != nil { + predicates = append(predicates, provider.CreatedByGTE(*i.CreatedByGTE)) + } + if i.CreatedByLT != nil { + predicates = append(predicates, provider.CreatedByLT(*i.CreatedByLT)) + } + if i.CreatedByLTE != nil { + predicates = append(predicates, provider.CreatedByLTE(*i.CreatedByLTE)) + } + if i.CreatedByContains != nil { + predicates = append(predicates, provider.CreatedByContains(*i.CreatedByContains)) + } + if i.CreatedByHasPrefix != nil { + predicates = append(predicates, provider.CreatedByHasPrefix(*i.CreatedByHasPrefix)) + } + if i.CreatedByHasSuffix != nil { + predicates = append(predicates, provider.CreatedByHasSuffix(*i.CreatedByHasSuffix)) + } + if i.CreatedByIsNil { + predicates = append(predicates, provider.CreatedByIsNil()) + } + if i.CreatedByNotNil { + predicates = append(predicates, provider.CreatedByNotNil()) + } + if i.CreatedByEqualFold != nil { + predicates = append(predicates, provider.CreatedByEqualFold(*i.CreatedByEqualFold)) + } + if i.CreatedByContainsFold != nil { + predicates = append(predicates, provider.CreatedByContainsFold(*i.CreatedByContainsFold)) + } + if i.UpdatedBy != nil { + predicates = append(predicates, provider.UpdatedByEQ(*i.UpdatedBy)) + } + if i.UpdatedByNEQ != nil { + predicates = append(predicates, provider.UpdatedByNEQ(*i.UpdatedByNEQ)) + } + if len(i.UpdatedByIn) > 0 { + predicates = append(predicates, provider.UpdatedByIn(i.UpdatedByIn...)) + } + if len(i.UpdatedByNotIn) > 0 { + predicates = append(predicates, provider.UpdatedByNotIn(i.UpdatedByNotIn...)) + } + if i.UpdatedByGT != nil { + predicates = append(predicates, provider.UpdatedByGT(*i.UpdatedByGT)) + } + if i.UpdatedByGTE != nil { + predicates = append(predicates, provider.UpdatedByGTE(*i.UpdatedByGTE)) + } + if i.UpdatedByLT != nil { + predicates = append(predicates, provider.UpdatedByLT(*i.UpdatedByLT)) + } + if i.UpdatedByLTE != nil { + predicates = append(predicates, provider.UpdatedByLTE(*i.UpdatedByLTE)) + } + if i.UpdatedByContains != nil { + predicates = append(predicates, provider.UpdatedByContains(*i.UpdatedByContains)) + } + if i.UpdatedByHasPrefix != nil { + predicates = append(predicates, provider.UpdatedByHasPrefix(*i.UpdatedByHasPrefix)) + } + if i.UpdatedByHasSuffix != nil { + predicates = append(predicates, provider.UpdatedByHasSuffix(*i.UpdatedByHasSuffix)) + } + if i.UpdatedByIsNil { + predicates = append(predicates, provider.UpdatedByIsNil()) + } + if i.UpdatedByNotNil { + predicates = append(predicates, provider.UpdatedByNotNil()) + } + if i.UpdatedByEqualFold != nil { + predicates = append(predicates, provider.UpdatedByEqualFold(*i.UpdatedByEqualFold)) + } + if i.UpdatedByContainsFold != nil { + predicates = append(predicates, provider.UpdatedByContainsFold(*i.UpdatedByContainsFold)) + } if i.Name != nil { predicates = append(predicates, provider.NameEQ(*i.Name)) } diff --git a/internal/ent/generated/migrate/schema.go b/internal/ent/generated/migrate/schema.go index 89f71b083..d776c9008 100644 --- a/internal/ent/generated/migrate/schema.go +++ b/internal/ent/generated/migrate/schema.go @@ -80,6 +80,8 @@ var ( {Name: "id", Type: field.TypeString, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, + {Name: "created_by", Type: field.TypeString, Nullable: true}, + {Name: "updated_by", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "weight", Type: field.TypeInt32, Default: 100}, {Name: "target", Type: field.TypeString}, @@ -95,7 +97,7 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "origins_pools_pool", - Columns: []*schema.Column{OriginsColumns[8]}, + Columns: []*schema.Column{OriginsColumns[10]}, RefColumns: []*schema.Column{PoolsColumns[0]}, OnDelete: schema.NoAction, }, @@ -114,7 +116,7 @@ var ( { Name: "origin_pool_id", Unique: false, - Columns: []*schema.Column{OriginsColumns[8]}, + Columns: []*schema.Column{OriginsColumns[10]}, }, }, } @@ -123,6 +125,8 @@ var ( {Name: "id", Type: field.TypeString, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, + {Name: "created_by", Type: field.TypeString, Nullable: true}, + {Name: "updated_by", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "protocol", Type: field.TypeEnum, Enums: []string{"tcp", "udp"}}, {Name: "owner_id", Type: field.TypeString}, @@ -146,7 +150,7 @@ var ( { Name: "pool_owner_id", Unique: false, - Columns: []*schema.Column{PoolsColumns[5]}, + Columns: []*schema.Column{PoolsColumns[7]}, }, }, } @@ -155,6 +159,8 @@ var ( {Name: "id", Type: field.TypeString, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, + {Name: "created_by", Type: field.TypeString, Nullable: true}, + {Name: "updated_by", Type: field.TypeString, Nullable: true}, {Name: "number", Type: field.TypeInt}, {Name: "name", Type: field.TypeString}, {Name: "load_balancer_id", Type: field.TypeString}, @@ -167,7 +173,7 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "ports_load_balancers_load_balancer", - Columns: []*schema.Column{PortsColumns[5]}, + Columns: []*schema.Column{PortsColumns[7]}, RefColumns: []*schema.Column{LoadBalancersColumns[0]}, OnDelete: schema.NoAction, }, @@ -186,12 +192,12 @@ var ( { Name: "port_load_balancer_id", Unique: false, - Columns: []*schema.Column{PortsColumns[5]}, + Columns: []*schema.Column{PortsColumns[7]}, }, { Name: "port_load_balancer_id_number", Unique: true, - Columns: []*schema.Column{PortsColumns[5], PortsColumns[3]}, + Columns: []*schema.Column{PortsColumns[7], PortsColumns[5]}, }, }, } @@ -200,6 +206,8 @@ var ( {Name: "id", Type: field.TypeString, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, + {Name: "created_by", Type: field.TypeString, Nullable: true}, + {Name: "updated_by", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "owner_id", Type: field.TypeString}, } @@ -222,7 +230,7 @@ var ( { Name: "provider_owner_id", Unique: false, - Columns: []*schema.Column{ProvidersColumns[4]}, + Columns: []*schema.Column{ProvidersColumns[6]}, }, }, } diff --git a/internal/ent/generated/mutation.go b/internal/ent/generated/mutation.go index 3e9fd9238..c7e9c921b 100644 --- a/internal/ent/generated/mutation.go +++ b/internal/ent/generated/mutation.go @@ -948,6 +948,8 @@ type OriginMutation struct { id *gidx.PrefixedID created_at *time.Time updated_at *time.Time + created_by *string + updated_by *string name *string weight *int32 addweight *int32 @@ -1139,6 +1141,104 @@ func (m *OriginMutation) ResetUpdatedAt() { m.updated_at = nil } +// SetCreatedBy sets the "created_by" field. +func (m *OriginMutation) SetCreatedBy(s string) { + m.created_by = &s +} + +// CreatedBy returns the value of the "created_by" field in the mutation. +func (m *OriginMutation) CreatedBy() (r string, exists bool) { + v := m.created_by + if v == nil { + return + } + return *v, true +} + +// OldCreatedBy returns the old "created_by" field's value of the Origin entity. +// If the Origin 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 *OriginMutation) OldCreatedBy(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCreatedBy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCreatedBy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCreatedBy: %w", err) + } + return oldValue.CreatedBy, nil +} + +// ClearCreatedBy clears the value of the "created_by" field. +func (m *OriginMutation) ClearCreatedBy() { + m.created_by = nil + m.clearedFields[origin.FieldCreatedBy] = struct{}{} +} + +// CreatedByCleared returns if the "created_by" field was cleared in this mutation. +func (m *OriginMutation) CreatedByCleared() bool { + _, ok := m.clearedFields[origin.FieldCreatedBy] + return ok +} + +// ResetCreatedBy resets all changes to the "created_by" field. +func (m *OriginMutation) ResetCreatedBy() { + m.created_by = nil + delete(m.clearedFields, origin.FieldCreatedBy) +} + +// SetUpdatedBy sets the "updated_by" field. +func (m *OriginMutation) SetUpdatedBy(s string) { + m.updated_by = &s +} + +// UpdatedBy returns the value of the "updated_by" field in the mutation. +func (m *OriginMutation) UpdatedBy() (r string, exists bool) { + v := m.updated_by + if v == nil { + return + } + return *v, true +} + +// OldUpdatedBy returns the old "updated_by" field's value of the Origin entity. +// If the Origin 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 *OriginMutation) OldUpdatedBy(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldUpdatedBy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldUpdatedBy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldUpdatedBy: %w", err) + } + return oldValue.UpdatedBy, nil +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (m *OriginMutation) ClearUpdatedBy() { + m.updated_by = nil + m.clearedFields[origin.FieldUpdatedBy] = struct{}{} +} + +// UpdatedByCleared returns if the "updated_by" field was cleared in this mutation. +func (m *OriginMutation) UpdatedByCleared() bool { + _, ok := m.clearedFields[origin.FieldUpdatedBy] + return ok +} + +// ResetUpdatedBy resets all changes to the "updated_by" field. +func (m *OriginMutation) ResetUpdatedBy() { + m.updated_by = nil + delete(m.clearedFields, origin.FieldUpdatedBy) +} + // SetName sets the "name" field. func (m *OriginMutation) SetName(s string) { m.name = &s @@ -1456,13 +1556,19 @@ func (m *OriginMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *OriginMutation) Fields() []string { - fields := make([]string, 0, 8) + fields := make([]string, 0, 10) if m.created_at != nil { fields = append(fields, origin.FieldCreatedAt) } if m.updated_at != nil { fields = append(fields, origin.FieldUpdatedAt) } + if m.created_by != nil { + fields = append(fields, origin.FieldCreatedBy) + } + if m.updated_by != nil { + fields = append(fields, origin.FieldUpdatedBy) + } if m.name != nil { fields = append(fields, origin.FieldName) } @@ -1493,6 +1599,10 @@ func (m *OriginMutation) Field(name string) (ent.Value, bool) { return m.CreatedAt() case origin.FieldUpdatedAt: return m.UpdatedAt() + case origin.FieldCreatedBy: + return m.CreatedBy() + case origin.FieldUpdatedBy: + return m.UpdatedBy() case origin.FieldName: return m.Name() case origin.FieldWeight: @@ -1518,6 +1628,10 @@ func (m *OriginMutation) OldField(ctx context.Context, name string) (ent.Value, return m.OldCreatedAt(ctx) case origin.FieldUpdatedAt: return m.OldUpdatedAt(ctx) + case origin.FieldCreatedBy: + return m.OldCreatedBy(ctx) + case origin.FieldUpdatedBy: + return m.OldUpdatedBy(ctx) case origin.FieldName: return m.OldName(ctx) case origin.FieldWeight: @@ -1553,6 +1667,20 @@ func (m *OriginMutation) SetField(name string, value ent.Value) error { } m.SetUpdatedAt(v) return nil + case origin.FieldCreatedBy: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedBy(v) + return nil + case origin.FieldUpdatedBy: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetUpdatedBy(v) + return nil case origin.FieldName: v, ok := value.(string) if !ok { @@ -1651,7 +1779,14 @@ func (m *OriginMutation) AddField(name string, value ent.Value) error { // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *OriginMutation) ClearedFields() []string { - return nil + var fields []string + if m.FieldCleared(origin.FieldCreatedBy) { + fields = append(fields, origin.FieldCreatedBy) + } + if m.FieldCleared(origin.FieldUpdatedBy) { + fields = append(fields, origin.FieldUpdatedBy) + } + return fields } // FieldCleared returns a boolean indicating if a field with the given name was @@ -1664,6 +1799,14 @@ func (m *OriginMutation) FieldCleared(name string) bool { // 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 *OriginMutation) ClearField(name string) error { + switch name { + case origin.FieldCreatedBy: + m.ClearCreatedBy() + return nil + case origin.FieldUpdatedBy: + m.ClearUpdatedBy() + return nil + } return fmt.Errorf("unknown Origin nullable field %s", name) } @@ -1677,6 +1820,12 @@ func (m *OriginMutation) ResetField(name string) error { case origin.FieldUpdatedAt: m.ResetUpdatedAt() return nil + case origin.FieldCreatedBy: + m.ResetCreatedBy() + return nil + case origin.FieldUpdatedBy: + m.ResetUpdatedBy() + return nil case origin.FieldName: m.ResetName() return nil @@ -1781,6 +1930,8 @@ type PoolMutation struct { id *gidx.PrefixedID created_at *time.Time updated_at *time.Time + created_by *string + updated_by *string name *string protocol *pool.Protocol owner_id *gidx.PrefixedID @@ -1972,6 +2123,104 @@ func (m *PoolMutation) ResetUpdatedAt() { m.updated_at = nil } +// SetCreatedBy sets the "created_by" field. +func (m *PoolMutation) SetCreatedBy(s string) { + m.created_by = &s +} + +// CreatedBy returns the value of the "created_by" field in the mutation. +func (m *PoolMutation) CreatedBy() (r string, exists bool) { + v := m.created_by + if v == nil { + return + } + return *v, true +} + +// OldCreatedBy returns the old "created_by" field's value of the Pool entity. +// If the Pool 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 *PoolMutation) OldCreatedBy(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCreatedBy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCreatedBy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCreatedBy: %w", err) + } + return oldValue.CreatedBy, nil +} + +// ClearCreatedBy clears the value of the "created_by" field. +func (m *PoolMutation) ClearCreatedBy() { + m.created_by = nil + m.clearedFields[pool.FieldCreatedBy] = struct{}{} +} + +// CreatedByCleared returns if the "created_by" field was cleared in this mutation. +func (m *PoolMutation) CreatedByCleared() bool { + _, ok := m.clearedFields[pool.FieldCreatedBy] + return ok +} + +// ResetCreatedBy resets all changes to the "created_by" field. +func (m *PoolMutation) ResetCreatedBy() { + m.created_by = nil + delete(m.clearedFields, pool.FieldCreatedBy) +} + +// SetUpdatedBy sets the "updated_by" field. +func (m *PoolMutation) SetUpdatedBy(s string) { + m.updated_by = &s +} + +// UpdatedBy returns the value of the "updated_by" field in the mutation. +func (m *PoolMutation) UpdatedBy() (r string, exists bool) { + v := m.updated_by + if v == nil { + return + } + return *v, true +} + +// OldUpdatedBy returns the old "updated_by" field's value of the Pool entity. +// If the Pool 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 *PoolMutation) OldUpdatedBy(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldUpdatedBy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldUpdatedBy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldUpdatedBy: %w", err) + } + return oldValue.UpdatedBy, nil +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (m *PoolMutation) ClearUpdatedBy() { + m.updated_by = nil + m.clearedFields[pool.FieldUpdatedBy] = struct{}{} +} + +// UpdatedByCleared returns if the "updated_by" field was cleared in this mutation. +func (m *PoolMutation) UpdatedByCleared() bool { + _, ok := m.clearedFields[pool.FieldUpdatedBy] + return ok +} + +// ResetUpdatedBy resets all changes to the "updated_by" field. +func (m *PoolMutation) ResetUpdatedBy() { + m.updated_by = nil + delete(m.clearedFields, pool.FieldUpdatedBy) +} + // SetName sets the "name" field. func (m *PoolMutation) SetName(s string) { m.name = &s @@ -2222,13 +2471,19 @@ func (m *PoolMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *PoolMutation) Fields() []string { - fields := make([]string, 0, 5) + fields := make([]string, 0, 7) if m.created_at != nil { fields = append(fields, pool.FieldCreatedAt) } if m.updated_at != nil { fields = append(fields, pool.FieldUpdatedAt) } + if m.created_by != nil { + fields = append(fields, pool.FieldCreatedBy) + } + if m.updated_by != nil { + fields = append(fields, pool.FieldUpdatedBy) + } if m.name != nil { fields = append(fields, pool.FieldName) } @@ -2250,6 +2505,10 @@ func (m *PoolMutation) Field(name string) (ent.Value, bool) { return m.CreatedAt() case pool.FieldUpdatedAt: return m.UpdatedAt() + case pool.FieldCreatedBy: + return m.CreatedBy() + case pool.FieldUpdatedBy: + return m.UpdatedBy() case pool.FieldName: return m.Name() case pool.FieldProtocol: @@ -2269,6 +2528,10 @@ func (m *PoolMutation) OldField(ctx context.Context, name string) (ent.Value, er return m.OldCreatedAt(ctx) case pool.FieldUpdatedAt: return m.OldUpdatedAt(ctx) + case pool.FieldCreatedBy: + return m.OldCreatedBy(ctx) + case pool.FieldUpdatedBy: + return m.OldUpdatedBy(ctx) case pool.FieldName: return m.OldName(ctx) case pool.FieldProtocol: @@ -2298,6 +2561,20 @@ func (m *PoolMutation) SetField(name string, value ent.Value) error { } m.SetUpdatedAt(v) return nil + case pool.FieldCreatedBy: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedBy(v) + return nil + case pool.FieldUpdatedBy: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetUpdatedBy(v) + return nil case pool.FieldName: v, ok := value.(string) if !ok { @@ -2348,7 +2625,14 @@ func (m *PoolMutation) AddField(name string, value ent.Value) error { // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *PoolMutation) ClearedFields() []string { - return nil + var fields []string + if m.FieldCleared(pool.FieldCreatedBy) { + fields = append(fields, pool.FieldCreatedBy) + } + if m.FieldCleared(pool.FieldUpdatedBy) { + fields = append(fields, pool.FieldUpdatedBy) + } + return fields } // FieldCleared returns a boolean indicating if a field with the given name was @@ -2361,6 +2645,14 @@ func (m *PoolMutation) FieldCleared(name string) bool { // 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 *PoolMutation) ClearField(name string) error { + switch name { + case pool.FieldCreatedBy: + m.ClearCreatedBy() + return nil + case pool.FieldUpdatedBy: + m.ClearUpdatedBy() + return nil + } return fmt.Errorf("unknown Pool nullable field %s", name) } @@ -2374,6 +2666,12 @@ func (m *PoolMutation) ResetField(name string) error { case pool.FieldUpdatedAt: m.ResetUpdatedAt() return nil + case pool.FieldCreatedBy: + m.ResetCreatedBy() + return nil + case pool.FieldUpdatedBy: + m.ResetUpdatedBy() + return nil case pool.FieldName: m.ResetName() return nil @@ -2505,6 +2803,8 @@ type PortMutation struct { id *gidx.PrefixedID created_at *time.Time updated_at *time.Time + created_by *string + updated_by *string number *int addnumber *int name *string @@ -2695,6 +2995,104 @@ func (m *PortMutation) ResetUpdatedAt() { m.updated_at = nil } +// SetCreatedBy sets the "created_by" field. +func (m *PortMutation) SetCreatedBy(s string) { + m.created_by = &s +} + +// CreatedBy returns the value of the "created_by" field in the mutation. +func (m *PortMutation) CreatedBy() (r string, exists bool) { + v := m.created_by + if v == nil { + return + } + return *v, true +} + +// OldCreatedBy returns the old "created_by" field's value of the Port entity. +// If the Port 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 *PortMutation) OldCreatedBy(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCreatedBy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCreatedBy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCreatedBy: %w", err) + } + return oldValue.CreatedBy, nil +} + +// ClearCreatedBy clears the value of the "created_by" field. +func (m *PortMutation) ClearCreatedBy() { + m.created_by = nil + m.clearedFields[port.FieldCreatedBy] = struct{}{} +} + +// CreatedByCleared returns if the "created_by" field was cleared in this mutation. +func (m *PortMutation) CreatedByCleared() bool { + _, ok := m.clearedFields[port.FieldCreatedBy] + return ok +} + +// ResetCreatedBy resets all changes to the "created_by" field. +func (m *PortMutation) ResetCreatedBy() { + m.created_by = nil + delete(m.clearedFields, port.FieldCreatedBy) +} + +// SetUpdatedBy sets the "updated_by" field. +func (m *PortMutation) SetUpdatedBy(s string) { + m.updated_by = &s +} + +// UpdatedBy returns the value of the "updated_by" field in the mutation. +func (m *PortMutation) UpdatedBy() (r string, exists bool) { + v := m.updated_by + if v == nil { + return + } + return *v, true +} + +// OldUpdatedBy returns the old "updated_by" field's value of the Port entity. +// If the Port 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 *PortMutation) OldUpdatedBy(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldUpdatedBy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldUpdatedBy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldUpdatedBy: %w", err) + } + return oldValue.UpdatedBy, nil +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (m *PortMutation) ClearUpdatedBy() { + m.updated_by = nil + m.clearedFields[port.FieldUpdatedBy] = struct{}{} +} + +// UpdatedByCleared returns if the "updated_by" field was cleared in this mutation. +func (m *PortMutation) UpdatedByCleared() bool { + _, ok := m.clearedFields[port.FieldUpdatedBy] + return ok +} + +// ResetUpdatedBy resets all changes to the "updated_by" field. +func (m *PortMutation) ResetUpdatedBy() { + m.updated_by = nil + delete(m.clearedFields, port.FieldUpdatedBy) +} + // SetNumber sets the "number" field. func (m *PortMutation) SetNumber(i int) { m.number = &i @@ -2938,13 +3336,19 @@ func (m *PortMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *PortMutation) Fields() []string { - fields := make([]string, 0, 5) + fields := make([]string, 0, 7) if m.created_at != nil { fields = append(fields, port.FieldCreatedAt) } if m.updated_at != nil { fields = append(fields, port.FieldUpdatedAt) } + if m.created_by != nil { + fields = append(fields, port.FieldCreatedBy) + } + if m.updated_by != nil { + fields = append(fields, port.FieldUpdatedBy) + } if m.number != nil { fields = append(fields, port.FieldNumber) } @@ -2966,6 +3370,10 @@ func (m *PortMutation) Field(name string) (ent.Value, bool) { return m.CreatedAt() case port.FieldUpdatedAt: return m.UpdatedAt() + case port.FieldCreatedBy: + return m.CreatedBy() + case port.FieldUpdatedBy: + return m.UpdatedBy() case port.FieldNumber: return m.Number() case port.FieldName: @@ -2985,6 +3393,10 @@ func (m *PortMutation) OldField(ctx context.Context, name string) (ent.Value, er return m.OldCreatedAt(ctx) case port.FieldUpdatedAt: return m.OldUpdatedAt(ctx) + case port.FieldCreatedBy: + return m.OldCreatedBy(ctx) + case port.FieldUpdatedBy: + return m.OldUpdatedBy(ctx) case port.FieldNumber: return m.OldNumber(ctx) case port.FieldName: @@ -3014,6 +3426,20 @@ func (m *PortMutation) SetField(name string, value ent.Value) error { } m.SetUpdatedAt(v) return nil + case port.FieldCreatedBy: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedBy(v) + return nil + case port.FieldUpdatedBy: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetUpdatedBy(v) + return nil case port.FieldNumber: v, ok := value.(int) if !ok { @@ -3079,7 +3505,14 @@ func (m *PortMutation) AddField(name string, value ent.Value) error { // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *PortMutation) ClearedFields() []string { - return nil + var fields []string + if m.FieldCleared(port.FieldCreatedBy) { + fields = append(fields, port.FieldCreatedBy) + } + if m.FieldCleared(port.FieldUpdatedBy) { + fields = append(fields, port.FieldUpdatedBy) + } + return fields } // FieldCleared returns a boolean indicating if a field with the given name was @@ -3092,6 +3525,14 @@ func (m *PortMutation) FieldCleared(name string) bool { // 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 *PortMutation) ClearField(name string) error { + switch name { + case port.FieldCreatedBy: + m.ClearCreatedBy() + return nil + case port.FieldUpdatedBy: + m.ClearUpdatedBy() + return nil + } return fmt.Errorf("unknown Port nullable field %s", name) } @@ -3105,6 +3546,12 @@ func (m *PortMutation) ResetField(name string) error { case port.FieldUpdatedAt: m.ResetUpdatedAt() return nil + case port.FieldCreatedBy: + m.ResetCreatedBy() + return nil + case port.FieldUpdatedBy: + m.ResetUpdatedBy() + return nil case port.FieldNumber: m.ResetNumber() return nil @@ -3228,6 +3675,8 @@ type ProviderMutation struct { id *gidx.PrefixedID created_at *time.Time updated_at *time.Time + created_by *string + updated_by *string name *string owner_id *gidx.PrefixedID clearedFields map[string]struct{} @@ -3415,6 +3864,104 @@ func (m *ProviderMutation) ResetUpdatedAt() { m.updated_at = nil } +// SetCreatedBy sets the "created_by" field. +func (m *ProviderMutation) SetCreatedBy(s string) { + m.created_by = &s +} + +// CreatedBy returns the value of the "created_by" field in the mutation. +func (m *ProviderMutation) CreatedBy() (r string, exists bool) { + v := m.created_by + if v == nil { + return + } + return *v, true +} + +// OldCreatedBy returns the old "created_by" field's value of the Provider entity. +// If the Provider 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 *ProviderMutation) OldCreatedBy(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCreatedBy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCreatedBy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCreatedBy: %w", err) + } + return oldValue.CreatedBy, nil +} + +// ClearCreatedBy clears the value of the "created_by" field. +func (m *ProviderMutation) ClearCreatedBy() { + m.created_by = nil + m.clearedFields[provider.FieldCreatedBy] = struct{}{} +} + +// CreatedByCleared returns if the "created_by" field was cleared in this mutation. +func (m *ProviderMutation) CreatedByCleared() bool { + _, ok := m.clearedFields[provider.FieldCreatedBy] + return ok +} + +// ResetCreatedBy resets all changes to the "created_by" field. +func (m *ProviderMutation) ResetCreatedBy() { + m.created_by = nil + delete(m.clearedFields, provider.FieldCreatedBy) +} + +// SetUpdatedBy sets the "updated_by" field. +func (m *ProviderMutation) SetUpdatedBy(s string) { + m.updated_by = &s +} + +// UpdatedBy returns the value of the "updated_by" field in the mutation. +func (m *ProviderMutation) UpdatedBy() (r string, exists bool) { + v := m.updated_by + if v == nil { + return + } + return *v, true +} + +// OldUpdatedBy returns the old "updated_by" field's value of the Provider entity. +// If the Provider 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 *ProviderMutation) OldUpdatedBy(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldUpdatedBy is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldUpdatedBy requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldUpdatedBy: %w", err) + } + return oldValue.UpdatedBy, nil +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (m *ProviderMutation) ClearUpdatedBy() { + m.updated_by = nil + m.clearedFields[provider.FieldUpdatedBy] = struct{}{} +} + +// UpdatedByCleared returns if the "updated_by" field was cleared in this mutation. +func (m *ProviderMutation) UpdatedByCleared() bool { + _, ok := m.clearedFields[provider.FieldUpdatedBy] + return ok +} + +// ResetUpdatedBy resets all changes to the "updated_by" field. +func (m *ProviderMutation) ResetUpdatedBy() { + m.updated_by = nil + delete(m.clearedFields, provider.FieldUpdatedBy) +} + // SetName sets the "name" field. func (m *ProviderMutation) SetName(s string) { m.name = &s @@ -3575,13 +4122,19 @@ func (m *ProviderMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *ProviderMutation) Fields() []string { - fields := make([]string, 0, 4) + fields := make([]string, 0, 6) if m.created_at != nil { fields = append(fields, provider.FieldCreatedAt) } if m.updated_at != nil { fields = append(fields, provider.FieldUpdatedAt) } + if m.created_by != nil { + fields = append(fields, provider.FieldCreatedBy) + } + if m.updated_by != nil { + fields = append(fields, provider.FieldUpdatedBy) + } if m.name != nil { fields = append(fields, provider.FieldName) } @@ -3600,6 +4153,10 @@ func (m *ProviderMutation) Field(name string) (ent.Value, bool) { return m.CreatedAt() case provider.FieldUpdatedAt: return m.UpdatedAt() + case provider.FieldCreatedBy: + return m.CreatedBy() + case provider.FieldUpdatedBy: + return m.UpdatedBy() case provider.FieldName: return m.Name() case provider.FieldOwnerID: @@ -3617,6 +4174,10 @@ func (m *ProviderMutation) OldField(ctx context.Context, name string) (ent.Value return m.OldCreatedAt(ctx) case provider.FieldUpdatedAt: return m.OldUpdatedAt(ctx) + case provider.FieldCreatedBy: + return m.OldCreatedBy(ctx) + case provider.FieldUpdatedBy: + return m.OldUpdatedBy(ctx) case provider.FieldName: return m.OldName(ctx) case provider.FieldOwnerID: @@ -3644,6 +4205,20 @@ func (m *ProviderMutation) SetField(name string, value ent.Value) error { } m.SetUpdatedAt(v) return nil + case provider.FieldCreatedBy: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedBy(v) + return nil + case provider.FieldUpdatedBy: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetUpdatedBy(v) + return nil case provider.FieldName: v, ok := value.(string) if !ok { @@ -3687,7 +4262,14 @@ func (m *ProviderMutation) AddField(name string, value ent.Value) error { // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *ProviderMutation) ClearedFields() []string { - return nil + var fields []string + if m.FieldCleared(provider.FieldCreatedBy) { + fields = append(fields, provider.FieldCreatedBy) + } + if m.FieldCleared(provider.FieldUpdatedBy) { + fields = append(fields, provider.FieldUpdatedBy) + } + return fields } // FieldCleared returns a boolean indicating if a field with the given name was @@ -3700,6 +4282,14 @@ func (m *ProviderMutation) FieldCleared(name string) bool { // 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 *ProviderMutation) ClearField(name string) error { + switch name { + case provider.FieldCreatedBy: + m.ClearCreatedBy() + return nil + case provider.FieldUpdatedBy: + m.ClearUpdatedBy() + return nil + } return fmt.Errorf("unknown Provider nullable field %s", name) } @@ -3713,6 +4303,12 @@ func (m *ProviderMutation) ResetField(name string) error { case provider.FieldUpdatedAt: m.ResetUpdatedAt() return nil + case provider.FieldCreatedBy: + m.ResetCreatedBy() + return nil + case provider.FieldUpdatedBy: + m.ResetUpdatedBy() + return nil case provider.FieldName: m.ResetName() return nil diff --git a/internal/ent/generated/origin.go b/internal/ent/generated/origin.go index f22c9bedd..3e76985a9 100644 --- a/internal/ent/generated/origin.go +++ b/internal/ent/generated/origin.go @@ -37,6 +37,10 @@ type Origin struct { CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` + // CreatedBy holds the value of the "created_by" field. + CreatedBy string `json:"created_by,omitempty"` + // UpdatedBy holds the value of the "updated_by" field. + UpdatedBy string `json:"updated_by,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Weight holds the value of the "weight" field. @@ -90,7 +94,7 @@ func (*Origin) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullBool) case origin.FieldWeight, origin.FieldPortNumber: values[i] = new(sql.NullInt64) - case origin.FieldName, origin.FieldTarget: + case origin.FieldCreatedBy, origin.FieldUpdatedBy, origin.FieldName, origin.FieldTarget: values[i] = new(sql.NullString) case origin.FieldCreatedAt, origin.FieldUpdatedAt: values[i] = new(sql.NullTime) @@ -127,6 +131,18 @@ func (o *Origin) assignValues(columns []string, values []any) error { } else if value.Valid { o.UpdatedAt = value.Time } + case origin.FieldCreatedBy: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field created_by", values[i]) + } else if value.Valid { + o.CreatedBy = value.String + } + case origin.FieldUpdatedBy: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field updated_by", values[i]) + } else if value.Valid { + o.UpdatedBy = value.String + } case origin.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) @@ -210,6 +226,12 @@ func (o *Origin) String() string { builder.WriteString("updated_at=") builder.WriteString(o.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") + builder.WriteString("created_by=") + builder.WriteString(o.CreatedBy) + builder.WriteString(", ") + builder.WriteString("updated_by=") + builder.WriteString(o.UpdatedBy) + builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(o.Name) builder.WriteString(", ") diff --git a/internal/ent/generated/origin/origin.go b/internal/ent/generated/origin/origin.go index e62502948..b58f40bd4 100644 --- a/internal/ent/generated/origin/origin.go +++ b/internal/ent/generated/origin/origin.go @@ -19,6 +19,7 @@ package origin import ( "time" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "go.infratographer.com/x/gidx" @@ -33,6 +34,10 @@ const ( FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" + // FieldCreatedBy holds the string denoting the created_by field in the database. + FieldCreatedBy = "created_by" + // FieldUpdatedBy holds the string denoting the updated_by field in the database. + FieldUpdatedBy = "updated_by" // FieldName holds the string denoting the name field in the database. FieldName = "name" // FieldWeight holds the string denoting the weight field in the database. @@ -63,6 +68,8 @@ var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, + FieldCreatedBy, + FieldUpdatedBy, FieldName, FieldWeight, FieldTarget, @@ -81,7 +88,13 @@ func ValidColumn(column string) bool { 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 _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" var ( + Hooks [1]ent.Hook // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. @@ -122,6 +135,16 @@ func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() } +// ByCreatedBy orders the results by the created_by field. +func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCreatedBy, opts...).ToFunc() +} + +// ByUpdatedBy orders the results by the updated_by field. +func ByUpdatedBy(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldUpdatedBy, opts...).ToFunc() +} + // ByName orders the results by the name field. func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() diff --git a/internal/ent/generated/origin/where.go b/internal/ent/generated/origin/where.go index 2bc8efc51..cd7addf09 100644 --- a/internal/ent/generated/origin/where.go +++ b/internal/ent/generated/origin/where.go @@ -80,6 +80,16 @@ func UpdatedAt(v time.Time) predicate.Origin { return predicate.Origin(sql.FieldEQ(FieldUpdatedAt, v)) } +// CreatedBy applies equality check predicate on the "created_by" field. It's identical to CreatedByEQ. +func CreatedBy(v string) predicate.Origin { + return predicate.Origin(sql.FieldEQ(FieldCreatedBy, v)) +} + +// UpdatedBy applies equality check predicate on the "updated_by" field. It's identical to UpdatedByEQ. +func UpdatedBy(v string) predicate.Origin { + return predicate.Origin(sql.FieldEQ(FieldUpdatedBy, v)) +} + // Name applies equality check predicate on the "name" field. It's identical to NameEQ. func Name(v string) predicate.Origin { return predicate.Origin(sql.FieldEQ(FieldName, v)) @@ -190,6 +200,156 @@ func UpdatedAtLTE(v time.Time) predicate.Origin { return predicate.Origin(sql.FieldLTE(FieldUpdatedAt, v)) } +// CreatedByEQ applies the EQ predicate on the "created_by" field. +func CreatedByEQ(v string) predicate.Origin { + return predicate.Origin(sql.FieldEQ(FieldCreatedBy, v)) +} + +// CreatedByNEQ applies the NEQ predicate on the "created_by" field. +func CreatedByNEQ(v string) predicate.Origin { + return predicate.Origin(sql.FieldNEQ(FieldCreatedBy, v)) +} + +// CreatedByIn applies the In predicate on the "created_by" field. +func CreatedByIn(vs ...string) predicate.Origin { + return predicate.Origin(sql.FieldIn(FieldCreatedBy, vs...)) +} + +// CreatedByNotIn applies the NotIn predicate on the "created_by" field. +func CreatedByNotIn(vs ...string) predicate.Origin { + return predicate.Origin(sql.FieldNotIn(FieldCreatedBy, vs...)) +} + +// CreatedByGT applies the GT predicate on the "created_by" field. +func CreatedByGT(v string) predicate.Origin { + return predicate.Origin(sql.FieldGT(FieldCreatedBy, v)) +} + +// CreatedByGTE applies the GTE predicate on the "created_by" field. +func CreatedByGTE(v string) predicate.Origin { + return predicate.Origin(sql.FieldGTE(FieldCreatedBy, v)) +} + +// CreatedByLT applies the LT predicate on the "created_by" field. +func CreatedByLT(v string) predicate.Origin { + return predicate.Origin(sql.FieldLT(FieldCreatedBy, v)) +} + +// CreatedByLTE applies the LTE predicate on the "created_by" field. +func CreatedByLTE(v string) predicate.Origin { + return predicate.Origin(sql.FieldLTE(FieldCreatedBy, v)) +} + +// CreatedByContains applies the Contains predicate on the "created_by" field. +func CreatedByContains(v string) predicate.Origin { + return predicate.Origin(sql.FieldContains(FieldCreatedBy, v)) +} + +// CreatedByHasPrefix applies the HasPrefix predicate on the "created_by" field. +func CreatedByHasPrefix(v string) predicate.Origin { + return predicate.Origin(sql.FieldHasPrefix(FieldCreatedBy, v)) +} + +// CreatedByHasSuffix applies the HasSuffix predicate on the "created_by" field. +func CreatedByHasSuffix(v string) predicate.Origin { + return predicate.Origin(sql.FieldHasSuffix(FieldCreatedBy, v)) +} + +// CreatedByIsNil applies the IsNil predicate on the "created_by" field. +func CreatedByIsNil() predicate.Origin { + return predicate.Origin(sql.FieldIsNull(FieldCreatedBy)) +} + +// CreatedByNotNil applies the NotNil predicate on the "created_by" field. +func CreatedByNotNil() predicate.Origin { + return predicate.Origin(sql.FieldNotNull(FieldCreatedBy)) +} + +// CreatedByEqualFold applies the EqualFold predicate on the "created_by" field. +func CreatedByEqualFold(v string) predicate.Origin { + return predicate.Origin(sql.FieldEqualFold(FieldCreatedBy, v)) +} + +// CreatedByContainsFold applies the ContainsFold predicate on the "created_by" field. +func CreatedByContainsFold(v string) predicate.Origin { + return predicate.Origin(sql.FieldContainsFold(FieldCreatedBy, v)) +} + +// UpdatedByEQ applies the EQ predicate on the "updated_by" field. +func UpdatedByEQ(v string) predicate.Origin { + return predicate.Origin(sql.FieldEQ(FieldUpdatedBy, v)) +} + +// UpdatedByNEQ applies the NEQ predicate on the "updated_by" field. +func UpdatedByNEQ(v string) predicate.Origin { + return predicate.Origin(sql.FieldNEQ(FieldUpdatedBy, v)) +} + +// UpdatedByIn applies the In predicate on the "updated_by" field. +func UpdatedByIn(vs ...string) predicate.Origin { + return predicate.Origin(sql.FieldIn(FieldUpdatedBy, vs...)) +} + +// UpdatedByNotIn applies the NotIn predicate on the "updated_by" field. +func UpdatedByNotIn(vs ...string) predicate.Origin { + return predicate.Origin(sql.FieldNotIn(FieldUpdatedBy, vs...)) +} + +// UpdatedByGT applies the GT predicate on the "updated_by" field. +func UpdatedByGT(v string) predicate.Origin { + return predicate.Origin(sql.FieldGT(FieldUpdatedBy, v)) +} + +// UpdatedByGTE applies the GTE predicate on the "updated_by" field. +func UpdatedByGTE(v string) predicate.Origin { + return predicate.Origin(sql.FieldGTE(FieldUpdatedBy, v)) +} + +// UpdatedByLT applies the LT predicate on the "updated_by" field. +func UpdatedByLT(v string) predicate.Origin { + return predicate.Origin(sql.FieldLT(FieldUpdatedBy, v)) +} + +// UpdatedByLTE applies the LTE predicate on the "updated_by" field. +func UpdatedByLTE(v string) predicate.Origin { + return predicate.Origin(sql.FieldLTE(FieldUpdatedBy, v)) +} + +// UpdatedByContains applies the Contains predicate on the "updated_by" field. +func UpdatedByContains(v string) predicate.Origin { + return predicate.Origin(sql.FieldContains(FieldUpdatedBy, v)) +} + +// UpdatedByHasPrefix applies the HasPrefix predicate on the "updated_by" field. +func UpdatedByHasPrefix(v string) predicate.Origin { + return predicate.Origin(sql.FieldHasPrefix(FieldUpdatedBy, v)) +} + +// UpdatedByHasSuffix applies the HasSuffix predicate on the "updated_by" field. +func UpdatedByHasSuffix(v string) predicate.Origin { + return predicate.Origin(sql.FieldHasSuffix(FieldUpdatedBy, v)) +} + +// UpdatedByIsNil applies the IsNil predicate on the "updated_by" field. +func UpdatedByIsNil() predicate.Origin { + return predicate.Origin(sql.FieldIsNull(FieldUpdatedBy)) +} + +// UpdatedByNotNil applies the NotNil predicate on the "updated_by" field. +func UpdatedByNotNil() predicate.Origin { + return predicate.Origin(sql.FieldNotNull(FieldUpdatedBy)) +} + +// UpdatedByEqualFold applies the EqualFold predicate on the "updated_by" field. +func UpdatedByEqualFold(v string) predicate.Origin { + return predicate.Origin(sql.FieldEqualFold(FieldUpdatedBy, v)) +} + +// UpdatedByContainsFold applies the ContainsFold predicate on the "updated_by" field. +func UpdatedByContainsFold(v string) predicate.Origin { + return predicate.Origin(sql.FieldContainsFold(FieldUpdatedBy, v)) +} + // NameEQ applies the EQ predicate on the "name" field. func NameEQ(v string) predicate.Origin { return predicate.Origin(sql.FieldEQ(FieldName, v)) diff --git a/internal/ent/generated/origin_create.go b/internal/ent/generated/origin_create.go index 24b7dd441..67a75fa75 100644 --- a/internal/ent/generated/origin_create.go +++ b/internal/ent/generated/origin_create.go @@ -64,6 +64,34 @@ func (oc *OriginCreate) SetNillableUpdatedAt(t *time.Time) *OriginCreate { return oc } +// SetCreatedBy sets the "created_by" field. +func (oc *OriginCreate) SetCreatedBy(s string) *OriginCreate { + oc.mutation.SetCreatedBy(s) + return oc +} + +// SetNillableCreatedBy sets the "created_by" field if the given value is not nil. +func (oc *OriginCreate) SetNillableCreatedBy(s *string) *OriginCreate { + if s != nil { + oc.SetCreatedBy(*s) + } + return oc +} + +// SetUpdatedBy sets the "updated_by" field. +func (oc *OriginCreate) SetUpdatedBy(s string) *OriginCreate { + oc.mutation.SetUpdatedBy(s) + return oc +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (oc *OriginCreate) SetNillableUpdatedBy(s *string) *OriginCreate { + if s != nil { + oc.SetUpdatedBy(*s) + } + return oc +} + // SetName sets the "name" field. func (oc *OriginCreate) SetName(s string) *OriginCreate { oc.mutation.SetName(s) @@ -142,7 +170,9 @@ func (oc *OriginCreate) Mutation() *OriginMutation { // Save creates the Origin in the database. func (oc *OriginCreate) Save(ctx context.Context) (*Origin, error) { - oc.defaults() + if err := oc.defaults(); err != nil { + return nil, err + } return withHooks(ctx, oc.sqlSave, oc.mutation, oc.hooks) } @@ -169,12 +199,18 @@ func (oc *OriginCreate) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (oc *OriginCreate) defaults() { +func (oc *OriginCreate) defaults() error { if _, ok := oc.mutation.CreatedAt(); !ok { + if origin.DefaultCreatedAt == nil { + return fmt.Errorf("generated: uninitialized origin.DefaultCreatedAt (forgotten import generated/runtime?)") + } v := origin.DefaultCreatedAt() oc.mutation.SetCreatedAt(v) } if _, ok := oc.mutation.UpdatedAt(); !ok { + if origin.DefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized origin.DefaultUpdatedAt (forgotten import generated/runtime?)") + } v := origin.DefaultUpdatedAt() oc.mutation.SetUpdatedAt(v) } @@ -187,9 +223,13 @@ func (oc *OriginCreate) defaults() { oc.mutation.SetActive(v) } if _, ok := oc.mutation.ID(); !ok { + if origin.DefaultID == nil { + return fmt.Errorf("generated: uninitialized origin.DefaultID (forgotten import generated/runtime?)") + } v := origin.DefaultID() oc.mutation.SetID(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -284,6 +324,14 @@ func (oc *OriginCreate) createSpec() (*Origin, *sqlgraph.CreateSpec) { _spec.SetField(origin.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } + if value, ok := oc.mutation.CreatedBy(); ok { + _spec.SetField(origin.FieldCreatedBy, field.TypeString, value) + _node.CreatedBy = value + } + if value, ok := oc.mutation.UpdatedBy(); ok { + _spec.SetField(origin.FieldUpdatedBy, field.TypeString, value) + _node.UpdatedBy = value + } if value, ok := oc.mutation.Name(); ok { _spec.SetField(origin.FieldName, field.TypeString, value) _node.Name = value diff --git a/internal/ent/generated/origin_update.go b/internal/ent/generated/origin_update.go index bdddf0551..117c2af48 100644 --- a/internal/ent/generated/origin_update.go +++ b/internal/ent/generated/origin_update.go @@ -41,6 +41,26 @@ func (ou *OriginUpdate) Where(ps ...predicate.Origin) *OriginUpdate { return ou } +// SetUpdatedBy sets the "updated_by" field. +func (ou *OriginUpdate) SetUpdatedBy(s string) *OriginUpdate { + ou.mutation.SetUpdatedBy(s) + return ou +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (ou *OriginUpdate) SetNillableUpdatedBy(s *string) *OriginUpdate { + if s != nil { + ou.SetUpdatedBy(*s) + } + return ou +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (ou *OriginUpdate) ClearUpdatedBy() *OriginUpdate { + ou.mutation.ClearUpdatedBy() + return ou +} + // SetName sets the "name" field. func (ou *OriginUpdate) SetName(s string) *OriginUpdate { ou.mutation.SetName(s) @@ -108,7 +128,9 @@ func (ou *OriginUpdate) Mutation() *OriginMutation { // Save executes the query and returns the number of nodes affected by the update operation. func (ou *OriginUpdate) Save(ctx context.Context) (int, error) { - ou.defaults() + if err := ou.defaults(); err != nil { + return 0, err + } return withHooks(ctx, ou.sqlSave, ou.mutation, ou.hooks) } @@ -135,11 +157,15 @@ func (ou *OriginUpdate) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (ou *OriginUpdate) defaults() { +func (ou *OriginUpdate) defaults() error { if _, ok := ou.mutation.UpdatedAt(); !ok { + if origin.UpdateDefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized origin.UpdateDefaultUpdatedAt (forgotten import generated/runtime?)") + } v := origin.UpdateDefaultUpdatedAt() ou.mutation.SetUpdatedAt(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -180,6 +206,15 @@ func (ou *OriginUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := ou.mutation.UpdatedAt(); ok { _spec.SetField(origin.FieldUpdatedAt, field.TypeTime, value) } + if ou.mutation.CreatedByCleared() { + _spec.ClearField(origin.FieldCreatedBy, field.TypeString) + } + if value, ok := ou.mutation.UpdatedBy(); ok { + _spec.SetField(origin.FieldUpdatedBy, field.TypeString, value) + } + if ou.mutation.UpdatedByCleared() { + _spec.ClearField(origin.FieldUpdatedBy, field.TypeString) + } if value, ok := ou.mutation.Name(); ok { _spec.SetField(origin.FieldName, field.TypeString, value) } @@ -221,6 +256,26 @@ type OriginUpdateOne struct { mutation *OriginMutation } +// SetUpdatedBy sets the "updated_by" field. +func (ouo *OriginUpdateOne) SetUpdatedBy(s string) *OriginUpdateOne { + ouo.mutation.SetUpdatedBy(s) + return ouo +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (ouo *OriginUpdateOne) SetNillableUpdatedBy(s *string) *OriginUpdateOne { + if s != nil { + ouo.SetUpdatedBy(*s) + } + return ouo +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (ouo *OriginUpdateOne) ClearUpdatedBy() *OriginUpdateOne { + ouo.mutation.ClearUpdatedBy() + return ouo +} + // SetName sets the "name" field. func (ouo *OriginUpdateOne) SetName(s string) *OriginUpdateOne { ouo.mutation.SetName(s) @@ -301,7 +356,9 @@ func (ouo *OriginUpdateOne) Select(field string, fields ...string) *OriginUpdate // Save executes the query and returns the updated Origin entity. func (ouo *OriginUpdateOne) Save(ctx context.Context) (*Origin, error) { - ouo.defaults() + if err := ouo.defaults(); err != nil { + return nil, err + } return withHooks(ctx, ouo.sqlSave, ouo.mutation, ouo.hooks) } @@ -328,11 +385,15 @@ func (ouo *OriginUpdateOne) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (ouo *OriginUpdateOne) defaults() { +func (ouo *OriginUpdateOne) defaults() error { if _, ok := ouo.mutation.UpdatedAt(); !ok { + if origin.UpdateDefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized origin.UpdateDefaultUpdatedAt (forgotten import generated/runtime?)") + } v := origin.UpdateDefaultUpdatedAt() ouo.mutation.SetUpdatedAt(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -390,6 +451,15 @@ func (ouo *OriginUpdateOne) sqlSave(ctx context.Context) (_node *Origin, err err if value, ok := ouo.mutation.UpdatedAt(); ok { _spec.SetField(origin.FieldUpdatedAt, field.TypeTime, value) } + if ouo.mutation.CreatedByCleared() { + _spec.ClearField(origin.FieldCreatedBy, field.TypeString) + } + if value, ok := ouo.mutation.UpdatedBy(); ok { + _spec.SetField(origin.FieldUpdatedBy, field.TypeString, value) + } + if ouo.mutation.UpdatedByCleared() { + _spec.ClearField(origin.FieldUpdatedBy, field.TypeString) + } if value, ok := ouo.mutation.Name(); ok { _spec.SetField(origin.FieldName, field.TypeString, value) } diff --git a/internal/ent/generated/pool.go b/internal/ent/generated/pool.go index 6fb38ab55..34f88a7bf 100644 --- a/internal/ent/generated/pool.go +++ b/internal/ent/generated/pool.go @@ -36,6 +36,10 @@ type Pool struct { CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` + // CreatedBy holds the value of the "created_by" field. + CreatedBy string `json:"created_by,omitempty"` + // UpdatedBy holds the value of the "updated_by" field. + UpdatedBy string `json:"updated_by,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Protocol holds the value of the "protocol" field. @@ -89,7 +93,7 @@ func (*Pool) scanValues(columns []string) ([]any, error) { switch columns[i] { case pool.FieldID, pool.FieldOwnerID: values[i] = new(gidx.PrefixedID) - case pool.FieldName, pool.FieldProtocol: + case pool.FieldCreatedBy, pool.FieldUpdatedBy, pool.FieldName, pool.FieldProtocol: values[i] = new(sql.NullString) case pool.FieldCreatedAt, pool.FieldUpdatedAt: values[i] = new(sql.NullTime) @@ -126,6 +130,18 @@ func (po *Pool) assignValues(columns []string, values []any) error { } else if value.Valid { po.UpdatedAt = value.Time } + case pool.FieldCreatedBy: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field created_by", values[i]) + } else if value.Valid { + po.CreatedBy = value.String + } + case pool.FieldUpdatedBy: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field updated_by", values[i]) + } else if value.Valid { + po.UpdatedBy = value.String + } case pool.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) @@ -196,6 +212,12 @@ func (po *Pool) String() string { builder.WriteString("updated_at=") builder.WriteString(po.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") + builder.WriteString("created_by=") + builder.WriteString(po.CreatedBy) + builder.WriteString(", ") + builder.WriteString("updated_by=") + builder.WriteString(po.UpdatedBy) + builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(po.Name) builder.WriteString(", ") diff --git a/internal/ent/generated/pool/pool.go b/internal/ent/generated/pool/pool.go index 578fabf70..0720b3d02 100644 --- a/internal/ent/generated/pool/pool.go +++ b/internal/ent/generated/pool/pool.go @@ -22,6 +22,7 @@ import ( "strconv" "time" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "go.infratographer.com/x/gidx" @@ -36,6 +37,10 @@ const ( FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" + // FieldCreatedBy holds the string denoting the created_by field in the database. + FieldCreatedBy = "created_by" + // FieldUpdatedBy holds the string denoting the updated_by field in the database. + FieldUpdatedBy = "updated_by" // FieldName holds the string denoting the name field in the database. FieldName = "name" // FieldProtocol holds the string denoting the protocol field in the database. @@ -67,6 +72,8 @@ var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, + FieldCreatedBy, + FieldUpdatedBy, FieldName, FieldProtocol, FieldOwnerID, @@ -88,7 +95,13 @@ func ValidColumn(column string) bool { 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 _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" var ( + Hooks [1]ent.Hook // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. @@ -144,6 +157,16 @@ func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() } +// ByCreatedBy orders the results by the created_by field. +func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCreatedBy, opts...).ToFunc() +} + +// ByUpdatedBy orders the results by the updated_by field. +func ByUpdatedBy(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldUpdatedBy, opts...).ToFunc() +} + // ByName orders the results by the name field. func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() diff --git a/internal/ent/generated/pool/where.go b/internal/ent/generated/pool/where.go index f8ebe2b11..f5771610a 100644 --- a/internal/ent/generated/pool/where.go +++ b/internal/ent/generated/pool/where.go @@ -80,6 +80,16 @@ func UpdatedAt(v time.Time) predicate.Pool { return predicate.Pool(sql.FieldEQ(FieldUpdatedAt, v)) } +// CreatedBy applies equality check predicate on the "created_by" field. It's identical to CreatedByEQ. +func CreatedBy(v string) predicate.Pool { + return predicate.Pool(sql.FieldEQ(FieldCreatedBy, v)) +} + +// UpdatedBy applies equality check predicate on the "updated_by" field. It's identical to UpdatedByEQ. +func UpdatedBy(v string) predicate.Pool { + return predicate.Pool(sql.FieldEQ(FieldUpdatedBy, v)) +} + // Name applies equality check predicate on the "name" field. It's identical to NameEQ. func Name(v string) predicate.Pool { return predicate.Pool(sql.FieldEQ(FieldName, v)) @@ -170,6 +180,156 @@ func UpdatedAtLTE(v time.Time) predicate.Pool { return predicate.Pool(sql.FieldLTE(FieldUpdatedAt, v)) } +// CreatedByEQ applies the EQ predicate on the "created_by" field. +func CreatedByEQ(v string) predicate.Pool { + return predicate.Pool(sql.FieldEQ(FieldCreatedBy, v)) +} + +// CreatedByNEQ applies the NEQ predicate on the "created_by" field. +func CreatedByNEQ(v string) predicate.Pool { + return predicate.Pool(sql.FieldNEQ(FieldCreatedBy, v)) +} + +// CreatedByIn applies the In predicate on the "created_by" field. +func CreatedByIn(vs ...string) predicate.Pool { + return predicate.Pool(sql.FieldIn(FieldCreatedBy, vs...)) +} + +// CreatedByNotIn applies the NotIn predicate on the "created_by" field. +func CreatedByNotIn(vs ...string) predicate.Pool { + return predicate.Pool(sql.FieldNotIn(FieldCreatedBy, vs...)) +} + +// CreatedByGT applies the GT predicate on the "created_by" field. +func CreatedByGT(v string) predicate.Pool { + return predicate.Pool(sql.FieldGT(FieldCreatedBy, v)) +} + +// CreatedByGTE applies the GTE predicate on the "created_by" field. +func CreatedByGTE(v string) predicate.Pool { + return predicate.Pool(sql.FieldGTE(FieldCreatedBy, v)) +} + +// CreatedByLT applies the LT predicate on the "created_by" field. +func CreatedByLT(v string) predicate.Pool { + return predicate.Pool(sql.FieldLT(FieldCreatedBy, v)) +} + +// CreatedByLTE applies the LTE predicate on the "created_by" field. +func CreatedByLTE(v string) predicate.Pool { + return predicate.Pool(sql.FieldLTE(FieldCreatedBy, v)) +} + +// CreatedByContains applies the Contains predicate on the "created_by" field. +func CreatedByContains(v string) predicate.Pool { + return predicate.Pool(sql.FieldContains(FieldCreatedBy, v)) +} + +// CreatedByHasPrefix applies the HasPrefix predicate on the "created_by" field. +func CreatedByHasPrefix(v string) predicate.Pool { + return predicate.Pool(sql.FieldHasPrefix(FieldCreatedBy, v)) +} + +// CreatedByHasSuffix applies the HasSuffix predicate on the "created_by" field. +func CreatedByHasSuffix(v string) predicate.Pool { + return predicate.Pool(sql.FieldHasSuffix(FieldCreatedBy, v)) +} + +// CreatedByIsNil applies the IsNil predicate on the "created_by" field. +func CreatedByIsNil() predicate.Pool { + return predicate.Pool(sql.FieldIsNull(FieldCreatedBy)) +} + +// CreatedByNotNil applies the NotNil predicate on the "created_by" field. +func CreatedByNotNil() predicate.Pool { + return predicate.Pool(sql.FieldNotNull(FieldCreatedBy)) +} + +// CreatedByEqualFold applies the EqualFold predicate on the "created_by" field. +func CreatedByEqualFold(v string) predicate.Pool { + return predicate.Pool(sql.FieldEqualFold(FieldCreatedBy, v)) +} + +// CreatedByContainsFold applies the ContainsFold predicate on the "created_by" field. +func CreatedByContainsFold(v string) predicate.Pool { + return predicate.Pool(sql.FieldContainsFold(FieldCreatedBy, v)) +} + +// UpdatedByEQ applies the EQ predicate on the "updated_by" field. +func UpdatedByEQ(v string) predicate.Pool { + return predicate.Pool(sql.FieldEQ(FieldUpdatedBy, v)) +} + +// UpdatedByNEQ applies the NEQ predicate on the "updated_by" field. +func UpdatedByNEQ(v string) predicate.Pool { + return predicate.Pool(sql.FieldNEQ(FieldUpdatedBy, v)) +} + +// UpdatedByIn applies the In predicate on the "updated_by" field. +func UpdatedByIn(vs ...string) predicate.Pool { + return predicate.Pool(sql.FieldIn(FieldUpdatedBy, vs...)) +} + +// UpdatedByNotIn applies the NotIn predicate on the "updated_by" field. +func UpdatedByNotIn(vs ...string) predicate.Pool { + return predicate.Pool(sql.FieldNotIn(FieldUpdatedBy, vs...)) +} + +// UpdatedByGT applies the GT predicate on the "updated_by" field. +func UpdatedByGT(v string) predicate.Pool { + return predicate.Pool(sql.FieldGT(FieldUpdatedBy, v)) +} + +// UpdatedByGTE applies the GTE predicate on the "updated_by" field. +func UpdatedByGTE(v string) predicate.Pool { + return predicate.Pool(sql.FieldGTE(FieldUpdatedBy, v)) +} + +// UpdatedByLT applies the LT predicate on the "updated_by" field. +func UpdatedByLT(v string) predicate.Pool { + return predicate.Pool(sql.FieldLT(FieldUpdatedBy, v)) +} + +// UpdatedByLTE applies the LTE predicate on the "updated_by" field. +func UpdatedByLTE(v string) predicate.Pool { + return predicate.Pool(sql.FieldLTE(FieldUpdatedBy, v)) +} + +// UpdatedByContains applies the Contains predicate on the "updated_by" field. +func UpdatedByContains(v string) predicate.Pool { + return predicate.Pool(sql.FieldContains(FieldUpdatedBy, v)) +} + +// UpdatedByHasPrefix applies the HasPrefix predicate on the "updated_by" field. +func UpdatedByHasPrefix(v string) predicate.Pool { + return predicate.Pool(sql.FieldHasPrefix(FieldUpdatedBy, v)) +} + +// UpdatedByHasSuffix applies the HasSuffix predicate on the "updated_by" field. +func UpdatedByHasSuffix(v string) predicate.Pool { + return predicate.Pool(sql.FieldHasSuffix(FieldUpdatedBy, v)) +} + +// UpdatedByIsNil applies the IsNil predicate on the "updated_by" field. +func UpdatedByIsNil() predicate.Pool { + return predicate.Pool(sql.FieldIsNull(FieldUpdatedBy)) +} + +// UpdatedByNotNil applies the NotNil predicate on the "updated_by" field. +func UpdatedByNotNil() predicate.Pool { + return predicate.Pool(sql.FieldNotNull(FieldUpdatedBy)) +} + +// UpdatedByEqualFold applies the EqualFold predicate on the "updated_by" field. +func UpdatedByEqualFold(v string) predicate.Pool { + return predicate.Pool(sql.FieldEqualFold(FieldUpdatedBy, v)) +} + +// UpdatedByContainsFold applies the ContainsFold predicate on the "updated_by" field. +func UpdatedByContainsFold(v string) predicate.Pool { + return predicate.Pool(sql.FieldContainsFold(FieldUpdatedBy, v)) +} + // NameEQ applies the EQ predicate on the "name" field. func NameEQ(v string) predicate.Pool { return predicate.Pool(sql.FieldEQ(FieldName, v)) diff --git a/internal/ent/generated/pool_create.go b/internal/ent/generated/pool_create.go index 138688174..eeb2fac7d 100644 --- a/internal/ent/generated/pool_create.go +++ b/internal/ent/generated/pool_create.go @@ -65,6 +65,34 @@ func (pc *PoolCreate) SetNillableUpdatedAt(t *time.Time) *PoolCreate { return pc } +// SetCreatedBy sets the "created_by" field. +func (pc *PoolCreate) SetCreatedBy(s string) *PoolCreate { + pc.mutation.SetCreatedBy(s) + return pc +} + +// SetNillableCreatedBy sets the "created_by" field if the given value is not nil. +func (pc *PoolCreate) SetNillableCreatedBy(s *string) *PoolCreate { + if s != nil { + pc.SetCreatedBy(*s) + } + return pc +} + +// SetUpdatedBy sets the "updated_by" field. +func (pc *PoolCreate) SetUpdatedBy(s string) *PoolCreate { + pc.mutation.SetUpdatedBy(s) + return pc +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (pc *PoolCreate) SetNillableUpdatedBy(s *string) *PoolCreate { + if s != nil { + pc.SetUpdatedBy(*s) + } + return pc +} + // SetName sets the "name" field. func (pc *PoolCreate) SetName(s string) *PoolCreate { pc.mutation.SetName(s) @@ -134,7 +162,9 @@ func (pc *PoolCreate) Mutation() *PoolMutation { // Save creates the Pool in the database. func (pc *PoolCreate) Save(ctx context.Context) (*Pool, error) { - pc.defaults() + if err := pc.defaults(); err != nil { + return nil, err + } return withHooks(ctx, pc.sqlSave, pc.mutation, pc.hooks) } @@ -161,19 +191,29 @@ func (pc *PoolCreate) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (pc *PoolCreate) defaults() { +func (pc *PoolCreate) defaults() error { if _, ok := pc.mutation.CreatedAt(); !ok { + if pool.DefaultCreatedAt == nil { + return fmt.Errorf("generated: uninitialized pool.DefaultCreatedAt (forgotten import generated/runtime?)") + } v := pool.DefaultCreatedAt() pc.mutation.SetCreatedAt(v) } if _, ok := pc.mutation.UpdatedAt(); !ok { + if pool.DefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized pool.DefaultUpdatedAt (forgotten import generated/runtime?)") + } v := pool.DefaultUpdatedAt() pc.mutation.SetUpdatedAt(v) } if _, ok := pc.mutation.ID(); !ok { + if pool.DefaultID == nil { + return fmt.Errorf("generated: uninitialized pool.DefaultID (forgotten import generated/runtime?)") + } v := pool.DefaultID() pc.mutation.SetID(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -251,6 +291,14 @@ func (pc *PoolCreate) createSpec() (*Pool, *sqlgraph.CreateSpec) { _spec.SetField(pool.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } + if value, ok := pc.mutation.CreatedBy(); ok { + _spec.SetField(pool.FieldCreatedBy, field.TypeString, value) + _node.CreatedBy = value + } + if value, ok := pc.mutation.UpdatedBy(); ok { + _spec.SetField(pool.FieldUpdatedBy, field.TypeString, value) + _node.UpdatedBy = value + } if value, ok := pc.mutation.Name(); ok { _spec.SetField(pool.FieldName, field.TypeString, value) _node.Name = value diff --git a/internal/ent/generated/pool_update.go b/internal/ent/generated/pool_update.go index 4703aa855..8b90681b8 100644 --- a/internal/ent/generated/pool_update.go +++ b/internal/ent/generated/pool_update.go @@ -44,6 +44,26 @@ func (pu *PoolUpdate) Where(ps ...predicate.Pool) *PoolUpdate { return pu } +// SetUpdatedBy sets the "updated_by" field. +func (pu *PoolUpdate) SetUpdatedBy(s string) *PoolUpdate { + pu.mutation.SetUpdatedBy(s) + return pu +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (pu *PoolUpdate) SetNillableUpdatedBy(s *string) *PoolUpdate { + if s != nil { + pu.SetUpdatedBy(*s) + } + return pu +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (pu *PoolUpdate) ClearUpdatedBy() *PoolUpdate { + pu.mutation.ClearUpdatedBy() + return pu +} + // SetName sets the "name" field. func (pu *PoolUpdate) SetName(s string) *PoolUpdate { pu.mutation.SetName(s) @@ -135,7 +155,9 @@ func (pu *PoolUpdate) RemoveOrigins(o ...*Origin) *PoolUpdate { // Save executes the query and returns the number of nodes affected by the update operation. func (pu *PoolUpdate) Save(ctx context.Context) (int, error) { - pu.defaults() + if err := pu.defaults(); err != nil { + return 0, err + } return withHooks(ctx, pu.sqlSave, pu.mutation, pu.hooks) } @@ -162,11 +184,15 @@ func (pu *PoolUpdate) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (pu *PoolUpdate) defaults() { +func (pu *PoolUpdate) defaults() error { if _, ok := pu.mutation.UpdatedAt(); !ok { + if pool.UpdateDefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized pool.UpdateDefaultUpdatedAt (forgotten import generated/runtime?)") + } v := pool.UpdateDefaultUpdatedAt() pu.mutation.SetUpdatedAt(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -199,6 +225,15 @@ func (pu *PoolUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := pu.mutation.UpdatedAt(); ok { _spec.SetField(pool.FieldUpdatedAt, field.TypeTime, value) } + if pu.mutation.CreatedByCleared() { + _spec.ClearField(pool.FieldCreatedBy, field.TypeString) + } + if value, ok := pu.mutation.UpdatedBy(); ok { + _spec.SetField(pool.FieldUpdatedBy, field.TypeString, value) + } + if pu.mutation.UpdatedByCleared() { + _spec.ClearField(pool.FieldUpdatedBy, field.TypeString) + } if value, ok := pu.mutation.Name(); ok { _spec.SetField(pool.FieldName, field.TypeString, value) } @@ -315,6 +350,26 @@ type PoolUpdateOne struct { mutation *PoolMutation } +// SetUpdatedBy sets the "updated_by" field. +func (puo *PoolUpdateOne) SetUpdatedBy(s string) *PoolUpdateOne { + puo.mutation.SetUpdatedBy(s) + return puo +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (puo *PoolUpdateOne) SetNillableUpdatedBy(s *string) *PoolUpdateOne { + if s != nil { + puo.SetUpdatedBy(*s) + } + return puo +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (puo *PoolUpdateOne) ClearUpdatedBy() *PoolUpdateOne { + puo.mutation.ClearUpdatedBy() + return puo +} + // SetName sets the "name" field. func (puo *PoolUpdateOne) SetName(s string) *PoolUpdateOne { puo.mutation.SetName(s) @@ -419,7 +474,9 @@ func (puo *PoolUpdateOne) Select(field string, fields ...string) *PoolUpdateOne // Save executes the query and returns the updated Pool entity. func (puo *PoolUpdateOne) Save(ctx context.Context) (*Pool, error) { - puo.defaults() + if err := puo.defaults(); err != nil { + return nil, err + } return withHooks(ctx, puo.sqlSave, puo.mutation, puo.hooks) } @@ -446,11 +503,15 @@ func (puo *PoolUpdateOne) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (puo *PoolUpdateOne) defaults() { +func (puo *PoolUpdateOne) defaults() error { if _, ok := puo.mutation.UpdatedAt(); !ok { + if pool.UpdateDefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized pool.UpdateDefaultUpdatedAt (forgotten import generated/runtime?)") + } v := pool.UpdateDefaultUpdatedAt() puo.mutation.SetUpdatedAt(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -500,6 +561,15 @@ func (puo *PoolUpdateOne) sqlSave(ctx context.Context) (_node *Pool, err error) if value, ok := puo.mutation.UpdatedAt(); ok { _spec.SetField(pool.FieldUpdatedAt, field.TypeTime, value) } + if puo.mutation.CreatedByCleared() { + _spec.ClearField(pool.FieldCreatedBy, field.TypeString) + } + if value, ok := puo.mutation.UpdatedBy(); ok { + _spec.SetField(pool.FieldUpdatedBy, field.TypeString, value) + } + if puo.mutation.UpdatedByCleared() { + _spec.ClearField(pool.FieldUpdatedBy, field.TypeString) + } if value, ok := puo.mutation.Name(); ok { _spec.SetField(pool.FieldName, field.TypeString, value) } diff --git a/internal/ent/generated/port.go b/internal/ent/generated/port.go index 1af1c987b..7293c1cc5 100644 --- a/internal/ent/generated/port.go +++ b/internal/ent/generated/port.go @@ -37,6 +37,10 @@ type Port struct { CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` + // CreatedBy holds the value of the "created_by" field. + CreatedBy string `json:"created_by,omitempty"` + // UpdatedBy holds the value of the "updated_by" field. + UpdatedBy string `json:"updated_by,omitempty"` // Number holds the value of the "number" field. Number int `json:"number,omitempty"` // Name holds the value of the "name" field. @@ -95,7 +99,7 @@ func (*Port) scanValues(columns []string) ([]any, error) { values[i] = new(gidx.PrefixedID) case port.FieldNumber: values[i] = new(sql.NullInt64) - case port.FieldName: + case port.FieldCreatedBy, port.FieldUpdatedBy, port.FieldName: values[i] = new(sql.NullString) case port.FieldCreatedAt, port.FieldUpdatedAt: values[i] = new(sql.NullTime) @@ -132,6 +136,18 @@ func (po *Port) assignValues(columns []string, values []any) error { } else if value.Valid { po.UpdatedAt = value.Time } + case port.FieldCreatedBy: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field created_by", values[i]) + } else if value.Valid { + po.CreatedBy = value.String + } + case port.FieldUpdatedBy: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field updated_by", values[i]) + } else if value.Valid { + po.UpdatedBy = value.String + } case port.FieldNumber: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field number", values[i]) @@ -202,6 +218,12 @@ func (po *Port) String() string { builder.WriteString("updated_at=") builder.WriteString(po.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") + builder.WriteString("created_by=") + builder.WriteString(po.CreatedBy) + builder.WriteString(", ") + builder.WriteString("updated_by=") + builder.WriteString(po.UpdatedBy) + builder.WriteString(", ") builder.WriteString("number=") builder.WriteString(fmt.Sprintf("%v", po.Number)) builder.WriteString(", ") diff --git a/internal/ent/generated/port/port.go b/internal/ent/generated/port/port.go index 01c1f3bf0..53953f34c 100644 --- a/internal/ent/generated/port/port.go +++ b/internal/ent/generated/port/port.go @@ -19,6 +19,7 @@ package port import ( "time" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "go.infratographer.com/x/gidx" @@ -33,6 +34,10 @@ const ( FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" + // FieldCreatedBy holds the string denoting the created_by field in the database. + FieldCreatedBy = "created_by" + // FieldUpdatedBy holds the string denoting the updated_by field in the database. + FieldUpdatedBy = "updated_by" // FieldNumber holds the string denoting the number field in the database. FieldNumber = "number" // FieldName holds the string denoting the name field in the database. @@ -64,6 +69,8 @@ var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, + FieldCreatedBy, + FieldUpdatedBy, FieldNumber, FieldName, FieldLoadBalancerID, @@ -85,7 +92,13 @@ func ValidColumn(column string) bool { 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 _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" var ( + Hooks [1]ent.Hook // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. @@ -118,6 +131,16 @@ func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() } +// ByCreatedBy orders the results by the created_by field. +func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCreatedBy, opts...).ToFunc() +} + +// ByUpdatedBy orders the results by the updated_by field. +func ByUpdatedBy(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldUpdatedBy, opts...).ToFunc() +} + // ByNumber orders the results by the number field. func ByNumber(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldNumber, opts...).ToFunc() diff --git a/internal/ent/generated/port/where.go b/internal/ent/generated/port/where.go index d9e0cd3d0..c8ba45606 100644 --- a/internal/ent/generated/port/where.go +++ b/internal/ent/generated/port/where.go @@ -80,6 +80,16 @@ func UpdatedAt(v time.Time) predicate.Port { return predicate.Port(sql.FieldEQ(FieldUpdatedAt, v)) } +// CreatedBy applies equality check predicate on the "created_by" field. It's identical to CreatedByEQ. +func CreatedBy(v string) predicate.Port { + return predicate.Port(sql.FieldEQ(FieldCreatedBy, v)) +} + +// UpdatedBy applies equality check predicate on the "updated_by" field. It's identical to UpdatedByEQ. +func UpdatedBy(v string) predicate.Port { + return predicate.Port(sql.FieldEQ(FieldUpdatedBy, v)) +} + // Number applies equality check predicate on the "number" field. It's identical to NumberEQ. func Number(v int) predicate.Port { return predicate.Port(sql.FieldEQ(FieldNumber, v)) @@ -175,6 +185,156 @@ func UpdatedAtLTE(v time.Time) predicate.Port { return predicate.Port(sql.FieldLTE(FieldUpdatedAt, v)) } +// CreatedByEQ applies the EQ predicate on the "created_by" field. +func CreatedByEQ(v string) predicate.Port { + return predicate.Port(sql.FieldEQ(FieldCreatedBy, v)) +} + +// CreatedByNEQ applies the NEQ predicate on the "created_by" field. +func CreatedByNEQ(v string) predicate.Port { + return predicate.Port(sql.FieldNEQ(FieldCreatedBy, v)) +} + +// CreatedByIn applies the In predicate on the "created_by" field. +func CreatedByIn(vs ...string) predicate.Port { + return predicate.Port(sql.FieldIn(FieldCreatedBy, vs...)) +} + +// CreatedByNotIn applies the NotIn predicate on the "created_by" field. +func CreatedByNotIn(vs ...string) predicate.Port { + return predicate.Port(sql.FieldNotIn(FieldCreatedBy, vs...)) +} + +// CreatedByGT applies the GT predicate on the "created_by" field. +func CreatedByGT(v string) predicate.Port { + return predicate.Port(sql.FieldGT(FieldCreatedBy, v)) +} + +// CreatedByGTE applies the GTE predicate on the "created_by" field. +func CreatedByGTE(v string) predicate.Port { + return predicate.Port(sql.FieldGTE(FieldCreatedBy, v)) +} + +// CreatedByLT applies the LT predicate on the "created_by" field. +func CreatedByLT(v string) predicate.Port { + return predicate.Port(sql.FieldLT(FieldCreatedBy, v)) +} + +// CreatedByLTE applies the LTE predicate on the "created_by" field. +func CreatedByLTE(v string) predicate.Port { + return predicate.Port(sql.FieldLTE(FieldCreatedBy, v)) +} + +// CreatedByContains applies the Contains predicate on the "created_by" field. +func CreatedByContains(v string) predicate.Port { + return predicate.Port(sql.FieldContains(FieldCreatedBy, v)) +} + +// CreatedByHasPrefix applies the HasPrefix predicate on the "created_by" field. +func CreatedByHasPrefix(v string) predicate.Port { + return predicate.Port(sql.FieldHasPrefix(FieldCreatedBy, v)) +} + +// CreatedByHasSuffix applies the HasSuffix predicate on the "created_by" field. +func CreatedByHasSuffix(v string) predicate.Port { + return predicate.Port(sql.FieldHasSuffix(FieldCreatedBy, v)) +} + +// CreatedByIsNil applies the IsNil predicate on the "created_by" field. +func CreatedByIsNil() predicate.Port { + return predicate.Port(sql.FieldIsNull(FieldCreatedBy)) +} + +// CreatedByNotNil applies the NotNil predicate on the "created_by" field. +func CreatedByNotNil() predicate.Port { + return predicate.Port(sql.FieldNotNull(FieldCreatedBy)) +} + +// CreatedByEqualFold applies the EqualFold predicate on the "created_by" field. +func CreatedByEqualFold(v string) predicate.Port { + return predicate.Port(sql.FieldEqualFold(FieldCreatedBy, v)) +} + +// CreatedByContainsFold applies the ContainsFold predicate on the "created_by" field. +func CreatedByContainsFold(v string) predicate.Port { + return predicate.Port(sql.FieldContainsFold(FieldCreatedBy, v)) +} + +// UpdatedByEQ applies the EQ predicate on the "updated_by" field. +func UpdatedByEQ(v string) predicate.Port { + return predicate.Port(sql.FieldEQ(FieldUpdatedBy, v)) +} + +// UpdatedByNEQ applies the NEQ predicate on the "updated_by" field. +func UpdatedByNEQ(v string) predicate.Port { + return predicate.Port(sql.FieldNEQ(FieldUpdatedBy, v)) +} + +// UpdatedByIn applies the In predicate on the "updated_by" field. +func UpdatedByIn(vs ...string) predicate.Port { + return predicate.Port(sql.FieldIn(FieldUpdatedBy, vs...)) +} + +// UpdatedByNotIn applies the NotIn predicate on the "updated_by" field. +func UpdatedByNotIn(vs ...string) predicate.Port { + return predicate.Port(sql.FieldNotIn(FieldUpdatedBy, vs...)) +} + +// UpdatedByGT applies the GT predicate on the "updated_by" field. +func UpdatedByGT(v string) predicate.Port { + return predicate.Port(sql.FieldGT(FieldUpdatedBy, v)) +} + +// UpdatedByGTE applies the GTE predicate on the "updated_by" field. +func UpdatedByGTE(v string) predicate.Port { + return predicate.Port(sql.FieldGTE(FieldUpdatedBy, v)) +} + +// UpdatedByLT applies the LT predicate on the "updated_by" field. +func UpdatedByLT(v string) predicate.Port { + return predicate.Port(sql.FieldLT(FieldUpdatedBy, v)) +} + +// UpdatedByLTE applies the LTE predicate on the "updated_by" field. +func UpdatedByLTE(v string) predicate.Port { + return predicate.Port(sql.FieldLTE(FieldUpdatedBy, v)) +} + +// UpdatedByContains applies the Contains predicate on the "updated_by" field. +func UpdatedByContains(v string) predicate.Port { + return predicate.Port(sql.FieldContains(FieldUpdatedBy, v)) +} + +// UpdatedByHasPrefix applies the HasPrefix predicate on the "updated_by" field. +func UpdatedByHasPrefix(v string) predicate.Port { + return predicate.Port(sql.FieldHasPrefix(FieldUpdatedBy, v)) +} + +// UpdatedByHasSuffix applies the HasSuffix predicate on the "updated_by" field. +func UpdatedByHasSuffix(v string) predicate.Port { + return predicate.Port(sql.FieldHasSuffix(FieldUpdatedBy, v)) +} + +// UpdatedByIsNil applies the IsNil predicate on the "updated_by" field. +func UpdatedByIsNil() predicate.Port { + return predicate.Port(sql.FieldIsNull(FieldUpdatedBy)) +} + +// UpdatedByNotNil applies the NotNil predicate on the "updated_by" field. +func UpdatedByNotNil() predicate.Port { + return predicate.Port(sql.FieldNotNull(FieldUpdatedBy)) +} + +// UpdatedByEqualFold applies the EqualFold predicate on the "updated_by" field. +func UpdatedByEqualFold(v string) predicate.Port { + return predicate.Port(sql.FieldEqualFold(FieldUpdatedBy, v)) +} + +// UpdatedByContainsFold applies the ContainsFold predicate on the "updated_by" field. +func UpdatedByContainsFold(v string) predicate.Port { + return predicate.Port(sql.FieldContainsFold(FieldUpdatedBy, v)) +} + // NumberEQ applies the EQ predicate on the "number" field. func NumberEQ(v int) predicate.Port { return predicate.Port(sql.FieldEQ(FieldNumber, v)) diff --git a/internal/ent/generated/port_create.go b/internal/ent/generated/port_create.go index 148089e05..e4b56a0d8 100644 --- a/internal/ent/generated/port_create.go +++ b/internal/ent/generated/port_create.go @@ -65,6 +65,34 @@ func (pc *PortCreate) SetNillableUpdatedAt(t *time.Time) *PortCreate { return pc } +// SetCreatedBy sets the "created_by" field. +func (pc *PortCreate) SetCreatedBy(s string) *PortCreate { + pc.mutation.SetCreatedBy(s) + return pc +} + +// SetNillableCreatedBy sets the "created_by" field if the given value is not nil. +func (pc *PortCreate) SetNillableCreatedBy(s *string) *PortCreate { + if s != nil { + pc.SetCreatedBy(*s) + } + return pc +} + +// SetUpdatedBy sets the "updated_by" field. +func (pc *PortCreate) SetUpdatedBy(s string) *PortCreate { + pc.mutation.SetUpdatedBy(s) + return pc +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (pc *PortCreate) SetNillableUpdatedBy(s *string) *PortCreate { + if s != nil { + pc.SetUpdatedBy(*s) + } + return pc +} + // SetNumber sets the "number" field. func (pc *PortCreate) SetNumber(i int) *PortCreate { pc.mutation.SetNumber(i) @@ -124,7 +152,9 @@ func (pc *PortCreate) Mutation() *PortMutation { // Save creates the Port in the database. func (pc *PortCreate) Save(ctx context.Context) (*Port, error) { - pc.defaults() + if err := pc.defaults(); err != nil { + return nil, err + } return withHooks(ctx, pc.sqlSave, pc.mutation, pc.hooks) } @@ -151,19 +181,29 @@ func (pc *PortCreate) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (pc *PortCreate) defaults() { +func (pc *PortCreate) defaults() error { if _, ok := pc.mutation.CreatedAt(); !ok { + if port.DefaultCreatedAt == nil { + return fmt.Errorf("generated: uninitialized port.DefaultCreatedAt (forgotten import generated/runtime?)") + } v := port.DefaultCreatedAt() pc.mutation.SetCreatedAt(v) } if _, ok := pc.mutation.UpdatedAt(); !ok { + if port.DefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized port.DefaultUpdatedAt (forgotten import generated/runtime?)") + } v := port.DefaultUpdatedAt() pc.mutation.SetUpdatedAt(v) } if _, ok := pc.mutation.ID(); !ok { + if port.DefaultID == nil { + return fmt.Errorf("generated: uninitialized port.DefaultID (forgotten import generated/runtime?)") + } v := port.DefaultID() pc.mutation.SetID(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -239,6 +279,14 @@ func (pc *PortCreate) createSpec() (*Port, *sqlgraph.CreateSpec) { _spec.SetField(port.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } + if value, ok := pc.mutation.CreatedBy(); ok { + _spec.SetField(port.FieldCreatedBy, field.TypeString, value) + _node.CreatedBy = value + } + if value, ok := pc.mutation.UpdatedBy(); ok { + _spec.SetField(port.FieldUpdatedBy, field.TypeString, value) + _node.UpdatedBy = value + } if value, ok := pc.mutation.Number(); ok { _spec.SetField(port.FieldNumber, field.TypeInt, value) _node.Number = value diff --git a/internal/ent/generated/port_update.go b/internal/ent/generated/port_update.go index 2c1de4074..2367ffcab 100644 --- a/internal/ent/generated/port_update.go +++ b/internal/ent/generated/port_update.go @@ -43,6 +43,26 @@ func (pu *PortUpdate) Where(ps ...predicate.Port) *PortUpdate { return pu } +// SetUpdatedBy sets the "updated_by" field. +func (pu *PortUpdate) SetUpdatedBy(s string) *PortUpdate { + pu.mutation.SetUpdatedBy(s) + return pu +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (pu *PortUpdate) SetNillableUpdatedBy(s *string) *PortUpdate { + if s != nil { + pu.SetUpdatedBy(*s) + } + return pu +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (pu *PortUpdate) ClearUpdatedBy() *PortUpdate { + pu.mutation.ClearUpdatedBy() + return pu +} + // SetNumber sets the "number" field. func (pu *PortUpdate) SetNumber(i int) *PortUpdate { pu.mutation.ResetNumber() @@ -105,7 +125,9 @@ func (pu *PortUpdate) RemovePools(p ...*Pool) *PortUpdate { // Save executes the query and returns the number of nodes affected by the update operation. func (pu *PortUpdate) Save(ctx context.Context) (int, error) { - pu.defaults() + if err := pu.defaults(); err != nil { + return 0, err + } return withHooks(ctx, pu.sqlSave, pu.mutation, pu.hooks) } @@ -132,11 +154,15 @@ func (pu *PortUpdate) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (pu *PortUpdate) defaults() { +func (pu *PortUpdate) defaults() error { if _, ok := pu.mutation.UpdatedAt(); !ok { + if port.UpdateDefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized port.UpdateDefaultUpdatedAt (forgotten import generated/runtime?)") + } v := port.UpdateDefaultUpdatedAt() pu.mutation.SetUpdatedAt(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -167,6 +193,15 @@ func (pu *PortUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := pu.mutation.UpdatedAt(); ok { _spec.SetField(port.FieldUpdatedAt, field.TypeTime, value) } + if pu.mutation.CreatedByCleared() { + _spec.ClearField(port.FieldCreatedBy, field.TypeString) + } + if value, ok := pu.mutation.UpdatedBy(); ok { + _spec.SetField(port.FieldUpdatedBy, field.TypeString, value) + } + if pu.mutation.UpdatedByCleared() { + _spec.ClearField(port.FieldUpdatedBy, field.TypeString) + } if value, ok := pu.mutation.Number(); ok { _spec.SetField(port.FieldNumber, field.TypeInt, value) } @@ -241,6 +276,26 @@ type PortUpdateOne struct { mutation *PortMutation } +// SetUpdatedBy sets the "updated_by" field. +func (puo *PortUpdateOne) SetUpdatedBy(s string) *PortUpdateOne { + puo.mutation.SetUpdatedBy(s) + return puo +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (puo *PortUpdateOne) SetNillableUpdatedBy(s *string) *PortUpdateOne { + if s != nil { + puo.SetUpdatedBy(*s) + } + return puo +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (puo *PortUpdateOne) ClearUpdatedBy() *PortUpdateOne { + puo.mutation.ClearUpdatedBy() + return puo +} + // SetNumber sets the "number" field. func (puo *PortUpdateOne) SetNumber(i int) *PortUpdateOne { puo.mutation.ResetNumber() @@ -316,7 +371,9 @@ func (puo *PortUpdateOne) Select(field string, fields ...string) *PortUpdateOne // Save executes the query and returns the updated Port entity. func (puo *PortUpdateOne) Save(ctx context.Context) (*Port, error) { - puo.defaults() + if err := puo.defaults(); err != nil { + return nil, err + } return withHooks(ctx, puo.sqlSave, puo.mutation, puo.hooks) } @@ -343,11 +400,15 @@ func (puo *PortUpdateOne) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (puo *PortUpdateOne) defaults() { +func (puo *PortUpdateOne) defaults() error { if _, ok := puo.mutation.UpdatedAt(); !ok { + if port.UpdateDefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized port.UpdateDefaultUpdatedAt (forgotten import generated/runtime?)") + } v := port.UpdateDefaultUpdatedAt() puo.mutation.SetUpdatedAt(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -395,6 +456,15 @@ func (puo *PortUpdateOne) sqlSave(ctx context.Context) (_node *Port, err error) if value, ok := puo.mutation.UpdatedAt(); ok { _spec.SetField(port.FieldUpdatedAt, field.TypeTime, value) } + if puo.mutation.CreatedByCleared() { + _spec.ClearField(port.FieldCreatedBy, field.TypeString) + } + if value, ok := puo.mutation.UpdatedBy(); ok { + _spec.SetField(port.FieldUpdatedBy, field.TypeString, value) + } + if puo.mutation.UpdatedByCleared() { + _spec.ClearField(port.FieldUpdatedBy, field.TypeString) + } if value, ok := puo.mutation.Number(); ok { _spec.SetField(port.FieldNumber, field.TypeInt, value) } diff --git a/internal/ent/generated/provider.go b/internal/ent/generated/provider.go index 28ed622f0..7e9582099 100644 --- a/internal/ent/generated/provider.go +++ b/internal/ent/generated/provider.go @@ -37,6 +37,10 @@ type Provider struct { CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` + // CreatedBy holds the value of the "created_by" field. + CreatedBy string `json:"created_by,omitempty"` + // UpdatedBy holds the value of the "updated_by" field. + UpdatedBy string `json:"updated_by,omitempty"` // The name of the load balancer provider. Name string `json:"name,omitempty"` // The ID for the owner for this load balancer. @@ -76,7 +80,7 @@ func (*Provider) scanValues(columns []string) ([]any, error) { switch columns[i] { case provider.FieldID, provider.FieldOwnerID: values[i] = new(gidx.PrefixedID) - case provider.FieldName: + case provider.FieldCreatedBy, provider.FieldUpdatedBy, provider.FieldName: values[i] = new(sql.NullString) case provider.FieldCreatedAt, provider.FieldUpdatedAt: values[i] = new(sql.NullTime) @@ -113,6 +117,18 @@ func (pr *Provider) assignValues(columns []string, values []any) error { } else if value.Valid { pr.UpdatedAt = value.Time } + case provider.FieldCreatedBy: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field created_by", values[i]) + } else if value.Valid { + pr.CreatedBy = value.String + } + case provider.FieldUpdatedBy: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field updated_by", values[i]) + } else if value.Valid { + pr.UpdatedBy = value.String + } case provider.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) @@ -172,6 +188,12 @@ func (pr *Provider) String() string { builder.WriteString("updated_at=") builder.WriteString(pr.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") + builder.WriteString("created_by=") + builder.WriteString(pr.CreatedBy) + builder.WriteString(", ") + builder.WriteString("updated_by=") + builder.WriteString(pr.UpdatedBy) + builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(pr.Name) builder.WriteString(", ") diff --git a/internal/ent/generated/provider/provider.go b/internal/ent/generated/provider/provider.go index 22ffdf7c9..554cf6d09 100644 --- a/internal/ent/generated/provider/provider.go +++ b/internal/ent/generated/provider/provider.go @@ -19,6 +19,7 @@ package provider import ( "time" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "go.infratographer.com/x/gidx" @@ -33,6 +34,10 @@ const ( FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" + // FieldCreatedBy holds the string denoting the created_by field in the database. + FieldCreatedBy = "created_by" + // FieldUpdatedBy holds the string denoting the updated_by field in the database. + FieldUpdatedBy = "updated_by" // FieldName holds the string denoting the name field in the database. FieldName = "name" // FieldOwnerID holds the string denoting the owner_id field in the database. @@ -55,6 +60,8 @@ var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, + FieldCreatedBy, + FieldUpdatedBy, FieldName, FieldOwnerID, } @@ -69,7 +76,13 @@ func ValidColumn(column string) bool { 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 _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" var ( + Hooks [1]ent.Hook // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. @@ -102,6 +115,16 @@ func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() } +// ByCreatedBy orders the results by the created_by field. +func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCreatedBy, opts...).ToFunc() +} + +// ByUpdatedBy orders the results by the updated_by field. +func ByUpdatedBy(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldUpdatedBy, opts...).ToFunc() +} + // ByName orders the results by the name field. func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() diff --git a/internal/ent/generated/provider/where.go b/internal/ent/generated/provider/where.go index f3daf70ea..66d0e448b 100644 --- a/internal/ent/generated/provider/where.go +++ b/internal/ent/generated/provider/where.go @@ -80,6 +80,16 @@ func UpdatedAt(v time.Time) predicate.Provider { return predicate.Provider(sql.FieldEQ(FieldUpdatedAt, v)) } +// CreatedBy applies equality check predicate on the "created_by" field. It's identical to CreatedByEQ. +func CreatedBy(v string) predicate.Provider { + return predicate.Provider(sql.FieldEQ(FieldCreatedBy, v)) +} + +// UpdatedBy applies equality check predicate on the "updated_by" field. It's identical to UpdatedByEQ. +func UpdatedBy(v string) predicate.Provider { + return predicate.Provider(sql.FieldEQ(FieldUpdatedBy, v)) +} + // Name applies equality check predicate on the "name" field. It's identical to NameEQ. func Name(v string) predicate.Provider { return predicate.Provider(sql.FieldEQ(FieldName, v)) @@ -170,6 +180,156 @@ func UpdatedAtLTE(v time.Time) predicate.Provider { return predicate.Provider(sql.FieldLTE(FieldUpdatedAt, v)) } +// CreatedByEQ applies the EQ predicate on the "created_by" field. +func CreatedByEQ(v string) predicate.Provider { + return predicate.Provider(sql.FieldEQ(FieldCreatedBy, v)) +} + +// CreatedByNEQ applies the NEQ predicate on the "created_by" field. +func CreatedByNEQ(v string) predicate.Provider { + return predicate.Provider(sql.FieldNEQ(FieldCreatedBy, v)) +} + +// CreatedByIn applies the In predicate on the "created_by" field. +func CreatedByIn(vs ...string) predicate.Provider { + return predicate.Provider(sql.FieldIn(FieldCreatedBy, vs...)) +} + +// CreatedByNotIn applies the NotIn predicate on the "created_by" field. +func CreatedByNotIn(vs ...string) predicate.Provider { + return predicate.Provider(sql.FieldNotIn(FieldCreatedBy, vs...)) +} + +// CreatedByGT applies the GT predicate on the "created_by" field. +func CreatedByGT(v string) predicate.Provider { + return predicate.Provider(sql.FieldGT(FieldCreatedBy, v)) +} + +// CreatedByGTE applies the GTE predicate on the "created_by" field. +func CreatedByGTE(v string) predicate.Provider { + return predicate.Provider(sql.FieldGTE(FieldCreatedBy, v)) +} + +// CreatedByLT applies the LT predicate on the "created_by" field. +func CreatedByLT(v string) predicate.Provider { + return predicate.Provider(sql.FieldLT(FieldCreatedBy, v)) +} + +// CreatedByLTE applies the LTE predicate on the "created_by" field. +func CreatedByLTE(v string) predicate.Provider { + return predicate.Provider(sql.FieldLTE(FieldCreatedBy, v)) +} + +// CreatedByContains applies the Contains predicate on the "created_by" field. +func CreatedByContains(v string) predicate.Provider { + return predicate.Provider(sql.FieldContains(FieldCreatedBy, v)) +} + +// CreatedByHasPrefix applies the HasPrefix predicate on the "created_by" field. +func CreatedByHasPrefix(v string) predicate.Provider { + return predicate.Provider(sql.FieldHasPrefix(FieldCreatedBy, v)) +} + +// CreatedByHasSuffix applies the HasSuffix predicate on the "created_by" field. +func CreatedByHasSuffix(v string) predicate.Provider { + return predicate.Provider(sql.FieldHasSuffix(FieldCreatedBy, v)) +} + +// CreatedByIsNil applies the IsNil predicate on the "created_by" field. +func CreatedByIsNil() predicate.Provider { + return predicate.Provider(sql.FieldIsNull(FieldCreatedBy)) +} + +// CreatedByNotNil applies the NotNil predicate on the "created_by" field. +func CreatedByNotNil() predicate.Provider { + return predicate.Provider(sql.FieldNotNull(FieldCreatedBy)) +} + +// CreatedByEqualFold applies the EqualFold predicate on the "created_by" field. +func CreatedByEqualFold(v string) predicate.Provider { + return predicate.Provider(sql.FieldEqualFold(FieldCreatedBy, v)) +} + +// CreatedByContainsFold applies the ContainsFold predicate on the "created_by" field. +func CreatedByContainsFold(v string) predicate.Provider { + return predicate.Provider(sql.FieldContainsFold(FieldCreatedBy, v)) +} + +// UpdatedByEQ applies the EQ predicate on the "updated_by" field. +func UpdatedByEQ(v string) predicate.Provider { + return predicate.Provider(sql.FieldEQ(FieldUpdatedBy, v)) +} + +// UpdatedByNEQ applies the NEQ predicate on the "updated_by" field. +func UpdatedByNEQ(v string) predicate.Provider { + return predicate.Provider(sql.FieldNEQ(FieldUpdatedBy, v)) +} + +// UpdatedByIn applies the In predicate on the "updated_by" field. +func UpdatedByIn(vs ...string) predicate.Provider { + return predicate.Provider(sql.FieldIn(FieldUpdatedBy, vs...)) +} + +// UpdatedByNotIn applies the NotIn predicate on the "updated_by" field. +func UpdatedByNotIn(vs ...string) predicate.Provider { + return predicate.Provider(sql.FieldNotIn(FieldUpdatedBy, vs...)) +} + +// UpdatedByGT applies the GT predicate on the "updated_by" field. +func UpdatedByGT(v string) predicate.Provider { + return predicate.Provider(sql.FieldGT(FieldUpdatedBy, v)) +} + +// UpdatedByGTE applies the GTE predicate on the "updated_by" field. +func UpdatedByGTE(v string) predicate.Provider { + return predicate.Provider(sql.FieldGTE(FieldUpdatedBy, v)) +} + +// UpdatedByLT applies the LT predicate on the "updated_by" field. +func UpdatedByLT(v string) predicate.Provider { + return predicate.Provider(sql.FieldLT(FieldUpdatedBy, v)) +} + +// UpdatedByLTE applies the LTE predicate on the "updated_by" field. +func UpdatedByLTE(v string) predicate.Provider { + return predicate.Provider(sql.FieldLTE(FieldUpdatedBy, v)) +} + +// UpdatedByContains applies the Contains predicate on the "updated_by" field. +func UpdatedByContains(v string) predicate.Provider { + return predicate.Provider(sql.FieldContains(FieldUpdatedBy, v)) +} + +// UpdatedByHasPrefix applies the HasPrefix predicate on the "updated_by" field. +func UpdatedByHasPrefix(v string) predicate.Provider { + return predicate.Provider(sql.FieldHasPrefix(FieldUpdatedBy, v)) +} + +// UpdatedByHasSuffix applies the HasSuffix predicate on the "updated_by" field. +func UpdatedByHasSuffix(v string) predicate.Provider { + return predicate.Provider(sql.FieldHasSuffix(FieldUpdatedBy, v)) +} + +// UpdatedByIsNil applies the IsNil predicate on the "updated_by" field. +func UpdatedByIsNil() predicate.Provider { + return predicate.Provider(sql.FieldIsNull(FieldUpdatedBy)) +} + +// UpdatedByNotNil applies the NotNil predicate on the "updated_by" field. +func UpdatedByNotNil() predicate.Provider { + return predicate.Provider(sql.FieldNotNull(FieldUpdatedBy)) +} + +// UpdatedByEqualFold applies the EqualFold predicate on the "updated_by" field. +func UpdatedByEqualFold(v string) predicate.Provider { + return predicate.Provider(sql.FieldEqualFold(FieldUpdatedBy, v)) +} + +// UpdatedByContainsFold applies the ContainsFold predicate on the "updated_by" field. +func UpdatedByContainsFold(v string) predicate.Provider { + return predicate.Provider(sql.FieldContainsFold(FieldUpdatedBy, v)) +} + // NameEQ applies the EQ predicate on the "name" field. func NameEQ(v string) predicate.Provider { return predicate.Provider(sql.FieldEQ(FieldName, v)) diff --git a/internal/ent/generated/provider_create.go b/internal/ent/generated/provider_create.go index f37496f68..0f84327d4 100644 --- a/internal/ent/generated/provider_create.go +++ b/internal/ent/generated/provider_create.go @@ -64,6 +64,34 @@ func (pc *ProviderCreate) SetNillableUpdatedAt(t *time.Time) *ProviderCreate { return pc } +// SetCreatedBy sets the "created_by" field. +func (pc *ProviderCreate) SetCreatedBy(s string) *ProviderCreate { + pc.mutation.SetCreatedBy(s) + return pc +} + +// SetNillableCreatedBy sets the "created_by" field if the given value is not nil. +func (pc *ProviderCreate) SetNillableCreatedBy(s *string) *ProviderCreate { + if s != nil { + pc.SetCreatedBy(*s) + } + return pc +} + +// SetUpdatedBy sets the "updated_by" field. +func (pc *ProviderCreate) SetUpdatedBy(s string) *ProviderCreate { + pc.mutation.SetUpdatedBy(s) + return pc +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (pc *ProviderCreate) SetNillableUpdatedBy(s *string) *ProviderCreate { + if s != nil { + pc.SetUpdatedBy(*s) + } + return pc +} + // SetName sets the "name" field. func (pc *ProviderCreate) SetName(s string) *ProviderCreate { pc.mutation.SetName(s) @@ -112,7 +140,9 @@ func (pc *ProviderCreate) Mutation() *ProviderMutation { // Save creates the Provider in the database. func (pc *ProviderCreate) Save(ctx context.Context) (*Provider, error) { - pc.defaults() + if err := pc.defaults(); err != nil { + return nil, err + } return withHooks(ctx, pc.sqlSave, pc.mutation, pc.hooks) } @@ -139,19 +169,29 @@ func (pc *ProviderCreate) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (pc *ProviderCreate) defaults() { +func (pc *ProviderCreate) defaults() error { if _, ok := pc.mutation.CreatedAt(); !ok { + if provider.DefaultCreatedAt == nil { + return fmt.Errorf("generated: uninitialized provider.DefaultCreatedAt (forgotten import generated/runtime?)") + } v := provider.DefaultCreatedAt() pc.mutation.SetCreatedAt(v) } if _, ok := pc.mutation.UpdatedAt(); !ok { + if provider.DefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized provider.DefaultUpdatedAt (forgotten import generated/runtime?)") + } v := provider.DefaultUpdatedAt() pc.mutation.SetUpdatedAt(v) } if _, ok := pc.mutation.ID(); !ok { + if provider.DefaultID == nil { + return fmt.Errorf("generated: uninitialized provider.DefaultID (forgotten import generated/runtime?)") + } v := provider.DefaultID() pc.mutation.SetID(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -221,6 +261,14 @@ func (pc *ProviderCreate) createSpec() (*Provider, *sqlgraph.CreateSpec) { _spec.SetField(provider.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } + if value, ok := pc.mutation.CreatedBy(); ok { + _spec.SetField(provider.FieldCreatedBy, field.TypeString, value) + _node.CreatedBy = value + } + if value, ok := pc.mutation.UpdatedBy(); ok { + _spec.SetField(provider.FieldUpdatedBy, field.TypeString, value) + _node.UpdatedBy = value + } if value, ok := pc.mutation.Name(); ok { _spec.SetField(provider.FieldName, field.TypeString, value) _node.Name = value diff --git a/internal/ent/generated/provider_update.go b/internal/ent/generated/provider_update.go index 6db34a3a3..ad81b6cfe 100644 --- a/internal/ent/generated/provider_update.go +++ b/internal/ent/generated/provider_update.go @@ -43,6 +43,26 @@ func (pu *ProviderUpdate) Where(ps ...predicate.Provider) *ProviderUpdate { return pu } +// SetUpdatedBy sets the "updated_by" field. +func (pu *ProviderUpdate) SetUpdatedBy(s string) *ProviderUpdate { + pu.mutation.SetUpdatedBy(s) + return pu +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (pu *ProviderUpdate) SetNillableUpdatedBy(s *string) *ProviderUpdate { + if s != nil { + pu.SetUpdatedBy(*s) + } + return pu +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (pu *ProviderUpdate) ClearUpdatedBy() *ProviderUpdate { + pu.mutation.ClearUpdatedBy() + return pu +} + // SetName sets the "name" field. func (pu *ProviderUpdate) SetName(s string) *ProviderUpdate { pu.mutation.SetName(s) @@ -92,7 +112,9 @@ func (pu *ProviderUpdate) RemoveLoadBalancers(l ...*LoadBalancer) *ProviderUpdat // Save executes the query and returns the number of nodes affected by the update operation. func (pu *ProviderUpdate) Save(ctx context.Context) (int, error) { - pu.defaults() + if err := pu.defaults(); err != nil { + return 0, err + } return withHooks(ctx, pu.sqlSave, pu.mutation, pu.hooks) } @@ -119,11 +141,15 @@ func (pu *ProviderUpdate) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (pu *ProviderUpdate) defaults() { +func (pu *ProviderUpdate) defaults() error { if _, ok := pu.mutation.UpdatedAt(); !ok { + if provider.UpdateDefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized provider.UpdateDefaultUpdatedAt (forgotten import generated/runtime?)") + } v := provider.UpdateDefaultUpdatedAt() pu.mutation.SetUpdatedAt(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -151,6 +177,15 @@ func (pu *ProviderUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := pu.mutation.UpdatedAt(); ok { _spec.SetField(provider.FieldUpdatedAt, field.TypeTime, value) } + if pu.mutation.CreatedByCleared() { + _spec.ClearField(provider.FieldCreatedBy, field.TypeString) + } + if value, ok := pu.mutation.UpdatedBy(); ok { + _spec.SetField(provider.FieldUpdatedBy, field.TypeString, value) + } + if pu.mutation.UpdatedByCleared() { + _spec.ClearField(provider.FieldUpdatedBy, field.TypeString) + } if value, ok := pu.mutation.Name(); ok { _spec.SetField(provider.FieldName, field.TypeString, value) } @@ -219,6 +254,26 @@ type ProviderUpdateOne struct { mutation *ProviderMutation } +// SetUpdatedBy sets the "updated_by" field. +func (puo *ProviderUpdateOne) SetUpdatedBy(s string) *ProviderUpdateOne { + puo.mutation.SetUpdatedBy(s) + return puo +} + +// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil. +func (puo *ProviderUpdateOne) SetNillableUpdatedBy(s *string) *ProviderUpdateOne { + if s != nil { + puo.SetUpdatedBy(*s) + } + return puo +} + +// ClearUpdatedBy clears the value of the "updated_by" field. +func (puo *ProviderUpdateOne) ClearUpdatedBy() *ProviderUpdateOne { + puo.mutation.ClearUpdatedBy() + return puo +} + // SetName sets the "name" field. func (puo *ProviderUpdateOne) SetName(s string) *ProviderUpdateOne { puo.mutation.SetName(s) @@ -281,7 +336,9 @@ func (puo *ProviderUpdateOne) Select(field string, fields ...string) *ProviderUp // Save executes the query and returns the updated Provider entity. func (puo *ProviderUpdateOne) Save(ctx context.Context) (*Provider, error) { - puo.defaults() + if err := puo.defaults(); err != nil { + return nil, err + } return withHooks(ctx, puo.sqlSave, puo.mutation, puo.hooks) } @@ -308,11 +365,15 @@ func (puo *ProviderUpdateOne) ExecX(ctx context.Context) { } // defaults sets the default values of the builder before save. -func (puo *ProviderUpdateOne) defaults() { +func (puo *ProviderUpdateOne) defaults() error { if _, ok := puo.mutation.UpdatedAt(); !ok { + if provider.UpdateDefaultUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized provider.UpdateDefaultUpdatedAt (forgotten import generated/runtime?)") + } v := provider.UpdateDefaultUpdatedAt() puo.mutation.SetUpdatedAt(v) } + return nil } // check runs all checks and user-defined validators on the builder. @@ -357,6 +418,15 @@ func (puo *ProviderUpdateOne) sqlSave(ctx context.Context) (_node *Provider, err if value, ok := puo.mutation.UpdatedAt(); ok { _spec.SetField(provider.FieldUpdatedAt, field.TypeTime, value) } + if puo.mutation.CreatedByCleared() { + _spec.ClearField(provider.FieldCreatedBy, field.TypeString) + } + if value, ok := puo.mutation.UpdatedBy(); ok { + _spec.SetField(provider.FieldUpdatedBy, field.TypeString, value) + } + if puo.mutation.UpdatedByCleared() { + _spec.ClearField(provider.FieldUpdatedBy, field.TypeString) + } if value, ok := puo.mutation.Name(); ok { _spec.SetField(provider.FieldName, field.TypeString, value) } diff --git a/internal/ent/generated/runtime/runtime.go b/internal/ent/generated/runtime/runtime.go index 0c13decc6..0820916c8 100644 --- a/internal/ent/generated/runtime/runtime.go +++ b/internal/ent/generated/runtime/runtime.go @@ -70,6 +70,8 @@ func init() { // loadbalancer.DefaultID holds the default value on creation for the id field. loadbalancer.DefaultID = loadbalancerDescID.Default.(func() gidx.PrefixedID) originMixin := schema.Origin{}.Mixin() + originMixinHooks1 := originMixin[1].Hooks() + origin.Hooks[0] = originMixinHooks1[0] originMixinFields0 := originMixin[0].Fields() _ = originMixinFields0 originFields := schema.Origin{}.Fields() @@ -141,6 +143,8 @@ func init() { // origin.DefaultID holds the default value on creation for the id field. origin.DefaultID = originDescID.Default.(func() gidx.PrefixedID) poolMixin := schema.Pool{}.Mixin() + poolMixinHooks1 := poolMixin[1].Hooks() + pool.Hooks[0] = poolMixinHooks1[0] poolMixinFields0 := poolMixin[0].Fields() _ = poolMixinFields0 poolFields := schema.Pool{}.Fields() @@ -168,6 +172,8 @@ func init() { // pool.DefaultID holds the default value on creation for the id field. pool.DefaultID = poolDescID.Default.(func() gidx.PrefixedID) portMixin := schema.Port{}.Mixin() + portMixinHooks1 := portMixin[1].Hooks() + port.Hooks[0] = portMixinHooks1[0] portMixinFields0 := portMixin[0].Fields() _ = portMixinFields0 portFields := schema.Port{}.Fields() @@ -210,6 +216,8 @@ func init() { // port.DefaultID holds the default value on creation for the id field. port.DefaultID = portDescID.Default.(func() gidx.PrefixedID) providerMixin := schema.Provider{}.Mixin() + providerMixinHooks1 := providerMixin[1].Hooks() + provider.Hooks[0] = providerMixinHooks1[0] providerMixinFields0 := providerMixin[0].Fields() _ = providerMixinFields0 providerFields := schema.Provider{}.Fields() diff --git a/internal/ent/schema/origin.go b/internal/ent/schema/origin.go index a7c88c2e8..cad4e74db 100644 --- a/internal/ent/schema/origin.go +++ b/internal/ent/schema/origin.go @@ -11,6 +11,7 @@ import ( "go.infratographer.com/x/entx" "go.infratographer.com/x/gidx" + "go.infratographer.com/load-balancer-api/internal/ent/schema/audit" "go.infratographer.com/load-balancer-api/internal/ent/schema/validations" "go.infratographer.com/load-balancer-api/x/pubsubinfo" ) @@ -26,6 +27,7 @@ type Origin struct { func (Origin) Mixin() []ent.Mixin { return []ent.Mixin{ entx.NewTimestampMixin(), + audit.AuditMixin{}, } } diff --git a/internal/ent/schema/pool.go b/internal/ent/schema/pool.go index 98432e28d..dc085867b 100644 --- a/internal/ent/schema/pool.go +++ b/internal/ent/schema/pool.go @@ -11,6 +11,7 @@ import ( "go.infratographer.com/x/entx" "go.infratographer.com/x/gidx" + "go.infratographer.com/load-balancer-api/internal/ent/schema/audit" "go.infratographer.com/load-balancer-api/x/pubsubinfo" ) @@ -23,6 +24,7 @@ type Pool struct { func (Pool) Mixin() []ent.Mixin { return []ent.Mixin{ entx.NewTimestampMixin(), + audit.AuditMixin{}, } } diff --git a/internal/ent/schema/port.go b/internal/ent/schema/port.go index 47fe46f3c..7da853e1e 100644 --- a/internal/ent/schema/port.go +++ b/internal/ent/schema/port.go @@ -11,6 +11,7 @@ import ( "go.infratographer.com/x/entx" "go.infratographer.com/x/gidx" + "go.infratographer.com/load-balancer-api/internal/ent/schema/audit" "go.infratographer.com/load-balancer-api/internal/ent/schema/validations" "go.infratographer.com/load-balancer-api/x/pubsubinfo" ) @@ -29,6 +30,7 @@ type Port struct { func (Port) Mixin() []ent.Mixin { return []ent.Mixin{ entx.NewTimestampMixin(), + audit.AuditMixin{}, } } diff --git a/internal/ent/schema/provider.go b/internal/ent/schema/provider.go index 2b2d9ce52..54bb74637 100644 --- a/internal/ent/schema/provider.go +++ b/internal/ent/schema/provider.go @@ -10,6 +10,7 @@ import ( "go.infratographer.com/x/entx" "go.infratographer.com/x/gidx" + "go.infratographer.com/load-balancer-api/internal/ent/schema/audit" "go.infratographer.com/load-balancer-api/x/pubsubinfo" ) @@ -22,6 +23,7 @@ type Provider struct { func (Provider) Mixin() []ent.Mixin { return []ent.Mixin{ entx.NewTimestampMixin(), + audit.AuditMixin{}, } } diff --git a/internal/graphapi/gen_server.go b/internal/graphapi/gen_server.go index dff105670..05c72ffd1 100644 --- a/internal/graphapi/gen_server.go +++ b/internal/graphapi/gen_server.go @@ -101,6 +101,7 @@ type ComplexityRoot struct { LoadBalancerOrigin struct { Active func(childComplexity int) int CreatedAt func(childComplexity int) int + CreatedBy func(childComplexity int) int ID func(childComplexity int) int Name func(childComplexity int) int Pool func(childComplexity int) int @@ -108,6 +109,7 @@ type ComplexityRoot struct { PortNumber func(childComplexity int) int Target func(childComplexity int) int UpdatedAt func(childComplexity int) int + UpdatedBy func(childComplexity int) int Weight func(childComplexity int) int } @@ -136,6 +138,7 @@ type ComplexityRoot struct { LoadBalancerPool struct { CreatedAt func(childComplexity int) int + CreatedBy func(childComplexity int) int ID func(childComplexity int) int Name func(childComplexity int) int Origins func(childComplexity int, after *entgql.Cursor[gidx.PrefixedID], first *int, before *entgql.Cursor[gidx.PrefixedID], last *int, orderBy *generated.LoadBalancerOriginOrder, where *generated.LoadBalancerOriginWhereInput) int @@ -144,6 +147,7 @@ type ComplexityRoot struct { Ports func(childComplexity int) int Protocol func(childComplexity int) int UpdatedAt func(childComplexity int) int + UpdatedBy func(childComplexity int) int } LoadBalancerPoolConnection struct { @@ -171,6 +175,7 @@ type ComplexityRoot struct { LoadBalancerPort struct { CreatedAt func(childComplexity int) int + CreatedBy func(childComplexity int) int ID func(childComplexity int) int LoadBalancer func(childComplexity int) int LoadBalancerID func(childComplexity int) int @@ -178,6 +183,7 @@ type ComplexityRoot struct { Number func(childComplexity int) int Pools func(childComplexity int) int UpdatedAt func(childComplexity int) int + UpdatedBy func(childComplexity int) int } LoadBalancerPortConnection struct { @@ -205,11 +211,13 @@ type ComplexityRoot struct { LoadBalancerProvider struct { CreatedAt func(childComplexity int) int + CreatedBy func(childComplexity int) int ID func(childComplexity int) int LoadBalancers func(childComplexity int, after *entgql.Cursor[gidx.PrefixedID], first *int, before *entgql.Cursor[gidx.PrefixedID], last *int, orderBy *generated.LoadBalancerOrder, where *generated.LoadBalancerWhereInput) int Name func(childComplexity int) int Owner func(childComplexity int) int UpdatedAt func(childComplexity int) int + UpdatedBy func(childComplexity int) int } LoadBalancerProviderConnection struct { @@ -578,6 +586,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LoadBalancerOrigin.CreatedAt(childComplexity), true + case "LoadBalancerOrigin.createdBy": + if e.complexity.LoadBalancerOrigin.CreatedBy == nil { + break + } + + return e.complexity.LoadBalancerOrigin.CreatedBy(childComplexity), true + case "LoadBalancerOrigin.id": if e.complexity.LoadBalancerOrigin.ID == nil { break @@ -627,6 +642,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LoadBalancerOrigin.UpdatedAt(childComplexity), true + case "LoadBalancerOrigin.updatedBy": + if e.complexity.LoadBalancerOrigin.UpdatedBy == nil { + break + } + + return e.complexity.LoadBalancerOrigin.UpdatedBy(childComplexity), true + case "LoadBalancerOrigin.weight": if e.complexity.LoadBalancerOrigin.Weight == nil { break @@ -697,6 +719,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LoadBalancerPool.CreatedAt(childComplexity), true + case "LoadBalancerPool.createdBy": + if e.complexity.LoadBalancerPool.CreatedBy == nil { + break + } + + return e.complexity.LoadBalancerPool.CreatedBy(childComplexity), true + case "LoadBalancerPool.id": if e.complexity.LoadBalancerPool.ID == nil { break @@ -758,6 +787,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LoadBalancerPool.UpdatedAt(childComplexity), true + case "LoadBalancerPool.updatedBy": + if e.complexity.LoadBalancerPool.UpdatedBy == nil { + break + } + + return e.complexity.LoadBalancerPool.UpdatedBy(childComplexity), true + case "LoadBalancerPoolConnection.edges": if e.complexity.LoadBalancerPoolConnection.Edges == nil { break @@ -821,6 +857,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LoadBalancerPort.CreatedAt(childComplexity), true + case "LoadBalancerPort.createdBy": + if e.complexity.LoadBalancerPort.CreatedBy == nil { + break + } + + return e.complexity.LoadBalancerPort.CreatedBy(childComplexity), true + case "LoadBalancerPort.id": if e.complexity.LoadBalancerPort.ID == nil { break @@ -870,6 +913,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LoadBalancerPort.UpdatedAt(childComplexity), true + case "LoadBalancerPort.updatedBy": + if e.complexity.LoadBalancerPort.UpdatedBy == nil { + break + } + + return e.complexity.LoadBalancerPort.UpdatedBy(childComplexity), true + case "LoadBalancerPortConnection.edges": if e.complexity.LoadBalancerPortConnection.Edges == nil { break @@ -933,6 +983,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LoadBalancerProvider.CreatedAt(childComplexity), true + case "LoadBalancerProvider.createdBy": + if e.complexity.LoadBalancerProvider.CreatedBy == nil { + break + } + + return e.complexity.LoadBalancerProvider.CreatedBy(childComplexity), true + case "LoadBalancerProvider.id": if e.complexity.LoadBalancerProvider.ID == nil { break @@ -973,6 +1030,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LoadBalancerProvider.UpdatedAt(childComplexity), true + case "LoadBalancerProvider.updatedBy": + if e.complexity.LoadBalancerProvider.UpdatedBy == nil { + break + } + + return e.complexity.LoadBalancerProvider.UpdatedBy(childComplexity), true + case "LoadBalancerProviderConnection.edges": if e.complexity.LoadBalancerProviderConnection.Edges == nil { break @@ -1525,6 +1589,8 @@ CreateLoadBalancerOriginInput is used for create LoadBalancerOrigin object. Input was generated by ent. """ input CreateLoadBalancerOriginInput { + createdBy: String + updatedBy: String name: String! weight: Int target: String! @@ -1537,6 +1603,8 @@ CreateLoadBalancerPoolInput is used for create LoadBalancerPool object. Input was generated by ent. """ input CreateLoadBalancerPoolInput { + createdBy: String + updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -1548,6 +1616,8 @@ CreateLoadBalancerPortInput is used for create LoadBalancerPort object. Input was generated by ent. """ input CreateLoadBalancerPortInput { + createdBy: String + updatedBy: String number: Int! name: String! poolIDs: [ID!] @@ -1555,6 +1625,8 @@ input CreateLoadBalancerPortInput { } """Input information to create a load balancer provider.""" input CreateLoadBalancerProviderInput { + createdBy: String + updatedBy: String """The name of the load balancer provider.""" name: String! """The ID for the owner for this load balancer.""" @@ -1633,6 +1705,8 @@ type LoadBalancerOrigin implements Node @key(fields: "id") @prefixedID(prefix: " id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String name: String! weight: Int! target: String! @@ -1709,6 +1783,38 @@ input LoadBalancerOriginWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -1766,6 +1872,8 @@ type LoadBalancerPool implements Node @key(fields: "id") @prefixedID(prefix: "lo id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -1860,6 +1968,38 @@ input LoadBalancerPoolWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -1890,6 +2030,8 @@ type LoadBalancerPort implements Node @key(fields: "id") @prefixedID(prefix: "lo id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String number: Int! name: String! loadBalancerID: ID! @@ -1961,6 +2103,38 @@ input LoadBalancerPortWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """number field predicates""" number: Int numberNEQ: Int @@ -1996,6 +2170,8 @@ type LoadBalancerProvider implements Node @key(fields: "id") @prefixedID(prefix: id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String """The name of the load balancer provider.""" name: String! loadBalancers( @@ -2084,6 +2260,38 @@ input LoadBalancerProviderWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -2257,6 +2465,8 @@ UpdateLoadBalancerOriginInput is used for update LoadBalancerOrigin object. Input was generated by ent. """ input UpdateLoadBalancerOriginInput { + updatedBy: String + clearUpdatedBy: Boolean name: String weight: Int target: String @@ -2268,6 +2478,8 @@ UpdateLoadBalancerPoolInput is used for update LoadBalancerPool object. Input was generated by ent. """ input UpdateLoadBalancerPoolInput { + updatedBy: String + clearUpdatedBy: Boolean name: String protocol: LoadBalancerPoolProtocol addPortIDs: [ID!] @@ -2282,6 +2494,8 @@ UpdateLoadBalancerPortInput is used for update LoadBalancerPort object. Input was generated by ent. """ input UpdateLoadBalancerPortInput { + updatedBy: String + clearUpdatedBy: Boolean number: Int name: String addPoolIDs: [ID!] @@ -2290,6 +2504,8 @@ input UpdateLoadBalancerPortInput { } """Input information to update a load balancer provider.""" input UpdateLoadBalancerProviderInput { + updatedBy: String + clearUpdatedBy: Boolean """The name of the load balancer provider.""" name: String } @@ -3920,6 +4136,10 @@ func (ec *executionContext) fieldContext_Entity_findLoadBalancerOriginByID(ctx c return ec.fieldContext_LoadBalancerOrigin_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerOrigin_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerOrigin_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerOrigin_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerOrigin_name(ctx, field) case "weight": @@ -3997,6 +4217,10 @@ func (ec *executionContext) fieldContext_Entity_findLoadBalancerPoolByID(ctx con return ec.fieldContext_LoadBalancerPool_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPool_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPool_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPool_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerPool_name(ctx, field) case "protocol": @@ -4072,6 +4296,10 @@ func (ec *executionContext) fieldContext_Entity_findLoadBalancerPortByID(ctx con return ec.fieldContext_LoadBalancerPort_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPort_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPort_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPort_updatedBy(ctx, field) case "number": return ec.fieldContext_LoadBalancerPort_number(ctx, field) case "name": @@ -4145,6 +4373,10 @@ func (ec *executionContext) fieldContext_Entity_findLoadBalancerProviderByID(ctx return ec.fieldContext_LoadBalancerProvider_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerProvider_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerProvider_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerProvider_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerProvider_name(ctx, field) case "loadBalancers": @@ -4661,6 +4893,10 @@ func (ec *executionContext) fieldContext_LoadBalancer_loadBalancerProvider(ctx c return ec.fieldContext_LoadBalancerProvider_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerProvider_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerProvider_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerProvider_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerProvider_name(ctx, field) case "loadBalancers": @@ -5272,8 +5508,8 @@ func (ec *executionContext) fieldContext_LoadBalancerOrigin_updatedAt(ctx contex return fc, nil } -func (ec *executionContext) _LoadBalancerOrigin_name(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoadBalancerOrigin_name(ctx, field) +func (ec *executionContext) _LoadBalancerOrigin_createdBy(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerOrigin_createdBy(ctx, field) if err != nil { return graphql.Null } @@ -5286,24 +5522,21 @@ func (ec *executionContext) _LoadBalancerOrigin_name(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.CreatedBy, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoadBalancerOrigin_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LoadBalancerOrigin_createdBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "LoadBalancerOrigin", Field: field, @@ -5316,8 +5549,8 @@ func (ec *executionContext) fieldContext_LoadBalancerOrigin_name(ctx context.Con return fc, nil } -func (ec *executionContext) _LoadBalancerOrigin_weight(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoadBalancerOrigin_weight(ctx, field) +func (ec *executionContext) _LoadBalancerOrigin_updatedBy(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerOrigin_updatedBy(ctx, field) if err != nil { return graphql.Null } @@ -5330,38 +5563,35 @@ func (ec *executionContext) _LoadBalancerOrigin_weight(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Weight, nil + return obj.UpdatedBy, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(int32) + res := resTmp.(string) fc.Result = res - return ec.marshalNInt2int32(ctx, field.Selections, res) + return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoadBalancerOrigin_weight(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LoadBalancerOrigin_updatedBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "LoadBalancerOrigin", 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LoadBalancerOrigin_target(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoadBalancerOrigin_target(ctx, field) +func (ec *executionContext) _LoadBalancerOrigin_name(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerOrigin_name(ctx, field) if err != nil { return graphql.Null } @@ -5374,7 +5604,7 @@ func (ec *executionContext) _LoadBalancerOrigin_target(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Target, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -5391,7 +5621,7 @@ func (ec *executionContext) _LoadBalancerOrigin_target(ctx context.Context, fiel return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoadBalancerOrigin_target(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LoadBalancerOrigin_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "LoadBalancerOrigin", Field: field, @@ -5404,8 +5634,8 @@ func (ec *executionContext) fieldContext_LoadBalancerOrigin_target(ctx context.C return fc, nil } -func (ec *executionContext) _LoadBalancerOrigin_portNumber(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoadBalancerOrigin_portNumber(ctx, field) +func (ec *executionContext) _LoadBalancerOrigin_weight(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerOrigin_weight(ctx, field) if err != nil { return graphql.Null } @@ -5418,7 +5648,7 @@ func (ec *executionContext) _LoadBalancerOrigin_portNumber(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PortNumber, nil + return obj.Weight, nil }) if err != nil { ec.Error(ctx, err) @@ -5430,12 +5660,12 @@ func (ec *executionContext) _LoadBalancerOrigin_portNumber(ctx context.Context, } return graphql.Null } - res := resTmp.(int) + res := resTmp.(int32) fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) + return ec.marshalNInt2int32(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoadBalancerOrigin_portNumber(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LoadBalancerOrigin_weight(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "LoadBalancerOrigin", Field: field, @@ -5448,8 +5678,8 @@ func (ec *executionContext) fieldContext_LoadBalancerOrigin_portNumber(ctx conte return fc, nil } -func (ec *executionContext) _LoadBalancerOrigin_active(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoadBalancerOrigin_active(ctx, field) +func (ec *executionContext) _LoadBalancerOrigin_target(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerOrigin_target(ctx, field) if err != nil { return graphql.Null } @@ -5462,7 +5692,7 @@ func (ec *executionContext) _LoadBalancerOrigin_active(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Active, nil + return obj.Target, nil }) if err != nil { ec.Error(ctx, err) @@ -5474,26 +5704,114 @@ func (ec *executionContext) _LoadBalancerOrigin_active(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoadBalancerOrigin_active(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LoadBalancerOrigin_target(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "LoadBalancerOrigin", 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LoadBalancerOrigin_poolID(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoadBalancerOrigin_poolID(ctx, field) +func (ec *executionContext) _LoadBalancerOrigin_portNumber(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerOrigin_portNumber(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PortNumber, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoadBalancerOrigin_portNumber(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoadBalancerOrigin", + 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) _LoadBalancerOrigin_active(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerOrigin_active(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Active, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoadBalancerOrigin_active(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoadBalancerOrigin", + 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 +} + +func (ec *executionContext) _LoadBalancerOrigin_poolID(ctx context.Context, field graphql.CollectedField, obj *generated.Origin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerOrigin_poolID(ctx, field) if err != nil { return graphql.Null } @@ -5581,6 +5899,10 @@ func (ec *executionContext) fieldContext_LoadBalancerOrigin_pool(ctx context.Con return ec.fieldContext_LoadBalancerPool_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPool_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPool_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPool_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerPool_name(ctx, field) case "protocol": @@ -5790,6 +6112,10 @@ func (ec *executionContext) fieldContext_LoadBalancerOriginCreatePayload_loadBal return ec.fieldContext_LoadBalancerOrigin_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerOrigin_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerOrigin_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerOrigin_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerOrigin_name(ctx, field) case "weight": @@ -5897,6 +6223,10 @@ func (ec *executionContext) fieldContext_LoadBalancerOriginEdge_node(ctx context return ec.fieldContext_LoadBalancerOrigin_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerOrigin_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerOrigin_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerOrigin_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerOrigin_name(ctx, field) case "weight": @@ -6007,6 +6337,10 @@ func (ec *executionContext) fieldContext_LoadBalancerOriginUpdatePayload_loadBal return ec.fieldContext_LoadBalancerOrigin_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerOrigin_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerOrigin_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerOrigin_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerOrigin_name(ctx, field) case "weight": @@ -6160,6 +6494,88 @@ func (ec *executionContext) fieldContext_LoadBalancerPool_updatedAt(ctx context. return fc, nil } +func (ec *executionContext) _LoadBalancerPool_createdBy(ctx context.Context, field graphql.CollectedField, obj *generated.Pool) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerPool_createdBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoadBalancerPool_createdBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoadBalancerPool", + 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) _LoadBalancerPool_updatedBy(ctx context.Context, field graphql.CollectedField, obj *generated.Pool) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerPool_updatedBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoadBalancerPool_updatedBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoadBalancerPool", + 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) _LoadBalancerPool_name(ctx context.Context, field graphql.CollectedField, obj *generated.Pool) (ret graphql.Marshaler) { fc, err := ec.fieldContext_LoadBalancerPool_name(ctx, field) if err != nil { @@ -6334,6 +6750,10 @@ func (ec *executionContext) fieldContext_LoadBalancerPool_ports(ctx context.Cont return ec.fieldContext_LoadBalancerPort_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPort_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPort_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPort_updatedBy(ctx, field) case "number": return ec.fieldContext_LoadBalancerPort_number(ctx, field) case "name": @@ -6658,6 +7078,10 @@ func (ec *executionContext) fieldContext_LoadBalancerPoolCreatePayload_loadBalan return ec.fieldContext_LoadBalancerPool_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPool_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPool_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPool_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerPool_name(ctx, field) case "protocol": @@ -6760,6 +7184,10 @@ func (ec *executionContext) fieldContext_LoadBalancerPoolEdge_node(ctx context.C return ec.fieldContext_LoadBalancerPool_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPool_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPool_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPool_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerPool_name(ctx, field) case "protocol": @@ -6868,6 +7296,10 @@ func (ec *executionContext) fieldContext_LoadBalancerPoolUpdatePayload_loadBalan return ec.fieldContext_LoadBalancerPool_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPool_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPool_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPool_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerPool_name(ctx, field) case "protocol": @@ -7019,8 +7451,8 @@ func (ec *executionContext) fieldContext_LoadBalancerPort_updatedAt(ctx context. return fc, nil } -func (ec *executionContext) _LoadBalancerPort_number(ctx context.Context, field graphql.CollectedField, obj *generated.Port) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoadBalancerPort_number(ctx, field) +func (ec *executionContext) _LoadBalancerPort_createdBy(ctx context.Context, field graphql.CollectedField, obj *generated.Port) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerPort_createdBy(ctx, field) if err != nil { return graphql.Null } @@ -7033,38 +7465,35 @@ func (ec *executionContext) _LoadBalancerPort_number(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Number, nil + return obj.CreatedBy, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(int) + res := resTmp.(string) fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) + return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoadBalancerPort_number(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LoadBalancerPort_createdBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "LoadBalancerPort", 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LoadBalancerPort_name(ctx context.Context, field graphql.CollectedField, obj *generated.Port) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoadBalancerPort_name(ctx, field) +func (ec *executionContext) _LoadBalancerPort_updatedBy(ctx context.Context, field graphql.CollectedField, obj *generated.Port) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerPort_updatedBy(ctx, field) if err != nil { return graphql.Null } @@ -7077,24 +7506,21 @@ func (ec *executionContext) _LoadBalancerPort_name(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.UpdatedBy, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoadBalancerPort_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LoadBalancerPort_updatedBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "LoadBalancerPort", Field: field, @@ -7107,8 +7533,8 @@ func (ec *executionContext) fieldContext_LoadBalancerPort_name(ctx context.Conte return fc, nil } -func (ec *executionContext) _LoadBalancerPort_loadBalancerID(ctx context.Context, field graphql.CollectedField, obj *generated.Port) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoadBalancerPort_loadBalancerID(ctx, field) +func (ec *executionContext) _LoadBalancerPort_number(ctx context.Context, field graphql.CollectedField, obj *generated.Port) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerPort_number(ctx, field) if err != nil { return graphql.Null } @@ -7121,7 +7547,7 @@ func (ec *executionContext) _LoadBalancerPort_loadBalancerID(ctx context.Context }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.LoadBalancerID, nil + return obj.Number, nil }) if err != nil { ec.Error(ctx, err) @@ -7133,26 +7559,26 @@ func (ec *executionContext) _LoadBalancerPort_loadBalancerID(ctx context.Context } return graphql.Null } - res := resTmp.(gidx.PrefixedID) + res := resTmp.(int) fc.Result = res - return ec.marshalNID2goᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoadBalancerPort_loadBalancerID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LoadBalancerPort_number(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "LoadBalancerPort", 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 nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LoadBalancerPort_pools(ctx context.Context, field graphql.CollectedField, obj *generated.Port) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoadBalancerPort_pools(ctx, field) +func (ec *executionContext) _LoadBalancerPort_name(ctx context.Context, field graphql.CollectedField, obj *generated.Port) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerPort_name(ctx, field) if err != nil { return graphql.Null } @@ -7165,46 +7591,138 @@ func (ec *executionContext) _LoadBalancerPort_pools(ctx context.Context, field g }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Pools(ctx) + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*generated.Pool) + res := resTmp.(string) fc.Result = res - return ec.marshalOLoadBalancerPool2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐPoolᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoadBalancerPort_pools(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_LoadBalancerPort_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "LoadBalancerPort", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_LoadBalancerPool_id(ctx, field) - case "createdAt": - return ec.fieldContext_LoadBalancerPool_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_LoadBalancerPool_updatedAt(ctx, field) - case "name": - return ec.fieldContext_LoadBalancerPool_name(ctx, field) - case "protocol": - return ec.fieldContext_LoadBalancerPool_protocol(ctx, field) - case "ownerID": - return ec.fieldContext_LoadBalancerPool_ownerID(ctx, field) - case "ports": - return ec.fieldContext_LoadBalancerPool_ports(ctx, field) - case "origins": - return ec.fieldContext_LoadBalancerPool_origins(ctx, field) - case "owner": - return ec.fieldContext_LoadBalancerPool_owner(ctx, field) + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _LoadBalancerPort_loadBalancerID(ctx context.Context, field graphql.CollectedField, obj *generated.Port) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerPort_loadBalancerID(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LoadBalancerID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(gidx.PrefixedID) + fc.Result = res + return ec.marshalNID2goᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoadBalancerPort_loadBalancerID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoadBalancerPort", + 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) _LoadBalancerPort_pools(ctx context.Context, field graphql.CollectedField, obj *generated.Port) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerPort_pools(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Pools(ctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*generated.Pool) + fc.Result = res + return ec.marshalOLoadBalancerPool2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐPoolᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoadBalancerPort_pools(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoadBalancerPort", + 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_LoadBalancerPool_id(ctx, field) + case "createdAt": + return ec.fieldContext_LoadBalancerPool_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_LoadBalancerPool_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPool_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPool_updatedBy(ctx, field) + case "name": + return ec.fieldContext_LoadBalancerPool_name(ctx, field) + case "protocol": + return ec.fieldContext_LoadBalancerPool_protocol(ctx, field) + case "ownerID": + return ec.fieldContext_LoadBalancerPool_ownerID(ctx, field) + case "ports": + return ec.fieldContext_LoadBalancerPool_ports(ctx, field) + case "origins": + return ec.fieldContext_LoadBalancerPool_origins(ctx, field) + case "owner": + return ec.fieldContext_LoadBalancerPool_owner(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type LoadBalancerPool", field.Name) }, @@ -7468,6 +7986,10 @@ func (ec *executionContext) fieldContext_LoadBalancerPortCreatePayload_loadBalan return ec.fieldContext_LoadBalancerPort_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPort_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPort_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPort_updatedBy(ctx, field) case "number": return ec.fieldContext_LoadBalancerPort_number(ctx, field) case "name": @@ -7571,6 +8093,10 @@ func (ec *executionContext) fieldContext_LoadBalancerPortEdge_node(ctx context.C return ec.fieldContext_LoadBalancerPort_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPort_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPort_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPort_updatedBy(ctx, field) case "number": return ec.fieldContext_LoadBalancerPort_number(ctx, field) case "name": @@ -7677,6 +8203,10 @@ func (ec *executionContext) fieldContext_LoadBalancerPortUpdatePayload_loadBalan return ec.fieldContext_LoadBalancerPort_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPort_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPort_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPort_updatedBy(ctx, field) case "number": return ec.fieldContext_LoadBalancerPort_number(ctx, field) case "name": @@ -7826,6 +8356,88 @@ func (ec *executionContext) fieldContext_LoadBalancerProvider_updatedAt(ctx cont return fc, nil } +func (ec *executionContext) _LoadBalancerProvider_createdBy(ctx context.Context, field graphql.CollectedField, obj *generated.Provider) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerProvider_createdBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoadBalancerProvider_createdBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoadBalancerProvider", + 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) _LoadBalancerProvider_updatedBy(ctx context.Context, field graphql.CollectedField, obj *generated.Provider) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoadBalancerProvider_updatedBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoadBalancerProvider_updatedBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoadBalancerProvider", + 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) _LoadBalancerProvider_name(ctx context.Context, field graphql.CollectedField, obj *generated.Provider) (ret graphql.Marshaler) { fc, err := ec.fieldContext_LoadBalancerProvider_name(ctx, field) if err != nil { @@ -8177,6 +8789,10 @@ func (ec *executionContext) fieldContext_LoadBalancerProviderCreatePayload_loadB return ec.fieldContext_LoadBalancerProvider_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerProvider_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerProvider_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerProvider_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerProvider_name(ctx, field) case "loadBalancers": @@ -8276,6 +8892,10 @@ func (ec *executionContext) fieldContext_LoadBalancerProviderEdge_node(ctx conte return ec.fieldContext_LoadBalancerProvider_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerProvider_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerProvider_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerProvider_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerProvider_name(ctx, field) case "loadBalancers": @@ -8378,6 +8998,10 @@ func (ec *executionContext) fieldContext_LoadBalancerProviderUpdatePayload_loadB return ec.fieldContext_LoadBalancerProvider_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerProvider_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerProvider_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerProvider_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerProvider_name(ctx, field) case "loadBalancers": @@ -9804,6 +10428,10 @@ func (ec *executionContext) fieldContext_Query_loadBalancerPool(ctx context.Cont return ec.fieldContext_LoadBalancerPool_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerPool_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerPool_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerPool_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerPool_name(ctx, field) case "protocol": @@ -9879,6 +10507,10 @@ func (ec *executionContext) fieldContext_Query_loadBalancerProvider(ctx context. return ec.fieldContext_LoadBalancerProvider_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_LoadBalancerProvider_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_LoadBalancerProvider_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_LoadBalancerProvider_updatedBy(ctx, field) case "name": return ec.fieldContext_LoadBalancerProvider_name(ctx, field) case "loadBalancers": @@ -12272,13 +12904,31 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerOriginInput(ctx cont asMap[k] = v } - fieldsInOrder := [...]string{"name", "weight", "target", "portNumber", "active", "poolID"} + fieldsInOrder := [...]string{"createdBy", "updatedBy", "name", "weight", "target", "portNumber", "active", "poolID"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "createdBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedBy = data + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data case "name": var err error @@ -12346,13 +12996,31 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerPoolInput(ctx contex asMap[k] = v } - fieldsInOrder := [...]string{"name", "protocol", "ownerID", "portIDs", "originIDs"} + fieldsInOrder := [...]string{"createdBy", "updatedBy", "name", "protocol", "ownerID", "portIDs", "originIDs"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "createdBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedBy = data + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data case "name": var err error @@ -12411,13 +13079,31 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerPortInput(ctx contex asMap[k] = v } - fieldsInOrder := [...]string{"number", "name", "poolIDs", "loadBalancerID"} + fieldsInOrder := [...]string{"createdBy", "updatedBy", "number", "name", "poolIDs", "loadBalancerID"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "createdBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedBy = data + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data case "number": var err error @@ -12467,18 +13153,36 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerProviderInput(ctx co asMap[k] = v } - fieldsInOrder := [...]string{"name", "ownerID"} + fieldsInOrder := [...]string{"createdBy", "updatedBy", "name", "ownerID"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "name": + case "createdBy": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedBy = data + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data + case "name": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } @@ -12589,7 +13293,7 @@ func (ec *executionContext) unmarshalInputLoadBalancerOriginWhereInput(ctx conte asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "weight", "weightNEQ", "weightIn", "weightNotIn", "weightGT", "weightGTE", "weightLT", "weightLTE", "target", "targetNEQ", "targetIn", "targetNotIn", "targetGT", "targetGTE", "targetLT", "targetLTE", "targetContains", "targetHasPrefix", "targetHasSuffix", "targetEqualFold", "targetContainsFold", "portNumber", "portNumberNEQ", "portNumberIn", "portNumberNotIn", "portNumberGT", "portNumberGTE", "portNumberLT", "portNumberLTE", "active", "activeNEQ", "hasPool", "hasPoolWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "weight", "weightNEQ", "weightIn", "weightNotIn", "weightGT", "weightGTE", "weightLT", "weightLTE", "target", "targetNEQ", "targetIn", "targetNotIn", "targetGT", "targetGTE", "targetLT", "targetLTE", "targetContains", "targetHasPrefix", "targetHasSuffix", "targetEqualFold", "targetContainsFold", "portNumber", "portNumberNEQ", "portNumberIn", "portNumberNotIn", "portNumberGT", "portNumberGTE", "portNumberLT", "portNumberLTE", "active", "activeNEQ", "hasPool", "hasPoolWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -12839,725 +13543,2101 @@ func (ec *executionContext) unmarshalInputLoadBalancerOriginWhereInput(ctx conte return it, err } it.UpdatedAtLTE = data - case "name": + case "createdBy": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": + it.CreatedBy = data + case "createdByNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": + it.CreatedByNEQ = data + case "createdByIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": + it.CreatedByIn = data + case "createdByNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": + it.CreatedByNotIn = data + case "createdByGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": + it.CreatedByGT = data + case "createdByGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": + it.CreatedByGTE = data + case "createdByLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": + it.CreatedByLT = data + case "createdByLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": + it.CreatedByLTE = data + case "createdByContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": + it.CreatedByContains = data + case "createdByHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": + it.CreatedByHasPrefix = data + case "createdByHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": + it.CreatedByHasSuffix = data + case "createdByIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": + it.CreatedByIsNil = data + case "createdByNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "weight": + it.CreatedByNotNil = data + case "createdByEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weight")) - data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Weight = data - case "weightNEQ": + it.CreatedByEqualFold = data + case "createdByContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightNEQ")) - data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.WeightNEQ = data - case "weightIn": + it.CreatedByContainsFold = data + case "updatedBy": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightIn")) - data, err := ec.unmarshalOInt2ᚕint32ᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.WeightIn = data - case "weightNotIn": + it.UpdatedBy = data + case "updatedByNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightNotIn")) - data, err := ec.unmarshalOInt2ᚕint32ᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.WeightNotIn = data - case "weightGT": + it.UpdatedByNEQ = data + case "updatedByIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightGT")) - data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.WeightGT = data - case "weightGTE": + it.UpdatedByIn = data + case "updatedByNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightGTE")) - data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.WeightGTE = data - case "weightLT": + it.UpdatedByNotIn = data + case "updatedByGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightLT")) - data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.WeightLT = data - case "weightLTE": + it.UpdatedByGT = data + case "updatedByGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightLTE")) - data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.WeightLTE = data - case "target": + it.UpdatedByGTE = data + case "updatedByLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("target")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Target = data - case "targetNEQ": + it.UpdatedByLT = data + case "updatedByLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.TargetNEQ = data - case "targetIn": + it.UpdatedByLTE = data + case "updatedByContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.TargetIn = data - case "targetNotIn": + it.UpdatedByContains = data + case "updatedByHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.TargetNotIn = data - case "targetGT": + it.UpdatedByHasPrefix = data + case "updatedByHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.TargetGT = data - case "targetGTE": + it.UpdatedByHasSuffix = data + case "updatedByIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.TargetGTE = data - case "targetLT": + it.UpdatedByIsNil = data + case "updatedByNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.TargetLT = data - case "targetLTE": + it.UpdatedByNotNil = data + case "updatedByEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.TargetLTE = data - case "targetContains": + it.UpdatedByEqualFold = data + case "updatedByContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.TargetContains = data - case "targetHasPrefix": + it.UpdatedByContainsFold = data + case "name": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetHasPrefix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.TargetHasPrefix = data - case "targetHasSuffix": + it.Name = data + case "nameNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.TargetHasSuffix = data - case "targetEqualFold": + it.NameNEQ = data + case "nameIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.TargetEqualFold = data - case "targetContainsFold": + it.NameIn = data + case "nameNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.TargetContainsFold = data - case "portNumber": + it.NameNotIn = data + case "nameGT": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContainsFold = data + case "weight": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weight")) + data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + if err != nil { + return it, err + } + it.Weight = data + case "weightNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightNEQ")) + data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + if err != nil { + return it, err + } + it.WeightNEQ = data + case "weightIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightIn")) + data, err := ec.unmarshalOInt2ᚕint32ᚄ(ctx, v) + if err != nil { + return it, err + } + it.WeightIn = data + case "weightNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightNotIn")) + data, err := ec.unmarshalOInt2ᚕint32ᚄ(ctx, v) + if err != nil { + return it, err + } + it.WeightNotIn = data + case "weightGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightGT")) + data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + if err != nil { + return it, err + } + it.WeightGT = data + case "weightGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightGTE")) + data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + if err != nil { + return it, err + } + it.WeightGTE = data + case "weightLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightLT")) + data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + if err != nil { + return it, err + } + it.WeightLT = data + case "weightLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weightLTE")) + data, err := ec.unmarshalOInt2ᚖint32(ctx, v) + if err != nil { + return it, err + } + it.WeightLTE = data + case "target": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("target")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Target = data + case "targetNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TargetNEQ = data + case "targetIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.TargetIn = data + case "targetNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.TargetNotIn = data + case "targetGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TargetGT = data + case "targetGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TargetGTE = data + case "targetLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TargetLT = data + case "targetLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TargetLTE = data + case "targetContains": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TargetContains = data + case "targetHasPrefix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TargetHasPrefix = data + case "targetHasSuffix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TargetHasSuffix = data + case "targetEqualFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TargetEqualFold = data + case "targetContainsFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TargetContainsFold = data + case "portNumber": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumber")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.PortNumber = data + case "portNumberNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberNEQ")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.PortNumberNEQ = data + case "portNumberIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.PortNumberIn = data + case "portNumberNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberNotIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.PortNumberNotIn = data + case "portNumberGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberGT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.PortNumberGT = data + case "portNumberGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberGTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.PortNumberGTE = data + case "portNumberLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberLT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.PortNumberLT = data + case "portNumberLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberLTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.PortNumberLTE = data + case "active": + var err error + + 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": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNEQ")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.ActiveNEQ = data + case "hasPool": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPool")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasPool = data + case "hasPoolWith": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPoolWith")) + data, err := ec.unmarshalOLoadBalancerPoolWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasPoolWith = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputLoadBalancerPoolOrder(ctx context.Context, obj interface{}) (generated.LoadBalancerPoolOrder, error) { + var it generated.LoadBalancerPoolOrder + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + 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": + var err error + + 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": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNLoadBalancerPoolOrderField2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputLoadBalancerPoolWhereInput(ctx context.Context, obj interface{}) (generated.LoadBalancerPoolWhereInput, error) { + var it generated.LoadBalancerPoolWhereInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "protocol", "protocolNEQ", "protocolIn", "protocolNotIn", "hasPorts", "hasPortsWith", "hasOrigins", "hasOriginsWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOLoadBalancerPoolWhereInput2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolWhereInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + case "and": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOLoadBalancerPoolWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "or": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOLoadBalancerPoolWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "id": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "idNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.IDNEQ = data + case "idIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedIDᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDIn = data + case "idNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedIDᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDNotIn = data + case "idGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.IDGT = data + case "idGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.IDGTE = data + case "idLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.IDLT = data + case "idLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.IDLTE = data + case "createdAt": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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 "updatedAt": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAt = data + case "updatedAtNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtNEQ = data + case "updatedAtIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtIn = data + case "updatedAtNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtNotIn = data + case "updatedAtGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtGT = data + case "updatedAtGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtGTE = data + case "updatedAtLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtLT = data + case "updatedAtLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtLTE = data + case "createdBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedBy = data + case "createdByNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByNEQ = data + case "createdByIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedByIn = data + case "createdByNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedByNotIn = data + case "createdByGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByGT = data + case "createdByGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByGTE = data + case "createdByLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByLT = data + case "createdByLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByLTE = data + case "createdByContains": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByContains = data + case "createdByHasPrefix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByHasPrefix = data + case "createdByHasSuffix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByHasSuffix = data + case "createdByIsNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.CreatedByIsNil = data + case "createdByNotNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.CreatedByNotNil = data + case "createdByEqualFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByEqualFold = data + case "createdByContainsFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByContainsFold = data + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data + case "updatedByNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByNEQ = data + case "updatedByIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByIn = data + case "updatedByNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByNotIn = data + case "updatedByGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByGT = data + case "updatedByGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByGTE = data + case "updatedByLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByLT = data + case "updatedByLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByLTE = data + case "updatedByContains": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByContains = data + case "updatedByHasPrefix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByHasPrefix = data + case "updatedByHasSuffix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByHasSuffix = data + case "updatedByIsNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByIsNil = data + case "updatedByNotNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByNotNil = data + case "updatedByEqualFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByEqualFold = data + case "updatedByContainsFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedByContainsFold = data + case "name": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + 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": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContainsFold = data + case "protocol": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("protocol")) + data, err := ec.unmarshalOLoadBalancerPoolProtocol2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚋpoolᚐProtocol(ctx, v) + if err != nil { + return it, err + } + it.Protocol = data + case "protocolNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("protocolNEQ")) + data, err := ec.unmarshalOLoadBalancerPoolProtocol2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚋpoolᚐProtocol(ctx, v) + if err != nil { + return it, err + } + it.ProtocolNEQ = data + case "protocolIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("protocolIn")) + data, err := ec.unmarshalOLoadBalancerPoolProtocol2ᚕgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚋpoolᚐProtocolᚄ(ctx, v) + if err != nil { + return it, err + } + it.ProtocolIn = data + case "protocolNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("protocolNotIn")) + data, err := ec.unmarshalOLoadBalancerPoolProtocol2ᚕgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚋpoolᚐProtocolᚄ(ctx, v) + if err != nil { + return it, err + } + it.ProtocolNotIn = data + case "hasPorts": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPorts")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasPorts = data + case "hasPortsWith": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPortsWith")) + data, err := ec.unmarshalOLoadBalancerPortWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPortWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasPortsWith = data + case "hasOrigins": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOrigins")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasOrigins = data + case "hasOriginsWith": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOriginsWith")) + data, err := ec.unmarshalOLoadBalancerOriginWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerOriginWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasOriginsWith = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputLoadBalancerPortOrder(ctx context.Context, obj interface{}) (generated.LoadBalancerPortOrder, error) { + var it generated.LoadBalancerPortOrder + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + 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": + var err error + + 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": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNLoadBalancerPortOrderField2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPortOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputLoadBalancerPortWhereInput(ctx context.Context, obj interface{}) (generated.LoadBalancerPortWhereInput, error) { + var it generated.LoadBalancerPortWhereInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "number", "numberNEQ", "numberIn", "numberNotIn", "numberGT", "numberGTE", "numberLT", "numberLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "hasPools", "hasPoolsWith", "hasLoadBalancer", "hasLoadBalancerWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOLoadBalancerPortWhereInput2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPortWhereInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + case "and": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOLoadBalancerPortWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPortWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "or": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOLoadBalancerPortWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPortWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "id": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "idNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.IDNEQ = data + case "idIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedIDᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDIn = data + case "idNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedIDᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDNotIn = data + case "idGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.IDGT = data + case "idGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.IDGTE = data + case "idLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.IDLT = data + case "idLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + if err != nil { + return it, err + } + it.IDLTE = data + case "createdAt": + var err error + + 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": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumber")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PortNumber = data - case "portNumberNEQ": + it.CreatedAtNEQ = data + case "createdAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberNEQ")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.PortNumberNEQ = data - case "portNumberIn": + it.CreatedAtIn = data + case "createdAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberIn")) - data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.PortNumberIn = data - case "portNumberNotIn": + it.CreatedAtNotIn = data + case "createdAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberNotIn")) - data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PortNumberNotIn = data - case "portNumberGT": + it.CreatedAtGT = data + case "createdAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberGT")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PortNumberGT = data - case "portNumberGTE": + it.CreatedAtGTE = data + case "createdAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberGTE")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PortNumberGTE = data - case "portNumberLT": + it.CreatedAtLT = data + case "createdAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberLT")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PortNumberLT = data - case "portNumberLTE": + it.CreatedAtLTE = data + case "updatedAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("portNumberLTE")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PortNumberLTE = data - case "active": + it.UpdatedAt = data + case "updatedAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("active")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.Active = data - case "activeNEQ": + it.UpdatedAtNEQ = data + case "updatedAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("activeNEQ")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.ActiveNEQ = data - case "hasPool": + it.UpdatedAtIn = data + case "updatedAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPool")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.HasPool = data - case "hasPoolWith": + it.UpdatedAtNotIn = data + case "updatedAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPoolWith")) - data, err := ec.unmarshalOLoadBalancerPoolWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.HasPoolWith = data - } - } + it.UpdatedAtGT = data + case "updatedAtGTE": + var err error - return it, nil -} + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtGTE = data + case "updatedAtLT": + var err error -func (ec *executionContext) unmarshalInputLoadBalancerPoolOrder(ctx context.Context, obj interface{}) (generated.LoadBalancerPoolOrder, error) { - var it generated.LoadBalancerPoolOrder - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtLT = data + case "updatedAtLTE": + var err error - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtLTE = data + case "createdBy": + var err error - 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("createdBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedBy = data + case "createdByNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": + it.CreatedByNEQ = data + case "createdByIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNLoadBalancerPoolOrderField2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolOrderField(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.Field = data - } - } + it.CreatedByIn = data + case "createdByNotIn": + var err error - return it, nil -} + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedByNotIn = data + case "createdByGT": + var err error -func (ec *executionContext) unmarshalInputLoadBalancerPoolWhereInput(ctx context.Context, obj interface{}) (generated.LoadBalancerPoolWhereInput, error) { - var it generated.LoadBalancerPoolWhereInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByGT = data + case "createdByGTE": + var err error - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "protocol", "protocolNEQ", "protocolIn", "protocolNotIn", "hasPorts", "hasPortsWith", "hasOrigins", "hasOriginsWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByGTE = data + case "createdByLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOLoadBalancerPoolWhereInput2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolWhereInput(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByLT = data + case "createdByLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByLTE = data + case "createdByContains": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByContains = data + case "createdByHasPrefix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByHasPrefix = data + case "createdByHasSuffix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.CreatedByHasSuffix = data + case "createdByIsNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.Not = data - case "and": + it.CreatedByIsNil = data + case "createdByNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOLoadBalancerPoolWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.And = data - case "or": + it.CreatedByNotNil = data + case "createdByEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOLoadBalancerPoolWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": + it.CreatedByEqualFold = data + case "createdByContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": + it.CreatedByContainsFold = data + case "updatedBy": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": + it.UpdatedBy = data + case "updatedByNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedIDᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": + it.UpdatedByNEQ = data + case "updatedByIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedIDᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": + it.UpdatedByIn = data + case "updatedByNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": + it.UpdatedByNotIn = data + case "updatedByGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGTE = data - case "idLT": + it.UpdatedByGT = data + case "updatedByGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": + it.UpdatedByGTE = data + case "updatedByLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "createdAt": + it.UpdatedByLT = data + case "updatedByLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAt = data - case "createdAtNEQ": + it.UpdatedByLTE = data + case "updatedByContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNEQ = data - case "createdAtIn": + it.UpdatedByContains = data + case "updatedByHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtIn = data - case "createdAtNotIn": + it.UpdatedByHasPrefix = data + case "updatedByHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNotIn = data - case "createdAtGT": + it.UpdatedByHasSuffix = data + case "updatedByIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAtGT = data - case "createdAtGTE": + it.UpdatedByIsNil = data + case "updatedByNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAtGTE = data - case "createdAtLT": + it.UpdatedByNotNil = data + case "updatedByEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtLT = data - case "createdAtLTE": + it.UpdatedByEqualFold = data + case "updatedByContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtLTE = data - case "updatedAt": + it.UpdatedByContainsFold = data + case "number": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("number")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.UpdatedAt = data - case "updatedAtNEQ": + it.Number = data + case "numberNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberNEQ")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.UpdatedAtNEQ = data - case "updatedAtIn": + it.NumberNEQ = data + case "numberIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.UpdatedAtIn = data - case "updatedAtNotIn": + it.NumberIn = data + case "numberNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberNotIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.UpdatedAtNotIn = data - case "updatedAtGT": + it.NumberNotIn = data + case "numberGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberGT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.UpdatedAtGT = data - case "updatedAtGTE": + it.NumberGT = data + case "numberGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberGTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.UpdatedAtGTE = data - case "updatedAtLT": + it.NumberGTE = data + case "numberLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberLT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.UpdatedAtLT = data - case "updatedAtLTE": + it.NumberLT = data + case "numberLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberLTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.UpdatedAtLTE = data + it.NumberLTE = data case "name": var err error @@ -13675,86 +15755,50 @@ func (ec *executionContext) unmarshalInputLoadBalancerPoolWhereInput(ctx context return it, err } it.NameContainsFold = data - case "protocol": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("protocol")) - data, err := ec.unmarshalOLoadBalancerPoolProtocol2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚋpoolᚐProtocol(ctx, v) - if err != nil { - return it, err - } - it.Protocol = data - case "protocolNEQ": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("protocolNEQ")) - data, err := ec.unmarshalOLoadBalancerPoolProtocol2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚋpoolᚐProtocol(ctx, v) - if err != nil { - return it, err - } - it.ProtocolNEQ = data - case "protocolIn": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("protocolIn")) - data, err := ec.unmarshalOLoadBalancerPoolProtocol2ᚕgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚋpoolᚐProtocolᚄ(ctx, v) - if err != nil { - return it, err - } - it.ProtocolIn = data - case "protocolNotIn": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("protocolNotIn")) - data, err := ec.unmarshalOLoadBalancerPoolProtocol2ᚕgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚋpoolᚐProtocolᚄ(ctx, v) - if err != nil { - return it, err - } - it.ProtocolNotIn = data - case "hasPorts": + case "hasPools": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPorts")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPools")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasPorts = data - case "hasPortsWith": + it.HasPools = data + case "hasPoolsWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPortsWith")) - data, err := ec.unmarshalOLoadBalancerPortWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPortWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPoolsWith")) + data, err := ec.unmarshalOLoadBalancerPoolWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasPortsWith = data - case "hasOrigins": + it.HasPoolsWith = data + case "hasLoadBalancer": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOrigins")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasLoadBalancer")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasOrigins = data - case "hasOriginsWith": + it.HasLoadBalancer = data + case "hasLoadBalancerWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOriginsWith")) - data, err := ec.unmarshalOLoadBalancerOriginWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerOriginWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasLoadBalancerWith")) + data, err := ec.unmarshalOLoadBalancerWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasOriginsWith = data + it.HasLoadBalancerWith = data } } return it, nil } -func (ec *executionContext) unmarshalInputLoadBalancerPortOrder(ctx context.Context, obj interface{}) (generated.LoadBalancerPortOrder, error) { - var it generated.LoadBalancerPortOrder +func (ec *executionContext) unmarshalInputLoadBalancerProviderOrder(ctx context.Context, obj interface{}) (generated.LoadBalancerProviderOrder, error) { + var it generated.LoadBalancerProviderOrder asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v @@ -13784,7 +15828,7 @@ func (ec *executionContext) unmarshalInputLoadBalancerPortOrder(ctx context.Cont var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNLoadBalancerPortOrderField2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPortOrderField(ctx, v) + data, err := ec.unmarshalNLoadBalancerProviderOrderField2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerProviderOrderField(ctx, v) if err != nil { return it, err } @@ -13795,14 +15839,14 @@ func (ec *executionContext) unmarshalInputLoadBalancerPortOrder(ctx context.Cont return it, nil } -func (ec *executionContext) unmarshalInputLoadBalancerPortWhereInput(ctx context.Context, obj interface{}) (generated.LoadBalancerPortWhereInput, error) { - var it generated.LoadBalancerPortWhereInput +func (ec *executionContext) unmarshalInputLoadBalancerProviderWhereInput(ctx context.Context, obj interface{}) (generated.LoadBalancerProviderWhereInput, error) { + var it generated.LoadBalancerProviderWhereInput asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "number", "numberNEQ", "numberIn", "numberNotIn", "numberGT", "numberGTE", "numberLT", "numberLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "hasPools", "hasPoolsWith", "hasLoadBalancer", "hasLoadBalancerWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "hasLoadBalancers", "hasLoadBalancersWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -13813,7 +15857,7 @@ func (ec *executionContext) unmarshalInputLoadBalancerPortWhereInput(ctx context var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOLoadBalancerPortWhereInput2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPortWhereInput(ctx, v) + data, err := ec.unmarshalOLoadBalancerProviderWhereInput2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerProviderWhereInput(ctx, v) if err != nil { return it, err } @@ -13822,7 +15866,7 @@ func (ec *executionContext) unmarshalInputLoadBalancerPortWhereInput(ctx context var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOLoadBalancerPortWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPortWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOLoadBalancerProviderWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerProviderWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -13831,7 +15875,7 @@ func (ec *executionContext) unmarshalInputLoadBalancerPortWhereInput(ctx context var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOLoadBalancerPortWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPortWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOLoadBalancerProviderWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerProviderWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -13883,705 +15927,445 @@ func (ec *executionContext) unmarshalInputLoadBalancerPortWhereInput(ctx context it.IDGT = data case "idGTE": var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) - if err != nil { - return it, err - } - it.IDGTE = data - case "idLT": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) - if err != nil { - return it, err - } - it.IDLT = data - case "idLTE": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) - if err != nil { - return it, err - } - it.IDLTE = data - case "createdAt": - var err error - - 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": - var err error - - 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": - var err error - - 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": - var err error - - 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": - var err error - - 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": - var err error - - 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": - var err error - - 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": - var err error - - 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 "updatedAt": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) - if err != nil { - return it, err - } - it.UpdatedAt = data - case "updatedAtNEQ": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) - if err != nil { - return it, err - } - it.UpdatedAtNEQ = data - case "updatedAtIn": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) - if err != nil { - return it, err - } - it.UpdatedAtIn = data - case "updatedAtNotIn": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) - if err != nil { - return it, err - } - it.UpdatedAtNotIn = data - case "updatedAtGT": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) - if err != nil { - return it, err - } - it.UpdatedAtGT = data - case "updatedAtGTE": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) - if err != nil { - return it, err - } - it.UpdatedAtGTE = data - case "updatedAtLT": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) - if err != nil { - return it, err - } - it.UpdatedAtLT = data - case "updatedAtLTE": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) - if err != nil { - return it, err - } - it.UpdatedAtLTE = data - case "number": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("number")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) - if err != nil { - return it, err - } - it.Number = data - case "numberNEQ": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberNEQ")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) - if err != nil { - return it, err - } - it.NumberNEQ = data - case "numberIn": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberIn")) - data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) - if err != nil { - return it, err - } - it.NumberIn = data - case "numberNotIn": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberNotIn")) - data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) - if err != nil { - return it, err - } - it.NumberNotIn = data - case "numberGT": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberGT")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) - if err != nil { - return it, err - } - it.NumberGT = data - case "numberGTE": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberGTE")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) if err != nil { return it, err } - it.NumberGTE = data - case "numberLT": + it.IDGTE = data + case "idLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberLT")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) if err != nil { return it, err } - it.NumberLT = data - case "numberLTE": + it.IDLT = data + case "idLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("numberLTE")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) if err != nil { return it, err } - it.NumberLTE = data - case "name": + it.IDLTE = data + case "createdAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": + it.CreatedAt = data + case "createdAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": + it.CreatedAtNEQ = data + case "createdAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": + it.CreatedAtIn = data + case "createdAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": + it.CreatedAtNotIn = data + case "createdAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": + it.CreatedAtGT = data + case "createdAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": + it.CreatedAtGTE = data + case "createdAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": + it.CreatedAtLT = data + case "createdAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": + it.CreatedAtLTE = data + case "updatedAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": + it.UpdatedAt = data + case "updatedAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": + it.UpdatedAtNEQ = data + case "updatedAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": + it.UpdatedAtIn = data + case "updatedAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": + it.UpdatedAtNotIn = data + case "updatedAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "hasPools": + it.UpdatedAtGT = data + case "updatedAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPools")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.HasPools = data - case "hasPoolsWith": + it.UpdatedAtGTE = data + case "updatedAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPoolsWith")) - data, err := ec.unmarshalOLoadBalancerPoolWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerPoolWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.HasPoolsWith = data - case "hasLoadBalancer": + it.UpdatedAtLT = data + case "updatedAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasLoadBalancer")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.HasLoadBalancer = data - case "hasLoadBalancerWith": + it.UpdatedAtLTE = data + case "createdBy": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasLoadBalancerWith")) - data, err := ec.unmarshalOLoadBalancerWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasLoadBalancerWith = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputLoadBalancerProviderOrder(ctx context.Context, obj interface{}) (generated.LoadBalancerProviderOrder, error) { - var it generated.LoadBalancerProviderOrder - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - 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": + it.CreatedBy = data + case "createdByNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": + it.CreatedByNEQ = data + case "createdByIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNLoadBalancerProviderOrderField2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerProviderOrderField(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.Field = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputLoadBalancerProviderWhereInput(ctx context.Context, obj interface{}) (generated.LoadBalancerProviderWhereInput, error) { - var it generated.LoadBalancerProviderWhereInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "hasLoadBalancers", "hasLoadBalancersWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": + it.CreatedByIn = data + case "createdByNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOLoadBalancerProviderWhereInput2ᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerProviderWhereInput(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.Not = data - case "and": + it.CreatedByNotIn = data + case "createdByGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOLoadBalancerProviderWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerProviderWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.And = data - case "or": + it.CreatedByGT = data + case "createdByGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOLoadBalancerProviderWhereInput2ᚕᚖgoᚗinfratographerᚗcomᚋloadᚑbalancerᚑapiᚋinternalᚋentᚋgeneratedᚐLoadBalancerProviderWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": + it.CreatedByGTE = data + case "createdByLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": + it.CreatedByLT = data + case "createdByLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": + it.CreatedByLTE = data + case "createdByContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedIDᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": + it.CreatedByContains = data + case "createdByHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedIDᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": + it.CreatedByHasPrefix = data + case "createdByHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": + it.CreatedByHasSuffix = data + case "createdByIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.IDGTE = data - case "idLT": + it.CreatedByIsNil = data + case "createdByNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": + it.CreatedByNotNil = data + case "createdByEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖgoᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "createdAt": + it.CreatedByEqualFold = data + case "createdByContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdByContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAt = data - case "createdAtNEQ": + it.CreatedByContainsFold = data + case "updatedBy": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNEQ = data - case "createdAtIn": + it.UpdatedBy = data + case "updatedByNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtIn = data - case "createdAtNotIn": + it.UpdatedByNEQ = data + case "updatedByIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtNotIn = data - case "createdAtGT": + it.UpdatedByIn = data + case "updatedByNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtGT = data - case "createdAtGTE": + it.UpdatedByNotIn = data + case "updatedByGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtGTE = data - case "createdAtLT": + it.UpdatedByGT = data + case "updatedByGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtLT = data - case "createdAtLTE": + it.UpdatedByGTE = data + case "updatedByLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtLTE = data - case "updatedAt": + it.UpdatedByLT = data + case "updatedByLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.UpdatedAt = data - case "updatedAtNEQ": + it.UpdatedByLTE = data + case "updatedByContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.UpdatedAtNEQ = data - case "updatedAtIn": + it.UpdatedByContains = data + case "updatedByHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.UpdatedAtIn = data - case "updatedAtNotIn": + it.UpdatedByHasPrefix = data + case "updatedByHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.UpdatedAtNotIn = data - case "updatedAtGT": + it.UpdatedByHasSuffix = data + case "updatedByIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.UpdatedAtGT = data - case "updatedAtGTE": + it.UpdatedByIsNil = data + case "updatedByNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.UpdatedAtGTE = data - case "updatedAtLT": + it.UpdatedByNotNil = data + case "updatedByEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.UpdatedAtLT = data - case "updatedAtLTE": + it.UpdatedByEqualFold = data + case "updatedByContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedByContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.UpdatedAtLTE = data + it.UpdatedByContainsFold = data case "name": var err error @@ -15490,13 +17274,31 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerOriginInput(ctx cont asMap[k] = v } - fieldsInOrder := [...]string{"name", "weight", "target", "portNumber", "active"} + fieldsInOrder := [...]string{"updatedBy", "clearUpdatedBy", "name", "weight", "target", "portNumber", "active"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data + case "clearUpdatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearUpdatedBy")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClearUpdatedBy = data case "name": var err error @@ -15555,13 +17357,31 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerPoolInput(ctx contex asMap[k] = v } - fieldsInOrder := [...]string{"name", "protocol", "addPortIDs", "removePortIDs", "clearPorts", "addOriginIDs", "removeOriginIDs", "clearOrigins"} + fieldsInOrder := [...]string{"updatedBy", "clearUpdatedBy", "name", "protocol", "addPortIDs", "removePortIDs", "clearPorts", "addOriginIDs", "removeOriginIDs", "clearOrigins"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data + case "clearUpdatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearUpdatedBy")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClearUpdatedBy = data case "name": var err error @@ -15647,13 +17467,31 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerPortInput(ctx contex asMap[k] = v } - fieldsInOrder := [...]string{"number", "name", "addPoolIDs", "removePoolIDs", "clearPools"} + fieldsInOrder := [...]string{"updatedBy", "clearUpdatedBy", "number", "name", "addPoolIDs", "removePoolIDs", "clearPools"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data + case "clearUpdatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearUpdatedBy")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClearUpdatedBy = data case "number": var err error @@ -15712,13 +17550,31 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerProviderInput(ctx co asMap[k] = v } - fieldsInOrder := [...]string{"name"} + fieldsInOrder := [...]string{"updatedBy", "clearUpdatedBy", "name"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "updatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.UpdatedBy = data + case "clearUpdatedBy": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearUpdatedBy")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClearUpdatedBy = data case "name": var err error @@ -16455,6 +18311,10 @@ func (ec *executionContext) _LoadBalancerOrigin(ctx context.Context, sel ast.Sel if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } + case "createdBy": + out.Values[i] = ec._LoadBalancerOrigin_createdBy(ctx, field, obj) + case "updatedBy": + out.Values[i] = ec._LoadBalancerOrigin_updatedBy(ctx, field, obj) case "name": out.Values[i] = ec._LoadBalancerOrigin_name(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -16774,6 +18634,10 @@ func (ec *executionContext) _LoadBalancerPool(ctx context.Context, sel ast.Selec if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } + case "createdBy": + out.Values[i] = ec._LoadBalancerPool_createdBy(ctx, field, obj) + case "updatedBy": + out.Values[i] = ec._LoadBalancerPool_updatedBy(ctx, field, obj) case "name": out.Values[i] = ec._LoadBalancerPool_name(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -17144,6 +19008,10 @@ func (ec *executionContext) _LoadBalancerPort(ctx context.Context, sel ast.Selec if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } + case "createdBy": + out.Values[i] = ec._LoadBalancerPort_createdBy(ctx, field, obj) + case "updatedBy": + out.Values[i] = ec._LoadBalancerPort_updatedBy(ctx, field, obj) case "number": out.Values[i] = ec._LoadBalancerPort_number(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -17481,6 +19349,10 @@ func (ec *executionContext) _LoadBalancerProvider(ctx context.Context, sel ast.S if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } + case "createdBy": + out.Values[i] = ec._LoadBalancerProvider_createdBy(ctx, field, obj) + case "updatedBy": + out.Values[i] = ec._LoadBalancerProvider_updatedBy(ctx, field, obj) case "name": out.Values[i] = ec._LoadBalancerProvider_name(ctx, field, obj) if out.Values[i] == graphql.Null { diff --git a/internal/graphapi/location.resolvers.go b/internal/graphapi/location.resolvers.go index 008884756..13256ef46 100644 --- a/internal/graphapi/location.resolvers.go +++ b/internal/graphapi/location.resolvers.go @@ -10,6 +10,7 @@ import ( "entgo.io/contrib/entgql" "go.infratographer.com/load-balancer-api/internal/ent/generated" "go.infratographer.com/load-balancer-api/internal/ent/generated/loadbalancer" + _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" "go.infratographer.com/x/gidx" ) diff --git a/internal/graphapi/metadata.go b/internal/graphapi/metadata.go index 7292462b0..64293e418 100644 --- a/internal/graphapi/metadata.go +++ b/internal/graphapi/metadata.go @@ -10,6 +10,8 @@ import ( metastatus "go.infratographer.com/load-balancer-api/pkg/metadata" "go.infratographer.com/load-balancer-api/internal/config" + + _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" ) const metadataStatusSource = "load-balancer-api" diff --git a/internal/graphapi/origin.resolvers.go b/internal/graphapi/origin.resolvers.go index 0b8c03cdf..d17f96f22 100644 --- a/internal/graphapi/origin.resolvers.go +++ b/internal/graphapi/origin.resolvers.go @@ -11,6 +11,7 @@ import ( "go.infratographer.com/load-balancer-api/internal/ent/generated/origin" "go.infratographer.com/load-balancer-api/internal/ent/generated/pool" "go.infratographer.com/load-balancer-api/internal/ent/generated/port" + _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" "go.infratographer.com/load-balancer-api/pkg/metadata" "go.infratographer.com/permissions-api/pkg/permissions" "go.infratographer.com/x/gidx" diff --git a/internal/graphapi/owner.resolvers.go b/internal/graphapi/owner.resolvers.go index 93c9ab4f2..21877a190 100644 --- a/internal/graphapi/owner.resolvers.go +++ b/internal/graphapi/owner.resolvers.go @@ -12,6 +12,7 @@ import ( "go.infratographer.com/load-balancer-api/internal/ent/generated" "go.infratographer.com/load-balancer-api/internal/ent/generated/loadbalancer" "go.infratographer.com/load-balancer-api/internal/ent/generated/pool" + _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" "go.infratographer.com/x/gidx" ) diff --git a/internal/graphapi/pool.resolvers.go b/internal/graphapi/pool.resolvers.go index 6e1d1f847..4d6c0b32d 100644 --- a/internal/graphapi/pool.resolvers.go +++ b/internal/graphapi/pool.resolvers.go @@ -14,6 +14,7 @@ import ( "go.infratographer.com/load-balancer-api/internal/ent/generated/pool" "go.infratographer.com/load-balancer-api/internal/ent/generated/port" "go.infratographer.com/load-balancer-api/internal/ent/generated/predicate" + _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" "go.infratographer.com/load-balancer-api/pkg/metadata" "go.infratographer.com/permissions-api/pkg/permissions" "go.infratographer.com/x/gidx" diff --git a/internal/graphapi/port.resolvers.go b/internal/graphapi/port.resolvers.go index 9222a4afe..97e421ec9 100644 --- a/internal/graphapi/port.resolvers.go +++ b/internal/graphapi/port.resolvers.go @@ -11,6 +11,7 @@ import ( "go.infratographer.com/load-balancer-api/internal/ent/generated" "go.infratographer.com/load-balancer-api/internal/ent/generated/pool" "go.infratographer.com/load-balancer-api/internal/ent/generated/port" + _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" "go.infratographer.com/load-balancer-api/pkg/metadata" "go.infratographer.com/permissions-api/pkg/permissions" "go.infratographer.com/x/gidx" diff --git a/internal/graphapi/provider.resolvers.go b/internal/graphapi/provider.resolvers.go index 5f98234b9..8f5bd93b6 100644 --- a/internal/graphapi/provider.resolvers.go +++ b/internal/graphapi/provider.resolvers.go @@ -8,6 +8,7 @@ import ( "context" "go.infratographer.com/load-balancer-api/internal/ent/generated" + _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" "go.infratographer.com/permissions-api/pkg/permissions" "go.infratographer.com/x/gidx" ) diff --git a/internal/graphclient/gen_models.go b/internal/graphclient/gen_models.go index 447aec221..0f76620db 100644 --- a/internal/graphclient/gen_models.go +++ b/internal/graphclient/gen_models.go @@ -50,6 +50,8 @@ type CreateLoadBalancerInput struct { // CreateLoadBalancerOriginInput is used for create LoadBalancerOrigin object. // Input was generated by ent. type CreateLoadBalancerOriginInput struct { + CreatedBy *string `json:"createdBy,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` Name string `json:"name"` Weight *int64 `json:"weight,omitempty"` Target string `json:"target"` @@ -61,6 +63,8 @@ type CreateLoadBalancerOriginInput struct { // CreateLoadBalancerPoolInput is used for create LoadBalancerPool object. // Input was generated by ent. type CreateLoadBalancerPoolInput struct { + CreatedBy *string `json:"createdBy,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` Name string `json:"name"` Protocol LoadBalancerPoolProtocol `json:"protocol"` OwnerID gidx.PrefixedID `json:"ownerID"` @@ -71,6 +75,8 @@ type CreateLoadBalancerPoolInput struct { // CreateLoadBalancerPortInput is used for create LoadBalancerPort object. // Input was generated by ent. type CreateLoadBalancerPortInput struct { + CreatedBy *string `json:"createdBy,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` Number int64 `json:"number"` Name string `json:"name"` PoolIDs []gidx.PrefixedID `json:"poolIDs,omitempty"` @@ -79,6 +85,8 @@ type CreateLoadBalancerPortInput struct { // Input information to create a load balancer provider. type CreateLoadBalancerProviderInput struct { + CreatedBy *string `json:"createdBy,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` // The name of the load balancer provider. Name string `json:"name"` // The ID for the owner for this load balancer. @@ -156,6 +164,8 @@ type LoadBalancerOrigin struct { ID gidx.PrefixedID `json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` + CreatedBy *string `json:"createdBy,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` Name string `json:"name"` Weight int64 `json:"weight"` Target string `json:"target"` @@ -249,6 +259,38 @@ type LoadBalancerOriginWhereInput struct { UpdatedAtGte *time.Time `json:"updatedAtGTE,omitempty"` UpdatedAtLt *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLte *time.Time `json:"updatedAtLTE,omitempty"` + // created_by field predicates + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByNeq *string `json:"createdByNEQ,omitempty"` + CreatedByIn []string `json:"createdByIn,omitempty"` + CreatedByNotIn []string `json:"createdByNotIn,omitempty"` + CreatedByGt *string `json:"createdByGT,omitempty"` + CreatedByGte *string `json:"createdByGTE,omitempty"` + CreatedByLt *string `json:"createdByLT,omitempty"` + CreatedByLte *string `json:"createdByLTE,omitempty"` + CreatedByContains *string `json:"createdByContains,omitempty"` + CreatedByHasPrefix *string `json:"createdByHasPrefix,omitempty"` + CreatedByHasSuffix *string `json:"createdByHasSuffix,omitempty"` + CreatedByIsNil *bool `json:"createdByIsNil,omitempty"` + CreatedByNotNil *bool `json:"createdByNotNil,omitempty"` + CreatedByEqualFold *string `json:"createdByEqualFold,omitempty"` + CreatedByContainsFold *string `json:"createdByContainsFold,omitempty"` + // updated_by field predicates + UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedByNeq *string `json:"updatedByNEQ,omitempty"` + UpdatedByIn []string `json:"updatedByIn,omitempty"` + UpdatedByNotIn []string `json:"updatedByNotIn,omitempty"` + UpdatedByGt *string `json:"updatedByGT,omitempty"` + UpdatedByGte *string `json:"updatedByGTE,omitempty"` + UpdatedByLt *string `json:"updatedByLT,omitempty"` + UpdatedByLte *string `json:"updatedByLTE,omitempty"` + UpdatedByContains *string `json:"updatedByContains,omitempty"` + UpdatedByHasPrefix *string `json:"updatedByHasPrefix,omitempty"` + UpdatedByHasSuffix *string `json:"updatedByHasSuffix,omitempty"` + UpdatedByIsNil *bool `json:"updatedByIsNil,omitempty"` + UpdatedByNotNil *bool `json:"updatedByNotNil,omitempty"` + UpdatedByEqualFold *string `json:"updatedByEqualFold,omitempty"` + UpdatedByContainsFold *string `json:"updatedByContainsFold,omitempty"` // name field predicates Name *string `json:"name,omitempty"` NameNeq *string `json:"nameNEQ,omitempty"` @@ -307,6 +349,8 @@ type LoadBalancerPool struct { ID gidx.PrefixedID `json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` + CreatedBy *string `json:"createdBy,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` Name string `json:"name"` Protocol LoadBalancerPoolProtocol `json:"protocol"` OwnerID gidx.PrefixedID `json:"ownerID"` @@ -400,6 +444,38 @@ type LoadBalancerPoolWhereInput struct { UpdatedAtGte *time.Time `json:"updatedAtGTE,omitempty"` UpdatedAtLt *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLte *time.Time `json:"updatedAtLTE,omitempty"` + // created_by field predicates + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByNeq *string `json:"createdByNEQ,omitempty"` + CreatedByIn []string `json:"createdByIn,omitempty"` + CreatedByNotIn []string `json:"createdByNotIn,omitempty"` + CreatedByGt *string `json:"createdByGT,omitempty"` + CreatedByGte *string `json:"createdByGTE,omitempty"` + CreatedByLt *string `json:"createdByLT,omitempty"` + CreatedByLte *string `json:"createdByLTE,omitempty"` + CreatedByContains *string `json:"createdByContains,omitempty"` + CreatedByHasPrefix *string `json:"createdByHasPrefix,omitempty"` + CreatedByHasSuffix *string `json:"createdByHasSuffix,omitempty"` + CreatedByIsNil *bool `json:"createdByIsNil,omitempty"` + CreatedByNotNil *bool `json:"createdByNotNil,omitempty"` + CreatedByEqualFold *string `json:"createdByEqualFold,omitempty"` + CreatedByContainsFold *string `json:"createdByContainsFold,omitempty"` + // updated_by field predicates + UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedByNeq *string `json:"updatedByNEQ,omitempty"` + UpdatedByIn []string `json:"updatedByIn,omitempty"` + UpdatedByNotIn []string `json:"updatedByNotIn,omitempty"` + UpdatedByGt *string `json:"updatedByGT,omitempty"` + UpdatedByGte *string `json:"updatedByGTE,omitempty"` + UpdatedByLt *string `json:"updatedByLT,omitempty"` + UpdatedByLte *string `json:"updatedByLTE,omitempty"` + UpdatedByContains *string `json:"updatedByContains,omitempty"` + UpdatedByHasPrefix *string `json:"updatedByHasPrefix,omitempty"` + UpdatedByHasSuffix *string `json:"updatedByHasSuffix,omitempty"` + UpdatedByIsNil *bool `json:"updatedByIsNil,omitempty"` + UpdatedByNotNil *bool `json:"updatedByNotNil,omitempty"` + UpdatedByEqualFold *string `json:"updatedByEqualFold,omitempty"` + UpdatedByContainsFold *string `json:"updatedByContainsFold,omitempty"` // name field predicates Name *string `json:"name,omitempty"` NameNeq *string `json:"nameNEQ,omitempty"` @@ -431,6 +507,8 @@ type LoadBalancerPort struct { ID gidx.PrefixedID `json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` + CreatedBy *string `json:"createdBy,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` Number int64 `json:"number"` Name string `json:"name"` LoadBalancerID gidx.PrefixedID `json:"loadBalancerID"` @@ -522,6 +600,38 @@ type LoadBalancerPortWhereInput struct { UpdatedAtGte *time.Time `json:"updatedAtGTE,omitempty"` UpdatedAtLt *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLte *time.Time `json:"updatedAtLTE,omitempty"` + // created_by field predicates + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByNeq *string `json:"createdByNEQ,omitempty"` + CreatedByIn []string `json:"createdByIn,omitempty"` + CreatedByNotIn []string `json:"createdByNotIn,omitempty"` + CreatedByGt *string `json:"createdByGT,omitempty"` + CreatedByGte *string `json:"createdByGTE,omitempty"` + CreatedByLt *string `json:"createdByLT,omitempty"` + CreatedByLte *string `json:"createdByLTE,omitempty"` + CreatedByContains *string `json:"createdByContains,omitempty"` + CreatedByHasPrefix *string `json:"createdByHasPrefix,omitempty"` + CreatedByHasSuffix *string `json:"createdByHasSuffix,omitempty"` + CreatedByIsNil *bool `json:"createdByIsNil,omitempty"` + CreatedByNotNil *bool `json:"createdByNotNil,omitempty"` + CreatedByEqualFold *string `json:"createdByEqualFold,omitempty"` + CreatedByContainsFold *string `json:"createdByContainsFold,omitempty"` + // updated_by field predicates + UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedByNeq *string `json:"updatedByNEQ,omitempty"` + UpdatedByIn []string `json:"updatedByIn,omitempty"` + UpdatedByNotIn []string `json:"updatedByNotIn,omitempty"` + UpdatedByGt *string `json:"updatedByGT,omitempty"` + UpdatedByGte *string `json:"updatedByGTE,omitempty"` + UpdatedByLt *string `json:"updatedByLT,omitempty"` + UpdatedByLte *string `json:"updatedByLTE,omitempty"` + UpdatedByContains *string `json:"updatedByContains,omitempty"` + UpdatedByHasPrefix *string `json:"updatedByHasPrefix,omitempty"` + UpdatedByHasSuffix *string `json:"updatedByHasSuffix,omitempty"` + UpdatedByIsNil *bool `json:"updatedByIsNil,omitempty"` + UpdatedByNotNil *bool `json:"updatedByNotNil,omitempty"` + UpdatedByEqualFold *string `json:"updatedByEqualFold,omitempty"` + UpdatedByContainsFold *string `json:"updatedByContainsFold,omitempty"` // number field predicates Number *int64 `json:"number,omitempty"` NumberNeq *int64 `json:"numberNEQ,omitempty"` @@ -558,6 +668,8 @@ type LoadBalancerProvider struct { ID gidx.PrefixedID `json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` + CreatedBy *string `json:"createdBy,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` // The name of the load balancer provider. Name string `json:"name"` LoadBalancers LoadBalancerConnection `json:"loadBalancers"` @@ -649,6 +761,38 @@ type LoadBalancerProviderWhereInput struct { UpdatedAtGte *time.Time `json:"updatedAtGTE,omitempty"` UpdatedAtLt *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLte *time.Time `json:"updatedAtLTE,omitempty"` + // created_by field predicates + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByNeq *string `json:"createdByNEQ,omitempty"` + CreatedByIn []string `json:"createdByIn,omitempty"` + CreatedByNotIn []string `json:"createdByNotIn,omitempty"` + CreatedByGt *string `json:"createdByGT,omitempty"` + CreatedByGte *string `json:"createdByGTE,omitempty"` + CreatedByLt *string `json:"createdByLT,omitempty"` + CreatedByLte *string `json:"createdByLTE,omitempty"` + CreatedByContains *string `json:"createdByContains,omitempty"` + CreatedByHasPrefix *string `json:"createdByHasPrefix,omitempty"` + CreatedByHasSuffix *string `json:"createdByHasSuffix,omitempty"` + CreatedByIsNil *bool `json:"createdByIsNil,omitempty"` + CreatedByNotNil *bool `json:"createdByNotNil,omitempty"` + CreatedByEqualFold *string `json:"createdByEqualFold,omitempty"` + CreatedByContainsFold *string `json:"createdByContainsFold,omitempty"` + // updated_by field predicates + UpdatedBy *string `json:"updatedBy,omitempty"` + UpdatedByNeq *string `json:"updatedByNEQ,omitempty"` + UpdatedByIn []string `json:"updatedByIn,omitempty"` + UpdatedByNotIn []string `json:"updatedByNotIn,omitempty"` + UpdatedByGt *string `json:"updatedByGT,omitempty"` + UpdatedByGte *string `json:"updatedByGTE,omitempty"` + UpdatedByLt *string `json:"updatedByLT,omitempty"` + UpdatedByLte *string `json:"updatedByLTE,omitempty"` + UpdatedByContains *string `json:"updatedByContains,omitempty"` + UpdatedByHasPrefix *string `json:"updatedByHasPrefix,omitempty"` + UpdatedByHasSuffix *string `json:"updatedByHasSuffix,omitempty"` + UpdatedByIsNil *bool `json:"updatedByIsNil,omitempty"` + UpdatedByNotNil *bool `json:"updatedByNotNil,omitempty"` + UpdatedByEqualFold *string `json:"updatedByEqualFold,omitempty"` + UpdatedByContainsFold *string `json:"updatedByContainsFold,omitempty"` // name field predicates Name *string `json:"name,omitempty"` NameNeq *string `json:"nameNEQ,omitempty"` @@ -804,16 +948,20 @@ type UpdateLoadBalancerInput struct { // UpdateLoadBalancerOriginInput is used for update LoadBalancerOrigin object. // Input was generated by ent. type UpdateLoadBalancerOriginInput struct { - Name *string `json:"name,omitempty"` - Weight *int64 `json:"weight,omitempty"` - Target *string `json:"target,omitempty"` - PortNumber *int64 `json:"portNumber,omitempty"` - Active *bool `json:"active,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` + ClearUpdatedBy *bool `json:"clearUpdatedBy,omitempty"` + Name *string `json:"name,omitempty"` + Weight *int64 `json:"weight,omitempty"` + Target *string `json:"target,omitempty"` + PortNumber *int64 `json:"portNumber,omitempty"` + Active *bool `json:"active,omitempty"` } // UpdateLoadBalancerPoolInput is used for update LoadBalancerPool object. // Input was generated by ent. type UpdateLoadBalancerPoolInput struct { + UpdatedBy *string `json:"updatedBy,omitempty"` + ClearUpdatedBy *bool `json:"clearUpdatedBy,omitempty"` Name *string `json:"name,omitempty"` Protocol *LoadBalancerPoolProtocol `json:"protocol,omitempty"` AddPortIDs []gidx.PrefixedID `json:"addPortIDs,omitempty"` @@ -827,15 +975,19 @@ type UpdateLoadBalancerPoolInput struct { // UpdateLoadBalancerPortInput is used for update LoadBalancerPort object. // Input was generated by ent. type UpdateLoadBalancerPortInput struct { - Number *int64 `json:"number,omitempty"` - Name *string `json:"name,omitempty"` - AddPoolIDs []gidx.PrefixedID `json:"addPoolIDs,omitempty"` - RemovePoolIDs []gidx.PrefixedID `json:"removePoolIDs,omitempty"` - ClearPools *bool `json:"clearPools,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` + ClearUpdatedBy *bool `json:"clearUpdatedBy,omitempty"` + Number *int64 `json:"number,omitempty"` + Name *string `json:"name,omitempty"` + AddPoolIDs []gidx.PrefixedID `json:"addPoolIDs,omitempty"` + RemovePoolIDs []gidx.PrefixedID `json:"removePoolIDs,omitempty"` + ClearPools *bool `json:"clearPools,omitempty"` } // Input information to update a load balancer provider. type UpdateLoadBalancerProviderInput struct { + UpdatedBy *string `json:"updatedBy,omitempty"` + ClearUpdatedBy *bool `json:"clearUpdatedBy,omitempty"` // The name of the load balancer provider. Name *string `json:"name,omitempty"` } diff --git a/internal/graphclient/schema/schema.graphql b/internal/graphclient/schema/schema.graphql index 4191abffd..00e1d3ea2 100644 --- a/internal/graphclient/schema/schema.graphql +++ b/internal/graphclient/schema/schema.graphql @@ -29,6 +29,8 @@ CreateLoadBalancerOriginInput is used for create LoadBalancerOrigin object. Input was generated by ent. """ input CreateLoadBalancerOriginInput { + createdBy: String + updatedBy: String name: String! weight: Int target: String! @@ -41,6 +43,8 @@ CreateLoadBalancerPoolInput is used for create LoadBalancerPool object. Input was generated by ent. """ input CreateLoadBalancerPoolInput { + createdBy: String + updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -52,6 +56,8 @@ CreateLoadBalancerPortInput is used for create LoadBalancerPort object. Input was generated by ent. """ input CreateLoadBalancerPortInput { + createdBy: String + updatedBy: String number: Int! name: String! poolIDs: [ID!] @@ -59,6 +65,8 @@ input CreateLoadBalancerPortInput { } """Input information to create a load balancer provider.""" input CreateLoadBalancerProviderInput { + createdBy: String + updatedBy: String """The name of the load balancer provider.""" name: String! """The ID for the owner for this load balancer.""" @@ -155,6 +163,8 @@ type LoadBalancerOrigin implements Node @key(fields: "id") @prefixedID(prefix: " id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String name: String! weight: Int! target: String! @@ -246,6 +256,38 @@ input LoadBalancerOriginWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -303,6 +345,8 @@ type LoadBalancerPool implements Node @key(fields: "id") @prefixedID(prefix: "lo id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -414,6 +458,38 @@ input LoadBalancerPoolWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -444,6 +520,8 @@ type LoadBalancerPort implements Node @key(fields: "id") @prefixedID(prefix: "lo id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String number: Int! name: String! loadBalancerID: ID! @@ -530,6 +608,38 @@ input LoadBalancerPortWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """number field predicates""" number: Int numberNEQ: Int @@ -565,6 +675,8 @@ type LoadBalancerProvider implements Node @key(fields: "id") @prefixedID(prefix: id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String """The name of the load balancer provider.""" name: String! loadBalancers( @@ -670,6 +782,38 @@ input LoadBalancerProviderWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -982,6 +1126,8 @@ UpdateLoadBalancerOriginInput is used for update LoadBalancerOrigin object. Input was generated by ent. """ input UpdateLoadBalancerOriginInput { + updatedBy: String + clearUpdatedBy: Boolean name: String weight: Int target: String @@ -993,6 +1139,8 @@ UpdateLoadBalancerPoolInput is used for update LoadBalancerPool object. Input was generated by ent. """ input UpdateLoadBalancerPoolInput { + updatedBy: String + clearUpdatedBy: Boolean name: String protocol: LoadBalancerPoolProtocol addPortIDs: [ID!] @@ -1007,6 +1155,8 @@ UpdateLoadBalancerPortInput is used for update LoadBalancerPort object. Input was generated by ent. """ input UpdateLoadBalancerPortInput { + updatedBy: String + clearUpdatedBy: Boolean number: Int name: String addPoolIDs: [ID!] @@ -1015,6 +1165,8 @@ input UpdateLoadBalancerPortInput { } """Input information to update a load balancer provider.""" input UpdateLoadBalancerProviderInput { + updatedBy: String + clearUpdatedBy: Boolean """The name of the load balancer provider.""" name: String } diff --git a/schema.graphql b/schema.graphql index 889710069..78c5342d5 100644 --- a/schema.graphql +++ b/schema.graphql @@ -17,6 +17,8 @@ CreateLoadBalancerOriginInput is used for create LoadBalancerOrigin object. Input was generated by ent. """ input CreateLoadBalancerOriginInput { + createdBy: String + updatedBy: String name: String! weight: Int target: String! @@ -29,6 +31,8 @@ CreateLoadBalancerPoolInput is used for create LoadBalancerPool object. Input was generated by ent. """ input CreateLoadBalancerPoolInput { + createdBy: String + updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -40,6 +44,8 @@ CreateLoadBalancerPortInput is used for create LoadBalancerPort object. Input was generated by ent. """ input CreateLoadBalancerPortInput { + createdBy: String + updatedBy: String number: Int! name: String! poolIDs: [ID!] @@ -47,6 +53,8 @@ input CreateLoadBalancerPortInput { } """Input information to create a load balancer provider.""" input CreateLoadBalancerProviderInput { + createdBy: String + updatedBy: String """The name of the load balancer provider.""" name: String! """The ID for the owner for this load balancer.""" @@ -142,6 +150,8 @@ type LoadBalancerOrigin implements Node @key(fields: "id") @prefixedID(prefix: " id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String name: String! weight: Int! target: String! @@ -233,6 +243,38 @@ input LoadBalancerOriginWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -290,6 +332,8 @@ type LoadBalancerPool implements Node @key(fields: "id") @prefixedID(prefix: "lo id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -401,6 +445,38 @@ input LoadBalancerPoolWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -431,6 +507,8 @@ type LoadBalancerPort implements Node @key(fields: "id") @prefixedID(prefix: "lo id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String number: Int! name: String! loadBalancerID: ID! @@ -517,6 +595,38 @@ input LoadBalancerPortWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """number field predicates""" number: Int numberNEQ: Int @@ -552,6 +662,8 @@ type LoadBalancerProvider implements Node @key(fields: "id") @prefixedID(prefix: id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String """The name of the load balancer provider.""" name: String! loadBalancers( @@ -657,6 +769,38 @@ input LoadBalancerProviderWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -969,6 +1113,8 @@ UpdateLoadBalancerOriginInput is used for update LoadBalancerOrigin object. Input was generated by ent. """ input UpdateLoadBalancerOriginInput { + updatedBy: String + clearUpdatedBy: Boolean name: String weight: Int target: String @@ -980,6 +1126,8 @@ UpdateLoadBalancerPoolInput is used for update LoadBalancerPool object. Input was generated by ent. """ input UpdateLoadBalancerPoolInput { + updatedBy: String + clearUpdatedBy: Boolean name: String protocol: LoadBalancerPoolProtocol addPortIDs: [ID!] @@ -994,6 +1142,8 @@ UpdateLoadBalancerPortInput is used for update LoadBalancerPort object. Input was generated by ent. """ input UpdateLoadBalancerPortInput { + updatedBy: String + clearUpdatedBy: Boolean number: Int name: String addPoolIDs: [ID!] @@ -1002,6 +1152,8 @@ input UpdateLoadBalancerPortInput { } """Input information to update a load balancer provider.""" input UpdateLoadBalancerProviderInput { + updatedBy: String + clearUpdatedBy: Boolean """The name of the load balancer provider.""" name: String } diff --git a/schema/ent.graphql b/schema/ent.graphql index 622ef6bb9..8ee5b6844 100644 --- a/schema/ent.graphql +++ b/schema/ent.graphql @@ -18,6 +18,8 @@ CreateLoadBalancerOriginInput is used for create LoadBalancerOrigin object. Input was generated by ent. """ input CreateLoadBalancerOriginInput { + createdBy: String + updatedBy: String name: String! weight: Int target: String! @@ -30,6 +32,8 @@ CreateLoadBalancerPoolInput is used for create LoadBalancerPool object. Input was generated by ent. """ input CreateLoadBalancerPoolInput { + createdBy: String + updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -41,6 +45,8 @@ CreateLoadBalancerPortInput is used for create LoadBalancerPort object. Input was generated by ent. """ input CreateLoadBalancerPortInput { + createdBy: String + updatedBy: String number: Int! name: String! poolIDs: [ID!] @@ -48,6 +54,8 @@ input CreateLoadBalancerPortInput { } """Input information to create a load balancer provider.""" input CreateLoadBalancerProviderInput { + createdBy: String + updatedBy: String """The name of the load balancer provider.""" name: String! """The ID for the owner for this load balancer.""" @@ -126,6 +134,8 @@ type LoadBalancerOrigin implements Node @key(fields: "id") @prefixedID(prefix: " id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String name: String! weight: Int! target: String! @@ -202,6 +212,38 @@ input LoadBalancerOriginWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -259,6 +301,8 @@ type LoadBalancerPool implements Node @key(fields: "id") @prefixedID(prefix: "lo id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -353,6 +397,38 @@ input LoadBalancerPoolWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -383,6 +459,8 @@ type LoadBalancerPort implements Node @key(fields: "id") @prefixedID(prefix: "lo id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String number: Int! name: String! loadBalancerID: ID! @@ -454,6 +532,38 @@ input LoadBalancerPortWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """number field predicates""" number: Int numberNEQ: Int @@ -489,6 +599,8 @@ type LoadBalancerProvider implements Node @key(fields: "id") @prefixedID(prefix: id: ID! createdAt: Time! updatedAt: Time! + createdBy: String + updatedBy: String """The name of the load balancer provider.""" name: String! loadBalancers( @@ -577,6 +689,38 @@ input LoadBalancerProviderWhereInput { updatedAtGTE: Time updatedAtLT: Time updatedAtLTE: Time + """created_by field predicates""" + createdBy: String + createdByNEQ: String + createdByIn: [String!] + createdByNotIn: [String!] + createdByGT: String + createdByGTE: String + createdByLT: String + createdByLTE: String + createdByContains: String + createdByHasPrefix: String + createdByHasSuffix: String + createdByIsNil: Boolean + createdByNotNil: Boolean + createdByEqualFold: String + createdByContainsFold: String + """updated_by field predicates""" + updatedBy: String + updatedByNEQ: String + updatedByIn: [String!] + updatedByNotIn: [String!] + updatedByGT: String + updatedByGTE: String + updatedByLT: String + updatedByLTE: String + updatedByContains: String + updatedByHasPrefix: String + updatedByHasSuffix: String + updatedByIsNil: Boolean + updatedByNotNil: Boolean + updatedByEqualFold: String + updatedByContainsFold: String """name field predicates""" name: String nameNEQ: String @@ -750,6 +894,8 @@ UpdateLoadBalancerOriginInput is used for update LoadBalancerOrigin object. Input was generated by ent. """ input UpdateLoadBalancerOriginInput { + updatedBy: String + clearUpdatedBy: Boolean name: String weight: Int target: String @@ -761,6 +907,8 @@ UpdateLoadBalancerPoolInput is used for update LoadBalancerPool object. Input was generated by ent. """ input UpdateLoadBalancerPoolInput { + updatedBy: String + clearUpdatedBy: Boolean name: String protocol: LoadBalancerPoolProtocol addPortIDs: [ID!] @@ -775,6 +923,8 @@ UpdateLoadBalancerPortInput is used for update LoadBalancerPort object. Input was generated by ent. """ input UpdateLoadBalancerPortInput { + updatedBy: String + clearUpdatedBy: Boolean number: Int name: String addPoolIDs: [ID!] @@ -783,6 +933,8 @@ input UpdateLoadBalancerPortInput { } """Input information to update a load balancer provider.""" input UpdateLoadBalancerProviderInput { + updatedBy: String + clearUpdatedBy: Boolean """The name of the load balancer provider.""" name: String } From cbca5c442d56a37b57d45ac4bb68beefe740d058 Mon Sep 17 00:00:00 2001 From: Tyler Auerbeck Date: Wed, 7 Feb 2024 10:26:58 -0500 Subject: [PATCH 3/7] Cleanup fields Signed-off-by: Tyler Auerbeck --- internal/ent/generated/gql_mutation_input.go | 114 ++------- internal/ent/generated/gql_pagination.go | 180 +++++++++++++++ internal/ent/schema/audit/mixin.go | 14 +- internal/graphapi/gen_server.go | 230 ++----------------- internal/graphclient/gen_models.go | 70 +++--- internal/graphclient/schema/schema.graphql | 30 +-- schema.graphql | 30 +-- schema/ent.graphql | 30 +-- 8 files changed, 292 insertions(+), 406 deletions(-) diff --git a/internal/ent/generated/gql_mutation_input.go b/internal/ent/generated/gql_mutation_input.go index b0a039a17..ede04cd8c 100644 --- a/internal/ent/generated/gql_mutation_input.go +++ b/internal/ent/generated/gql_mutation_input.go @@ -23,8 +23,6 @@ import ( // CreateLoadBalancerInput represents a mutation input for creating loadbalancers. type CreateLoadBalancerInput struct { - CreatedBy *string - UpdatedBy *string Name string OwnerID gidx.PrefixedID LocationID gidx.PrefixedID @@ -34,12 +32,6 @@ type CreateLoadBalancerInput struct { // Mutate applies the CreateLoadBalancerInput on the LoadBalancerMutation builder. func (i *CreateLoadBalancerInput) Mutate(m *LoadBalancerMutation) { - if v := i.CreatedBy; v != nil { - m.SetCreatedBy(*v) - } - if v := i.UpdatedBy; v != nil { - m.SetUpdatedBy(*v) - } m.SetName(i.Name) m.SetOwnerID(i.OwnerID) m.SetLocationID(i.LocationID) @@ -57,22 +49,14 @@ func (c *LoadBalancerCreate) SetInput(i CreateLoadBalancerInput) *LoadBalancerCr // UpdateLoadBalancerInput represents a mutation input for updating loadbalancers. type UpdateLoadBalancerInput struct { - ClearUpdatedBy bool - UpdatedBy *string - Name *string - ClearPorts bool - AddPortIDs []gidx.PrefixedID - RemovePortIDs []gidx.PrefixedID + Name *string + ClearPorts bool + AddPortIDs []gidx.PrefixedID + RemovePortIDs []gidx.PrefixedID } // Mutate applies the UpdateLoadBalancerInput on the LoadBalancerMutation builder. func (i *UpdateLoadBalancerInput) Mutate(m *LoadBalancerMutation) { - if i.ClearUpdatedBy { - m.ClearUpdatedBy() - } - if v := i.UpdatedBy; v != nil { - m.SetUpdatedBy(*v) - } if v := i.Name; v != nil { m.SetName(*v) } @@ -101,8 +85,6 @@ func (c *LoadBalancerUpdateOne) SetInput(i UpdateLoadBalancerInput) *LoadBalance // CreateLoadBalancerOriginInput represents a mutation input for creating loadbalancerorigins. type CreateLoadBalancerOriginInput struct { - CreatedBy *string - UpdatedBy *string Name string Weight *int32 Target string @@ -113,12 +95,6 @@ type CreateLoadBalancerOriginInput struct { // Mutate applies the CreateLoadBalancerOriginInput on the OriginMutation builder. func (i *CreateLoadBalancerOriginInput) Mutate(m *OriginMutation) { - if v := i.CreatedBy; v != nil { - m.SetCreatedBy(*v) - } - if v := i.UpdatedBy; v != nil { - m.SetUpdatedBy(*v) - } m.SetName(i.Name) if v := i.Weight; v != nil { m.SetWeight(*v) @@ -139,23 +115,15 @@ func (c *OriginCreate) SetInput(i CreateLoadBalancerOriginInput) *OriginCreate { // UpdateLoadBalancerOriginInput represents a mutation input for updating loadbalancerorigins. type UpdateLoadBalancerOriginInput struct { - ClearUpdatedBy bool - UpdatedBy *string - Name *string - Weight *int32 - Target *string - PortNumber *int - Active *bool + Name *string + Weight *int32 + Target *string + PortNumber *int + Active *bool } // Mutate applies the UpdateLoadBalancerOriginInput on the OriginMutation builder. func (i *UpdateLoadBalancerOriginInput) Mutate(m *OriginMutation) { - if i.ClearUpdatedBy { - m.ClearUpdatedBy() - } - if v := i.UpdatedBy; v != nil { - m.SetUpdatedBy(*v) - } if v := i.Name; v != nil { m.SetName(*v) } @@ -187,8 +155,6 @@ func (c *OriginUpdateOne) SetInput(i UpdateLoadBalancerOriginInput) *OriginUpdat // CreateLoadBalancerPoolInput represents a mutation input for creating loadbalancerpools. type CreateLoadBalancerPoolInput struct { - CreatedBy *string - UpdatedBy *string Name string Protocol pool.Protocol OwnerID gidx.PrefixedID @@ -198,12 +164,6 @@ type CreateLoadBalancerPoolInput struct { // Mutate applies the CreateLoadBalancerPoolInput on the PoolMutation builder. func (i *CreateLoadBalancerPoolInput) Mutate(m *PoolMutation) { - if v := i.CreatedBy; v != nil { - m.SetCreatedBy(*v) - } - if v := i.UpdatedBy; v != nil { - m.SetUpdatedBy(*v) - } m.SetName(i.Name) m.SetProtocol(i.Protocol) m.SetOwnerID(i.OwnerID) @@ -223,8 +183,6 @@ func (c *PoolCreate) SetInput(i CreateLoadBalancerPoolInput) *PoolCreate { // UpdateLoadBalancerPoolInput represents a mutation input for updating loadbalancerpools. type UpdateLoadBalancerPoolInput struct { - ClearUpdatedBy bool - UpdatedBy *string Name *string Protocol *pool.Protocol ClearPorts bool @@ -237,12 +195,6 @@ type UpdateLoadBalancerPoolInput struct { // Mutate applies the UpdateLoadBalancerPoolInput on the PoolMutation builder. func (i *UpdateLoadBalancerPoolInput) Mutate(m *PoolMutation) { - if i.ClearUpdatedBy { - m.ClearUpdatedBy() - } - if v := i.UpdatedBy; v != nil { - m.SetUpdatedBy(*v) - } if v := i.Name; v != nil { m.SetName(*v) } @@ -283,8 +235,6 @@ func (c *PoolUpdateOne) SetInput(i UpdateLoadBalancerPoolInput) *PoolUpdateOne { // CreateLoadBalancerPortInput represents a mutation input for creating loadbalancerports. type CreateLoadBalancerPortInput struct { - CreatedBy *string - UpdatedBy *string Number int Name string PoolIDs []gidx.PrefixedID @@ -293,12 +243,6 @@ type CreateLoadBalancerPortInput struct { // Mutate applies the CreateLoadBalancerPortInput on the PortMutation builder. func (i *CreateLoadBalancerPortInput) Mutate(m *PortMutation) { - if v := i.CreatedBy; v != nil { - m.SetCreatedBy(*v) - } - if v := i.UpdatedBy; v != nil { - m.SetUpdatedBy(*v) - } m.SetNumber(i.Number) m.SetName(i.Name) if v := i.PoolIDs; len(v) > 0 { @@ -315,23 +259,15 @@ func (c *PortCreate) SetInput(i CreateLoadBalancerPortInput) *PortCreate { // UpdateLoadBalancerPortInput represents a mutation input for updating loadbalancerports. type UpdateLoadBalancerPortInput struct { - ClearUpdatedBy bool - UpdatedBy *string - Number *int - Name *string - ClearPools bool - AddPoolIDs []gidx.PrefixedID - RemovePoolIDs []gidx.PrefixedID + Number *int + Name *string + ClearPools bool + AddPoolIDs []gidx.PrefixedID + RemovePoolIDs []gidx.PrefixedID } // Mutate applies the UpdateLoadBalancerPortInput on the PortMutation builder. func (i *UpdateLoadBalancerPortInput) Mutate(m *PortMutation) { - if i.ClearUpdatedBy { - m.ClearUpdatedBy() - } - if v := i.UpdatedBy; v != nil { - m.SetUpdatedBy(*v) - } if v := i.Number; v != nil { m.SetNumber(*v) } @@ -363,20 +299,12 @@ func (c *PortUpdateOne) SetInput(i UpdateLoadBalancerPortInput) *PortUpdateOne { // CreateLoadBalancerProviderInput represents a mutation input for creating loadbalancerproviders. type CreateLoadBalancerProviderInput struct { - CreatedBy *string - UpdatedBy *string - Name string - OwnerID gidx.PrefixedID + Name string + OwnerID gidx.PrefixedID } // Mutate applies the CreateLoadBalancerProviderInput on the ProviderMutation builder. func (i *CreateLoadBalancerProviderInput) Mutate(m *ProviderMutation) { - if v := i.CreatedBy; v != nil { - m.SetCreatedBy(*v) - } - if v := i.UpdatedBy; v != nil { - m.SetUpdatedBy(*v) - } m.SetName(i.Name) m.SetOwnerID(i.OwnerID) } @@ -389,19 +317,11 @@ func (c *ProviderCreate) SetInput(i CreateLoadBalancerProviderInput) *ProviderCr // UpdateLoadBalancerProviderInput represents a mutation input for updating loadbalancerproviders. type UpdateLoadBalancerProviderInput struct { - ClearUpdatedBy bool - UpdatedBy *string - Name *string + Name *string } // Mutate applies the UpdateLoadBalancerProviderInput on the ProviderMutation builder. func (i *UpdateLoadBalancerProviderInput) Mutate(m *ProviderMutation) { - if i.ClearUpdatedBy { - m.ClearUpdatedBy() - } - if v := i.UpdatedBy; v != nil { - m.SetUpdatedBy(*v) - } if v := i.Name; v != nil { m.SetName(*v) } diff --git a/internal/ent/generated/gql_pagination.go b/internal/ent/generated/gql_pagination.go index b692adbb5..a6d6ebf21 100644 --- a/internal/ent/generated/gql_pagination.go +++ b/internal/ent/generated/gql_pagination.go @@ -365,6 +365,34 @@ var ( } }, } + // LoadBalancerOrderFieldCreatedBy orders LoadBalancer by created_by. + LoadBalancerOrderFieldCreatedBy = &LoadBalancerOrderField{ + Value: func(lb *LoadBalancer) (ent.Value, error) { + return lb.CreatedBy, nil + }, + column: loadbalancer.FieldCreatedBy, + toTerm: loadbalancer.ByCreatedBy, + toCursor: func(lb *LoadBalancer) Cursor { + return Cursor{ + ID: lb.ID, + Value: lb.CreatedBy, + } + }, + } + // LoadBalancerOrderFieldUpdatedBy orders LoadBalancer by updated_by. + LoadBalancerOrderFieldUpdatedBy = &LoadBalancerOrderField{ + Value: func(lb *LoadBalancer) (ent.Value, error) { + return lb.UpdatedBy, nil + }, + column: loadbalancer.FieldUpdatedBy, + toTerm: loadbalancer.ByUpdatedBy, + toCursor: func(lb *LoadBalancer) Cursor { + return Cursor{ + ID: lb.ID, + Value: lb.UpdatedBy, + } + }, + } // LoadBalancerOrderFieldName orders LoadBalancer by name. LoadBalancerOrderFieldName = &LoadBalancerOrderField{ Value: func(lb *LoadBalancer) (ent.Value, error) { @@ -405,6 +433,10 @@ func (f LoadBalancerOrderField) String() string { str = "CREATED_AT" case LoadBalancerOrderFieldUpdatedAt.column: str = "UPDATED_AT" + case LoadBalancerOrderFieldCreatedBy.column: + str = "CREATED_BY" + case LoadBalancerOrderFieldUpdatedBy.column: + str = "UPDATED_BY" case LoadBalancerOrderFieldName.column: str = "NAME" case LoadBalancerOrderFieldOwnerID.column: @@ -431,6 +463,10 @@ func (f *LoadBalancerOrderField) UnmarshalGQL(v interface{}) error { *f = *LoadBalancerOrderFieldCreatedAt case "UPDATED_AT": *f = *LoadBalancerOrderFieldUpdatedAt + case "CREATED_BY": + *f = *LoadBalancerOrderFieldCreatedBy + case "UPDATED_BY": + *f = *LoadBalancerOrderFieldUpdatedBy case "NAME": *f = *LoadBalancerOrderFieldName case "OWNER": @@ -719,6 +755,34 @@ var ( } }, } + // OriginOrderFieldCreatedBy orders Origin by created_by. + OriginOrderFieldCreatedBy = &LoadBalancerOriginOrderField{ + Value: func(o *LoadBalancerOrigin) (ent.Value, error) { + return o.CreatedBy, nil + }, + column: origin.FieldCreatedBy, + toTerm: origin.ByCreatedBy, + toCursor: func(o *LoadBalancerOrigin) Cursor { + return Cursor{ + ID: o.ID, + Value: o.CreatedBy, + } + }, + } + // OriginOrderFieldUpdatedBy orders Origin by updated_by. + OriginOrderFieldUpdatedBy = &LoadBalancerOriginOrderField{ + Value: func(o *LoadBalancerOrigin) (ent.Value, error) { + return o.UpdatedBy, nil + }, + column: origin.FieldUpdatedBy, + toTerm: origin.ByUpdatedBy, + toCursor: func(o *LoadBalancerOrigin) Cursor { + return Cursor{ + ID: o.ID, + Value: o.UpdatedBy, + } + }, + } // OriginOrderFieldName orders Origin by name. OriginOrderFieldName = &LoadBalancerOriginOrderField{ Value: func(o *LoadBalancerOrigin) (ent.Value, error) { @@ -799,6 +863,10 @@ func (f LoadBalancerOriginOrderField) String() string { str = "CREATED_AT" case OriginOrderFieldUpdatedAt.column: str = "UPDATED_AT" + case OriginOrderFieldCreatedBy.column: + str = "CREATED_BY" + case OriginOrderFieldUpdatedBy.column: + str = "UPDATED_BY" case OriginOrderFieldName.column: str = "name" case OriginOrderFieldWeight.column: @@ -829,6 +897,10 @@ func (f *LoadBalancerOriginOrderField) UnmarshalGQL(v interface{}) error { *f = *OriginOrderFieldCreatedAt case "UPDATED_AT": *f = *OriginOrderFieldUpdatedAt + case "CREATED_BY": + *f = *OriginOrderFieldCreatedBy + case "UPDATED_BY": + *f = *OriginOrderFieldUpdatedBy case "name": *f = *OriginOrderFieldName case "weight": @@ -1123,6 +1195,34 @@ var ( } }, } + // PoolOrderFieldCreatedBy orders Pool by created_by. + PoolOrderFieldCreatedBy = &LoadBalancerPoolOrderField{ + Value: func(po *LoadBalancerPool) (ent.Value, error) { + return po.CreatedBy, nil + }, + column: pool.FieldCreatedBy, + toTerm: pool.ByCreatedBy, + toCursor: func(po *LoadBalancerPool) Cursor { + return Cursor{ + ID: po.ID, + Value: po.CreatedBy, + } + }, + } + // PoolOrderFieldUpdatedBy orders Pool by updated_by. + PoolOrderFieldUpdatedBy = &LoadBalancerPoolOrderField{ + Value: func(po *LoadBalancerPool) (ent.Value, error) { + return po.UpdatedBy, nil + }, + column: pool.FieldUpdatedBy, + toTerm: pool.ByUpdatedBy, + toCursor: func(po *LoadBalancerPool) Cursor { + return Cursor{ + ID: po.ID, + Value: po.UpdatedBy, + } + }, + } // PoolOrderFieldName orders Pool by name. PoolOrderFieldName = &LoadBalancerPoolOrderField{ Value: func(po *LoadBalancerPool) (ent.Value, error) { @@ -1161,6 +1261,10 @@ func (f LoadBalancerPoolOrderField) String() string { str = "CREATED_AT" case PoolOrderFieldUpdatedAt.column: str = "UPDATED_AT" + case PoolOrderFieldCreatedBy.column: + str = "CREATED_BY" + case PoolOrderFieldUpdatedBy.column: + str = "UPDATED_BY" case PoolOrderFieldName.column: str = "name" case PoolOrderFieldProtocol.column: @@ -1185,6 +1289,10 @@ func (f *LoadBalancerPoolOrderField) UnmarshalGQL(v interface{}) error { *f = *PoolOrderFieldCreatedAt case "UPDATED_AT": *f = *PoolOrderFieldUpdatedAt + case "CREATED_BY": + *f = *PoolOrderFieldCreatedBy + case "UPDATED_BY": + *f = *PoolOrderFieldUpdatedBy case "name": *f = *PoolOrderFieldName case "protocol": @@ -1473,6 +1581,34 @@ var ( } }, } + // PortOrderFieldCreatedBy orders Port by created_by. + PortOrderFieldCreatedBy = &LoadBalancerPortOrderField{ + Value: func(po *LoadBalancerPort) (ent.Value, error) { + return po.CreatedBy, nil + }, + column: port.FieldCreatedBy, + toTerm: port.ByCreatedBy, + toCursor: func(po *LoadBalancerPort) Cursor { + return Cursor{ + ID: po.ID, + Value: po.CreatedBy, + } + }, + } + // PortOrderFieldUpdatedBy orders Port by updated_by. + PortOrderFieldUpdatedBy = &LoadBalancerPortOrderField{ + Value: func(po *LoadBalancerPort) (ent.Value, error) { + return po.UpdatedBy, nil + }, + column: port.FieldUpdatedBy, + toTerm: port.ByUpdatedBy, + toCursor: func(po *LoadBalancerPort) Cursor { + return Cursor{ + ID: po.ID, + Value: po.UpdatedBy, + } + }, + } // PortOrderFieldNumber orders Port by number. PortOrderFieldNumber = &LoadBalancerPortOrderField{ Value: func(po *LoadBalancerPort) (ent.Value, error) { @@ -1511,6 +1647,10 @@ func (f LoadBalancerPortOrderField) String() string { str = "CREATED_AT" case PortOrderFieldUpdatedAt.column: str = "UPDATED_AT" + case PortOrderFieldCreatedBy.column: + str = "CREATED_BY" + case PortOrderFieldUpdatedBy.column: + str = "UPDATED_BY" case PortOrderFieldNumber.column: str = "number" case PortOrderFieldName.column: @@ -1535,6 +1675,10 @@ func (f *LoadBalancerPortOrderField) UnmarshalGQL(v interface{}) error { *f = *PortOrderFieldCreatedAt case "UPDATED_AT": *f = *PortOrderFieldUpdatedAt + case "CREATED_BY": + *f = *PortOrderFieldCreatedBy + case "UPDATED_BY": + *f = *PortOrderFieldUpdatedBy case "number": *f = *PortOrderFieldNumber case "name": @@ -1837,6 +1981,34 @@ var ( } }, } + // ProviderOrderFieldCreatedBy orders Provider by created_by. + ProviderOrderFieldCreatedBy = &LoadBalancerProviderOrderField{ + Value: func(pr *LoadBalancerProvider) (ent.Value, error) { + return pr.CreatedBy, nil + }, + column: provider.FieldCreatedBy, + toTerm: provider.ByCreatedBy, + toCursor: func(pr *LoadBalancerProvider) Cursor { + return Cursor{ + ID: pr.ID, + Value: pr.CreatedBy, + } + }, + } + // ProviderOrderFieldUpdatedBy orders Provider by updated_by. + ProviderOrderFieldUpdatedBy = &LoadBalancerProviderOrderField{ + Value: func(pr *LoadBalancerProvider) (ent.Value, error) { + return pr.UpdatedBy, nil + }, + column: provider.FieldUpdatedBy, + toTerm: provider.ByUpdatedBy, + toCursor: func(pr *LoadBalancerProvider) Cursor { + return Cursor{ + ID: pr.ID, + Value: pr.UpdatedBy, + } + }, + } // ProviderOrderFieldName orders Provider by name. ProviderOrderFieldName = &LoadBalancerProviderOrderField{ Value: func(pr *LoadBalancerProvider) (ent.Value, error) { @@ -1877,6 +2049,10 @@ func (f LoadBalancerProviderOrderField) String() string { str = "CREATED_AT" case ProviderOrderFieldUpdatedAt.column: str = "UPDATED_AT" + case ProviderOrderFieldCreatedBy.column: + str = "CREATED_BY" + case ProviderOrderFieldUpdatedBy.column: + str = "UPDATED_BY" case ProviderOrderFieldName.column: str = "NAME" case ProviderOrderFieldOwnerID.column: @@ -1903,6 +2079,10 @@ func (f *LoadBalancerProviderOrderField) UnmarshalGQL(v interface{}) error { *f = *ProviderOrderFieldCreatedAt case "UPDATED_AT": *f = *ProviderOrderFieldUpdatedAt + case "CREATED_BY": + *f = *ProviderOrderFieldCreatedBy + case "UPDATED_BY": + *f = *ProviderOrderFieldUpdatedBy case "NAME": *f = *ProviderOrderFieldName case "OWNER": diff --git a/internal/ent/schema/audit/mixin.go b/internal/ent/schema/audit/mixin.go index e2f9cb084..4c4414746 100644 --- a/internal/ent/schema/audit/mixin.go +++ b/internal/ent/schema/audit/mixin.go @@ -2,9 +2,8 @@ package audit import ( "context" - "errors" - "fmt" + "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/schema/field" "entgo.io/ent/schema/mixin" @@ -21,8 +20,16 @@ func (AuditMixin) Fields() []ent.Field { return []ent.Field{ field.String("created_by"). Immutable(). + Annotations( + entgql.Skip(entgql.SkipMutationCreateInput, entgql.SkipMutationUpdateInput), + entgql.OrderField("CREATED_BY"), + ). Optional(), field.String("updated_by"). + Annotations( + entgql.Skip(entgql.SkipMutationCreateInput, entgql.SkipMutationUpdateInput), + entgql.OrderField("UPDATED_BY"), + ). Optional(), } } @@ -46,7 +53,7 @@ func AuditHook(next ent.Mutator) ent.Mutator { return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { ml, ok := m.(AuditLogger) if !ok { - return nil, errors.New("unexpected mutation type") + return nil, newUnexpectedMutationError(m) } actor := "unknown-actor" id, ok := ctx.Value(echojwtx.ActorCtxKey).(string) @@ -58,7 +65,6 @@ func AuditHook(next ent.Mutator) ent.Mutator { case op.Is(ent.OpCreate): ml.SetCreatedBy(actor) ml.SetUpdatedBy(actor) - fmt.Println("chacha") case op.Is(ent.OpUpdateOne | ent.OpUpdate): ml.SetUpdatedBy(actor) diff --git a/internal/graphapi/gen_server.go b/internal/graphapi/gen_server.go index 05c72ffd1..70715d01a 100644 --- a/internal/graphapi/gen_server.go +++ b/internal/graphapi/gen_server.go @@ -1573,8 +1573,6 @@ var sources = []*ast.Source{ directive @goModel(model: String, models: [String!]) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION """Input information to create a load balancer.""" input CreateLoadBalancerInput { - createdBy: String - updatedBy: String """The name of the load balancer.""" name: String! """The ID for the owner for this load balancer.""" @@ -1589,8 +1587,6 @@ CreateLoadBalancerOriginInput is used for create LoadBalancerOrigin object. Input was generated by ent. """ input CreateLoadBalancerOriginInput { - createdBy: String - updatedBy: String name: String! weight: Int target: String! @@ -1603,8 +1599,6 @@ CreateLoadBalancerPoolInput is used for create LoadBalancerPool object. Input was generated by ent. """ input CreateLoadBalancerPoolInput { - createdBy: String - updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -1616,8 +1610,6 @@ CreateLoadBalancerPortInput is used for create LoadBalancerPort object. Input was generated by ent. """ input CreateLoadBalancerPortInput { - createdBy: String - updatedBy: String number: Int! name: String! poolIDs: [ID!] @@ -1625,8 +1617,6 @@ input CreateLoadBalancerPortInput { } """Input information to create a load balancer provider.""" input CreateLoadBalancerProviderInput { - createdBy: String - updatedBy: String """The name of the load balancer provider.""" name: String! """The ID for the owner for this load balancer.""" @@ -1698,6 +1688,8 @@ enum LoadBalancerOrderField { ID CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY NAME OWNER } @@ -1742,6 +1734,8 @@ input LoadBalancerOriginOrder { enum LoadBalancerOriginOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY name weight target @@ -1925,6 +1919,8 @@ input LoadBalancerPoolOrder { enum LoadBalancerPoolOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY name protocol } @@ -2065,6 +2061,8 @@ input LoadBalancerPortOrder { enum LoadBalancerPortOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY number name } @@ -2222,6 +2220,8 @@ enum LoadBalancerProviderOrderField { ID CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY NAME OWNER } @@ -2452,8 +2452,6 @@ type Query { scalar Time """Input information to update a load balancer.""" input UpdateLoadBalancerInput { - updatedBy: String - clearUpdatedBy: Boolean """The name of the load balancer.""" name: String addPortIDs: [ID!] @@ -2465,8 +2463,6 @@ UpdateLoadBalancerOriginInput is used for update LoadBalancerOrigin object. Input was generated by ent. """ input UpdateLoadBalancerOriginInput { - updatedBy: String - clearUpdatedBy: Boolean name: String weight: Int target: String @@ -2478,8 +2474,6 @@ UpdateLoadBalancerPoolInput is used for update LoadBalancerPool object. Input was generated by ent. """ input UpdateLoadBalancerPoolInput { - updatedBy: String - clearUpdatedBy: Boolean name: String protocol: LoadBalancerPoolProtocol addPortIDs: [ID!] @@ -2494,8 +2488,6 @@ UpdateLoadBalancerPortInput is used for update LoadBalancerPort object. Input was generated by ent. """ input UpdateLoadBalancerPortInput { - updatedBy: String - clearUpdatedBy: Boolean number: Int name: String addPoolIDs: [ID!] @@ -2504,8 +2496,6 @@ input UpdateLoadBalancerPortInput { } """Input information to update a load balancer provider.""" input UpdateLoadBalancerProviderInput { - updatedBy: String - clearUpdatedBy: Boolean """The name of the load balancer provider.""" name: String } @@ -12821,31 +12811,13 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerInput(ctx context.Co asMap[k] = v } - fieldsInOrder := [...]string{"createdBy", "updatedBy", "name", "ownerID", "locationID", "portIDs", "providerID"} + fieldsInOrder := [...]string{"name", "ownerID", "locationID", "portIDs", "providerID"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "createdBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.CreatedBy = data - case "updatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.UpdatedBy = data case "name": var err error @@ -12904,31 +12876,13 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerOriginInput(ctx cont asMap[k] = v } - fieldsInOrder := [...]string{"createdBy", "updatedBy", "name", "weight", "target", "portNumber", "active", "poolID"} + fieldsInOrder := [...]string{"name", "weight", "target", "portNumber", "active", "poolID"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "createdBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.CreatedBy = data - case "updatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.UpdatedBy = data case "name": var err error @@ -12996,31 +12950,13 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerPoolInput(ctx contex asMap[k] = v } - fieldsInOrder := [...]string{"createdBy", "updatedBy", "name", "protocol", "ownerID", "portIDs", "originIDs"} + fieldsInOrder := [...]string{"name", "protocol", "ownerID", "portIDs", "originIDs"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "createdBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.CreatedBy = data - case "updatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.UpdatedBy = data case "name": var err error @@ -13079,31 +13015,13 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerPortInput(ctx contex asMap[k] = v } - fieldsInOrder := [...]string{"createdBy", "updatedBy", "number", "name", "poolIDs", "loadBalancerID"} + fieldsInOrder := [...]string{"number", "name", "poolIDs", "loadBalancerID"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "createdBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.CreatedBy = data - case "updatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.UpdatedBy = data case "number": var err error @@ -13153,31 +13071,13 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerProviderInput(ctx co asMap[k] = v } - fieldsInOrder := [...]string{"createdBy", "updatedBy", "name", "ownerID"} + fieldsInOrder := [...]string{"name", "ownerID"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "createdBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.CreatedBy = data - case "updatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.UpdatedBy = data case "name": var err error @@ -17200,31 +17100,13 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerInput(ctx context.Co asMap[k] = v } - fieldsInOrder := [...]string{"updatedBy", "clearUpdatedBy", "name", "addPortIDs", "removePortIDs", "clearPorts"} + fieldsInOrder := [...]string{"name", "addPortIDs", "removePortIDs", "clearPorts"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "updatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.UpdatedBy = data - case "clearUpdatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearUpdatedBy")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.ClearUpdatedBy = data case "name": var err error @@ -17274,31 +17156,13 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerOriginInput(ctx cont asMap[k] = v } - fieldsInOrder := [...]string{"updatedBy", "clearUpdatedBy", "name", "weight", "target", "portNumber", "active"} + fieldsInOrder := [...]string{"name", "weight", "target", "portNumber", "active"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "updatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.UpdatedBy = data - case "clearUpdatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearUpdatedBy")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.ClearUpdatedBy = data case "name": var err error @@ -17357,31 +17221,13 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerPoolInput(ctx contex asMap[k] = v } - fieldsInOrder := [...]string{"updatedBy", "clearUpdatedBy", "name", "protocol", "addPortIDs", "removePortIDs", "clearPorts", "addOriginIDs", "removeOriginIDs", "clearOrigins"} + fieldsInOrder := [...]string{"name", "protocol", "addPortIDs", "removePortIDs", "clearPorts", "addOriginIDs", "removeOriginIDs", "clearOrigins"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "updatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.UpdatedBy = data - case "clearUpdatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearUpdatedBy")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.ClearUpdatedBy = data case "name": var err error @@ -17467,31 +17313,13 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerPortInput(ctx contex asMap[k] = v } - fieldsInOrder := [...]string{"updatedBy", "clearUpdatedBy", "number", "name", "addPoolIDs", "removePoolIDs", "clearPools"} + fieldsInOrder := [...]string{"number", "name", "addPoolIDs", "removePoolIDs", "clearPools"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "updatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.UpdatedBy = data - case "clearUpdatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearUpdatedBy")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.ClearUpdatedBy = data case "number": var err error @@ -17550,31 +17378,13 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerProviderInput(ctx co asMap[k] = v } - fieldsInOrder := [...]string{"updatedBy", "clearUpdatedBy", "name"} + fieldsInOrder := [...]string{"name"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "updatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedBy")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.UpdatedBy = data - case "clearUpdatedBy": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearUpdatedBy")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.ClearUpdatedBy = data case "name": var err error diff --git a/internal/graphclient/gen_models.go b/internal/graphclient/gen_models.go index 0f76620db..8e8f20258 100644 --- a/internal/graphclient/gen_models.go +++ b/internal/graphclient/gen_models.go @@ -35,8 +35,6 @@ type Entity interface { // Input information to create a load balancer. type CreateLoadBalancerInput struct { - CreatedBy *string `json:"createdBy,omitempty"` - UpdatedBy *string `json:"updatedBy,omitempty"` // The name of the load balancer. Name string `json:"name"` // The ID for the owner for this load balancer. @@ -50,8 +48,6 @@ type CreateLoadBalancerInput struct { // CreateLoadBalancerOriginInput is used for create LoadBalancerOrigin object. // Input was generated by ent. type CreateLoadBalancerOriginInput struct { - CreatedBy *string `json:"createdBy,omitempty"` - UpdatedBy *string `json:"updatedBy,omitempty"` Name string `json:"name"` Weight *int64 `json:"weight,omitempty"` Target string `json:"target"` @@ -63,8 +59,6 @@ type CreateLoadBalancerOriginInput struct { // CreateLoadBalancerPoolInput is used for create LoadBalancerPool object. // Input was generated by ent. type CreateLoadBalancerPoolInput struct { - CreatedBy *string `json:"createdBy,omitempty"` - UpdatedBy *string `json:"updatedBy,omitempty"` Name string `json:"name"` Protocol LoadBalancerPoolProtocol `json:"protocol"` OwnerID gidx.PrefixedID `json:"ownerID"` @@ -75,8 +69,6 @@ type CreateLoadBalancerPoolInput struct { // CreateLoadBalancerPortInput is used for create LoadBalancerPort object. // Input was generated by ent. type CreateLoadBalancerPortInput struct { - CreatedBy *string `json:"createdBy,omitempty"` - UpdatedBy *string `json:"updatedBy,omitempty"` Number int64 `json:"number"` Name string `json:"name"` PoolIDs []gidx.PrefixedID `json:"poolIDs,omitempty"` @@ -85,8 +77,6 @@ type CreateLoadBalancerPortInput struct { // Input information to create a load balancer provider. type CreateLoadBalancerProviderInput struct { - CreatedBy *string `json:"createdBy,omitempty"` - UpdatedBy *string `json:"updatedBy,omitempty"` // The name of the load balancer provider. Name string `json:"name"` // The ID for the owner for this load balancer. @@ -936,8 +926,6 @@ func (ResourceOwner) IsEntity() {} // Input information to update a load balancer. type UpdateLoadBalancerInput struct { - UpdatedBy *string `json:"updatedBy,omitempty"` - ClearUpdatedBy *bool `json:"clearUpdatedBy,omitempty"` // The name of the load balancer. Name *string `json:"name,omitempty"` AddPortIDs []gidx.PrefixedID `json:"addPortIDs,omitempty"` @@ -948,20 +936,16 @@ type UpdateLoadBalancerInput struct { // UpdateLoadBalancerOriginInput is used for update LoadBalancerOrigin object. // Input was generated by ent. type UpdateLoadBalancerOriginInput struct { - UpdatedBy *string `json:"updatedBy,omitempty"` - ClearUpdatedBy *bool `json:"clearUpdatedBy,omitempty"` - Name *string `json:"name,omitempty"` - Weight *int64 `json:"weight,omitempty"` - Target *string `json:"target,omitempty"` - PortNumber *int64 `json:"portNumber,omitempty"` - Active *bool `json:"active,omitempty"` + Name *string `json:"name,omitempty"` + Weight *int64 `json:"weight,omitempty"` + Target *string `json:"target,omitempty"` + PortNumber *int64 `json:"portNumber,omitempty"` + Active *bool `json:"active,omitempty"` } // UpdateLoadBalancerPoolInput is used for update LoadBalancerPool object. // Input was generated by ent. type UpdateLoadBalancerPoolInput struct { - UpdatedBy *string `json:"updatedBy,omitempty"` - ClearUpdatedBy *bool `json:"clearUpdatedBy,omitempty"` Name *string `json:"name,omitempty"` Protocol *LoadBalancerPoolProtocol `json:"protocol,omitempty"` AddPortIDs []gidx.PrefixedID `json:"addPortIDs,omitempty"` @@ -975,19 +959,15 @@ type UpdateLoadBalancerPoolInput struct { // UpdateLoadBalancerPortInput is used for update LoadBalancerPort object. // Input was generated by ent. type UpdateLoadBalancerPortInput struct { - UpdatedBy *string `json:"updatedBy,omitempty"` - ClearUpdatedBy *bool `json:"clearUpdatedBy,omitempty"` - Number *int64 `json:"number,omitempty"` - Name *string `json:"name,omitempty"` - AddPoolIDs []gidx.PrefixedID `json:"addPoolIDs,omitempty"` - RemovePoolIDs []gidx.PrefixedID `json:"removePoolIDs,omitempty"` - ClearPools *bool `json:"clearPools,omitempty"` + Number *int64 `json:"number,omitempty"` + Name *string `json:"name,omitempty"` + AddPoolIDs []gidx.PrefixedID `json:"addPoolIDs,omitempty"` + RemovePoolIDs []gidx.PrefixedID `json:"removePoolIDs,omitempty"` + ClearPools *bool `json:"clearPools,omitempty"` } // Input information to update a load balancer provider. type UpdateLoadBalancerProviderInput struct { - UpdatedBy *string `json:"updatedBy,omitempty"` - ClearUpdatedBy *bool `json:"clearUpdatedBy,omitempty"` // The name of the load balancer provider. Name *string `json:"name,omitempty"` } @@ -1003,6 +983,8 @@ const ( LoadBalancerOrderFieldID LoadBalancerOrderField = "ID" LoadBalancerOrderFieldCreatedAt LoadBalancerOrderField = "CREATED_AT" LoadBalancerOrderFieldUpdatedAt LoadBalancerOrderField = "UPDATED_AT" + LoadBalancerOrderFieldCreatedBy LoadBalancerOrderField = "CREATED_BY" + LoadBalancerOrderFieldUpdatedBy LoadBalancerOrderField = "UPDATED_BY" LoadBalancerOrderFieldName LoadBalancerOrderField = "NAME" LoadBalancerOrderFieldOwner LoadBalancerOrderField = "OWNER" ) @@ -1011,13 +993,15 @@ var AllLoadBalancerOrderField = []LoadBalancerOrderField{ LoadBalancerOrderFieldID, LoadBalancerOrderFieldCreatedAt, LoadBalancerOrderFieldUpdatedAt, + LoadBalancerOrderFieldCreatedBy, + LoadBalancerOrderFieldUpdatedBy, LoadBalancerOrderFieldName, LoadBalancerOrderFieldOwner, } func (e LoadBalancerOrderField) IsValid() bool { switch e { - case LoadBalancerOrderFieldID, LoadBalancerOrderFieldCreatedAt, LoadBalancerOrderFieldUpdatedAt, LoadBalancerOrderFieldName, LoadBalancerOrderFieldOwner: + case LoadBalancerOrderFieldID, LoadBalancerOrderFieldCreatedAt, LoadBalancerOrderFieldUpdatedAt, LoadBalancerOrderFieldCreatedBy, LoadBalancerOrderFieldUpdatedBy, LoadBalancerOrderFieldName, LoadBalancerOrderFieldOwner: return true } return false @@ -1050,6 +1034,8 @@ type LoadBalancerOriginOrderField string const ( LoadBalancerOriginOrderFieldCreatedAt LoadBalancerOriginOrderField = "CREATED_AT" LoadBalancerOriginOrderFieldUpdatedAt LoadBalancerOriginOrderField = "UPDATED_AT" + LoadBalancerOriginOrderFieldCreatedBy LoadBalancerOriginOrderField = "CREATED_BY" + LoadBalancerOriginOrderFieldUpdatedBy LoadBalancerOriginOrderField = "UPDATED_BY" LoadBalancerOriginOrderFieldName LoadBalancerOriginOrderField = "name" LoadBalancerOriginOrderFieldWeight LoadBalancerOriginOrderField = "weight" LoadBalancerOriginOrderFieldTarget LoadBalancerOriginOrderField = "target" @@ -1060,6 +1046,8 @@ const ( var AllLoadBalancerOriginOrderField = []LoadBalancerOriginOrderField{ LoadBalancerOriginOrderFieldCreatedAt, LoadBalancerOriginOrderFieldUpdatedAt, + LoadBalancerOriginOrderFieldCreatedBy, + LoadBalancerOriginOrderFieldUpdatedBy, LoadBalancerOriginOrderFieldName, LoadBalancerOriginOrderFieldWeight, LoadBalancerOriginOrderFieldTarget, @@ -1069,7 +1057,7 @@ var AllLoadBalancerOriginOrderField = []LoadBalancerOriginOrderField{ func (e LoadBalancerOriginOrderField) IsValid() bool { switch e { - case LoadBalancerOriginOrderFieldCreatedAt, LoadBalancerOriginOrderFieldUpdatedAt, LoadBalancerOriginOrderFieldName, LoadBalancerOriginOrderFieldWeight, LoadBalancerOriginOrderFieldTarget, LoadBalancerOriginOrderFieldNumber, LoadBalancerOriginOrderFieldActive: + case LoadBalancerOriginOrderFieldCreatedAt, LoadBalancerOriginOrderFieldUpdatedAt, LoadBalancerOriginOrderFieldCreatedBy, LoadBalancerOriginOrderFieldUpdatedBy, LoadBalancerOriginOrderFieldName, LoadBalancerOriginOrderFieldWeight, LoadBalancerOriginOrderFieldTarget, LoadBalancerOriginOrderFieldNumber, LoadBalancerOriginOrderFieldActive: return true } return false @@ -1102,6 +1090,8 @@ type LoadBalancerPoolOrderField string const ( LoadBalancerPoolOrderFieldCreatedAt LoadBalancerPoolOrderField = "CREATED_AT" LoadBalancerPoolOrderFieldUpdatedAt LoadBalancerPoolOrderField = "UPDATED_AT" + LoadBalancerPoolOrderFieldCreatedBy LoadBalancerPoolOrderField = "CREATED_BY" + LoadBalancerPoolOrderFieldUpdatedBy LoadBalancerPoolOrderField = "UPDATED_BY" LoadBalancerPoolOrderFieldName LoadBalancerPoolOrderField = "name" LoadBalancerPoolOrderFieldProtocol LoadBalancerPoolOrderField = "protocol" ) @@ -1109,13 +1099,15 @@ const ( var AllLoadBalancerPoolOrderField = []LoadBalancerPoolOrderField{ LoadBalancerPoolOrderFieldCreatedAt, LoadBalancerPoolOrderFieldUpdatedAt, + LoadBalancerPoolOrderFieldCreatedBy, + LoadBalancerPoolOrderFieldUpdatedBy, LoadBalancerPoolOrderFieldName, LoadBalancerPoolOrderFieldProtocol, } func (e LoadBalancerPoolOrderField) IsValid() bool { switch e { - case LoadBalancerPoolOrderFieldCreatedAt, LoadBalancerPoolOrderFieldUpdatedAt, LoadBalancerPoolOrderFieldName, LoadBalancerPoolOrderFieldProtocol: + case LoadBalancerPoolOrderFieldCreatedAt, LoadBalancerPoolOrderFieldUpdatedAt, LoadBalancerPoolOrderFieldCreatedBy, LoadBalancerPoolOrderFieldUpdatedBy, LoadBalancerPoolOrderFieldName, LoadBalancerPoolOrderFieldProtocol: return true } return false @@ -1190,6 +1182,8 @@ type LoadBalancerPortOrderField string const ( LoadBalancerPortOrderFieldCreatedAt LoadBalancerPortOrderField = "CREATED_AT" LoadBalancerPortOrderFieldUpdatedAt LoadBalancerPortOrderField = "UPDATED_AT" + LoadBalancerPortOrderFieldCreatedBy LoadBalancerPortOrderField = "CREATED_BY" + LoadBalancerPortOrderFieldUpdatedBy LoadBalancerPortOrderField = "UPDATED_BY" LoadBalancerPortOrderFieldNumber LoadBalancerPortOrderField = "number" LoadBalancerPortOrderFieldName LoadBalancerPortOrderField = "name" ) @@ -1197,13 +1191,15 @@ const ( var AllLoadBalancerPortOrderField = []LoadBalancerPortOrderField{ LoadBalancerPortOrderFieldCreatedAt, LoadBalancerPortOrderFieldUpdatedAt, + LoadBalancerPortOrderFieldCreatedBy, + LoadBalancerPortOrderFieldUpdatedBy, LoadBalancerPortOrderFieldNumber, LoadBalancerPortOrderFieldName, } func (e LoadBalancerPortOrderField) IsValid() bool { switch e { - case LoadBalancerPortOrderFieldCreatedAt, LoadBalancerPortOrderFieldUpdatedAt, LoadBalancerPortOrderFieldNumber, LoadBalancerPortOrderFieldName: + case LoadBalancerPortOrderFieldCreatedAt, LoadBalancerPortOrderFieldUpdatedAt, LoadBalancerPortOrderFieldCreatedBy, LoadBalancerPortOrderFieldUpdatedBy, LoadBalancerPortOrderFieldNumber, LoadBalancerPortOrderFieldName: return true } return false @@ -1237,6 +1233,8 @@ const ( LoadBalancerProviderOrderFieldID LoadBalancerProviderOrderField = "ID" LoadBalancerProviderOrderFieldCreatedAt LoadBalancerProviderOrderField = "CREATED_AT" LoadBalancerProviderOrderFieldUpdatedAt LoadBalancerProviderOrderField = "UPDATED_AT" + LoadBalancerProviderOrderFieldCreatedBy LoadBalancerProviderOrderField = "CREATED_BY" + LoadBalancerProviderOrderFieldUpdatedBy LoadBalancerProviderOrderField = "UPDATED_BY" LoadBalancerProviderOrderFieldName LoadBalancerProviderOrderField = "NAME" LoadBalancerProviderOrderFieldOwner LoadBalancerProviderOrderField = "OWNER" ) @@ -1245,13 +1243,15 @@ var AllLoadBalancerProviderOrderField = []LoadBalancerProviderOrderField{ LoadBalancerProviderOrderFieldID, LoadBalancerProviderOrderFieldCreatedAt, LoadBalancerProviderOrderFieldUpdatedAt, + LoadBalancerProviderOrderFieldCreatedBy, + LoadBalancerProviderOrderFieldUpdatedBy, LoadBalancerProviderOrderFieldName, LoadBalancerProviderOrderFieldOwner, } func (e LoadBalancerProviderOrderField) IsValid() bool { switch e { - case LoadBalancerProviderOrderFieldID, LoadBalancerProviderOrderFieldCreatedAt, LoadBalancerProviderOrderFieldUpdatedAt, LoadBalancerProviderOrderFieldName, LoadBalancerProviderOrderFieldOwner: + case LoadBalancerProviderOrderFieldID, LoadBalancerProviderOrderFieldCreatedAt, LoadBalancerProviderOrderFieldUpdatedAt, LoadBalancerProviderOrderFieldCreatedBy, LoadBalancerProviderOrderFieldUpdatedBy, LoadBalancerProviderOrderFieldName, LoadBalancerProviderOrderFieldOwner: return true } return false diff --git a/internal/graphclient/schema/schema.graphql b/internal/graphclient/schema/schema.graphql index 00e1d3ea2..95c967fe5 100644 --- a/internal/graphclient/schema/schema.graphql +++ b/internal/graphclient/schema/schema.graphql @@ -13,8 +13,6 @@ directive @shareable repeatable on FIELD_DEFINITION | OBJECT directive @tag(name: String!) repeatable on ARGUMENT_DEFINITION | ENUM | ENUM_VALUE | FIELD_DEFINITION | INPUT_FIELD_DEFINITION | INPUT_OBJECT | INTERFACE | OBJECT | SCALAR | UNION """Input information to create a load balancer.""" input CreateLoadBalancerInput { - createdBy: String - updatedBy: String """The name of the load balancer.""" name: String! """The ID for the owner for this load balancer.""" @@ -29,8 +27,6 @@ CreateLoadBalancerOriginInput is used for create LoadBalancerOrigin object. Input was generated by ent. """ input CreateLoadBalancerOriginInput { - createdBy: String - updatedBy: String name: String! weight: Int target: String! @@ -43,8 +39,6 @@ CreateLoadBalancerPoolInput is used for create LoadBalancerPool object. Input was generated by ent. """ input CreateLoadBalancerPoolInput { - createdBy: String - updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -56,8 +50,6 @@ CreateLoadBalancerPortInput is used for create LoadBalancerPort object. Input was generated by ent. """ input CreateLoadBalancerPortInput { - createdBy: String - updatedBy: String number: Int! name: String! poolIDs: [ID!] @@ -65,8 +57,6 @@ input CreateLoadBalancerPortInput { } """Input information to create a load balancer provider.""" input CreateLoadBalancerProviderInput { - createdBy: String - updatedBy: String """The name of the load balancer provider.""" name: String! """The ID for the owner for this load balancer.""" @@ -156,6 +146,8 @@ enum LoadBalancerOrderField { ID CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY NAME OWNER } @@ -210,6 +202,8 @@ input LoadBalancerOriginOrder { enum LoadBalancerOriginOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY name weight target @@ -410,6 +404,8 @@ input LoadBalancerPoolOrder { enum LoadBalancerPoolOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY name protocol } @@ -565,6 +561,8 @@ input LoadBalancerPortOrder { enum LoadBalancerPortOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY number name } @@ -739,6 +737,8 @@ enum LoadBalancerProviderOrderField { ID CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY NAME OWNER } @@ -1113,8 +1113,6 @@ type ResourceOwner @interfaceObject @key(fields: "id") { scalar Time """Input information to update a load balancer.""" input UpdateLoadBalancerInput { - updatedBy: String - clearUpdatedBy: Boolean """The name of the load balancer.""" name: String addPortIDs: [ID!] @@ -1126,8 +1124,6 @@ UpdateLoadBalancerOriginInput is used for update LoadBalancerOrigin object. Input was generated by ent. """ input UpdateLoadBalancerOriginInput { - updatedBy: String - clearUpdatedBy: Boolean name: String weight: Int target: String @@ -1139,8 +1135,6 @@ UpdateLoadBalancerPoolInput is used for update LoadBalancerPool object. Input was generated by ent. """ input UpdateLoadBalancerPoolInput { - updatedBy: String - clearUpdatedBy: Boolean name: String protocol: LoadBalancerPoolProtocol addPortIDs: [ID!] @@ -1155,8 +1149,6 @@ UpdateLoadBalancerPortInput is used for update LoadBalancerPort object. Input was generated by ent. """ input UpdateLoadBalancerPortInput { - updatedBy: String - clearUpdatedBy: Boolean number: Int name: String addPoolIDs: [ID!] @@ -1165,8 +1157,6 @@ input UpdateLoadBalancerPortInput { } """Input information to update a load balancer provider.""" input UpdateLoadBalancerProviderInput { - updatedBy: String - clearUpdatedBy: Boolean """The name of the load balancer provider.""" name: String } diff --git a/schema.graphql b/schema.graphql index 78c5342d5..dbcd38662 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1,8 +1,6 @@ directive @prefixedID(prefix: String!) on OBJECT """Input information to create a load balancer.""" input CreateLoadBalancerInput { - createdBy: String - updatedBy: String """The name of the load balancer.""" name: String! """The ID for the owner for this load balancer.""" @@ -17,8 +15,6 @@ CreateLoadBalancerOriginInput is used for create LoadBalancerOrigin object. Input was generated by ent. """ input CreateLoadBalancerOriginInput { - createdBy: String - updatedBy: String name: String! weight: Int target: String! @@ -31,8 +27,6 @@ CreateLoadBalancerPoolInput is used for create LoadBalancerPool object. Input was generated by ent. """ input CreateLoadBalancerPoolInput { - createdBy: String - updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -44,8 +38,6 @@ CreateLoadBalancerPortInput is used for create LoadBalancerPort object. Input was generated by ent. """ input CreateLoadBalancerPortInput { - createdBy: String - updatedBy: String number: Int! name: String! poolIDs: [ID!] @@ -53,8 +45,6 @@ input CreateLoadBalancerPortInput { } """Input information to create a load balancer provider.""" input CreateLoadBalancerProviderInput { - createdBy: String - updatedBy: String """The name of the load balancer provider.""" name: String! """The ID for the owner for this load balancer.""" @@ -143,6 +133,8 @@ enum LoadBalancerOrderField { ID CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY NAME OWNER } @@ -197,6 +189,8 @@ input LoadBalancerOriginOrder { enum LoadBalancerOriginOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY name weight target @@ -397,6 +391,8 @@ input LoadBalancerPoolOrder { enum LoadBalancerPoolOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY name protocol } @@ -552,6 +548,8 @@ input LoadBalancerPortOrder { enum LoadBalancerPortOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY number name } @@ -726,6 +724,8 @@ enum LoadBalancerProviderOrderField { ID CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY NAME OWNER } @@ -1100,8 +1100,6 @@ type ResourceOwner @interfaceObject @key(fields: "id") { scalar Time """Input information to update a load balancer.""" input UpdateLoadBalancerInput { - updatedBy: String - clearUpdatedBy: Boolean """The name of the load balancer.""" name: String addPortIDs: [ID!] @@ -1113,8 +1111,6 @@ UpdateLoadBalancerOriginInput is used for update LoadBalancerOrigin object. Input was generated by ent. """ input UpdateLoadBalancerOriginInput { - updatedBy: String - clearUpdatedBy: Boolean name: String weight: Int target: String @@ -1126,8 +1122,6 @@ UpdateLoadBalancerPoolInput is used for update LoadBalancerPool object. Input was generated by ent. """ input UpdateLoadBalancerPoolInput { - updatedBy: String - clearUpdatedBy: Boolean name: String protocol: LoadBalancerPoolProtocol addPortIDs: [ID!] @@ -1142,8 +1136,6 @@ UpdateLoadBalancerPortInput is used for update LoadBalancerPort object. Input was generated by ent. """ input UpdateLoadBalancerPortInput { - updatedBy: String - clearUpdatedBy: Boolean number: Int name: String addPoolIDs: [ID!] @@ -1152,8 +1144,6 @@ input UpdateLoadBalancerPortInput { } """Input information to update a load balancer provider.""" input UpdateLoadBalancerProviderInput { - updatedBy: String - clearUpdatedBy: Boolean """The name of the load balancer provider.""" name: String } diff --git a/schema/ent.graphql b/schema/ent.graphql index 8ee5b6844..9607f0ff1 100644 --- a/schema/ent.graphql +++ b/schema/ent.graphql @@ -2,8 +2,6 @@ directive @goField(forceResolver: Boolean, name: String) on FIELD_DEFINITION | I directive @goModel(model: String, models: [String!]) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION """Input information to create a load balancer.""" input CreateLoadBalancerInput { - createdBy: String - updatedBy: String """The name of the load balancer.""" name: String! """The ID for the owner for this load balancer.""" @@ -18,8 +16,6 @@ CreateLoadBalancerOriginInput is used for create LoadBalancerOrigin object. Input was generated by ent. """ input CreateLoadBalancerOriginInput { - createdBy: String - updatedBy: String name: String! weight: Int target: String! @@ -32,8 +28,6 @@ CreateLoadBalancerPoolInput is used for create LoadBalancerPool object. Input was generated by ent. """ input CreateLoadBalancerPoolInput { - createdBy: String - updatedBy: String name: String! protocol: LoadBalancerPoolProtocol! ownerID: ID! @@ -45,8 +39,6 @@ CreateLoadBalancerPortInput is used for create LoadBalancerPort object. Input was generated by ent. """ input CreateLoadBalancerPortInput { - createdBy: String - updatedBy: String number: Int! name: String! poolIDs: [ID!] @@ -54,8 +46,6 @@ input CreateLoadBalancerPortInput { } """Input information to create a load balancer provider.""" input CreateLoadBalancerProviderInput { - createdBy: String - updatedBy: String """The name of the load balancer provider.""" name: String! """The ID for the owner for this load balancer.""" @@ -127,6 +117,8 @@ enum LoadBalancerOrderField { ID CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY NAME OWNER } @@ -171,6 +163,8 @@ input LoadBalancerOriginOrder { enum LoadBalancerOriginOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY name weight target @@ -354,6 +348,8 @@ input LoadBalancerPoolOrder { enum LoadBalancerPoolOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY name protocol } @@ -494,6 +490,8 @@ input LoadBalancerPortOrder { enum LoadBalancerPortOrderField { CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY number name } @@ -651,6 +649,8 @@ enum LoadBalancerProviderOrderField { ID CREATED_AT UPDATED_AT + CREATED_BY + UPDATED_BY NAME OWNER } @@ -881,8 +881,6 @@ type Query { scalar Time """Input information to update a load balancer.""" input UpdateLoadBalancerInput { - updatedBy: String - clearUpdatedBy: Boolean """The name of the load balancer.""" name: String addPortIDs: [ID!] @@ -894,8 +892,6 @@ UpdateLoadBalancerOriginInput is used for update LoadBalancerOrigin object. Input was generated by ent. """ input UpdateLoadBalancerOriginInput { - updatedBy: String - clearUpdatedBy: Boolean name: String weight: Int target: String @@ -907,8 +903,6 @@ UpdateLoadBalancerPoolInput is used for update LoadBalancerPool object. Input was generated by ent. """ input UpdateLoadBalancerPoolInput { - updatedBy: String - clearUpdatedBy: Boolean name: String protocol: LoadBalancerPoolProtocol addPortIDs: [ID!] @@ -923,8 +917,6 @@ UpdateLoadBalancerPortInput is used for update LoadBalancerPort object. Input was generated by ent. """ input UpdateLoadBalancerPortInput { - updatedBy: String - clearUpdatedBy: Boolean number: Int name: String addPoolIDs: [ID!] @@ -933,8 +925,6 @@ input UpdateLoadBalancerPortInput { } """Input information to update a load balancer provider.""" input UpdateLoadBalancerProviderInput { - updatedBy: String - clearUpdatedBy: Boolean """The name of the load balancer provider.""" name: String } From 9fd500b11a2420e805724752ccdcbec8cb21aa44 Mon Sep 17 00:00:00 2001 From: Tyler Auerbeck Date: Wed, 7 Feb 2024 12:37:01 -0500 Subject: [PATCH 4/7] Fix lints Signed-off-by: Tyler Auerbeck --- internal/ent/schema/audit/doc.go | 2 ++ internal/ent/schema/audit/errors.go | 10 +--------- internal/ent/schema/audit/mixin.go | 20 ++++++++++---------- internal/ent/schema/loadbalancer.go | 2 +- internal/ent/schema/origin.go | 2 +- internal/ent/schema/pool.go | 2 +- internal/ent/schema/port.go | 2 +- internal/ent/schema/provider.go | 2 +- internal/graphapi/metadata.go | 2 +- 9 files changed, 19 insertions(+), 25 deletions(-) create mode 100644 internal/ent/schema/audit/doc.go diff --git a/internal/ent/schema/audit/doc.go b/internal/ent/schema/audit/doc.go new file mode 100644 index 000000000..17bd6ef2f --- /dev/null +++ b/internal/ent/schema/audit/doc.go @@ -0,0 +1,2 @@ +// Package audit provides a mixin that automatically creates and populates created_by and updated_by fields for schemas where the mixin is configured. +package audit diff --git a/internal/ent/schema/audit/errors.go b/internal/ent/schema/audit/errors.go index 166551d53..3472b079c 100644 --- a/internal/ent/schema/audit/errors.go +++ b/internal/ent/schema/audit/errors.go @@ -2,17 +2,9 @@ package audit import ( "errors" - "fmt" - - "entgo.io/ent" ) var ( // errUnexpectedMutation is returned when an unexpected mutation is encountered - errUnexpectedMutation = errors.New("unexpected mutatino type") + errUnexpectedMutation = errors.New("unexpected mutation type") ) - -// newUnexpectedMutationErorr returns the UnexpectedAuditError in string format -func newUnexpectedMutationError(m ent.Mutation) error { - return fmt.Errorf("%s: %T", errUnexpectedMutation, m) -} diff --git a/internal/ent/schema/audit/mixin.go b/internal/ent/schema/audit/mixin.go index 4c4414746..b33b1efcc 100644 --- a/internal/ent/schema/audit/mixin.go +++ b/internal/ent/schema/audit/mixin.go @@ -10,13 +10,13 @@ import ( "go.infratographer.com/x/echojwtx" ) -// AuditMixin provides auditing for all records where enabled. The created_at, created_by, updated_at, and updated_by records are automatically populated when this mixin is enabled. -type AuditMixin struct { +// Mixin provides auditing for all records where enabled. The created_at, created_by, updated_at, and updated_by records are automatically populated when this mixin is enabled. +type Mixin struct { mixin.Schema } -// Fields of the AuditMixin -func (AuditMixin) Fields() []ent.Field { +// Fields of the Mixin +func (Mixin) Fields() []ent.Field { return []ent.Field{ field.String("created_by"). Immutable(). @@ -34,15 +34,15 @@ func (AuditMixin) Fields() []ent.Field { } } -// Hooks of the AuditMixin -func (AuditMixin) Hooks() []ent.Hook { +// Hooks of the Mixin +func (Mixin) Hooks() []ent.Hook { return []ent.Hook{ - AuditHook, + Hook, } } -// AuditHook sets and returns the created_at, updated_at, etc., fields -func AuditHook(next ent.Mutator) ent.Mutator { +// Hook sets and returns the created_at, updated_at, etc., fields +func Hook(next ent.Mutator) ent.Mutator { type AuditLogger interface { SetCreatedBy(string) CreatedBy() (id string, exists bool) @@ -53,7 +53,7 @@ func AuditHook(next ent.Mutator) ent.Mutator { return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { ml, ok := m.(AuditLogger) if !ok { - return nil, newUnexpectedMutationError(m) + return nil, errUnexpectedMutation } actor := "unknown-actor" id, ok := ctx.Value(echojwtx.ActorCtxKey).(string) diff --git a/internal/ent/schema/loadbalancer.go b/internal/ent/schema/loadbalancer.go index 9fe99f614..0b9945f89 100644 --- a/internal/ent/schema/loadbalancer.go +++ b/internal/ent/schema/loadbalancer.go @@ -25,7 +25,7 @@ type LoadBalancer struct { func (LoadBalancer) Mixin() []ent.Mixin { return []ent.Mixin{ entx.NewTimestampMixin(), - audit.AuditMixin{}, + audit.Mixin{}, // softdelete.Mixin{}, } } diff --git a/internal/ent/schema/origin.go b/internal/ent/schema/origin.go index cad4e74db..e7f181702 100644 --- a/internal/ent/schema/origin.go +++ b/internal/ent/schema/origin.go @@ -27,7 +27,7 @@ type Origin struct { func (Origin) Mixin() []ent.Mixin { return []ent.Mixin{ entx.NewTimestampMixin(), - audit.AuditMixin{}, + audit.Mixin{}, } } diff --git a/internal/ent/schema/pool.go b/internal/ent/schema/pool.go index dc085867b..1f1ae0ef2 100644 --- a/internal/ent/schema/pool.go +++ b/internal/ent/schema/pool.go @@ -24,7 +24,7 @@ type Pool struct { func (Pool) Mixin() []ent.Mixin { return []ent.Mixin{ entx.NewTimestampMixin(), - audit.AuditMixin{}, + audit.Mixin{}, } } diff --git a/internal/ent/schema/port.go b/internal/ent/schema/port.go index 7da853e1e..b16edd17b 100644 --- a/internal/ent/schema/port.go +++ b/internal/ent/schema/port.go @@ -30,7 +30,7 @@ type Port struct { func (Port) Mixin() []ent.Mixin { return []ent.Mixin{ entx.NewTimestampMixin(), - audit.AuditMixin{}, + audit.Mixin{}, } } diff --git a/internal/ent/schema/provider.go b/internal/ent/schema/provider.go index 54bb74637..dc0e92b82 100644 --- a/internal/ent/schema/provider.go +++ b/internal/ent/schema/provider.go @@ -23,7 +23,7 @@ type Provider struct { func (Provider) Mixin() []ent.Mixin { return []ent.Mixin{ entx.NewTimestampMixin(), - audit.AuditMixin{}, + audit.Mixin{}, } } diff --git a/internal/graphapi/metadata.go b/internal/graphapi/metadata.go index 64293e418..85fde0714 100644 --- a/internal/graphapi/metadata.go +++ b/internal/graphapi/metadata.go @@ -11,7 +11,7 @@ import ( "go.infratographer.com/load-balancer-api/internal/config" - _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" + _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" // imports the generated runtime package to instantiate the appropriate default values ) const metadataStatusSource = "load-balancer-api" From ab2111f9eacfbeb9547a29bd52e93a8ef954727c Mon Sep 17 00:00:00 2001 From: Tyler Auerbeck Date: Wed, 7 Feb 2024 13:06:12 -0500 Subject: [PATCH 5/7] Fix lints, pt 2 Signed-off-by: Tyler Auerbeck --- internal/ent/schema/audit/mixin.go | 2 ++ internal/graphapi/loadbalancer_test.go | 5 +++++ internal/graphapi/origin_test.go | 4 ++++ internal/graphapi/owner_resolvers_test.go | 1 + internal/graphapi/pool_test.go | 4 ++++ internal/graphapi/port_test.go | 3 +++ internal/graphapi/provider_test.go | 2 ++ pkg/client/client_test.go | 1 + 8 files changed, 22 insertions(+) diff --git a/internal/ent/schema/audit/mixin.go b/internal/ent/schema/audit/mixin.go index b33b1efcc..dad6063e5 100644 --- a/internal/ent/schema/audit/mixin.go +++ b/internal/ent/schema/audit/mixin.go @@ -55,7 +55,9 @@ func Hook(next ent.Mutator) ent.Mutator { if !ok { return nil, errUnexpectedMutation } + actor := "unknown-actor" + id, ok := ctx.Value(echojwtx.ActorCtxKey).(string) if ok { actor = id diff --git a/internal/graphapi/loadbalancer_test.go b/internal/graphapi/loadbalancer_test.go index f4249724c..bc1fa420c 100644 --- a/internal/graphapi/loadbalancer_test.go +++ b/internal/graphapi/loadbalancer_test.go @@ -62,6 +62,7 @@ func TestQuery_loadBalancer(t *testing.T) { for _, tt := range testCases { t.Run(tt.TestName, func(t *testing.T) { tt := tt + t.Parallel() resp, err := graphTestClient().GetLoadBalancer(ctx, tt.QueryID) @@ -133,6 +134,7 @@ func TestCreate_loadBalancer(t *testing.T) { for _, tt := range testCases { t.Run(tt.TestName, func(t *testing.T) { tt := tt + t.Parallel() resp, err := graphTestClient().LoadBalancerCreate(ctx, tt.Input) @@ -197,7 +199,9 @@ func TestCreate_loadBalancer_limit(t *testing.T) { for _, tt := range testCases { t.Run(tt.TestName, func(t *testing.T) { tt := tt + t.Parallel() + var err error for i := 1; i < tt.lbCount; i++ { @@ -210,6 +214,7 @@ func TestCreate_loadBalancer_limit(t *testing.T) { if tt.errorMsg != "" { require.Error(t, err) assert.ErrorContains(t, err, tt.errorMsg) + return } diff --git a/internal/graphapi/origin_test.go b/internal/graphapi/origin_test.go index 7f854d44f..b183f9af8 100644 --- a/internal/graphapi/origin_test.go +++ b/internal/graphapi/origin_test.go @@ -64,6 +64,7 @@ func TestQueryPoolOrigin(t *testing.T) { require.Error(t, err) assert.ErrorContains(t, err, tt.errorMsg) assert.Nil(t, poolOriginResp) + return } @@ -213,6 +214,7 @@ func TestMutate_OriginCreate(t *testing.T) { require.Error(t, err) assert.ErrorContains(t, err, tt.errorMsg) assert.Nil(t, createdOriginResp) + return } @@ -305,6 +307,7 @@ func TestMutate_OriginUpdate(t *testing.T) { require.Error(t, err) assert.ErrorContains(t, err, tt.errorMsg) assert.Nil(t, updatedOriginResp) + return } @@ -368,6 +371,7 @@ func TestMutate_OriginDelete(t *testing.T) { require.Error(t, err) assert.ErrorContains(t, err, tt.errorMsg) assert.Nil(t, deletedOriginResp) + return } diff --git a/internal/graphapi/owner_resolvers_test.go b/internal/graphapi/owner_resolvers_test.go index e5e3bc97d..13118df9e 100644 --- a/internal/graphapi/owner_resolvers_test.go +++ b/internal/graphapi/owner_resolvers_test.go @@ -96,6 +96,7 @@ func TestOwnerLoadBalancersResolver(t *testing.T) { } require.Len(t, resp.Entities[0].LoadBalancers.Edges, len(tt.ResponseOrder)) + for i, lb := range tt.ResponseOrder { respLB := resp.Entities[0].LoadBalancers.Edges[i].Node require.Equal(t, lb.ID, respLB.ID) diff --git a/internal/graphapi/pool_test.go b/internal/graphapi/pool_test.go index a359e0606..8d1341278 100644 --- a/internal/graphapi/pool_test.go +++ b/internal/graphapi/pool_test.go @@ -68,6 +68,7 @@ func TestQueryPool(t *testing.T) { require.Error(t, err) assert.ErrorContains(t, err, tt.errorMsg) assert.Nil(t, resp) + return } @@ -161,6 +162,7 @@ func TestMutate_PoolCreate(t *testing.T) { require.Error(t, err) assert.ErrorContains(t, err, tt.errorMsg) assert.Nil(t, createdPoolResp) + return } @@ -265,6 +267,7 @@ func TestMutate_PoolUpdate(t *testing.T) { require.Error(t, err) assert.ErrorContains(t, err, tt.errorMsg) assert.Nil(t, updatedPoolResp) + return } @@ -335,6 +338,7 @@ func TestMutate_PoolDelete(t *testing.T) { require.Error(t, err) assert.Nil(t, poolDeleteResp) assert.ErrorContains(t, err, tt.errorMsg) + return } diff --git a/internal/graphapi/port_test.go b/internal/graphapi/port_test.go index 686f6cc91..ac8e12ee8 100644 --- a/internal/graphapi/port_test.go +++ b/internal/graphapi/port_test.go @@ -134,6 +134,7 @@ func TestCreate_LoadbalancerPort(t *testing.T) { for _, tt := range testCases { t.Run(tt.TestName, func(t *testing.T) { tt := tt + t.Parallel() resp, err := graphTestClient().LoadBalancerPortCreate(ctx, tt.Input) @@ -339,7 +340,9 @@ func TestDelete_LoadbalancerPort(t *testing.T) { for _, tt := range testCases { t.Run(tt.TestName, func(t *testing.T) { tt := tt + t.Parallel() + resp, err := graphTestClient().LoadBalancerPortDelete(ctx, tt.Input) if tt.errorMsg != "" { diff --git a/internal/graphapi/provider_test.go b/internal/graphapi/provider_test.go index 1d88f4b9d..a0df85edc 100644 --- a/internal/graphapi/provider_test.go +++ b/internal/graphapi/provider_test.go @@ -55,6 +55,7 @@ func TestQuery_loadBalancerProvider(t *testing.T) { for _, tt := range testCases { t.Run(tt.TestName, func(t *testing.T) { tt := tt + t.Parallel() resp, err := graphTestClient().GetLoadBalancerProvider(ctx, tt.QueryID) @@ -118,6 +119,7 @@ func TestCreate_Provider(t *testing.T) { for _, tt := range testCases { t.Run(tt.TestName, func(t *testing.T) { tt := tt + t.Parallel() resp, err := graphTestClient().LoadBalancerProviderCreate(ctx, tt.Input) diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index a6e11e5e2..85e568cf2 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -281,6 +281,7 @@ func mustNewGQLTestClient(respJSON string, respCode int) *graphql.Client { w.WriteHeader(respCode) w.Header().Set("Content-Type", "application/json") _, err := io.WriteString(w, respJSON) + if err != nil { panic(err) } From 88afea6e5ed8ba1ace17705b96187fad259d823d Mon Sep 17 00:00:00 2001 From: Tyler Auerbeck Date: Wed, 7 Feb 2024 15:10:38 -0500 Subject: [PATCH 6/7] Fix failing tests Signed-off-by: Tyler Auerbeck --- internal/manualhooks/hooks.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/manualhooks/hooks.go b/internal/manualhooks/hooks.go index 1bd12cc23..34dce887b 100644 --- a/internal/manualhooks/hooks.go +++ b/internal/manualhooks/hooks.go @@ -18,6 +18,8 @@ import ( "go.infratographer.com/load-balancer-api/internal/ent/generated/pool" "go.infratographer.com/load-balancer-api/internal/ent/generated/port" "go.infratographer.com/load-balancer-api/internal/ent/schema" + + _ "go.infratographer.com/load-balancer-api/internal/ent/generated/runtime" ) func LoadBalancerHooks() []ent.Hook { From 886c6b549eabfc1f70fd6fa239ffdd7d106342f0 Mon Sep 17 00:00:00 2001 From: Tyler Auerbeck Date: Wed, 7 Feb 2024 16:03:30 -0500 Subject: [PATCH 7/7] Cleanup migrations Signed-off-by: Tyler Auerbeck --- db/migrations/20240207142600_audit-fields.sql | 7 ------ db/migrations/20240207205734_audit-fields.sql | 23 +++++++++++++++++++ db/migrations/atlas.sum | 4 ++-- 3 files changed, 25 insertions(+), 9 deletions(-) delete mode 100644 db/migrations/20240207142600_audit-fields.sql create mode 100644 db/migrations/20240207205734_audit-fields.sql diff --git a/db/migrations/20240207142600_audit-fields.sql b/db/migrations/20240207142600_audit-fields.sql deleted file mode 100644 index b27bb5406..000000000 --- a/db/migrations/20240207142600_audit-fields.sql +++ /dev/null @@ -1,7 +0,0 @@ --- +goose Up --- modify "load_balancers" table -ALTER TABLE "load_balancers" ADD COLUMN "created_by" character varying NULL, ADD COLUMN "updated_by" character varying NULL; - --- +goose Down --- reverse: modify "load_balancers" table -ALTER TABLE "load_balancers" DROP COLUMN "updated_by", DROP COLUMN "created_by"; diff --git a/db/migrations/20240207205734_audit-fields.sql b/db/migrations/20240207205734_audit-fields.sql new file mode 100644 index 000000000..b554530aa --- /dev/null +++ b/db/migrations/20240207205734_audit-fields.sql @@ -0,0 +1,23 @@ +-- +goose Up +-- modify "load_balancers" table +ALTER TABLE "load_balancers" ADD COLUMN "created_by" character varying NULL, ADD COLUMN "updated_by" character varying NULL; +-- modify "origins" table +ALTER TABLE "origins" ADD COLUMN "created_by" character varying NULL, ADD COLUMN "updated_by" character varying NULL; +-- modify "pools" table +ALTER TABLE "pools" ADD COLUMN "created_by" character varying NULL, ADD COLUMN "updated_by" character varying NULL; +-- modify "ports" table +ALTER TABLE "ports" ADD COLUMN "created_by" character varying NULL, ADD COLUMN "updated_by" character varying NULL; +-- modify "providers" table +ALTER TABLE "providers" ADD COLUMN "created_by" character varying NULL, ADD COLUMN "updated_by" character varying NULL; + +-- +goose Down +-- reverse: modify "providers" table +ALTER TABLE "providers" DROP COLUMN "updated_by", DROP COLUMN "created_by"; +-- reverse: modify "ports" table +ALTER TABLE "ports" DROP COLUMN "updated_by", DROP COLUMN "created_by"; +-- reverse: modify "pools" table +ALTER TABLE "pools" DROP COLUMN "updated_by", DROP COLUMN "created_by"; +-- reverse: modify "origins" table +ALTER TABLE "origins" DROP COLUMN "updated_by", DROP COLUMN "created_by"; +-- reverse: modify "load_balancers" table +ALTER TABLE "load_balancers" DROP COLUMN "updated_by", DROP COLUMN "created_by"; diff --git a/db/migrations/atlas.sum b/db/migrations/atlas.sum index f40f77b81..6dc49d5bb 100644 --- a/db/migrations/atlas.sum +++ b/db/migrations/atlas.sum @@ -1,6 +1,6 @@ -h1:bAkj0ukIXBVQjqVcBhf5MOM7PUprniStduLKnCAouxg= +h1:VbjEjTYQpHluH7ZPRqCN9Xz2sRkWFqFjgcQjf19L/xo= 20230503185445_initial-migration.sql h1:4pqNp2MDBBRdGxU/H5mmZui9oi1SyjIiMVGatajrBeY= 20230615194819_drop_tenant_add_owner.sql h1:KGCsItU0NYhxYEkhZOaMQjfIrBMnek5rxC6D/LhnyCk= 20230629085916_drop_status_and_annotations.sql h1:kvDMoaMEjyoj/aRi6rw4XvCLxGH09vGGLbL0/p5tpPo= 20231017005257_add_origin_weight.sql h1:NuorUbcydDqcyPK8wgwlkQxaH+zGWfVtJW9UPL1Vn+E= -20240207142600_audit-fields.sql h1:V4Pn+5bsH6ZMdNnTew+twztCRWbZjoWlN1e1vOxoMac= +20240207205734_audit-fields.sql h1:cplFCBB7laCP5Y+UAoxIfITMo56Hoc5XIVvgcfGL9o0=