@@ -351,6 +351,35 @@ public function detached(array $options = [])
351
351
* be between 0 and 600 seconds. Defaults to 600 seconds.
352
352
* @type bool $enableExactlyOnceDelivery Indicates whether to enable
353
353
* 'Exactly Once Delivery' on the subscription.
354
+ * @type array $cloudStorageConfig If provided, messages will be delivered to Google Cloud Storage.
355
+ * @type string $cloudStorageConfig.bucket User-provided name for the Cloud Storage bucket.
356
+ * The bucket must be created by the user. The bucket name must be without
357
+ * any prefix like "gs://". See the [bucket naming
358
+ * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
359
+ * @type string $cloudStorageConfig.filenamePrefix
360
+ * User-provided prefix for Cloud Storage filename. See the [object naming
361
+ * requirements](https://cloud.google.com/storage/docs/objects#naming).
362
+ * @type string $cloudStorageConfig.filenameSuffix
363
+ * User-provided suffix for Cloud Storage filename. See the [object naming
364
+ * requirements](https://cloud.google.com/storage/docs/objects#naming). Must
365
+ * not end in "/".
366
+ * @type array $cloudStorageConfig.textConfig If present, payloads will be written
367
+ * to Cloud Storage as raw text, separated by a newline.
368
+ * @type array $cloudStorageConfig.avroConfig If set, message payloads and metadata
369
+ * will be written to Cloud Storage in Avro format.
370
+ * @type bool $cloudStorageConfig.avroConfig.writeMetadata
371
+ * When true, write the subscription name, message_id, publish_time,
372
+ * attributes, and ordering_key as additional fields in the output.
373
+ * @type Duration|string $cloudStorageConfig.maxDuration The maximum duration
374
+ * that can elapse before a new Cloud Storage file is created.
375
+ * Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the
376
+ * subscription's acknowledgement deadline. If a string is provided,
377
+ * it should be as a duration in seconds with up to nine fractional digits,
378
+ * terminated by 's', e.g "3.5s"
379
+ * @type int|string $cloudStorageConfig.maxBytes The maximum bytes that can be
380
+ * written to a Cloud Storage file before a new file is created.
381
+ * Min 1 KB, max 10 GiB. The max_bytes limit may be exceeded in cases where
382
+ * messages are larger than the limit.
354
383
* }
355
384
* @return array An array of subscription info
356
385
* @throws \InvalidArgumentException
@@ -499,6 +528,35 @@ public function create(array $options = [])
499
528
* be between 0 and 600 seconds. Defaults to 600 seconds.
500
529
* @type bool $enableExactlyOnceDelivery Indicates whether to enable
501
530
* 'Exactly Once Delivery' on the subscription.
531
+ * @type array $cloudStorageConfig If provided, messages will be delivered to Google Cloud Storage.
532
+ * @type string $cloudStorageConfig.bucket User-provided name for the Cloud Storage bucket.
533
+ * The bucket must be created by the user. The bucket name must be without
534
+ * any prefix like "gs://". See the [bucket naming
535
+ * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
536
+ * @type string $cloudStorageConfig.filenamePrefix
537
+ * User-provided prefix for Cloud Storage filename. See the [object naming
538
+ * requirements](https://cloud.google.com/storage/docs/objects#naming).
539
+ * @type string $cloudStorageConfig.filenameSuffix
540
+ * User-provided suffix for Cloud Storage filename. See the [object naming
541
+ * requirements](https://cloud.google.com/storage/docs/objects#naming). Must
542
+ * not end in "/".
543
+ * @type array $cloudStorageConfig.textConfig If present, payloads will be written
544
+ * to Cloud Storage as raw text, separated by a newline.
545
+ * @type array $cloudStorageConfig.avroConfig If set, message payloads and metadata
546
+ * will be written to Cloud Storage in Avro format.
547
+ * @type bool $cloudStorageConfig.avroConfig.writeMetadata
548
+ * When true, write the subscription name, message_id, publish_time,
549
+ * attributes, and ordering_key as additional fields in the output.
550
+ * @type Duration|string $cloudStorageConfig.maxDuration The maximum duration
551
+ * that can elapse before a new Cloud Storage file is created.
552
+ * Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the
553
+ * subscription's acknowledgement deadline. If a string is provided,
554
+ * it should be as a duration in seconds with up to nine fractional digits,
555
+ * terminated by 's', e.g "3.5s"
556
+ * @type int|string $cloudStorageConfig.maxBytes The maximum bytes that can be
557
+ * written to a Cloud Storage file before a new file is created.
558
+ * Min 1 KB, max 10 GiB. The max_bytes limit may be exceeded in cases where
559
+ * messages are larger than the limit.
502
560
* }
503
561
* @param array $options [optional] {
504
562
* Configuration options.
@@ -1263,6 +1321,17 @@ private function formatSubscriptionDurations(array $options)
1263
1321
);
1264
1322
}
1265
1323
1324
+ if (isset ($ options ['cloudStorageConfig ' ]['maxDuration ' ]) &&
1325
+ $ options ['cloudStorageConfig ' ]['maxDuration ' ] instanceof Duration
1326
+ ) {
1327
+ $ duration = $ options ['cloudStorageConfig ' ]['maxDuration ' ]->get ();
1328
+ $ options ['cloudStorageConfig ' ]['maxDuration ' ] = sprintf (
1329
+ '%s.%ss ' ,
1330
+ $ duration ['seconds ' ],
1331
+ $ this ->convertNanoSecondsToFraction ($ duration ['nanos ' ], false )
1332
+ );
1333
+ }
1334
+
1266
1335
return $ options ;
1267
1336
}
1268
1337
0 commit comments