Module: TerraspacePluginGoogle::Clients

Extended by:
Memoist
Included in:
Interfaces::Backend, Interfaces::Helper::Secret, Interfaces::Summary
Defined in:
lib/terraspace_plugin_google/clients.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/terraspace_plugin_google/clients.rb', line 9

def initialize(*)
  # So google sdk newer versions use GOOGLE_CLOUD_PROJECT instead of GOOGLE_PROJECT
  # Found out between google-cloud-storage-1.35.0 and google-cloud-storage-1.28.0
  # Though it seems like an library underneath that with the change.
  # Keeping backwards compatibility to not create breakage users who already have GOOGLE_PROJECT
  # But then setting GOOGLE_CLOUD_PROJECT so it works with the SDK.
  # For users, who set GOOGLE_CLOUD_PROJECT that will work also.
  ENV['GOOGLE_CLOUD_PROJECT'] ||= ENV['GOOGLE_PROJECT']
  super
end

#resource_managerObject



30
31
32
# File 'lib/terraspace_plugin_google/clients.rb', line 30

def resource_manager
  Google::Cloud.new.resource_manager
end

#secret_manager_serviceObject



20
21
22
# File 'lib/terraspace_plugin_google/clients.rb', line 20

def secret_manager_service
  Google::Cloud::SecretManager.secret_manager_service
end

#storageObject



25
26
27
# File 'lib/terraspace_plugin_google/clients.rb', line 25

def storage
  Google::Cloud::Storage.new
end