code: function RestOperation(serviceClient, operation) {
    this.status = OperationState.Inited;
    this.operationId = -1;
    this._callbackArguments = null;
  
    // setup callback and args
    this._userCallback = arguments[arguments.length - 1];
    var sliceEnd = arguments.length;
    if(azureutil.objectIsFunction(this._userCallback)) {
      sliceEnd--;
    } else {
      this._userCallback = null;
    }
    var operationArguments = Array.prototype.slice.call(arguments).slice(2, sliceEnd);
  
    this.run = function(cb) {
      var func = serviceClient[operation];
      if(!func) {
        throw new ArgumentError('operation', util.format('Unknown operation %s in serviceclient', operation));
      } else {
        if(!cb) cb = this._userCallback;
        operationArguments.push(cb);
        this.status = OperationState.RUNNING;
        func.apply(serviceClient, operationArguments);
        operationArguments = operation = null;
      }
    };
  
    this._fireUserCallback = function () {
      if(this._userCallback) {
        this._userCallback.apply(null, this._callbackArguments);
      }
    };
  }
docs: Rest operation in sdk