Added pAHosts query
This commit is contained in:
parent
d674a1877c
commit
84152915d2
|
@ -172,4 +172,4 @@ async function addHost({ cidr, user, password, description, note }) {
|
|||
}
|
||||
}
|
||||
|
||||
export { updateUserIdMappings, addHost }
|
||||
export { updateUserIdMappings, addHost, decryptKey }
|
||||
|
|
7
server/src/resolvers/PAHost.js
Normal file
7
server/src/resolvers/PAHost.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { decryptKey } from '../lib/paloalto'
|
||||
|
||||
const PAHost = {
|
||||
key: parent => decryptKey(parent.encryptedKey).slice(0, 5) + '*****'
|
||||
}
|
||||
|
||||
export { PAHost }
|
|
@ -2,6 +2,7 @@ import { basicUser } from './basicUser'
|
|||
import { groups } from './groups'
|
||||
import { logs } from './logs'
|
||||
import { me } from './me'
|
||||
import { pAHosts } from './pAHosts'
|
||||
import { stats } from './stats'
|
||||
import { user } from './user'
|
||||
import { userPresence } from './userPresence'
|
||||
|
@ -14,6 +15,7 @@ const Query = {
|
|||
groups,
|
||||
logs,
|
||||
me,
|
||||
pAHosts,
|
||||
stats,
|
||||
user,
|
||||
userPresence,
|
||||
|
|
5
server/src/resolvers/Query/pAHosts.js
Normal file
5
server/src/resolvers/Query/pAHosts.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import prisma from '../../prisma'
|
||||
|
||||
export function pAHosts() {
|
||||
return prisma.pAHost.findMany()
|
||||
}
|
|
@ -4,6 +4,7 @@ import { Subscription } from './Subscriptions'
|
|||
|
||||
import { Group } from './Group'
|
||||
import { Log } from './Log'
|
||||
import { PAHost } from './PAHost'
|
||||
import { ResetToken } from './ResetToken'
|
||||
import { Stats } from './Stats'
|
||||
import { User } from './User'
|
||||
|
@ -17,6 +18,7 @@ const resolvers = {
|
|||
|
||||
Group,
|
||||
Log,
|
||||
PAHost,
|
||||
ResetToken,
|
||||
Stats,
|
||||
User,
|
||||
|
|
|
@ -56,6 +56,8 @@ const typeDefs = gql`
|
|||
): [Log]!
|
||||
@auth(roles: ["superAdmin"])
|
||||
@cacheControl(maxAge: 2, scope: PRIVATE)
|
||||
|
||||
pAHosts: [PAHost!]! @auth(roles: ["superAdmin"])
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
|
@ -257,12 +259,18 @@ const typeDefs = gql`
|
|||
ERROR
|
||||
}
|
||||
|
||||
"A Palo Alto firewall host"
|
||||
type PAHost {
|
||||
id: ID!
|
||||
description: String
|
||||
cidr: String
|
||||
key: String
|
||||
"Short description"
|
||||
description: String!
|
||||
"IP address in CIDR format"
|
||||
cidr: String!
|
||||
"First 5 characters from the key"
|
||||
key: String!
|
||||
"OptionalNote"
|
||||
note: String
|
||||
|
||||
createdAt: String
|
||||
updatedAt: String
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user