Skip to content

Google cloud storage added in source #650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

developerJai
Copy link
Contributor

Google Cloud Storage source integration implemented

@developerJai developerJai marked this pull request as draft March 19, 2025 10:19
hassimnaseef pushed a commit that referenced this pull request Mar 20, 2025
Co-authored-by: codiumai-pr-agent-pro[bot] <151058649+codiumai-pr-agent-pro[bot]@users.noreply.github.com>
Co-authored-by: sangkum <sangit.kumar@squared.ai>
@afthabvp
Copy link
Collaborator

@developerJai could you please split the PR for Google Cloud Storage into separate ones for source and destination?

Comment on lines 86 to 94
storage = Google::Cloud::Storage.new(
project_id: project_id,
credentials: {
type: "service_account",
project_id: project_id,
private_key: formatted_key,
client_email: client_email
}
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@developerJai please move this to a separate method and call it to avoid duplication.

Comment on lines 15 to 27
# Validate required parameters
missing_params = []
missing_params << "project_id" if project_id.nil? || project_id.strip.empty?
missing_params << "client_email" if client_email.nil? || client_email.strip.empty?
missing_params << "private_key" if private_key.nil? || private_key.strip.empty?
missing_params << "bucket" if bucket.nil? || bucket.strip.empty?

if missing_params.any?
return ConnectionStatus.new(
status: ConnectionStatusType["failed"],
message: "Missing required parameters: #{missing_params.join(', ')}"
).to_multiwoven_message
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@developerJai the empty validation is not required, as the JSON schema already validates these fields.

end

begin
require 'google/cloud/storage'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@developerJai this import not required

Comment on lines 97 to 112
bucket_obj = storage.bucket(bucket)

# Prepare the path prefix
prefix = path.start_with?("/") ? path[1..-1] : path

# List files in the bucket with the given prefix
files = bucket_obj.files(prefix: prefix)

# Filter files by file type
files = files.select { |file| file.name.end_with?(".#{file_type}") }

if files.empty?
return Catalog.new(
streams: []
).to_multiwoven_message
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@developerJai please move the file validation inside the check_connection method. The discover method should only handle returning the catalog.

@developerJai developerJai deleted the feature/new-source-google-cloud-storage branch March 25, 2025 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants