Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GQLCounterMutatorType = graphql.NewObject(graphql.ObjectConfig{ Name: "CounterMutator", Description: "Counter mutator provides an in-memory" + " unsigned 64 bit counter which can be incremented or decremented by one", Fields: graphql.Fields{ "increment": &graphql.Field{ Name: "Increment", Type: kind.GQLUInt64Type, Description: "Increment counter by one", Resolve: func(p graphql.ResolveParams) (interface{}, error) { i, ok := p.Source.(*uint64) if !ok { return nil, nil } if *i < 18446744073709551615 { var m uint64 = 1 atomic.AddUint64(i, m) } return kind.NewUInt64FromUInt64(*i), nil }, }, "decrement": &graphql.Field{ Name: "Decrement", Type: kind.GQLUInt64Type, Description: "Decrement counter by one", Resolve: func(p graphql.ResolveParams) (interface{}, error) { i, ok := p.Source.(*uint64) if !ok { return nil, nil } if *i > 0 { var m uint64 = 1 atomic.AddUint64(i, -m) } return kind.NewUInt64FromUInt64(*i), nil }, }, }, })
View Source
var GQLFlamedMutatorType = graphql.NewObject(graphql.ObjectConfig{ Name: "FlamedMutator", Description: "`FlamedMutator` gives the ability to perform any tasks related to the cluster", Fields: graphql.Fields{ "nodeAdminMutator": &graphql.Field{ Name: "NodeAdminMutator", Type: nodeadminmutator.GQLNodeAdminMutatorType, Description: "Perform administrative tasks using NodeAdmin by clusterID", Args: graphql.FieldConfigArgument{ "clusterID": &graphql.ArgumentConfig{ Description: "Cluster ID", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { clusterID := p.Args["clusterID"].(*kind.UInt64) fc, ok := p.Source.(*fContext.FlamedContext) if !ok { return nil, nil } if !fc.Flamed().IsClusterIDAvailable(clusterID.Value()) { return nil, gqlerrors.NewFormattedError(x.ErrClusterIsNotAvailable.Error()) } return fc.Flamed().NewNodeAdmin(clusterID.Value(), fc.GlobalRequestTimeout()), nil }, }, "adminMutator": &graphql.Field{ Name: "AdminMutator", Type: adminmutator.GQLAdminMutatorType, Description: "", Args: graphql.FieldConfigArgument{ "clusterID": &graphql.ArgumentConfig{ Description: "Cluster ID", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { clusterID := p.Args["clusterID"].(*kind.UInt64) fc, ok := p.Source.(*fContext.FlamedContext) if !ok { return nil, nil } if !fc.Flamed().IsClusterIDAvailable(clusterID.Value()) { return nil, gqlerrors.NewFormattedError(x.ErrClusterIsNotAvailable.Error()) } return fc.Flamed().NewAdmin(clusterID.Value(), fc.GlobalRequestTimeout()), nil }, }, }, })
Functions ¶
func CounterMutator ¶
func CounterMutator(_ *flamedContext.FlamedContext) *graphql.Field
func FlamedMutator ¶
func FlamedMutator(flamedContext *fContext.FlamedContext) *graphql.Field
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.