@@ -1301,8 +1301,12 @@ class Bucket extends ServiceObject {
13011301 ) ;
13021302
13031303 if ( options . append === false ) {
1304- this . setMetadata ( { lifecycle : { rule : newLifecycleRules } } , callback ) ;
1305- this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
1304+ this . setMetadata ( { lifecycle : { rule : newLifecycleRules } } )
1305+ . then ( resp => callback ! ( null , ...resp ) )
1306+ . catch ( callback ! )
1307+ . finally ( ( ) => {
1308+ this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
1309+ } ) ;
13061310 return ;
13071311 }
13081312
@@ -1318,16 +1322,17 @@ class Bucket extends ServiceObject {
13181322 metadata . lifecycle && metadata . lifecycle . rule
13191323 ) ;
13201324
1321- this . setMetadata (
1322- {
1323- lifecycle : {
1324- rule : currentLifecycleRules . concat ( newLifecycleRules ) ,
1325- } ,
1325+ this . setMetadata ( {
1326+ lifecycle : {
1327+ rule : currentLifecycleRules . concat ( newLifecycleRules ) ,
13261328 } ,
1327- callback !
1328- ) ;
1329+ } )
1330+ . then ( resp => callback ! ( null , ...resp ) )
1331+ . catch ( callback ! )
1332+ . finally ( ( ) => {
1333+ this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
1334+ } ) ;
13291335 } ) ;
1330- this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
13311336 }
13321337
13331338 combine (
@@ -2097,19 +2102,22 @@ class Bucket extends ServiceObject {
20972102 disableRequesterPays (
20982103 callback ?: DisableRequesterPaysCallback
20992104 ) : Promise < DisableRequesterPaysResponse > | void {
2105+ const cb = callback || util . noop ;
21002106 this . disableAutoRetryConditionallyIdempotent_ (
21012107 this . methods . setMetadata ,
21022108 AvailableServiceObjectMethods . setMetadata
21032109 ) ;
2104- this . setMetadata (
2105- {
2106- billing : {
2107- requesterPays : false ,
2108- } ,
2110+
2111+ this . setMetadata ( {
2112+ billing : {
2113+ requesterPays : false ,
21092114 } ,
2110- callback || util . noop
2111- ) ;
2112- this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
2115+ } )
2116+ . then ( resp => cb ( null , ...resp ) )
2117+ . catch ( cb )
2118+ . finally ( ( ) => {
2119+ this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
2120+ } ) ;
21132121 }
21142122
21152123 enableLogging (
@@ -2277,19 +2285,21 @@ class Bucket extends ServiceObject {
22772285 enableRequesterPays (
22782286 callback ?: EnableRequesterPaysCallback
22792287 ) : Promise < EnableRequesterPaysResponse > | void {
2288+ const cb = callback || util . noop ;
22802289 this . disableAutoRetryConditionallyIdempotent_ (
22812290 this . methods . setMetadata ,
22822291 AvailableServiceObjectMethods . setMetadata
22832292 ) ;
2284- this . setMetadata (
2285- {
2286- billing : {
2287- requesterPays : true ,
2288- } ,
2293+ this . setMetadata ( {
2294+ billing : {
2295+ requesterPays : true ,
22892296 } ,
2290- callback || util . noop
2291- ) ;
2292- this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
2297+ } )
2298+ . then ( resp => cb ( null , ...resp ) )
2299+ . catch ( cb )
2300+ . finally ( ( ) => {
2301+ this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
2302+ } ) ;
22932303 }
22942304
22952305 /**
@@ -3098,7 +3108,8 @@ class Bucket extends ServiceObject {
30983108 }
30993109 return [ ] ;
31003110 } )
3101- . then ( files => callback ! ( null , files ) , callback ! )
3111+ . then ( files => callback ! ( null , files ) )
3112+ . catch ( callback ! )
31023113 . finally ( ( ) => {
31033114 this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
31043115 } ) ;
@@ -3288,17 +3299,19 @@ class Bucket extends ServiceObject {
32883299 removeRetentionPeriod (
32893300 callback ?: SetBucketMetadataCallback
32903301 ) : Promise < SetBucketMetadataResponse > | void {
3302+ const cb = callback || util . noop ;
32913303 this . disableAutoRetryConditionallyIdempotent_ (
32923304 this . methods . setMetadata ,
32933305 AvailableServiceObjectMethods . setMetadata
32943306 ) ;
3295- this . setMetadata (
3296- {
3297- retentionPolicy : null ,
3298- } ,
3299- callback !
3300- ) ;
3301- this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
3307+ this . setMetadata ( {
3308+ retentionPolicy : null ,
3309+ } )
3310+ . then ( resp => cb ( null , ...resp ) )
3311+ . catch ( cb )
3312+ . finally ( ( ) => {
3313+ this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
3314+ } ) ;
33023315 }
33033316
33043317 request ( reqOpts : DecorateRequestOptions ) : Promise < [ ResponseBody , Metadata ] > ;
@@ -3403,8 +3416,12 @@ class Bucket extends ServiceObject {
34033416 this . methods . setMetadata ,
34043417 AvailableServiceObjectMethods . setMetadata
34053418 ) ;
3406- this . setMetadata ( { labels} , options , callback ) ;
3407- this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
3419+ this . setMetadata ( { labels} , options )
3420+ . then ( resp => callback ! ( null , ...resp ) )
3421+ . catch ( callback ! )
3422+ . finally ( ( ) => {
3423+ this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
3424+ } ) ;
34083425 }
34093426
34103427 setRetentionPeriod ( duration : number ) : Promise < SetBucketMetadataResponse > ;
@@ -3453,19 +3470,21 @@ class Bucket extends ServiceObject {
34533470 duration : number ,
34543471 callback ?: SetBucketMetadataCallback
34553472 ) : Promise < SetBucketMetadataResponse > | void {
3473+ const cb = callback || util . noop ;
34563474 this . disableAutoRetryConditionallyIdempotent_ (
34573475 this . methods . setMetadata ,
34583476 AvailableServiceObjectMethods . setMetadata
34593477 ) ;
3460- this . setMetadata (
3461- {
3462- retentionPolicy : {
3463- retentionPeriod : duration ,
3464- } ,
3478+ this . setMetadata ( {
3479+ retentionPolicy : {
3480+ retentionPeriod : duration ,
34653481 } ,
3466- callback !
3467- ) ;
3468- this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
3482+ } )
3483+ . then ( resp => cb ( null , ...resp ) )
3484+ . catch ( cb )
3485+ . finally ( ( ) => {
3486+ this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
3487+ } ) ;
34693488 }
34703489
34713490 setCorsConfiguration (
@@ -3524,17 +3543,20 @@ class Bucket extends ServiceObject {
35243543 corsConfiguration : Cors [ ] ,
35253544 callback ?: SetBucketMetadataCallback
35263545 ) : Promise < SetBucketMetadataResponse > | void {
3546+ const cb = callback || util . noop ;
35273547 this . disableAutoRetryConditionallyIdempotent_ (
35283548 this . methods . setMetadata ,
35293549 AvailableServiceObjectMethods . setMetadata
35303550 ) ;
3531- this . setMetadata (
3532- {
3533- cors : corsConfiguration ,
3534- } ,
3535- callback !
3536- ) ;
3537- this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
3551+
3552+ this . setMetadata ( {
3553+ cors : corsConfiguration ,
3554+ } )
3555+ . then ( resp => cb ( null , ...resp ) )
3556+ . catch ( cb )
3557+ . finally ( ( ) => {
3558+ this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
3559+ } ) ;
35383560 }
35393561
35403562 setStorageClass (
@@ -3619,8 +3641,12 @@ class Bucket extends ServiceObject {
36193641 } )
36203642 . toUpperCase ( ) ;
36213643
3622- this . setMetadata ( { storageClass} , options , callback ! ) ;
3623- this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
3644+ this . setMetadata ( { storageClass} , options )
3645+ . then ( ( ) => callback ! ( ) )
3646+ . catch ( callback ! )
3647+ . finally ( ( ) => {
3648+ this . storage . retryOptions . autoRetry = this . instanceRetryValue ;
3649+ } ) ;
36243650 }
36253651
36263652 /**
0 commit comments