Skip to content

Commit

Permalink
Merge pull request #189 from partik03/final_gsoc23
Browse files Browse the repository at this point in the history
Final Changes and Documentation
  • Loading branch information
mbcse authored Sep 2, 2023
2 parents 9130d75 + 88dcb88 commit a3fc0a1
Show file tree
Hide file tree
Showing 71 changed files with 694 additions and 503 deletions.
239 changes: 129 additions & 110 deletions README.md

Large diffs are not rendered by default.

Binary file added assets/generator/high_level_diagrams/linode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/generator/high_level_diagrams/oracle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/generator/high_level_diagrams/oracle2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 18 additions & 7 deletions examples/compute/linode-ks.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ function createCluster() {
control_plane: {
high_availability: true,
},
node_pools: [
{
type: 'g6-standard-4',
count: 6,
autoscaler: {
enabled: true,
max: 12,
min: 3,
},
},
],
};

kubernetes.create(clusterDetails).then(
Expand All @@ -41,7 +52,7 @@ function getAllClusters() {

//Delete cluster
function deleteCluster() {
let clusterID = 12345;
let clusterID = 127044;
kubernetes.delete(clusterID).then(
result => {
console.log('Output :', result);
Expand All @@ -54,7 +65,7 @@ function deleteCluster() {

//Create a Node pool
function createNodePool() {
let clusterID = 12345;
let clusterID = 127044;
let poolDetails = {
type: 'g6-standard-4',
count: 6,
Expand All @@ -78,8 +89,8 @@ function createNodePool() {

//Delete a node pool
function deleteNodePool() {
let nodePoolID = 12345;
let clusterID = 456;
let nodePoolID = 188341;
let clusterID = 127044;
kubernetes.deleteNodePool(clusterID, nodePoolID).then(
result => {
console.log('Output :', result);
Expand All @@ -92,8 +103,8 @@ function deleteNodePool() {

//Get details of Node Pools
function getNodePool() {
let nodePoolID = 12345;
let clusterID = 456;
let nodePoolID = 188341;
let clusterID = 127044;
kubernetes.getNodePool(clusterID, nodePoolID).then(
result => {
console.log('Output :', result);
Expand All @@ -106,7 +117,7 @@ function getNodePool() {

//Get all Nodepools
function getNodePools() {
let clusterID = 12345;
let clusterID = 127044;
kubernetes.getNodePools(clusterID).then(
result => {
console.log('Output :', result);
Expand Down
11 changes: 4 additions & 7 deletions examples/database/linode-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ const ncProviders = nodeCloud.getProviders(optionsProvider);
const linodeSql = ncProviders.linode.sql();

function createDatabase() {
const engine = 'mysql';
const dbParams = {
label: 'example-db',
region: 'us-east',
type: 'g6-dedicated-2',
cluster_size: 3,
engine: 'mysql/8.0.26',
encrypted: false,
ssl_connection: true,
engine: 'mysql/8.0.30',
replication_type: 'semi_synch',
allow_list: ['203.0.113.1', '192.0.1.0/24'],
};

// create database
Expand Down Expand Up @@ -45,7 +42,7 @@ function listDatabases() {

//delete a Database
function deleteDatabase() {
const engine = 'mysql/8.0.26';
const engine = 'mysql';
const dbId = 12345;
linodeSql
.deleteDatabase(engine, dbId)
Expand All @@ -58,7 +55,7 @@ function deleteDatabase() {
}
//update a Database
function updateDatabase() {
const engine = 'mysql/8.0.26';
const engine = 'mysql';
const dbId = 12345;
const updateData = {
label: 'example-db',
Expand Down
70 changes: 70 additions & 0 deletions examples/images/linode-images.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
const nodeCloud = require('../../lib/');
const optionsProvider = {
overrideProviders: false,
};
const ncProviders = nodeCloud.getProviders(optionsProvider);

const images = ncProviders.linode.images();

function createImage() {
const diskId = 123;
const label = 'this_is_a_label';
const description = 'A longer description of the image';
images
.createImage(diskId, label, description)
.then(result => {
console.log('Volumes are: ', result);
})
.catch(err => {
console.log('Error is: ', err);
});
}

function updateImage() {
const imageId = 123;
const label = 'this_is_a_new_label';
const description = 'A new longer description of the image';
images
.updateImage(imageId, label, description)
.then(result => {
console.log('Volumes are: ', result);
})
.catch(err => {
console.log('Error is: ', err);
});
}

function deleteImage() {
const imageId = 123;
images
.deleteImage(details)
.then(result => {
console.log('Output is: ', result);
})
.catch(err => {
console.log('Error is: ', err);
});
}

function getImage() {
const imageId = 1234;
images
.getImage(imageId)
.then(result => {
console.log('Output is: ', result);
})
.catch(err => {
console.log('Error is: ', err);
});
}

function listImages() {
images
.getImages()
.then(result => {
console.log('Output is: ', result);
})
.catch(err => {
console.log('Error is: ', err);
});
}
6 changes: 3 additions & 3 deletions examples/network/linode-dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const dns = ncProviders.linode.dns();
// Create a DNS Domain
function createDomain() {
let domainCreateOptions = {
domain: 'example.com',
domain: 'scorelab.com',
type: 'master',
soa_email: 'admin@example.com',
description: 'Example Description',
Expand Down Expand Up @@ -72,7 +72,7 @@ function deleteDomain() {
function updateDomain() {
let recordID = 3352896;
let options = {
domain: 'example.com',
domain: 'scorelab.com',
type: 'master',
soa_email: 'admin@example.com',
description: 'Example Description',
Expand All @@ -86,7 +86,7 @@ function updateDomain() {
group: 'Example Display Group',
tags: ['tag1', 'tag2'],
};
updateDomain(recordID, options)
dns.updateDomain(recordID, options)
.then(result => {
console.log('Output is: ', result);
})
Expand Down
74 changes: 3 additions & 71 deletions examples/network/linode-lb.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,7 @@ function create() {
region: 'us-east',
label: 'balancer12345',
client_conn_throttle: 0,
configs: [
{
port: 443,
protocol: 'https',
algorithm: 'roundrobin',
stickiness: 'http_cookie',
check: 'http_body',
check_interval: 90,
check_timeout: 10,
check_attempts: 3,
check_path: '/test',
check_body: 'it works',
check_passive: true,
proxy_protocol: 'none',
cipher_suite: 'recommended',
ssl_cert:
'-----BEGIN CERTIFICATE-----\nCERTIFICATE_INFORMATION\n-----END CERTIFICATE-----',
ssl_key:
'-----BEGIN PRIVATE KEY-----\nPRIVATE_KEY_INFORMATION\n-----END PRIVATE KEY-----',
nodes: [
{
address: '192.168.210.120:80',
label: 'node1',
weight: 50,
mode: 'accept',
},
{
address: '192.168.210.122:81',
label: 'node2',
weight: 50,
mode: 'accept',
},
],
},
],
configs: [],
};

lb.create(options)
Expand Down Expand Up @@ -85,43 +51,9 @@ function updateLoadBalancer() {
let lbId = 4954884;
let options = {
region: 'us-east',
label: 'balancer12345',
label: 'newbalancer12345',
client_conn_throttle: 0,
configs: [
{
port: 443,
protocol: 'https',
algorithm: 'roundrobin',
stickiness: 'http_cookie',
check: 'http_body',
check_interval: 90,
check_timeout: 10,
check_attempts: 3,
check_path: '/test',
check_body: 'it works',
check_passive: true,
proxy_protocol: 'none',
cipher_suite: 'recommended',
ssl_cert:
'-----BEGIN CERTIFICATE-----\nCERTIFICATE_INFORMATION\n-----END CERTIFICATE-----',
ssl_key:
'-----BEGIN PRIVATE KEY-----\nPRIVATE_KEY_INFORMATION\n-----END PRIVATE KEY-----',
nodes: [
{
address: '192.168.210.120:80',
label: 'node1',
weight: 50,
mode: 'accept',
},
{
address: '192.168.210.122:81',
label: 'node2',
weight: 50,
mode: 'accept',
},
],
},
],
configs: [],
};
lb.update(lbId, options)
.then(result => {
Expand Down
62 changes: 62 additions & 0 deletions examples/storage/linode-objectStorage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const nodeCloud = require('../../lib/');
const optionsProvider = {
overrideProviders: false,
};
const ncProviders = nodeCloud.getProviders(optionsProvider);

const objectStorage = ncProviders.linode.objectStorage();

function createBucket() {
const details = {
label: 'nodecloud-bucket',
cluster: 'us-east-1',
cors_enabled: true,
};
objectStorage
.create(details)
.then(result => {
console.log('Volumes are: ', result);
})
.catch(err => {
console.log('Error is: ', err);
});
}

function deleteBucket() {
const details = {
cluster: 'us-east-1',
label: 'nodecloud-bucket',
};
objectStorage
.delete(details)
.then(result => {
console.log('Output is: ', result);
})
.catch(err => {
console.log('Error is: ', err);
});
}

function getBucket() {
const clusterId = 'us-east-1';
const bucketName = 'nodecloud-bucket';
objectStorage
.get(clusterId, bucketName)
.then(result => {
console.log('Output is: ', result);
})
.catch(err => {
console.log('Error is: ', err);
});
}

function listBuckets() {
objectStorage
.list()
.then(result => {
console.log('Output is: ', result);
})
.catch(err => {
console.log('Error is: ', err);
});
}
Loading

0 comments on commit a3fc0a1

Please sign in to comment.