Skip to content

Commit

Permalink
remove get_source_url
Browse files Browse the repository at this point in the history
  • Loading branch information
angusmcleod committed Oct 25, 2024
1 parent c5dcd71 commit 0b6fa79
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions app/models/subscription_client_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ class SubscriptionClientResource < ActiveRecord::Base
has_many :notices, class_name: "SubscriptionClientNotice", as: :notice_subject, dependent: :destroy
has_many :subscriptions, foreign_key: "resource_id", class_name: "SubscriptionClientSubscription", dependent: :destroy

def get_source_url(bucket)
return nil unless access_key_id && secret_access_key && s3_client
return nil unless can_access_bucket?(bucket)

"s3://#{CGI.escapeURIComponent(access_key_id)}:#{CGI.escapeURIComponent(secret_access_key)}@#{bucket}"
end

def can_access_bucket?(bucket)
s3_client.head_bucket(bucket: bucket)
true
Expand All @@ -28,12 +21,16 @@ def s3_client
return nil unless access_key_id && secret_access_key

Aws::S3::Client.new(
region: "us-east-1",
region: region,
access_key_id: access_key_id,
secret_access_key: secret_access_key
)
end
end

def region
"us-east-1"
end
end

# == Schema Information
Expand Down

0 comments on commit 0b6fa79

Please sign in to comment.