@@ -110,6 +110,8 @@ util.inherits(Logging, commonGrpc.Service);
110110 * @param {string } name - Name of the sink.
111111 * @param {object } config - See a
112112 * [Sink resource](https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks#LogSink).
113+ * @param {object } config.gaxOptions - Request configuration options, outlined
114+ * here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions.
113115 * @param {module:storage/bucket|module:bigquery/dataset|module:pubsub/topic } config.destination -
114116 * The destination. The proper ACL scopes will be granted to the provided
115117 * destination.
@@ -171,10 +173,18 @@ Logging.prototype.createSink = function(name, config, callback) {
171173 return ;
172174 }
173175
174- this . api . Config . createSink ( {
176+ var gaxOptions = extend ( {
177+ timeout : 5000 // "Deadline Exceeded" errors without.
178+ } , config . gaxOptions ) ;
179+
180+ delete config . gaxOptions ;
181+
182+ var reqOpts = {
175183 parent : 'projects/' + this . projectId ,
176184 sink : extend ( { } , config , { name : name } )
177- } , function ( err , resp ) {
185+ } ;
186+
187+ this . api . Config . createSink ( reqOpts , gaxOptions , function ( err , resp ) {
178188 if ( err ) {
179189 callback ( err , null , resp ) ;
180190 return ;
@@ -244,8 +254,8 @@ Logging.prototype.entry = function(resource, data) {
244254 * @param {string } options.filter - An
245255 * [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters).
246256 * An empty filter matches all log entries.
247- * @param {number } options.maxApiCalls - Maximum number of API calls to make.
248- * @param { number } options.maxResults - Maximum number of results to return .
257+ * @param {object } options.gaxOptions - Request configuration options, outlined
258+ * here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions .
249259 * @param {string } options.orderBy - How the results should be sorted,
250260 * `timestamp` (oldest first) and `timestamp desc` (newest first,
251261 * **default**).
@@ -294,14 +304,17 @@ Logging.prototype.getEntries = function(options, callback) {
294304 var reqOpts = extend ( {
295305 orderBy : 'timestamp desc'
296306 } , options ) ;
307+
297308 reqOpts . resourceNames = arrify ( reqOpts . resourceNames ) ;
298309 reqOpts . resourceNames . push ( 'projects/' + this . projectId ) ;
299310
300311 delete reqOpts . autoPaginate ;
301- delete reqOpts . maxApiCalls ;
302- delete reqOpts . maxResults ;
303312
304- this . api . Logging . listLogEntries ( reqOpts , options , function ( ) {
313+ var gaxOptions = extend ( {
314+ autoPaginate : options . autoPaginate
315+ } , options . gaxOptions ) ;
316+
317+ this . api . Logging . listLogEntries ( reqOpts , gaxOptions , function ( ) {
305318 var entries = arguments [ 1 ] ;
306319
307320 if ( entries ) {
@@ -361,13 +374,16 @@ Logging.prototype.getEntriesStream = function(options) {
361374 var reqOpts = extend ( {
362375 orderBy : 'timestamp desc'
363376 } , options ) ;
364- reqOpts . projectIds = arrify ( reqOpts . projectIds ) ;
365- reqOpts . projectIds . push ( this . projectId ) ;
377+ reqOpts . resourceNames = arrify ( reqOpts . resourceNames ) ;
378+ reqOpts . resourceNames . push ( 'projects/' + self . projectId ) ;
366379
367- delete reqOpts . maxApiCalls ;
368- delete reqOpts . maxResults ;
380+ delete reqOpts . autoPaginate ;
369381
370- requestStream = self . api . Config . listLogEntriesStream ( reqOpts , options ) ;
382+ var gaxOptions = extend ( {
383+ autoPaginate : options . autoPaginate
384+ } , options . gaxOptions ) ;
385+
386+ requestStream = self . api . Logging . listLogEntriesStream ( reqOpts , gaxOptions ) ;
371387
372388 userStream . setPipeline ( requestStream , toEntryStream ) ;
373389 } ) ;
@@ -383,8 +399,8 @@ Logging.prototype.getEntriesStream = function(options) {
383399 * @param {object= } options - Configuration object.
384400 * @param {boolean } options.autoPaginate - Have pagination handled
385401 * automatically. Default: true.
386- * @param {number } options.maxApiCalls - Maximum number of API calls to make.
387- * @param { number } options.maxResults - Maximum number of results to return .
402+ * @param {object } options.gaxOptions - Request configuration options, outlined
403+ * here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions .
388404 * @param {function } callback - The callback function.
389405 * @param {?error } callback.err - An error returned while making this request.
390406 * @param {module:logging/sink[] } callback.sinks - Sink objects.
@@ -415,10 +431,12 @@ Logging.prototype.getSinks = function(options, callback) {
415431 } ) ;
416432
417433 delete reqOpts . autoPaginate ;
418- delete reqOpts . maxApiCalls ;
419- delete reqOpts . maxResults ;
420434
421- this . api . Config . listSinks ( reqOpts , options , function ( ) {
435+ var gaxOptions = extend ( {
436+ autoPaginate : options . autoPaginate
437+ } , options . gaxOptions ) ;
438+
439+ this . api . Config . listSinks ( reqOpts , gaxOptions , function ( ) {
422440 var sinks = arguments [ 1 ] ;
423441
424442 if ( sinks ) {
@@ -484,10 +502,11 @@ Logging.prototype.getSinksStream = function(options) {
484502 parent : 'projects/' + self . projectId
485503 } ) ;
486504
487- delete reqOpts . maxApiCalls ;
488- delete reqOpts . maxResults ;
505+ var gaxOptions = extend ( {
506+ autoPaginate : options . autoPaginate
507+ } , options . gaxOptions ) ;
489508
490- requestStream = self . api . Config . listSinksStream ( reqOpts , options ) ;
509+ requestStream = self . api . Config . listSinksStream ( reqOpts , gaxOptions ) ;
491510
492511 userStream . setPipeline ( requestStream , toSinkStream ) ;
493512 } ) ;
0 commit comments