Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* // 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.
*
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
});
};
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 = {
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
});
};
service: 'Operations',
method: 'getOperation'
},
reqOpts: {
name: name
}
}
};
var config = {
parent: parent,
id: name,
methods: methods
};
common.Operation.call(this, config);
ServiceObject.call(this, config);
}
service: 'Operations',
method: 'getOperation',
},
reqOpts: {
name: name,
},
},
};
var config = {
parent: parent,
id: name,
methods: methods,
};
common.Operation.call(this, config);
ServiceObject.call(this, config);
}
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 = {