diff --git a/Makefile b/Makefile index abcdc1e2c..00453ebd2 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ tests: | unit-tests unit-tests: ## Runs unit tests @echo --- Running unit tests... @date --rfc-3339=seconds - @go test -race -cover -failfast -tags testtools -p 1 -v ./... + @go test -race -cover -failfast -tags testtools -p 1 ./... coverage: ## Generates coverage report @echo --- Generating coverage report... diff --git a/internal/ent/generated/gql_mutation_input.go b/internal/ent/generated/gql_mutation_input.go index ede04cd8c..43c5ff969 100644 --- a/internal/ent/generated/gql_mutation_input.go +++ b/internal/ent/generated/gql_mutation_input.go @@ -236,7 +236,7 @@ func (c *PoolUpdateOne) SetInput(i UpdateLoadBalancerPoolInput) *PoolUpdateOne { // CreateLoadBalancerPortInput represents a mutation input for creating loadbalancerports. type CreateLoadBalancerPortInput struct { Number int - Name string + Name *string PoolIDs []gidx.PrefixedID LoadBalancerID gidx.PrefixedID } @@ -244,7 +244,9 @@ type CreateLoadBalancerPortInput struct { // Mutate applies the CreateLoadBalancerPortInput on the PortMutation builder. func (i *CreateLoadBalancerPortInput) Mutate(m *PortMutation) { m.SetNumber(i.Number) - m.SetName(i.Name) + if v := i.Name; v != nil { + m.SetName(*v) + } if v := i.PoolIDs; len(v) > 0 { m.AddPoolIDs(v...) } @@ -260,6 +262,7 @@ func (c *PortCreate) SetInput(i CreateLoadBalancerPortInput) *PortCreate { // UpdateLoadBalancerPortInput represents a mutation input for updating loadbalancerports. type UpdateLoadBalancerPortInput struct { Number *int + ClearName bool Name *string ClearPools bool AddPoolIDs []gidx.PrefixedID @@ -271,6 +274,9 @@ func (i *UpdateLoadBalancerPortInput) Mutate(m *PortMutation) { if v := i.Number; v != nil { m.SetNumber(*v) } + if i.ClearName { + m.ClearName() + } 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..482e65102 100644 --- a/internal/ent/generated/gql_where_input.go +++ b/internal/ent/generated/gql_where_input.go @@ -1087,6 +1087,8 @@ type LoadBalancerPortWhereInput struct { NameContains *string `json:"nameContains,omitempty"` NameHasPrefix *string `json:"nameHasPrefix,omitempty"` NameHasSuffix *string `json:"nameHasSuffix,omitempty"` + NameIsNil bool `json:"nameIsNil,omitempty"` + NameNotNil bool `json:"nameNotNil,omitempty"` NameEqualFold *string `json:"nameEqualFold,omitempty"` NameContainsFold *string `json:"nameContainsFold,omitempty"` @@ -1299,6 +1301,12 @@ func (i *LoadBalancerPortWhereInput) P() (predicate.Port, error) { if i.NameHasSuffix != nil { predicates = append(predicates, port.NameHasSuffix(*i.NameHasSuffix)) } + if i.NameIsNil { + predicates = append(predicates, port.NameIsNil()) + } + if i.NameNotNil { + predicates = append(predicates, port.NameNotNil()) + } if i.NameEqualFold != nil { predicates = append(predicates, port.NameEqualFold(*i.NameEqualFold)) } diff --git a/internal/ent/generated/migrate/schema.go b/internal/ent/generated/migrate/schema.go index 3af7f748a..9c58720f3 100644 --- a/internal/ent/generated/migrate/schema.go +++ b/internal/ent/generated/migrate/schema.go @@ -154,7 +154,7 @@ var ( {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "number", Type: field.TypeInt}, - {Name: "name", Type: field.TypeString}, + {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "load_balancer_id", Type: field.TypeString}, } // PortsTable holds the schema information for the "ports" table. diff --git a/internal/ent/generated/mutation.go b/internal/ent/generated/mutation.go index 404173fcf..eb57ed70c 100644 --- a/internal/ent/generated/mutation.go +++ b/internal/ent/generated/mutation.go @@ -2633,9 +2633,22 @@ func (m *PortMutation) OldName(ctx context.Context) (v string, err error) { return oldValue.Name, nil } +// ClearName clears the value of the "name" field. +func (m *PortMutation) ClearName() { + m.name = nil + m.clearedFields[port.FieldName] = struct{}{} +} + +// NameCleared returns if the "name" field was cleared in this mutation. +func (m *PortMutation) NameCleared() bool { + _, ok := m.clearedFields[port.FieldName] + return ok +} + // ResetName resets all changes to the "name" field. func (m *PortMutation) ResetName() { m.name = nil + delete(m.clearedFields, port.FieldName) } // SetLoadBalancerID sets the "load_balancer_id" field. @@ -2930,7 +2943,11 @@ 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.FieldName) { + fields = append(fields, port.FieldName) + } + return fields } // FieldCleared returns a boolean indicating if a field with the given name was @@ -2943,6 +2960,11 @@ 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.FieldName: + m.ClearName() + return nil + } return fmt.Errorf("unknown Port nullable field %s", name) } diff --git a/internal/ent/generated/port/where.go b/internal/ent/generated/port/where.go index d9e0cd3d0..4ba028966 100644 --- a/internal/ent/generated/port/where.go +++ b/internal/ent/generated/port/where.go @@ -270,6 +270,16 @@ func NameHasSuffix(v string) predicate.Port { return predicate.Port(sql.FieldHasSuffix(FieldName, v)) } +// NameIsNil applies the IsNil predicate on the "name" field. +func NameIsNil() predicate.Port { + return predicate.Port(sql.FieldIsNull(FieldName)) +} + +// NameNotNil applies the NotNil predicate on the "name" field. +func NameNotNil() predicate.Port { + return predicate.Port(sql.FieldNotNull(FieldName)) +} + // NameEqualFold applies the EqualFold predicate on the "name" field. func NameEqualFold(v string) predicate.Port { return predicate.Port(sql.FieldEqualFold(FieldName, v)) diff --git a/internal/ent/generated/port_create.go b/internal/ent/generated/port_create.go index 148089e05..3b0b9071c 100644 --- a/internal/ent/generated/port_create.go +++ b/internal/ent/generated/port_create.go @@ -77,6 +77,14 @@ func (pc *PortCreate) SetName(s string) *PortCreate { return pc } +// SetNillableName sets the "name" field if the given value is not nil. +func (pc *PortCreate) SetNillableName(s *string) *PortCreate { + if s != nil { + pc.SetName(*s) + } + return pc +} + // SetLoadBalancerID sets the "load_balancer_id" field. func (pc *PortCreate) SetLoadBalancerID(gi gidx.PrefixedID) *PortCreate { pc.mutation.SetLoadBalancerID(gi) @@ -182,9 +190,6 @@ func (pc *PortCreate) check() error { return &ValidationError{Name: "number", err: fmt.Errorf(`generated: validator failed for field "Port.number": %w`, err)} } } - if _, ok := pc.mutation.Name(); !ok { - return &ValidationError{Name: "name", err: errors.New(`generated: missing required field "Port.name"`)} - } if _, ok := pc.mutation.LoadBalancerID(); !ok { return &ValidationError{Name: "load_balancer_id", err: errors.New(`generated: missing required field "Port.load_balancer_id"`)} } diff --git a/internal/ent/generated/port_update.go b/internal/ent/generated/port_update.go index 2c1de4074..eee1bc86c 100644 --- a/internal/ent/generated/port_update.go +++ b/internal/ent/generated/port_update.go @@ -62,6 +62,20 @@ func (pu *PortUpdate) SetName(s string) *PortUpdate { return pu } +// SetNillableName sets the "name" field if the given value is not nil. +func (pu *PortUpdate) SetNillableName(s *string) *PortUpdate { + if s != nil { + pu.SetName(*s) + } + return pu +} + +// ClearName clears the value of the "name" field. +func (pu *PortUpdate) ClearName() *PortUpdate { + pu.mutation.ClearName() + return pu +} + // AddPoolIDs adds the "pools" edge to the Pool entity by IDs. func (pu *PortUpdate) AddPoolIDs(ids ...gidx.PrefixedID) *PortUpdate { pu.mutation.AddPoolIDs(ids...) @@ -176,6 +190,9 @@ func (pu *PortUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := pu.mutation.Name(); ok { _spec.SetField(port.FieldName, field.TypeString, value) } + if pu.mutation.NameCleared() { + _spec.ClearField(port.FieldName, field.TypeString) + } if pu.mutation.PoolsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, @@ -260,6 +277,20 @@ func (puo *PortUpdateOne) SetName(s string) *PortUpdateOne { return puo } +// SetNillableName sets the "name" field if the given value is not nil. +func (puo *PortUpdateOne) SetNillableName(s *string) *PortUpdateOne { + if s != nil { + puo.SetName(*s) + } + return puo +} + +// ClearName clears the value of the "name" field. +func (puo *PortUpdateOne) ClearName() *PortUpdateOne { + puo.mutation.ClearName() + return puo +} + // AddPoolIDs adds the "pools" edge to the Pool entity by IDs. func (puo *PortUpdateOne) AddPoolIDs(ids ...gidx.PrefixedID) *PortUpdateOne { puo.mutation.AddPoolIDs(ids...) @@ -404,6 +435,9 @@ func (puo *PortUpdateOne) sqlSave(ctx context.Context) (_node *Port, err error) if value, ok := puo.mutation.Name(); ok { _spec.SetField(port.FieldName, field.TypeString, value) } + if puo.mutation.NameCleared() { + _spec.ClearField(port.FieldName, field.TypeString) + } if puo.mutation.PoolsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, diff --git a/internal/ent/schema/port.go b/internal/ent/schema/port.go index 47fe46f3c..893daf8a4 100644 --- a/internal/ent/schema/port.go +++ b/internal/ent/schema/port.go @@ -50,7 +50,8 @@ func (Port) Fields() []ent.Field { field.String("name"). Annotations( entgql.OrderField("name"), - ), + ). + Optional(), field.String("load_balancer_id"). GoType(gidx.PrefixedID("")). Immutable(). diff --git a/internal/graphapi/gen_server.go b/internal/graphapi/gen_server.go index a9a6bbd4e..2a5747fc2 100644 --- a/internal/graphapi/gen_server.go +++ b/internal/graphapi/gen_server.go @@ -1531,7 +1531,7 @@ Input was generated by ent. """ input CreateLoadBalancerPortInput { number: Int! - name: String! + name: String poolIDs: [ID!] loadBalancerID: ID! } @@ -1871,7 +1871,7 @@ type LoadBalancerPort implements Node @key(fields: "id") @prefixedID(prefix: "lo createdAt: Time! updatedAt: Time! number: Int! - name: String! + name: String loadBalancerID: ID! pools: [LoadBalancerPool!] loadBalancer: LoadBalancer! @@ -1962,6 +1962,8 @@ input LoadBalancerPortWhereInput { nameContains: String nameHasPrefix: String nameHasSuffix: String + nameIsNil: Boolean + nameNotNil: Boolean nameEqualFold: String nameContainsFold: String """pools edge predicates""" @@ -2230,6 +2232,7 @@ Input was generated by ent. input UpdateLoadBalancerPortInput { number: Int name: String + clearName: Boolean addPoolIDs: [ID!] removePoolIDs: [ID!] clearPools: Boolean @@ -6936,14 +6939,11 @@ func (ec *executionContext) _LoadBalancerPort_name(ctx context.Context, field gr 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) { @@ -12253,7 +12253,7 @@ func (ec *executionContext) unmarshalInputCreateLoadBalancerPortInput(ctx contex var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) + data, err := ec.unmarshalOString2áš–string(ctx, v) if err != nil { return it, err } @@ -13624,7 +13624,7 @@ func (ec *executionContext) unmarshalInputLoadBalancerPortWhereInput(ctx context asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "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", "number", "numberNEQ", "numberIn", "numberNotIn", "numberGT", "numberGTE", "numberLT", "numberLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameIsNil", "nameNotNil", "nameEqualFold", "nameContainsFold", "hasPools", "hasPoolsWith", "hasLoadBalancer", "hasLoadBalancerWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -14045,6 +14045,24 @@ func (ec *executionContext) unmarshalInputLoadBalancerPortWhereInput(ctx context return it, err } it.NameHasSuffix = data + case "nameIsNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.NameIsNil = data + case "nameNotNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.NameNotNil = data case "nameEqualFold": var err error @@ -15181,7 +15199,7 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerPortInput(ctx contex asMap[k] = v } - fieldsInOrder := [...]string{"number", "name", "addPoolIDs", "removePoolIDs", "clearPools"} + fieldsInOrder := [...]string{"number", "name", "clearName", "addPoolIDs", "removePoolIDs", "clearPools"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -15206,6 +15224,15 @@ func (ec *executionContext) unmarshalInputUpdateLoadBalancerPortInput(ctx contex return it, err } it.Name = data + case "clearName": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearName")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClearName = data case "addPoolIDs": var err error @@ -16681,9 +16708,6 @@ func (ec *executionContext) _LoadBalancerPort(ctx context.Context, sel ast.Selec } case "name": out.Values[i] = ec._LoadBalancerPort_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "loadBalancerID": out.Values[i] = ec._LoadBalancerPort_loadBalancerID(ctx, field, obj) if out.Values[i] == graphql.Null { diff --git a/internal/graphapi/loadbalancer_test.go b/internal/graphapi/loadbalancer_test.go index f4249724c..30934a6c4 100644 --- a/internal/graphapi/loadbalancer_test.go +++ b/internal/graphapi/loadbalancer_test.go @@ -392,7 +392,7 @@ func TestFullLoadBalancerLifecycle(t *testing.T) { assert.Equal(t, ownerID, createdLB.Owner.ID) createdPortResp, err := graphTestClient().LoadBalancerPortCreate(ctx, graphclient.CreateLoadBalancerPortInput{ - Name: gofakeit.DomainName(), + Name: newString(gofakeit.DomainName()), Number: 8080, LoadBalancerID: createdLB.ID, }) diff --git a/internal/graphapi/port_test.go b/internal/graphapi/port_test.go index 686f6cc91..ec89fd5aa 100644 --- a/internal/graphapi/port_test.go +++ b/internal/graphapi/port_test.go @@ -43,31 +43,42 @@ func TestCreate_LoadbalancerPort(t *testing.T) { { TestName: "creates loadbalancer port", Input: graphclient.CreateLoadBalancerPortInput{ - Name: "lb-port", + Name: newString("lb-port"), LoadBalancerID: lb.ID, Number: 22, }, Expected: &graphclient.LoadBalancerPort{ - Name: "lb-port", + Name: newString("lb-port"), Number: 22, }, }, { TestName: "succeeds in creating loadbalancer port with empty name", Input: graphclient.CreateLoadBalancerPortInput{ - Name: "", + Name: newString(""), LoadBalancerID: lb.ID, Number: 23, }, Expected: &graphclient.LoadBalancerPort{ - Name: "", + Name: newString(""), Number: 23, }, }, + { + TestName: "succeeds in creating loadbalancer port with nil name", + Input: graphclient.CreateLoadBalancerPortInput{ + LoadBalancerID: lb.ID, + Number: 24, + }, + Expected: &graphclient.LoadBalancerPort{ + Name: newString(""), + Number: 24, + }, + }, { TestName: "fails to create loadbalancer port with empty loadbalancer id", Input: graphclient.CreateLoadBalancerPortInput{ - Name: "lb-port", + Name: newString(""), LoadBalancerID: "", Number: 22, }, @@ -76,7 +87,7 @@ func TestCreate_LoadbalancerPort(t *testing.T) { { TestName: "fails to create loadbalancer port with number < min", Input: graphclient.CreateLoadBalancerPortInput{ - Name: "lb-port", + Name: newString("lb-port"), LoadBalancerID: lb.ID, Number: 0, }, @@ -85,7 +96,7 @@ func TestCreate_LoadbalancerPort(t *testing.T) { { TestName: "fails to create loadbalancer port with number > max", Input: graphclient.CreateLoadBalancerPortInput{ - Name: "lb-port", + Name: newString("lb-port"), LoadBalancerID: lb.ID, Number: 65536, }, @@ -94,7 +105,7 @@ func TestCreate_LoadbalancerPort(t *testing.T) { { TestName: "fails to create loadbalancer port with duplicate port number", Input: graphclient.CreateLoadBalancerPortInput{ - Name: "lb-port", + Name: newString("lb-port"), LoadBalancerID: lb.ID, Number: 80, }, @@ -103,7 +114,7 @@ func TestCreate_LoadbalancerPort(t *testing.T) { { TestName: "fails to create loadbalancer port with restricted port number", Input: graphclient.CreateLoadBalancerPortInput{ - Name: "lb-port", + Name: newString("lb-port"), LoadBalancerID: lb.ID, Number: 1234, }, @@ -112,7 +123,7 @@ func TestCreate_LoadbalancerPort(t *testing.T) { { TestName: "fails to create loadbalancer port with invalid pool id", Input: graphclient.CreateLoadBalancerPortInput{ - Name: "lb-port", + Name: newString("lb-port"), LoadBalancerID: lb.ID, Number: 1234, PoolIDs: []gidx.PrefixedID{"not-a-valid-pool-id"}, @@ -122,7 +133,7 @@ func TestCreate_LoadbalancerPort(t *testing.T) { { TestName: "fails to create loadbalancer port with pool with conflicting OwnerID", Input: graphclient.CreateLoadBalancerPortInput{ - Name: "lb-port", + Name: newString("lb-port"), LoadBalancerID: lb.ID, Number: 1234, PoolIDs: []gidx.PrefixedID{poolBad.ID}, @@ -207,7 +218,7 @@ func TestUpdate_LoadbalancerPort(t *testing.T) { Name: newString("lb-port"), }, Expected: &graphclient.LoadBalancerPort{ - Name: "lb-port", + Name: newString("lb-port"), Number: 80, }, }, @@ -218,7 +229,7 @@ func TestUpdate_LoadbalancerPort(t *testing.T) { Number: newInt64(22), }, Expected: &graphclient.LoadBalancerPort{ - Name: "lb-port", + Name: newString("lb-port"), Number: 22, }, }, @@ -229,7 +240,7 @@ func TestUpdate_LoadbalancerPort(t *testing.T) { Name: newString(""), }, Expected: &graphclient.LoadBalancerPort{ - Name: "", + Name: newString(""), Number: 22, }, }, @@ -373,7 +384,7 @@ func TestFullLoadBalancerPortLifecycle(t *testing.T) { ctx = context.WithValue(ctx, permissions.CheckerCtxKey, permissions.DefaultAllowChecker) lb := (&testutils.LoadBalancerBuilder{}).MustNew(ctx) - name := gofakeit.DomainName() + name := newString(gofakeit.DomainName()) createdPortResp, err := graphTestClient().LoadBalancerPortCreate(ctx, graphclient.CreateLoadBalancerPortInput{ Name: name, diff --git a/internal/graphclient/gen_client.go b/internal/graphclient/gen_client.go index ee4294b9d..965e4bb6d 100644 --- a/internal/graphclient/gen_client.go +++ b/internal/graphclient/gen_client.go @@ -246,7 +246,7 @@ type LoadBalancerPortCreate struct { LoadBalancerPortCreate struct { LoadBalancerPort struct { ID gidx.PrefixedID "json:\"id\" graphql:\"id\"" - Name string "json:\"name\" graphql:\"name\"" + Name *string "json:\"name\" graphql:\"name\"" Number int64 "json:\"number\" graphql:\"number\"" LoadBalancer struct { ID gidx.PrefixedID "json:\"id\" graphql:\"id\"" @@ -265,7 +265,7 @@ type LoadBalancerPortUpdate struct { LoadBalancerPortUpdate struct { LoadBalancerPort struct { ID gidx.PrefixedID "json:\"id\" graphql:\"id\"" - Name string "json:\"name\" graphql:\"name\"" + Name *string "json:\"name\" graphql:\"name\"" Number int64 "json:\"number\" graphql:\"number\"" CreatedAt time.Time "json:\"createdAt\" graphql:\"createdAt\"" UpdatedAt time.Time "json:\"updatedAt\" graphql:\"updatedAt\"" diff --git a/internal/graphclient/gen_models.go b/internal/graphclient/gen_models.go index f05f180d9..6cf43cca7 100644 --- a/internal/graphclient/gen_models.go +++ b/internal/graphclient/gen_models.go @@ -70,7 +70,7 @@ type CreateLoadBalancerPoolInput struct { // Input was generated by ent. type CreateLoadBalancerPortInput struct { Number int64 `json:"number"` - Name string `json:"name"` + Name *string `json:"name,omitempty"` PoolIDs []gidx.PrefixedID `json:"poolIDs,omitempty"` LoadBalancerID gidx.PrefixedID `json:"loadBalancerID"` } @@ -428,7 +428,7 @@ type LoadBalancerPort struct { CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Number int64 `json:"number"` - Name string `json:"name"` + Name *string `json:"name,omitempty"` LoadBalancerID gidx.PrefixedID `json:"loadBalancerID"` Pools []*LoadBalancerPool `json:"pools,omitempty"` LoadBalancer LoadBalancer `json:"loadBalancer"` @@ -539,6 +539,8 @@ type LoadBalancerPortWhereInput struct { NameContains *string `json:"nameContains,omitempty"` NameHasPrefix *string `json:"nameHasPrefix,omitempty"` NameHasSuffix *string `json:"nameHasSuffix,omitempty"` + NameIsNil *bool `json:"nameIsNil,omitempty"` + NameNotNil *bool `json:"nameNotNil,omitempty"` NameEqualFold *string `json:"nameEqualFold,omitempty"` NameContainsFold *string `json:"nameContainsFold,omitempty"` // pools edge predicates @@ -791,6 +793,7 @@ type UpdateLoadBalancerPoolInput struct { type UpdateLoadBalancerPortInput struct { Number *int64 `json:"number,omitempty"` Name *string `json:"name,omitempty"` + ClearName *bool `json:"clearName,omitempty"` AddPoolIDs []gidx.PrefixedID `json:"addPoolIDs,omitempty"` RemovePoolIDs []gidx.PrefixedID `json:"removePoolIDs,omitempty"` ClearPools *bool `json:"clearPools,omitempty"` diff --git a/internal/graphclient/schema/schema.graphql b/internal/graphclient/schema/schema.graphql index 654c61ad1..ae2d71434 100644 --- a/internal/graphclient/schema/schema.graphql +++ b/internal/graphclient/schema/schema.graphql @@ -51,7 +51,7 @@ Input was generated by ent. """ input CreateLoadBalancerPortInput { number: Int! - name: String! + name: String poolIDs: [ID!] loadBalancerID: ID! } @@ -441,7 +441,7 @@ type LoadBalancerPort implements Node @key(fields: "id") @prefixedID(prefix: "lo createdAt: Time! updatedAt: Time! number: Int! - name: String! + name: String loadBalancerID: ID! pools: [LoadBalancerPool!] loadBalancer: LoadBalancer! @@ -547,6 +547,8 @@ input LoadBalancerPortWhereInput { nameContains: String nameHasPrefix: String nameHasSuffix: String + nameIsNil: Boolean + nameNotNil: Boolean nameEqualFold: String nameContainsFold: String """pools edge predicates""" @@ -971,6 +973,7 @@ Input was generated by ent. input UpdateLoadBalancerPortInput { number: Int name: String + clearName: Boolean addPoolIDs: [ID!] removePoolIDs: [ID!] clearPools: Boolean diff --git a/schema.graphql b/schema.graphql index 8fef4e101..c2e16d3cf 100644 --- a/schema.graphql +++ b/schema.graphql @@ -39,7 +39,7 @@ Input was generated by ent. """ input CreateLoadBalancerPortInput { number: Int! - name: String! + name: String poolIDs: [ID!] loadBalancerID: ID! } @@ -428,7 +428,7 @@ type LoadBalancerPort implements Node @key(fields: "id") @prefixedID(prefix: "lo createdAt: Time! updatedAt: Time! number: Int! - name: String! + name: String loadBalancerID: ID! pools: [LoadBalancerPool!] loadBalancer: LoadBalancer! @@ -534,6 +534,8 @@ input LoadBalancerPortWhereInput { nameContains: String nameHasPrefix: String nameHasSuffix: String + nameIsNil: Boolean + nameNotNil: Boolean nameEqualFold: String nameContainsFold: String """pools edge predicates""" @@ -958,6 +960,7 @@ Input was generated by ent. input UpdateLoadBalancerPortInput { number: Int name: String + clearName: Boolean addPoolIDs: [ID!] removePoolIDs: [ID!] clearPools: Boolean diff --git a/schema/ent.graphql b/schema/ent.graphql index 29c303ef2..dde4875db 100644 --- a/schema/ent.graphql +++ b/schema/ent.graphql @@ -40,7 +40,7 @@ Input was generated by ent. """ input CreateLoadBalancerPortInput { number: Int! - name: String! + name: String poolIDs: [ID!] loadBalancerID: ID! } @@ -380,7 +380,7 @@ type LoadBalancerPort implements Node @key(fields: "id") @prefixedID(prefix: "lo createdAt: Time! updatedAt: Time! number: Int! - name: String! + name: String loadBalancerID: ID! pools: [LoadBalancerPool!] loadBalancer: LoadBalancer! @@ -471,6 +471,8 @@ input LoadBalancerPortWhereInput { nameContains: String nameHasPrefix: String nameHasSuffix: String + nameIsNil: Boolean + nameNotNil: Boolean nameEqualFold: String nameContainsFold: String """pools edge predicates""" @@ -739,6 +741,7 @@ Input was generated by ent. input UpdateLoadBalancerPortInput { number: Int name: String + clearName: Boolean addPoolIDs: [ID!] removePoolIDs: [ID!] clearPools: Boolean