archived_remote_object 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/archived_remote_object/archive/archived_object.rb +7 -0
- data/lib/archived_remote_object/aws_s3/archived_object.rb +4 -0
- data/lib/archived_remote_object/aws_s3/client.rb +5 -0
- data/lib/archived_remote_object/aws_s3/remote_object.rb +5 -0
- data/lib/archived_remote_object/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8fd27ad3b07bda906169814dea5a5e305174715de286d749c9825dfdd5f2d98
|
4
|
+
data.tar.gz: e67315f5d0825f5c66cef22667424b1a5d90f04e060ec91801cd3a00e376131e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daa4996fb18897a4ec59844e858d997e581fbfba067374243d5f02f649913642b3a22b1f056868dad3e7dde84b51d4918031312b8c83774ee115523c4243060e
|
7
|
+
data.tar.gz: 55b449a47b42b1a36bb2f1f17c893421f9628b5a96ccc53d3dbeffdc2f2a5375c9538048932775434bd75077ecd9ef0940d7da9da7bcea014a42620dfacfbb4b
|
@@ -4,6 +4,7 @@ module ArchivedRemoteObject
|
|
4
4
|
module Archive
|
5
5
|
class ArchivedObject
|
6
6
|
CantBeRestoredError = Class.new(StandardError)
|
7
|
+
CantStopArchivingOnDurationError = Class.new(StandardError)
|
7
8
|
|
8
9
|
def initialize(
|
9
10
|
key:,
|
@@ -34,6 +35,12 @@ module ArchivedRemoteObject
|
|
34
35
|
remote_object.restore
|
35
36
|
end
|
36
37
|
|
38
|
+
def stop_archiving_on_duration
|
39
|
+
raise CantStopArchivingOnDurationError if !restored? || restore_in_progress?
|
40
|
+
|
41
|
+
remote_object.stop_archiving_on_duration
|
42
|
+
end
|
43
|
+
|
37
44
|
def available?
|
38
45
|
!archived? || restored?
|
39
46
|
end
|
@@ -33,6 +33,11 @@ module ArchivedRemoteObject
|
|
33
33
|
s3_client.restore_object(bucket: bucket, key: key, restore_request: { days: duration })
|
34
34
|
end
|
35
35
|
|
36
|
+
def assign_storage_class(key:, storage_class:)
|
37
|
+
s3_client.stub_responses(:copy_object) if stubbed?
|
38
|
+
s3_client.copy_object(bucket: bucket, key: key, copy_source: "#{bucket}/#{key}", storage_class: storage_class)
|
39
|
+
end
|
40
|
+
|
36
41
|
private
|
37
42
|
|
38
43
|
def bucket
|
@@ -23,6 +23,11 @@ module ArchivedRemoteObject
|
|
23
23
|
remote_client.restore(**args)
|
24
24
|
end
|
25
25
|
|
26
|
+
def storage_class=(storage_class)
|
27
|
+
# accepts STANDARD, STANDARD_IA, ONEZONE_IA, GLACIER, INTELLIGENT_TIERING, DEEP_ARCHIVE
|
28
|
+
remote_client.assign_storage_class(key: key, storage_class: storage_class)
|
29
|
+
end
|
30
|
+
|
26
31
|
def sync
|
27
32
|
tap { fetch_attributes }
|
28
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: archived_remote_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksey Strizhak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
|
-
rubygems_version: 3.
|
107
|
+
rubygems_version: 3.2.16
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: Get archived remote object with delayed restore
|