How to use the @google-cloud/common.Operation function in @google-cloud/common

To help you get started, we’ve selected a few @google-cloud/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-compute / src / operation.js View on Github external
* // Be sure to register an error handler as well to catch any issues which
 * // impeded the operation.
 * //-
 * operation.on('error', function(err) {
 *   // An error occurred during the operation.
 * });
 *
 * //-
 * // To force the Operation object to stop polling for updates, simply remove
 * // any "complete" listeners you've registered.
 * //
 * // The easiest way to do this is with `removeAllListeners()`.
 * //-
 * operation.removeAllListeners();
 */
class Operation extends common.Operation {
  constructor(scope, name) {
    const isCompute = scope.constructor.name === 'Compute';
    const methods = {
      /**
       * Delete the operation.
       *
       * @see [GlobalOperations: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalOperations/delete}
       * @see [RegionOperations: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations/delete}
       * @see [ZoneOperations: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations/delete}
       *
       * @method Operation#delete
       * @param {function=} callback - The callback function.
       * @param {?error} callback.err - An error returned while making this
       *     request.
       * @param {object} callback.apiResponse - The full API response.
       *
github googleapis / google-cloud-node / packages / resource / src / index.js View on Github external
Resource.prototype.operation = function(name) {
  if (!name) {
    throw new Error('A name must be specified for an operation.');
  }

  return new common.Operation({
    parent: this,
    id: name
  });
};
github googleapis / google-cloud-node / packages / common-grpc / src / operation.js View on Github external
name: name
      }
    }
  };

  var config = {
    parent: parent,
    id: name,
    methods: methods
  };

  common.Operation.call(this, config);
  ServiceObject.call(this, config);
}

modelo.inherits(Operation, ServiceObject, common.Operation);

/**
 * Cancel the operation.
 *
 * @param {function=} callback - The callback function.
 * @param {?error} callback.err - An error returned while making this
 *     request.
 * @param {object} callback.apiResponse - The full API response.
 */
Operation.prototype.cancel = function(callback) {
  var protoOpts = {
    service: 'Operations',
    method: 'cancelOperation'
  };

  var reqOpts = {
github googleapis / google-cloud-node / packages / resource / src / index.js View on Github external
Resource.prototype.operation = function(name) {
  if (!name) {
    throw new Error('A name must be specified for an operation.');
  }

  return new common.Operation({
    parent: this,
    id: name
  });
};
github googleapis / google-cloud-node / packages / common-grpc / src / operation.js View on Github external
service: 'Operations',
        method: 'getOperation'
      },
      reqOpts: {
        name: name
      }
    }
  };

  var config = {
    parent: parent,
    id: name,
    methods: methods
  };

  common.Operation.call(this, config);
  ServiceObject.call(this, config);
}
github firebase / user-privacy / functions / node_modules / @google-cloud / common-grpc / src / operation.js View on Github external
service: 'Operations',
        method: 'getOperation',
      },
      reqOpts: {
        name: name,
      },
    },
  };

  var config = {
    parent: parent,
    id: name,
    methods: methods,
  };

  common.Operation.call(this, config);
  ServiceObject.call(this, config);
}
github firebase / user-privacy / functions / node_modules / @google-cloud / common-grpc / src / operation.js View on Github external
name: name,
      },
    },
  };

  var config = {
    parent: parent,
    id: name,
    methods: methods,
  };

  common.Operation.call(this, config);
  ServiceObject.call(this, config);
}

modelo.inherits(Operation, ServiceObject, common.Operation);

/**
 * Cancel the operation.
 *
 * @param {function=} callback - The callback function.
 * @param {?error} callback.err - An error returned while making this
 *     request.
 * @param {object} callback.apiResponse - The full API response.
 */
Operation.prototype.cancel = function(callback) {
  var protoOpts = {
    service: 'Operations',
    method: 'cancelOperation',
  };

  var reqOpts = {