48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
const fs = require('fs');
|
|
const tokenData = JSON.parse(fs.readFileSync('D:/cumin/ghaymah_dns_net_sec_tests/token.json', 'utf8'));
|
|
|
|
const PROJECT_ID = '3f55ceef-78ae-40c8-a41b-0505db8c59ee';
|
|
const redisId = crypto.randomUUID();
|
|
|
|
async function main() {
|
|
console.log('Deploying test-redis (redis:alpine) into project dns-tcp-test...');
|
|
const res = await fetch('https://graphql.ghaymah.systems/v1/graphql', {
|
|
method: 'POST',
|
|
headers: { 'Authorization': 'Bearer ' + tokenData.token, 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
query: `mutation CreateResource($id: uuid!, $userId: uuid!, $chartName: String!, $chartVersion: String!, $values: json!) {
|
|
insert_ghaymah_cloud_resources_one(object: {
|
|
id: $id,
|
|
user_id: $userId,
|
|
chart_name: $chartName,
|
|
chart_version: $chartVersion,
|
|
values: $values
|
|
}) {
|
|
id status
|
|
}
|
|
}`,
|
|
variables: {
|
|
id: redisId,
|
|
userId: tokenData.userId,
|
|
chartName: 'ghaymah-app',
|
|
chartVersion: '0.1',
|
|
values: {
|
|
name: 'test-redis',
|
|
projectId: PROJECT_ID,
|
|
resourceTier: 't1',
|
|
ports: [{ number: 6379, expose: false }],
|
|
container: {
|
|
image: 'redis:alpine'
|
|
},
|
|
publicAccess: {
|
|
enabled: false
|
|
}
|
|
}
|
|
}
|
|
})
|
|
});
|
|
console.log('Create test-redis result:', JSON.stringify(await res.json(), null, 2));
|
|
}
|
|
|
|
main().catch(console.error);
|