Class: TerraspacePluginGoogle::Interfaces::Summary
- Inherits:
-
Object
- Object
- TerraspacePluginGoogle::Interfaces::Summary
- Includes:
- Terraspace::Plugin::Summary::Interface, Clients
- Defined in:
- lib/terraspace_plugin_google/interfaces/summary.rb
Instance Method Summary collapse
-
#delete_empty_statefile(key) ⇒ Object
interface method.
-
#download ⇒ Object
interface method.
-
#key_field ⇒ Object
interface method.
Methods included from Clients
#initialize, #resource_manager, #secret_manager_service, #storage
Instance Method Details
#delete_empty_statefile(key) ⇒ Object
interface method
29 30 31 32 33 |
# File 'lib/terraspace_plugin_google/interfaces/summary.rb', line 29 def delete_empty_statefile(key) bucket = storage.bucket(@bucket) file = bucket.file(key) file.delete end |
#download ⇒ Object
interface method
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/terraspace_plugin_google/interfaces/summary.rb', line 12 def download bucket = storage.bucket(@bucket) unless bucket logger.error "ERROR: bucket #{@bucket} does not exist".color(:red) exit 1 end bucket.files(prefix: @folder).all do |f| file = bucket.file(f.name) next if file.nil? # in case file has been removed since .files # Note the f.name already includes the folder local_path = "#{@dest}/#{f.name}" FileUtils.mkdir_p(File.dirname(local_path)) file.download(local_path) end end |
#key_field ⇒ Object
interface method
7 8 9 |
# File 'lib/terraspace_plugin_google/interfaces/summary.rb', line 7 def key_field 'prefix' end |