centurylinkcloud / clc-node-sdk Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
_As cloud user I want to have possibilities to search server templates by one method call_
Proposed method signature:
var templates = sdk.computeService().templates();
templates
.find({
dataCenter: ['de1', 'ca2'],
dataCenterNameContains: ['Frankfurt', 'Seattle'],
dataCenterWhere: function (metadata) {
return metadata.id === 'de1';
},
name: ['CentOS-6_32Bit'],
nameContains: 'CentOs',
descriptionContains: 'CentOs',
where: function (template) {
return template.id === 'CentOS-6_32Bit';
},
operatingSystem: {
family: templates.Os.Family.CENTOS,
version: '6',
architecture: templates.Os.Architecture.X86_64
}
});
Notes:
Task relates to "Template Operations - Search Templates"
Need to configure next jobs:
Thanks!
_As cloud user I want to have possibilities to query and group my server monitoring data_
Proposed use cases:
var Resource = compute.Monitoring.Resource;
computeServices()
.statistics()
.monitoringStats({
server: {
... // server search criteria
},
timeFilter: {
start: '2015-04-05T16:00:00',
end: '2015-04-05T22:00:00',
sampleInterval: '02:00:00',
type: MonitoringStatsType.HOURLY
},
groupBy: Resource.DATA_CENTER // "dataCenter"
});
computeServices()
.statistics()
.monitoringStats({
group: {
... // group search criteria
},
timeFilter: {
start: '2015-04-05T16:00:00',
end: '2015-04-05T22:00:00',
sampleInterval: '02:00:00',
type: MonitoringStatsType.HOURLY
},
summarize: true
});
computeServices()
.statistics()
.monitoringStats({
dataCenter: {
... // datacenter search criteria
},
timeFilter: {
type: MonitoringStatsType.LATEST
},
groupBy: Resource.SERVER // "server"
});
computeServices()
.statistics()
.monitoringStats({
dataCenter: {
... // datacenter search criteria
},
timeFilter: {
start: '2015-04-05T16:00:00',
sampleInterval: '00:10:00',
type: MonitoringStatsType.REALTIME
},
groupBy: Resource.GROUP // "group"
});
Task relates to "Statistics Engine: Monitoring Statistics"
_As cloud user for create server operation I want to provide attributes and objects that will be well named and will have good semantic_
It would be great to:
var Server = compute. Server;
var Group = compute.Group;
var DataCenter = compute.DataCenter;
compute
.servers()
.create({
name: 'ALTRS',
description: 'My Server',
type: Server.STANDARD,
storageType: Server.StorageType.PREMIUM,
group: { dataCenter: DataCenter.DE_FRANKFURT, name: Group.DEFAULT },
template: 'CentOS_6-32Bits',
machine: { cpu: 2, ram: 1 },
network: {
primaryDns: '192.168.1.5',
secondaryDns: '192.168.1.6'
}
})
.on('complete', function (server) {
console.log(server);
});
Notes:
Task relates to "Basic server functionality - Create Server"
_As cloud user I want to have possibilities to search datacenters that provided by CLC cloud_
Proposed method signature:
commonServices()
.dataCenters()
.find({
id: ['de1', 'va1'], // or just 'DE1'
nameContains: 'frankfurt', // or ['frankfurt', 'varcouver']
name: 'DE1 - Frankfurt',
where: function (metadata) {
return metadata.getName().contains('GB');
}
});
I think it would be great for search criteria implementation to use wrapper that transform json-like object to set of predicates.
Task relates to "Basic Datacenter Operations - Search Datacenters"
_As sdk user I want to have possibilities to specify server custom fields by single method call_
Proposed method signature:
computeServices()
.servers()
.createServer({
...
customFields: [{
id: "dba67b154f774a1fb413ddfa3dc4ac1d",
value: "Required Value 1"
}, {
id: "58f83bf6675846769ee6cb091ce3561e",
value: "Optional Value 1"
}, {
id: "22f002e08f3b46d9a8b38ecd4c6df7f9",
value: "Required Value 2"
}]
})
Task relates to "Basic Server Operations - Custom fields support"
Note: maybe it could be implement in scope #38
_As sdk user I want to have possibilities to start server maintenance_
Proposed method signature:
computeServices().servers().startMaintenance({ id: 'DE1ALTDWEB201'});
Task relates to "Server Power Operations - Start server maintenance"
_As sdk user I want to have possibilities to import server by single method call_
Proposed method signature:
computeServices()
.servers()
.import({
name: "web",
description: "My web server",
group: groupSearchCriteria,
network: {
primaryDns: "172.17.1.26",
secondaryDns: "172.17.1.27"
},
machine: {
cpu: 1,
memoryGB: 1
},
type: Server.STANDARD,
storageType: Server.StorageType.STANDARD,
ovf: {
id: "ALIAS/CUSTOM-OVF-IMPORT",
osType: "redHat6_64Bit"
}
});
Task relates to "Basic Server Operations - Import Server"
_As cloud user I want to have possibilities to resolve DataCenter info by key that will contains in name_
Proposed signature:
commonServices().dataCenters().findByRef({ name: 'frankfurt' });
Task relates to "DataCenter Operations - Search DataCenters"
Could you create special object - SdkPromise, that extends Promise and has major event emitter methods.
After that could you reimplement this method using it.
class OperationPromise extends Promise {
final EventEmitter emitter = new EventEmitter();
self.on = _.bind(emitter, emitter.on);
self.remoteListener...
}
Additional ideas for OperationPromise
OperationPromise::resolveOnJobComplete
, OperationPromise::processError
that will be possible to pass in then
function of basic operationmixinStatuSupport
to OperationPromise
and apply it automatically on resolveOnJobComplete methodOperationPromise
will return server reference with next structure { id: '<SERVER_ID>' }
OperationPromise
will be completed on actual job completion and provide possibilities to add additional checks for verify operation completion (for instance wait until server is not active)OperationPromise
will incapsulate logic for ping job statusThanks!
_As cloud user I want to have possibilities to specify additional disks on server creation_
Propose DSL syntax:
.create({
...
machine: {
cpu: 1, ram: 2,
disks: [
{ path: '/data', size: 50 }, // it's partition
{ size: 10 }, // it's raw disk volume
20 // raw disk volume
]
}
...
})
Task relates to "Basic server functionality - Create Server"
Could you investigate possibilities to configure auto retry policy for existing rest client library.
If it's not possible could you implement custom wrapper for rest client that allow to execute requests with response codes 5XX after specified timeout.
Thanks!
_As sdk user I want to have possibilities to modify server by single method call_
Proposed method signature:
computeServices()
.servers()
.modify(serverSearchCriteria, {
description: "My web server",
group: {
datacenter: DataCenter.DE_FRANKFURT,
name: Group.DEFAULT
},
password: {
old: "oldpass",
new: "newpass"
},
cpu: 2,
memory: 4,
disks: {
add: {
"path":"/temp",
"size":"1",
"type":"partitioned"
},
edit: [{
"id":"0:1",
"size":3
},
{
"id":"0:3",
"size":3
}],
remove: '0:4'
}
});
Task relates to "Basic Server Operations - Modify Server"
_As sdk user I want to have possibilities to reboot a server_
Proposed method signature:
computeServices().servers().reboot({ id: 'DE1ALTDWEB201'});
Task relates to "Server Power Operations - Reboot server"
_As sdk user I want to have possibilities to revert server to snapshots by single method call_
Proposed method signature:
computeServices()
.servers()
.revertToSnapshot({
servers:[serverRef1, serverRef2] //or servers:[serverSearchCriteria]
})
Task relates to "Super Command - Revert To Snapshot"
_As sdk user I want to have possibilities to search groups by single method call_
Proposed method signature:
computeServices()
.groups()
.find({
/* id: ['3asd7958f3ad44532h14e8d3cb641555', '3asd7958f3ad44532h14e8d3cb641556'], */
id: '3asd7958f3ad44532h14e8d3cb641555',
name: "Default Group", // name: ["Default Group1", "Default Group2"]
nameContains: ["group", "default"], // nameContains: "Default Group1",
description: "My group description", // description: ["My group description", "1"]
descriptionContains: ["My", "Test"], // descriptionContains: "My",
where: function(metadata) {
return metadata.name === 'Default Group';
},
/* dataCenter: [{ id: 'de1'}, { nameContains: 'Frankfurt' }], */
dataCenter: {
id: ['de1', 'va1'],
name: 'DE1 - Germany (Frankfurt)',
nameContains: ['Frankfurt', 'Seattle'],
where: function (metadata) {
return metadata.id === 'de1';
}
},
dataCenterId: ['de1', 'va1'], // dataCenterId: 'de1'
dataCenterName: ['A', 'B'], // dataCenterName: 'A'
dataCenterNameContains: ['A', 'B'] // dataCenterNameContains: 'A'
})
Task relates to "Basic Group Operations - Search Group"
_Could you implement gulp tasks that allow:
1. Run _jshint code validation
2. Run _unit tests_
3. Run _unit + integration_ tests
4. Run _long running_ tests
5. _Watch_ mode that will allow to execute code validation and run unit tests on each code changes.
Thanks!
_As sdk user I want to have possibilities to delete snapshots for servers by single method call_
Proposed method signature:
computeServices()
.servers()
.deleteSnapshot({
servers:[serverRef1, serverRef2] //or servers:[serverSearchCriteria]
})
Task relates to "Super Command - Delete Snapshot"
_As sdk user I want to have possibilities to add disks for servers by single method call_
Proposed method signature:
computeServices()
.servers()
.addDisks({
servers:[serverRef1, serverRef2], //or servers:[serverSearchCriteria]
disks:[
{
path:"/extra",
size:"20",
type:"partitioned"
},
{
size:"20"
}
]
})
Task relates to "Super Command - Add Disks"
_As sdk user I want to have possibilities to shut down a server_
Proposed method signature:
computeServices().servers().shutDown({ id: 'DE1ALTDWEB201'});
Task relates to "Server Power Operations - Shut down server"
_As sdk user I want to have possibilities to clone server by single method call_
Proposed method signature:
computeServices()
.servers()
.clone({
name: "web",
description: "My web server",
group: {
datacenter: DataCenter.DE_FRANKFURT,
name: Group.DEFAULT
},
network: {
primaryDns: "172.17.1.26",
secondaryDns: "172.17.1.27"
},
machine: {
cpu: 1,
memoryGB: 1,
disks: [
{ size: 2 },
{ path: "/data", size: 4 }
]
},
type: Server.STANDARD,
storageType: Server.StorageType.STANDARD,
from: {
server: serverSearchCriteria
}
});
Task relates to "Basic Server Operations - Clone Server"
it would be great to provide possibilities to resolve templates on create server operation in next way:
.create({
...
template: { os: compute.Os.CENTOS, version: "6", edition: "Some Addition", architecture: compute.Machine.Architecture.x86_64 }
...
});
Thanks!
_As sdk user I want to have possibilities to stop server maintenance_
Proposed method signature:
computeServices().servers().stopMaintenance({ id: 'DE1ALTDWEB201' });
Task relates to "Server Power Operations - Stop server maintenance"
_As sdk user I want to have possibilities to get my server credentials by single method call_
Proposed method signature:
computeServices().servers().credentials(serverSearchCriteria);
Task relates to "Basic Server Operations - Get Server Credentials Operation"
_As cloud user I want to receive billing statistics by single method call_
Proposed method signatures:
/*List<GroupBillingStats>*/ computeServices().groups().getBillingStats(groupSearchCriteria);
Task relates to "Basic statistics operations - Implement get group billing statistics"
_As sdk user I want to have possibilities to execute ssh script on servers by single method call_
Proposed method signature:
computeServices()
.servers()
.execSsh(searchServerCriteria)
.run('ls -all').then(processCommand, processError)
.run('cd ~')
.run('pwd')
.then(processResults);
Notes: This library (https://github.com/MCluck90/simple-ssh) may be very usable for implementation of current functionality.
Task relates to "Super Command - Implement possibilities to execute shell commands on remote servers over SSH"
_As sdk user I want to have possibilities to delete my server by single method call_
Proposed method signature:
computeServices().servers().delete({id: 'DE1ALTDWEB201'});
Task relates to "Basic Server Operations - Create Server"
_As sdk user I want to have possibilities to remove disks for servers by single method call_
Proposed method signature:
computeServices()
.servers()
.removeDisks({
servers:[serverRef1, serverRef2], //or servers:[serverSearchCriteria]
disks:[
{
id:"0:0"
},
{
path:"/extra"
},
{
type:"partitioned"
}
]
})
Task relates to "Super Command - Delete Disks"
It would be grate, if user can specify credentials through properties file, environment variables, system variables
_As cloud user I want to receive monitoring statistics by single method call_
Proposed method signatures:
var StatsType = compute.Monitoring.StatsType;
/**
* @returns ServerMonitoringStatistics[]
*/
computeServices().groups().getMonitoringStats({
groups: {
id: '2a5c0b9662cf4fc8bf6180f139facdc0'
},
timeRange: {
from: new Date("2015-06-20"),
to: new Date(),
type: StatsType.HOURLY,
last: moment.duration(2, 'days') /* last: 5 (in hours) */
}
);
Task relates to "Basic statistics operations - Implement get group monitoring statistics operation"
_As sdk user I want to have possibilities to define infrastructure by single method call_
Proposed method signature:
computeServices()
.groups()
.defineInfrastructure({
dataCenter: ['de1', 'ca1'],
group: { name: 'Group-1', description: 'Test Group' }, subItems: [
{group: 'Group-1-1', subItems: [
centosServer(),
{ group: 'Group-1-1-1' }
]},
{group: 'Group-1-2', subItems: [
mysqlServer(2),
nginxServer()
]}
]
})
Task relates to "Super Command - Implement super command functionality"
_As sdk user I want to have possibilities to reset a server_
Proposed method signature:
computeServices().servers().reset({ id: 'DE1ALTDWEB201'});
Task relates to "Server Power Operations - Reset server"
_As sdk user I want to have possibilities to create server by single method call_
Proposed method signature:
computeServices()
.servers()
.create({
name: "web",
description: "My web server",
group: {
datacenter: DataCenter.DE_FRANKFURT,
name: Group.DEFAULT
},
template: {
dataCenter: DataCenter.DE_FRANKFURT,
os: compute.Os.CENTOS,
version: "6",
architecture: compute.Machine.Architecture.X86_64
},
network: {
primaryDns: "172.17.1.26",
secondaryDns: "172.17.1.27",
publicIp: {
internalIpAddress: '172.17.1.100',
sourceRestrictions: ['172.17.1.100/32'],
ports: [
{
protocol: "TCP",
port: 443
},
{
protocol: "TCP",
port: 8080,
portTo: 8081
},
{
protocol: "UDP",
port: 123
}
]
}
},
machine: {
cpu: 1,
memoryGB: 1,
disks: [
{ size: 2 },
{ path: "/data", size: 4}
]
},
type: Server.STANDARD,
storageType: Server.StorageType.STANDARD,
ttl: new TimeToLive().plusDays(2)
})
Task relates to "Basic Server Operations - Create Server"
_As sdk user I want to have possibilities to create group by single method call_
Proposed method signature:
computeServices()
.groups()
.create({
parentGroup: groupSearchCriteria,
name:'Group-1',
description:'Test Group'
});
Task relates to "Basic Group Operations - Create Group"
Need to write documentation for one of our SDK code parts and generate documentation.
It must contains:
Thanks!
_As cloud user I want to have possibilities to query and group my servers billing data_
Proposed use cases:
var Resource = compute.Billing.Resource;
computeServices()
.statistics()
.billingStats({
server: {
... // server search criteria
},
groupBy: Resource.DATACENTER
});
computeServices()
.statistics()
.billingStats({
group: {
... // group search filter
},
aggregateSubItems: true,
groupBy: Resource.GROUP
});
computeServices()
.statistics()
.billingStats({
dataCenter: {
... // datacenter search criteria
},
groupBy: Resource.SERVER
});
computeServices()
.statistics()
.billingStats({
dataCenter: {
... // datacenter search criteria
},
groupBy: Resource.GROUP
});
computeServices()
.statistics()
.billingStats({
dataCenter: {
... // datacenter search criteria
},
summarize: true
});
Task relates to "Statistics Engine: Billing Statistics"
_As sdk user I want to have possibilities to modify group by single method call_
Proposed method signature:
computeServices()
.groups()
.modify({
parentGroup: groupSearchCriteria,
name:'new Group-1',
description:'new description'
});
Task relates to "Basic Group Operations - Modify Group"
_As sdk user I want to have possibilities to pause a server_
Proposed method signature:
computeServices().servers().pause({ id: 'DE1ALTDWEB201'});
Task relates to "Server Power Operations - Pause server"
_As sdk user I want to have possibilities to grow disks for servers by single method call_
Proposed method signature:
computeServices()
.servers()
.resizeDisks({
servers:[serverRef1, serverRef2], //or servers:[serverSearchCriteria]
disks:[
{
id:"0:0",
size:4
},
{
path:"/extra",
size:16
},
{
type:"partitioned",
size:1
}
]
})
Task relates to "Super Command - Grow Disks"
_As sdk user I want to have possibilities to search servers by single method call_
Proposed method signature:
computeServices()
.servers()
.find({
dataCenter: dataCenterCriteria /* [createria1, criteria2] */,
dataCenterId: 'id1' /* ['id2', 'id3'] */,
dataCenterName: 'name1' /* ['name1', 'name2'] */,
dataCenterNameContains: 'name1' /* ['name1', 'name2'] */,
group: groupCriteria /* [createria1, criteria2] */,
groupName: 'name1' /* ['name1', 'name2'] */,
groupNameContains: 'name1' /* ['name1', 'name2'] */,
groupDescription: 'name1' /* ['name1', 'name2'] */,
groupDescriptionContains: 'name1' /* ['name1', 'name2'] */,
onlyActive: true,
powerStates: ['active', compute.SERVER_STATE.PAUSED],
name: "de1altdweb100" /* ['id1', 'id2'] */,
description: "My web server" /* ['name1', 'name2'] */,
nameContains: "web" /* ['web1', 'web2'] */,
descriptionContains: "server" /* ['server1', 'server2'] */,
});
Task relates to "Basic Server Operations - Search Server"
_As sdk user I want to have possibilities to create snapshots for servers by single method call_
Proposed method signature:
computeServices()
.servers()
.createSnapshot({nameContains: 'web'}, 5) // serverSearchCriteria, expirationDays
Task relates to "Super Command - Create Snapshot"
_As sdk user I want to have possibilities to power on a server_
Proposed method signature:
computeServices().servers().powerOn({ id: 'DE1ALTDWEB201'});
Task relates to "Server Power Operations - Power on server"
_As sdk user I want to have possibilities to archive a server_
Proposed method signature:
computeServices().servers().archive({ id: 'DE1ALTDWEB201'});
Task relates to "Server Power Operations - Archive server"
_As sdk user I want to have possibilities to power off a server_
Proposed method signature:
computeServices().servers().powerOff({ id: 'DE1ALTDWEB201'});
Task relates to "Server Power Operations - Power off server"
_As cloud user I want to resolve my group during server creation by datacenter and group name_
Proposed syntax:
var compute = sdk.computeServices();
var DataCenter = compute.DataCenter;
compute.servers().create({
...
group: { datacenter: DataСenter.DE_FRANKFURT, name: 'My Group' }
});
Task relates to "Basic Server Operations - Create Server"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.