GithubHelp home page GithubHelp logo

clc-node-sdk's People

Contributors

idrabenia avatar jwebs1 avatar pslam avatar push1st1k avatar sergeisidorov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

katediomina

clc-node-sdk's Issues

Implement possibilities to search templates

_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:

  1. It would be great to implement support of and / or predicates for this criteria.
  2. It would be nice if all fields of search criteria will support both - single and value list modes.
  3. It would be great to cover this functionality by unit tests with mocked JSON response.

Task relates to "Template Operations - Search Templates"

Configure Node SDK jobs on CI

Need to configure next jobs:

  1. Commit Verification Job - it must run jshint, unit tests and integration tests. It would be great to run this job on each commit.
  2. Nightly Long Running Tests Job - it must run jshint, long running tests. It would be great to run such job each hour.

Thanks!

Statistics Engine. Monitoring Statistics

_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"

Improve naming of create server operation parameters

_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:

  1. improve structure and naming of create server attributes.
  2. implement set of enums for Server (it will contains server type), ServerStorage, Group.
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:

  1. If we have template or group provided as string then we will interpret it as Template Name / Group ID, when we will received object - then we will interpret it as reference

Task relates to "Basic server functionality - Create Server"

Implement possibilities to search datacenters

_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"

Implement possibilities to set server custom fields

_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

Implement possibilities to start server maintenance

_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"

Implement possibilities to import server

_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"

Implement possibilities to resolve DataCenter by name

_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"

Implement skeleton of OperationPromise

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

  • It would be great to create two methods - OperationPromise::resolveOnJobComplete, OperationPromise::processError that will be possible to pass in then function of basic operation
  • It would be great to move mixinStatuSupport to OperationPromise and apply it automatically on resolveOnJobComplete method
  • It would be great when OperationPromise will return server reference with next structure { id: '<SERVER_ID>' }
  • It would be great if 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)
  • It would be great when OperationPromise will incapsulate logic for ping job status

Thanks!

Implement possibilities to specify additional disks on server creation

_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"

Implement possibilities to modify server

_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"

Implement possibilities to reboot 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"

Implement possibilities to revert server to snapshot

_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"

Implement possibilities to search groups

_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"

Implement support of unit tests automated execution

_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!

Implement possibilities to delete snapshot

_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"

Implement possibilities to add disks

_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"

Implement possibilities to shut down server

_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"

Implement possibilities to clone 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"

Implement possibilities to stop server maintenance

_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"

Implement possibilities to retrieve server credentials

_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"

Implement possibilities to get group billing stats

_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"

Implement possibilities to execute shell commands on remote servers over SSH

_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"

Implement possibilities to delete server

_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"

Implement possibilities to delete disks

_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"

Implement get group monitoring statistics operation

_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"

Implement super command functionality

_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"

Implement possibilities to reset server

_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"

Implement possibilities to create 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"

Implement possibilities to create group

_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"

Statistics Engine. Billing Statistics

_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"

Implement possibilities to modify group

_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"

Implement possibilities to pause server

_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"

Implement possibilities to modify disks

_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"

Implement possibilities to search server

_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"

Implement possibilities to create snapshot

_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"

Implement possibilities to power on server

_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"

Implement possibilities to archive 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"

Implement possibilities to power off 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"

Implement possibilities to resolve group by name and datacenter

_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"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.