Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
d2c4b0b
functionality working
shubhangi-google Feb 13, 2025
a846d56
adding missing config
shubhangi-google Feb 27, 2025
61cbea2
fixing unit tests
shubhangi-google Feb 27, 2025
0d3be36
fixing lint issues
shubhangi-google Feb 27, 2025
284c281
changing storage_cleint approach
shubhangi-google Mar 10, 2025
477432f
fix linter
shubhangi-google Mar 10, 2025
5e8ec6e
code refactoring
shubhangi-google Mar 13, 2025
8b1e2fb
wip - implementation 2
shubhangi-google Apr 21, 2025
9d3365e
changes working
shubhangi-google Apr 24, 2025
1ebc0e5
adding test cases
shubhangi-google Apr 30, 2025
1614506
fix typo
shubhangi-google Apr 30, 2025
a4a22e8
removing unwanted change
shubhangi-google Apr 30, 2025
f9eb45f
removing unwanted changes
shubhangi-google Apr 30, 2025
3d9ba90
rewritting delete upload
shubhangi-google May 7, 2025
7b13e1b
Update google-cloud-storage/lib/google/cloud/storage/bucket.rb
shubhangi-google May 21, 2025
69ac3d9
chnaging method params
shubhangi-google Jun 11, 2025
fc03d05
Merge branch 'main' into restart_delete_resumable_upload_v3
shubhangi-google Jul 24, 2025
dfa9096
addressing comments
shubhangi-google Aug 25, 2025
d437897
removing space
shubhangi-google Aug 25, 2025
7fba719
resolving syntax
shubhangi-google Aug 25, 2025
158f5c2
Update bucket.rb
shubhangi-google Aug 25, 2025
dce6e85
chore: create pubsub v3 migration guide (#30680)
aandreassa Jul 24, 2025
972256f
chore(main): release google-cloud-bigtable-admin-v2 1.12.0 (#30700)
release-please[bot] Jul 24, 2025
ac6bebe
chore(main): release google-cloud-lustre-v1 0.2.0 (#30701)
release-please[bot] Jul 24, 2025
757166f
chore(main): release google-cloud-spanner-v1 1.10.0 (#30702)
release-please[bot] Jul 24, 2025
3dedeee
chore(main): release google-cloud-policy_simulator 1.3.0 (#30705)
release-please[bot] Jul 24, 2025
d4f0a06
chore(main): release google-cloud-policy_simulator-v1 1.4.0 (#30711)
release-please[bot] Jul 24, 2025
debd9a2
chore(main): release google-cloud-datastore 2.13.0 (#30710)
release-please[bot] Jul 24, 2025
0dd5846
feat: Publish Proto and Enum types to CBT data API (#30726)
gcf-owl-bot[bot] Jul 24, 2025
70a060a
feat!: Remove Policy and RetryPolicy in favor of auto-generated count…
aandreassa Jul 24, 2025
c0e4208
chore(main): release google-cloud-network_connectivity 2.2.0 (#30721)
release-please[bot] Jul 24, 2025
d98c570
chore(main): release google-cloud-network_connectivity-v1 1.7.0 (#30722)
release-please[bot] Jul 24, 2025
cfa8600
feat: add SessionService (#30717)
gcf-owl-bot[bot] Jul 24, 2025
171755d
feat: add SessionService (#30716)
gcf-owl-bot[bot] Jul 24, 2025
eb5b008
chore(main): release google-apps-chat-v1 0.13.0 (#30719)
release-please[bot] Jul 24, 2025
f991a7c
docs: Updated Private Service Connect IP ranges when route_all_traffi…
gcf-owl-bot[bot] Jul 26, 2025
ec5883b
chore(main): release google-cloud-discovery_engine-v1 2.4.0 (#30730)
release-please[bot] Jul 26, 2025
b3cbc3c
chore(main): release google-cloud-discovery_engine 2.3.0 (#30729)
release-please[bot] Jul 26, 2025
63bb208
feat: add SessionService (#30728)
gcf-owl-bot[bot] Jul 26, 2025
d1bd18f
feat: add support for new API resources: Issues, IssueComments, PullR…
gcf-owl-bot[bot] Jul 26, 2025
8a22de4
feat: add support for new API resources: Issues, IssueComments, PullR…
gcf-owl-bot[bot] Jul 26, 2025
a7af257
feat: proto changes for an internal api (#30718)
gcf-owl-bot[bot] Jul 26, 2025
635b039
feat: Add service_account to Reasoning Engine public protos (#30715)
gcf-owl-bot[bot] Jul 26, 2025
5c799b8
feat: Add support for Cloud SQL backup and restore (#30713)
gcf-owl-bot[bot] Jul 26, 2025
3e910fd
feat: A new enum `TransparentHugepageEnabled` is added (#30714)
gcf-owl-bot[bot] Jul 26, 2025
dceac29
chore(main): release google-cloud-video-transcoder-v1 2.2.0 (#30703)
release-please[bot] Jul 26, 2025
0a4594e
chore(main): release google-cloud-build-v1 1.6.1 (#30735)
release-please[bot] Jul 28, 2025
c9f46ba
chore(main): release google-cloud-discovery_engine-v1beta 0.21.0 (#30…
release-please[bot] Jul 28, 2025
02528b6
chore(main): release google-cloud-secure_source_manager 2.1.0 (#30738)
release-please[bot] Jul 28, 2025
6f68069
chore(main): release google-cloud-spanner-admin-database-v1 1.9.0 (#3…
release-please[bot] Jul 28, 2025
04dceea
chore(main): release google-cloud-secure_source_manager-v1 2.2.0 (#30…
release-please[bot] Jul 28, 2025
a61374b
chore(main): release google-cloud-backupdr-v1 1.2.0 (#30734)
release-please[bot] Jul 28, 2025
bd80949
chore(main): release google-cloud-container-v1beta1 0.48.0 (#30736)
release-please[bot] Jul 28, 2025
950e5b3
chore(main): release google-cloud-ai_platform-v1 1.19.0 (#30733)
release-please[bot] Jul 28, 2025
b7a1315
feat!: Change default number of concurrent streams to 1 (#30742)
aandreassa Jul 29, 2025
80d3a70
feat!: Introduce subclasses for TopicAdmin & SubscriptionAdmin auto-g…
aandreassa Jul 29, 2025
0042db3
chore(main): release google-cloud-pubsub 3.0.0 (#30663)
release-please[bot] Jul 29, 2025
1c88917
fix(merchant-reviews-v1beta1)!: Renamed MerchantReview#attributes fie…
gcf-owl-bot[bot] Jul 31, 2025
74d6872
docs(secure_source_manager-v1): Provided additional details on method…
gcf-owl-bot[bot] Aug 4, 2025
f3170ef
docs(pubsub): Update README.md to v3.x (#30751)
aandreassa Aug 5, 2025
72c08e3
samples(pubsub): pubsub_commit_avro_schema sample
cy-yun Jul 15, 2025
32d2955
samples(pubsub): pubsub_create_proto_schema v2 upgrade and testing
cy-yun Jul 15, 2025
ed0bf2f
samples(pubsub): pubsub_publish_with_error v2 upgrade and testing
cy-yun Jul 15, 2025
a4c25f5
samples(pubsub): pubsub_subscriber_error_listener v2 upgrade and testing
cy-yun Jul 15, 2025
a0641c8
samples(pubsub): pubsub_get_schema_revision sample
cy-yun Jul 18, 2025
5eb8d55
samples(pubsub): pubsub_optimistic_subscribe sample
cy-yun Jul 18, 2025
cc9e59f
samples(pubsub): pubsub_create_unwrapped_push_subscription sample
cy-yun Jul 18, 2025
0ecbe1c
samples(pubsub) add locational endpoint to pubsub_subscriber_exactly_…
cy-yun Jul 18, 2025
f24cfba
samples(pubsub) pubsub_create_topic_with_cloud_storage_ingestion sample
cy-yun Jul 18, 2025
d7beb0d
samples(pubsub): pubsub_create_topic_with_kinesis_ingestion sample
cy-yun Jul 18, 2025
c5a016d
samples(pubsub): pubsub_create_topic_with_aws_msk_ingestion sample
cy-yun Jul 18, 2025
a828725
samples(pubsub): pubsub_create_topic_with_azure_event_hubs_ingestion …
cy-yun Jul 19, 2025
8a90edc
samples(pubsub): pubsub_create_topic_with_confluent_cloud_ingestion s…
cy-yun Jul 19, 2025
1292972
samples(pubsub): pubsub_update_topic_type sample
cy-yun Jul 19, 2025
f737457
samples(pubsub): pubsub_delete_schema_revision sample
cy-yun Jul 19, 2025
fccc15a
samples(pubsub): pubsub_create_cloud_storage_subscription sample
cy-yun Jul 19, 2025
ae13ca7
chore(pubsub): skip emulator tests if emulator host is not set
cy-yun Jul 24, 2025
3ca8291
chore(pubsub): use local variables instead of instance variables wher…
cy-yun Jul 24, 2025
d21399f
chore(pubsub): Increase samples method length to 30
cy-yun Jul 24, 2025
06ebab3
chore(pubsub): white space changes and column restriction to 80
cy-yun Jul 24, 2025
8abcdb3
fix(pubsub): fix flakiness in pubsub_subscribe_avro_records samples t…
cy-yun Jul 25, 2025
096f422
fix(pubsub): removing unnecessary line breaks, adding line breaks whe…
cy-yun Aug 4, 2025
f00f9bc
chore(deps): update dependency google-apis-core to v1 (#30757)
renovate-bot Aug 5, 2025
5c1c71d
tests(storage): Fix some new rubocop failures (#30764)
dazuma Aug 6, 2025
acf9978
feat: Initial generation of google-shopping-merchant-inventories-v1 (…
yoshi-code-bot Aug 6, 2025
ab0f376
feat: Initial generation of google-shopping-merchant-data_sources-v1 …
yoshi-code-bot Aug 6, 2025
68a60b2
feat: Initial generation of google-shopping-merchant-conversions-v1 (…
yoshi-code-bot Aug 6, 2025
b0b59f2
feat: Initial generation of google-shopping-merchant-notifications-v1…
yoshi-code-bot Aug 6, 2025
3740f09
feat: Initial generation of google-shopping-merchant-lfp-v1 (#30775)
yoshi-code-bot Aug 6, 2025
8fa8a5a
feat: Initial generation of google-shopping-merchant-quota-v1 (#30774)
yoshi-code-bot Aug 6, 2025
0e3efec
feat(storage): Require Ruby 3.1 or later (#30765)
dazuma Aug 6, 2025
1655e65
feat: Initial generation of google-shopping-merchant-accounts-v1 (#30…
yoshi-code-bot Aug 6, 2025
aaacf1f
feat: Initial generation of google-shopping-merchant-promotions-v1 (#…
yoshi-code-bot Aug 6, 2025
95826dc
feat: Initial generation of google-shopping-merchant-issue_resolution…
yoshi-code-bot Aug 6, 2025
39b9eb4
feat: Initial generation of google-shopping-merchant-products-v1 (#30…
yoshi-code-bot Aug 6, 2025
2652635
feat: Initial generation of google-shopping-merchant-order_tracking-v…
yoshi-code-bot Aug 6, 2025
ad4c92b
feat: Initial generation of google-shopping-merchant-reports-v1 (#30767)
yoshi-code-bot Aug 6, 2025
e1ba5d5
chore(storage): Migrate to google-cloud-pubsub v3.x (#30773)
aandreassa Aug 6, 2025
278b530
chore(main): release google-cloud-pubsub 3.0.1 (#30763)
release-please[bot] Aug 7, 2025
02d36d9
chore(bigtable): Address conformance test failures (#30754)
aandreassa Aug 7, 2025
1974322
feat: Initial generation of google-apps-events-subscriptions-v1beta (…
yoshi-code-bot Aug 7, 2025
173efe5
chore(main): release google-cloud-firestore 3.1.0 (#30491)
release-please[bot] Aug 7, 2025
3eeb4f8
chore(main): release google-shopping-merchant-accounts-v1 0.1.0 (#30786)
release-please[bot] Aug 8, 2025
561a646
chore(main): release google-shopping-merchant-conversions-v1 0.1.0 (#…
release-please[bot] Aug 8, 2025
0b9a8ee
chore(main): release google-shopping-merchant-data_sources-v1 0.1.0 (…
release-please[bot] Aug 8, 2025
6e049f6
chore(main): release google-shopping-merchant-inventories-v1 0.1.0 (#…
release-please[bot] Aug 8, 2025
6083a18
chore(main): release google-shopping-merchant-issue_resolution-v1 0.1…
release-please[bot] Aug 8, 2025
49498d4
chore(main): release google-shopping-merchant-lfp-v1 0.1.0 (#30791)
release-please[bot] Aug 8, 2025
a110000
chore(main): release google-shopping-merchant-notifications-v1 0.1.0 …
release-please[bot] Aug 8, 2025
41e8675
chore(main): release google-shopping-merchant-order_tracking-v1 0.1.0…
release-please[bot] Aug 8, 2025
c39fa76
chore(main): release google-shopping-merchant-products-v1 0.1.0 (#30794)
release-please[bot] Aug 8, 2025
1a81649
chore(main): release google-shopping-merchant-promotions-v1 0.1.0 (#3…
release-please[bot] Aug 8, 2025
d8ea0ef
chore(main): release google-shopping-merchant-quota-v1 0.1.0 (#30796)
release-please[bot] Aug 8, 2025
12fde8e
chore(main): release google-shopping-merchant-reports-v1 0.1.0 (#30797)
release-please[bot] Aug 8, 2025
45c6b4d
fix(pubsub): Initialize topic_admin by default for the IAM client (#3…
aandreassa Aug 8, 2025
578828e
feat(storage): Support for using Faraday for HTTP requests (#30759)
dazuma Aug 8, 2025
9227a94
feat(bigquery): Support for using Faraday for HTTP requests (#30760)
dazuma Aug 8, 2025
41c1f45
feat: add `service_uri` field to CloudRunRevisionEndpoint (#30810)
gcf-owl-bot[bot] Aug 11, 2025
68ee1b5
feat: A new message `GetAttachmentRequest` and `GetComment` is added …
gcf-owl-bot[bot] Aug 11, 2025
8b20e52
feat: Add new field `salesforce_org` to message `DiscoverConnectionPr…
gcf-owl-bot[bot] Aug 11, 2025
d17d91f
feat: Addition of app auth support for chat api (#30748)
gcf-owl-bot[bot] Aug 11, 2025
b950bb5
feat(BigQuery): add data governance type to routine (#30732)
cy-yun Aug 11, 2025
608d25d
fix(bigtable): Fix mutate rows logic to handle errors (#30766)
aandreassa Aug 11, 2025
9c0fce9
docs: Fix subscriber snippet in OVERVIEW.md (#30813)
aandreassa Aug 11, 2025
51762ab
feat(bigquery): Add table resource tags support (#30804)
aandreassa Aug 11, 2025
b0b590e
fix(container_analysis): Update google-cloud-pubsub dependency to v3.…
aandreassa Aug 11, 2025
3be0594
feat: Add highest_upgradable_cve_severity field to Vulnerability repo…
gcf-owl-bot[bot] Aug 12, 2025
4af7fe6
chore(main): release google-shopping-merchant-reviews-v1beta 0.5.0 (#…
release-please[bot] Aug 12, 2025
1435d44
fix(bigtable-v2): Fixed routing headers when there is an authorized v…
gcf-owl-bot[bot] Aug 12, 2025
7b2af5a
chore(main): release google-cloud-support-v2beta 0.2.0 (#30821)
release-please[bot] Aug 12, 2025
51cf5d1
chore(main): release google-cloud-os_config-v1 1.4.0 (#30820)
release-please[bot] Aug 12, 2025
b5ec021
chore(main): release google-cloud-network_management-v1 2.3.0 (#30819)
release-please[bot] Aug 12, 2025
6fd4086
chore(main): release google-cloud-pubsub 3.0.2 (#30809)
release-please[bot] Aug 12, 2025
fe1cd71
chore(main): release google-cloud-datastream-v1 1.3.0 (#30818)
release-please[bot] Aug 12, 2025
659a448
chore(main): release google-cloud-container_analysis 1.5.3 (#30817)
release-please[bot] Aug 12, 2025
ceba3ea
chore(main): release google-cloud-bigtable 2.12.1 (#30816)
release-please[bot] Aug 12, 2025
6ce0f01
chore(main): release google-apps-chat-v1 0.14.0 (#30815)
release-please[bot] Aug 12, 2025
66e3c13
chore(main): release google-cloud-bigquery 1.53.0 (#30808)
release-please[bot] Aug 12, 2025
77b20fd
feat: Initial generation of google-cloud-config_delivery-v1 (#30761)
yoshi-code-bot Aug 12, 2025
95d5f28
chore(main): release google-apps-events-subscriptions-v1beta 0.1.0 (#…
release-please[bot] Aug 12, 2025
3a4455e
chore(main): release google-cloud-secure_source_manager-v1 2.2.1 (#30…
release-please[bot] Aug 12, 2025
f8ff7e9
feat: add Firestore CloneDatabase support (#30753)
gcf-owl-bot[bot] Aug 12, 2025
a617437
feat: Introducing new Grant states for Withdrawal operation (#30750)
gcf-owl-bot[bot] Aug 12, 2025
35d4e56
feat(BigQuery): load job external table options (#30743)
cy-yun Aug 12, 2025
ef63b6b
feat(ai_platform-v1): Support for the feature_view_direct_write RPC
gcf-owl-bot[bot] Aug 13, 2025
d71e2fe
feat(run-v2): Support for worker pools (#30802)
gcf-owl-bot[bot] Aug 13, 2025
e6c444c
feat(run): Support for worker pools (#30803)
gcf-owl-bot[bot] Aug 13, 2025
182aa7f
chore(gke_hub-v1): Trivial reformats (#30823)
gcf-owl-bot[bot] Aug 13, 2025
636419c
docs(merchant-issue_resolution-v1): Fixed an API documentation link (…
gcf-owl-bot[bot] Aug 13, 2025
5845d70
chore(deps): update actions/checkout action to v5 (#30811)
renovate-bot Aug 13, 2025
e487321
docs(shopping-merchant-accounts-v1): Fixed cross-reference links for …
gcf-owl-bot[bot] Aug 14, 2025
163e2d4
chore: use HTTP binding configuration class from new gapic-common
gcf-owl-bot[bot] Aug 14, 2025
e66b9a0
feat(BigQuery): Add support for format_options_use_int64_timestamp (#…
cy-yun Aug 14, 2025
4afcca1
feat: Initial generation of google-cloud-managed_kafka-schema_registr…
yoshi-code-bot Aug 14, 2025
1447a73
chore(main): release google-cloud-config_delivery-v1 0.1.0 (#30825)
release-please[bot] Aug 14, 2025
e43d50e
chore(main): release google-cloud-firestore-admin-v1 1.7.0 (#30826)
release-please[bot] Aug 14, 2025
4b147c4
chore(BigQuery): Fix flakey acceptance test - sets, updates and remov…
cy-yun Aug 14, 2025
5ab47ce
chore(BigQuery): Add missing unit tests for null_markers, source_colu…
cy-yun Aug 15, 2025
dc2bf93
chore(main): release google-shopping-merchant-accounts-v1 0.1.1 (#30861)
release-please[bot] Aug 15, 2025
a735b79
chore(main): release google-cloud-managed_kafka-schema_registry-v1 0.…
release-please[bot] Aug 15, 2025
0d0be77
chore(main): release google-shopping-merchant-issue_resolution-v1 0.1…
release-please[bot] Aug 15, 2025
616e53d
chore(main): release google-cloud-run-v2 0.26.0 (#30835)
release-please[bot] Aug 15, 2025
46e1c6a
chore(main): release google-cloud-run-client 1.5.0 (#30834)
release-please[bot] Aug 15, 2025
6058a75
chore(main): release google-cloud-ai_platform-v1 1.20.0 (#30833)
release-please[bot] Aug 15, 2025
e4a9c72
chore(main): release google-cloud-privileged_access_manager-v1 1.2.0 …
release-please[bot] Aug 15, 2025
a14b1e8
chore(main): release google-cloud-storage 1.57.0 (#30785)
release-please[bot] Aug 15, 2025
39400dd
chore(main): release google-cloud-bigquery 1.54.0 (#30824)
release-please[bot] Aug 15, 2025
1750471
feat: Initial generation of google-cloud-config_delivery (#30865)
yoshi-code-bot Aug 18, 2025
c9493b3
feat: Initial generation of google-cloud-managed_kafka-schema_registr…
yoshi-code-bot Aug 18, 2025
f9d4848
chore(main): release google-cloud-bigtable-v2 1.9.0 (#30720)
release-please[bot] Aug 18, 2025
08b39a2
feat: Added config options for derived fields and signature detection…
gcf-owl-bot[bot] Aug 18, 2025
1f3b687
feat: Add Reservation.max_slots field to Reservation proto, indicatin…
gcf-owl-bot[bot] Aug 18, 2025
69ecaeb
feat: Add option to enable nested virtualization if available (#30862)
gcf-owl-bot[bot] Aug 18, 2025
05d7f36
chore: use HTTP binding configuration class from new gapic-common (#3…
gcf-owl-bot[bot] Aug 18, 2025
815fcbc
fix!: return type for a number of `list` and `list_<resource>` method…
gcf-owl-bot[bot] Aug 18, 2025
4669d95
chore: use HTTP binding configuration class from new gapic-common (#3…
gcf-owl-bot[bot] Aug 18, 2025
86505cc
chore: use HTTP binding configuration class from new gapic-common (#3…
gcf-owl-bot[bot] Aug 18, 2025
4e7c6b6
feat(BigQuery): Add support for IAM Condition in Dataset Access (#30854)
cy-yun Aug 19, 2025
ba95b56
chore(main): release google-cloud-config_delivery 0.1.0 (#30870)
release-please[bot] Aug 21, 2025
54f846c
chore(main): release google-cloud-managed_kafka-schema_registry 0.1.0…
release-please[bot] Aug 21, 2025
6429828
chore: use HTTP binding configuration class from new gapic-common (#3…
gcf-owl-bot[bot] Aug 22, 2025
52dd671
chore: use HTTP binding configuration class from new gapic-common (#3…
gcf-owl-bot[bot] Aug 22, 2025
55288bb
chore: use HTTP binding configuration class from new gapic-common (#3…
gcf-owl-bot[bot] Aug 22, 2025
8d13054
chore: use HTTP binding configuration class from new gapic-common (#3…
gcf-owl-bot[bot] Aug 22, 2025
9339e15
chore: use HTTP binding configuration class from new gapic-common (#3…
gcf-owl-bot[bot] Aug 22, 2025
2eee652
chore: use HTTP binding configuration class from new gapic-common (#3…
gcf-owl-bot[bot] Aug 22, 2025
8488078
chore: use HTTP binding configuration class from new gapic-common (#3…
gcf-owl-bot[bot] Aug 22, 2025
195669a
Merge branch 'main' into restart_delete_resumable_upload_v3
shubhangi-google Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions google-cloud-storage/lib/google/cloud/storage/bucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,32 @@ def default_kms_key= new_default_kms_key
patch_gapi! :encryption
end

##
# Restart resumable upload
# @param [String, ::File] file Path of the file on the filesystem to
# upload. Can be an File object, or File-like object such as StringIO.
# (If the object does not have path, a `path` argument must be also be
# provided.)
# @param [String] upload_id Unique Id of a resumable upload
#
# @return [Hash(String => String)]
# A Hash of file object returned from server.
#
# @example
# require "google/cloud/storage"
#
# storage = Google::Cloud::Storage.new
#
# bucket = storage.bucket "my-bucket"
# bucket.restart_resumable_upload file,upload_id

def restart_resumable_upload file, upload_id
ensure_service!
ensure_io_or_file_exists! file
raise ArgumentError, "Upload Id missing" unless upload_id
service.restart_resumable_upload name, file, upload_id
end

##
# The period of time (in seconds) that files in the bucket must be
# retained, and cannot be deleted, overwritten, or archived.
Expand Down Expand Up @@ -1410,6 +1436,26 @@ def delete if_metageneration_match: nil, if_metageneration_not_match: nil
user_project: user_project
end

##
# Delete resumable upload
# @param [String] upload_id Unique Id of an resumable upload
#
# @return [Boolean] Returns `true` if the bucket was deleted.
#
# @example
# require "google/cloud/storage"
#
# storage = Google::Cloud::Storage.new
#
# bucket = storage.bucket "my-bucket"
# bucket.delete_resumable_upload upload_id

def delete_resumable_upload upload_id
ensure_service!
raise ArgumentError, "Upload Id missing" unless upload_id
service.delete_resumable_upload name, upload_id
end

##
# Retrieves a list of files matching the criteria.
#
Expand Down
12 changes: 12 additions & 0 deletions google-cloud-storage/lib/google/cloud/storage/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,18 @@ def delete_file bucket_name,
end
end

def restart_resumable_upload bucket_name, source, upload_id, options: {}
execute do
service.restart_resumable_upload bucket_name, source, upload_id, options: options
end
end

def delete_resumable_upload bucket_name, upload_id, options: {}
execute do
service.delete_resumable_upload bucket_name, upload_id, options: options
end
end

##
# Restore soft deleted bucket
def restore_bucket bucket_name,
Expand Down
63 changes: 63 additions & 0 deletions google-cloud-storage/test/google/cloud/storage/bucket_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,69 @@
end
end

it "restarts a resumable upload with upload_id" do
new_file_name = random_file_path
upload_id = "TEST_ID"

Tempfile.open ["google-cloud", ".txt"] do |tmpfile|
tmpfile.write "Hello world"
tmpfile.rewind
mock = Minitest::Mock.new
expected_return_value = create_file_gapi(bucket.name, new_file_name)
mock.expect :restart_resumable_upload, expected_return_value,
[bucket.name, tmpfile, upload_id],
**resumable_upload_args(options: {})
bucket.service.mocked_service = mock
returned_value= bucket.restart_resumable_upload tmpfile, upload_id
assert_equal expected_return_value, returned_value
mock.verify
end
end

it "raises ArgumentError if upload_id is not provided to restart_resumable_upload" do
new_file_name = random_file_path
upload_id = "TEST_ID"

Tempfile.open ["google-cloud", ".txt"] do |tmpfile|
tmpfile.write "Hello world"
tmpfile.rewind
mock = Minitest::Mock.new
mock.expect :restart_resumable_upload, create_file_gapi(bucket.name, new_file_name),
[bucket.name, tmpfile, upload_id],
**resumable_upload_args(options: {})
bucket.service.mocked_service = mock
expect do
bucket.restart_resumable_upload tmpfile
end.must_raise ArgumentError
end
end

it "deletes a resumable upload with upload_id" do
upload_id = "TEST_ID"

mock = Minitest::Mock.new
expected_return_value = true
mock.expect :delete_resumable_upload, expected_return_value,
[bucket.name, upload_id],
**resumable_upload_args(options: {})
bucket.service.mocked_service = mock
returned_value = bucket.delete_resumable_upload upload_id
assert_equal expected_return_value, returned_value
mock.verify
end

it "Raises ArgumentError if upload_id is not provided to delete_resumable_upload" do
upload_id = "TEST_ID"
mock = Minitest::Mock.new
mock.expect :delete_resumable_upload, true,
[bucket.name, upload_id],
**resumable_upload_args(options: {})
bucket.service.mocked_service = mock
expect do
bucket.delete_resumable_upload
end.must_raise ArgumentError
end

def create_file_gapi bucket=nil, name = nil
Google::Apis::StorageV1::Object.from_json random_file_hash(bucket, name).to_json
end
Expand Down
6 changes: 6 additions & 0 deletions google-cloud-storage/test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,12 @@ def insert_object_args name: nil,
}
end

def resumable_upload_args options: {}
{
options: options
}
end

def get_object_args generation: nil,
if_generation_match: nil,
if_generation_not_match: nil,
Expand Down
Loading