Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GQLAdminType = graphql.NewObject(graphql.ObjectConfig{ Name: "Admin", Description: "`Admin` provides user,index meta,access control related information related to the cluster", Fields: graphql.Fields{ "isUserAvailable": IsUserAvailable, "getUser": GetUser, "isAccessControlAvailable": IsAccessControlAvailable, "getAccessControl": GetAccessControl, "isIndexMetaAvailable": IsIndexMetaAvailable, "getIndexMeta": GetIndexMeta, }, })
View Source
var GetAccessControl = &graphql.Field{ Name: "GetAccessControl", Description: "Get access control information of a user", Type: kind.GQLAccessControlType, Args: graphql.FieldConfigArgument{ "username": &graphql.ArgumentConfig{ Description: "Username", Type: graphql.NewNonNull(graphql.String), }, "namespace": &graphql.ArgumentConfig{ Description: "Namespace", Type: graphql.NewNonNull(graphql.String), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { username := p.Args["username"].(string) namespace := p.Args["namespace"].(string) namespaceBytes := []byte(namespace) admin, ok := p.Source.(*flamed.Admin) if !ok { return nil, nil } accessControl, err := admin.GetAccessControl(username, namespaceBytes) if err != nil { return nil, gqlerrors.NewFormattedError(err.Error()) } return accessControl, nil }, }
View Source
var GetIndexMeta = &graphql.Field{ Name: "GetIndexMeta", Description: "", Type: kind.IndexMetaType, Args: graphql.FieldConfigArgument{ "namespace": &graphql.ArgumentConfig{ Description: "Namespace", Type: graphql.NewNonNull(graphql.String), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { namespace := p.Args["namespace"].(string) namespaceBytes := []byte(namespace) admin, ok := p.Source.(*flamed.Admin) if !ok { return nil, nil } indexMeta, err := admin.GetIndexMeta(namespaceBytes) if err != nil { return nil, gqlerrors.NewFormattedError(err.Error()) } return indexMeta, nil }, }
View Source
var GetUser = &graphql.Field{ Name: "GetUser", Description: "Get user by username", Type: kind.GQLUserType, Args: graphql.FieldConfigArgument{ "username": &graphql.ArgumentConfig{ Description: "Username", Type: graphql.NewNonNull(graphql.String), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { username := p.Args["username"].(string) admin, ok := p.Source.(*flamed.Admin) if !ok { return nil, nil } user, err := admin.GetUser(username) if err != nil { return nil, gqlerrors.NewFormattedError(err.Error()) } return user, nil }, }
View Source
var IsAccessControlAvailable = &graphql.Field{ Name: "IsAccessControlAvailable", Description: "Is access control available?", Type: graphql.Boolean, Args: graphql.FieldConfigArgument{ "username": &graphql.ArgumentConfig{ Description: "Username", Type: graphql.NewNonNull(graphql.String), }, "namespace": &graphql.ArgumentConfig{ Description: "Namespace", Type: graphql.NewNonNull(graphql.String), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { username := p.Args["username"].(string) namespace := p.Args["namespace"].(string) namespaceBytes := []byte(namespace) admin, ok := p.Source.(*flamed.Admin) if !ok { return nil, nil } return admin.IsAccessControlAvailable(username, namespaceBytes), nil }, }
View Source
var IsIndexMetaAvailable = &graphql.Field{ Name: "IsIndexMetaAvailable", Description: "Is index meta available?", Type: graphql.Boolean, Args: graphql.FieldConfigArgument{ "namespace": &graphql.ArgumentConfig{ Description: "Namespace", Type: graphql.NewNonNull(graphql.String), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { namespace := p.Args["namespace"].(string) namespaceBytes := []byte(namespace) admin, ok := p.Source.(*flamed.Admin) if !ok { return nil, nil } return admin.IsIndexMetaAvailable(namespaceBytes), nil }, }
View Source
var IsUserAvailable = &graphql.Field{ Name: "IsUserAvailable", Description: "Is user available?", Type: graphql.Boolean, Args: graphql.FieldConfigArgument{ "username": &graphql.ArgumentConfig{ Description: "Username", Type: graphql.NewNonNull(graphql.String), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { username := p.Args["username"].(string) admin, ok := p.Source.(*flamed.Admin) if !ok { return nil, nil } return admin.IsUserAvailable(username), nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.