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 { groups } from './groups'
|
||||||
import { logs } from './logs'
|
import { logs } from './logs'
|
||||||
import { me } from './me'
|
import { me } from './me'
|
||||||
|
import { pAHosts } from './pAHosts'
|
||||||
import { stats } from './stats'
|
import { stats } from './stats'
|
||||||
import { user } from './user'
|
import { user } from './user'
|
||||||
import { userPresence } from './userPresence'
|
import { userPresence } from './userPresence'
|
||||||
|
@ -14,6 +15,7 @@ const Query = {
|
||||||
groups,
|
groups,
|
||||||
logs,
|
logs,
|
||||||
me,
|
me,
|
||||||
|
pAHosts,
|
||||||
stats,
|
stats,
|
||||||
user,
|
user,
|
||||||
userPresence,
|
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 { Group } from './Group'
|
||||||
import { Log } from './Log'
|
import { Log } from './Log'
|
||||||
|
import { PAHost } from './PAHost'
|
||||||
import { ResetToken } from './ResetToken'
|
import { ResetToken } from './ResetToken'
|
||||||
import { Stats } from './Stats'
|
import { Stats } from './Stats'
|
||||||
import { User } from './User'
|
import { User } from './User'
|
||||||
|
@ -17,6 +18,7 @@ const resolvers = {
|
||||||
|
|
||||||
Group,
|
Group,
|
||||||
Log,
|
Log,
|
||||||
|
PAHost,
|
||||||
ResetToken,
|
ResetToken,
|
||||||
Stats,
|
Stats,
|
||||||
User,
|
User,
|
||||||
|
|
|
@ -56,6 +56,8 @@ const typeDefs = gql`
|
||||||
): [Log]!
|
): [Log]!
|
||||||
@auth(roles: ["superAdmin"])
|
@auth(roles: ["superAdmin"])
|
||||||
@cacheControl(maxAge: 2, scope: PRIVATE)
|
@cacheControl(maxAge: 2, scope: PRIVATE)
|
||||||
|
|
||||||
|
pAHosts: [PAHost!]! @auth(roles: ["superAdmin"])
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
|
@ -257,12 +259,18 @@ const typeDefs = gql`
|
||||||
ERROR
|
ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"A Palo Alto firewall host"
|
||||||
type PAHost {
|
type PAHost {
|
||||||
id: ID!
|
id: ID!
|
||||||
description: String
|
"Short description"
|
||||||
cidr: String
|
description: String!
|
||||||
key: String
|
"IP address in CIDR format"
|
||||||
|
cidr: String!
|
||||||
|
"First 5 characters from the key"
|
||||||
|
key: String!
|
||||||
|
"OptionalNote"
|
||||||
note: String
|
note: String
|
||||||
|
|
||||||
createdAt: String
|
createdAt: String
|
||||||
updatedAt: String
|
updatedAt: String
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user