query

package
v0.0.0-...-4334ecd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FlamedType = graphql.NewObject(graphql.ObjectConfig{
	Name:        "Flamed",
	Description: "`Flamed` provides all information related to the cluster",
	Fields: graphql.Fields{
		"nodeHostInfo": &graphql.Field{
			Type:        kind.NodeHostInfoType,
			Description: "Node host information",
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
				fc, ok := p.Source.(*fContext.FlamedContext)
				if !ok {
					return nil, nil
				}
				return fc.Flamed().GetNodeHostInfo(), nil
			},
		},

		"nodeAdmin": &graphql.Field{
			Name:        "NodeAdmin",
			Type:        nodeadmin.GQLNodeAdminType,
			Description: "Global administrative information from 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
			},
		},

		"admin": &graphql.Field{
			Name:        "Admin",
			Type:        admin.GQLAdminType,
			Description: "Global user,index meta,access control related information from Admin 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().NewAdmin(clusterID.Value(), fc.GlobalRequestTimeout()), nil
			},
		},
	},
})
View Source
var ServerStatusType = graphql.NewObject(graphql.ObjectConfig{
	Name:        "ServerStatus",
	Description: "`ServerStatus` provides information about service availability",
	Fields: graphql.Fields{
		"httpServer": &graphql.Field{
			Type:        graphql.Boolean,
			Description: "Is HTTP server available?",
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
				if val, ok := p.Source.(*utility2.ServerStatus); ok {
					return val.HTTPServer(), nil
				}
				return nil, nil
			},
		},

		"grpcServer": &graphql.Field{
			Type:        graphql.Boolean,
			Description: "Is GRPC server available?",
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
				if val, ok := p.Source.(*utility2.ServerStatus); ok {
					return val.GRPCServer(), nil
				}
				return nil, nil
			},
		},

		"raftServer": &graphql.Field{
			Type:        graphql.Boolean,
			Description: "Is RAFT server available?",
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
				if val, ok := p.Source.(*utility2.ServerStatus); ok {
					return val.RAFTServer(), nil
				}
				return nil, nil
			},
		},
	},
})

Functions

func Flamed

func Flamed(flamedContext *fContext.FlamedContext) *graphql.Field

func ServerStatus

func ServerStatus(_ *context.FlamedContext) *graphql.Field

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL