Skip to content

Defang SDK #452

@raphaeltm

Description

@raphaeltm

It would be neat if you could import an SDK to control your Defang provisioned infrastructure from within your application.

For example something very loosely along these lines:

import defang from '@defang/sdk';

function myMonitoringService(){
  const workerService = defang.getService('worker');
  const instanceCount = workerService.getInstanceCount();
  const customMetric = myPrivateFunctionThatGivesMeARelevantMetric();
  if(customMetric > 0.8 && instanceCount < 10) {
    workerService.setInstanceCount(instanceCount + 1);
  }
  if(customMetric < 0.4 && instanceCount > 2){
    workerService.setInstanceCount(instanceCount - 1);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions