Skip to content

Commit

Permalink
refactor: refactor DigitalOcean provider module
Browse files Browse the repository at this point in the history
  • Loading branch information
vst committed May 6, 2024
1 parent f5cdaf1 commit 63692f5
Show file tree
Hide file tree
Showing 6 changed files with 664 additions and 559 deletions.
8 changes: 4 additions & 4 deletions src/Clompse/Programs/ListObjectBuckets.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ listObjectBucketsForCloudConnection (CloudConnectionAws conn) = do
eBucketsS3 <- runExceptT (Providers.Aws.awsListAllS3Buckets conn)
bucketsS3 <- case eBucketsS3 of
Left e -> _log (" ERROR (AWS S3): " <> Z.Text.tshow e) >> pure []
Right buckets -> pure (fmap (\(n, c) -> Types.ObjectBucket n Types.ProviderAws "S3" (Just c)) buckets)
Right buckets -> pure (fmap (\(n, c) -> Types.ObjectBucket n Types.ProviderAws "s3" (Just c)) buckets)
eBucketsLightsail <- runExceptT (Providers.Aws.awsListAllLightsailBuckets conn)
bucketsLightsail <- case eBucketsLightsail of
Left e -> _log (" ERROR (AWS Lightsail): " <> Z.Text.tshow e) >> pure []
Right buckets -> pure (fmap (\(n, c) -> Types.ObjectBucket n Types.ProviderAws "Lightsail" (Just c)) buckets)
Right buckets -> pure (fmap (\(n, c) -> Types.ObjectBucket n Types.ProviderAws "lightsail" (Just c)) buckets)
pure $ bucketsS3 <> bucketsLightsail
listObjectBucketsForCloudConnection (CloudConnectionDo _conn) = do
eBucketSpaces <- runExceptT (Providers.Do.doListSpacesBuckets _conn)
eBucketSpaces <- runExceptT (Providers.Do.listBuckets _conn)
case eBucketSpaces of
Left e -> _log (" ERROR (DO Spaces): " <> Z.Text.tshow e) >> pure []
Right buckets -> pure (fmap (\(n, c) -> Types.ObjectBucket n Types.ProviderDo "Spaces" (Just c)) buckets)
Right buckets -> pure buckets
listObjectBucketsForCloudConnection (CloudConnectionHetzner _conn) = do
pure []

Expand Down
4 changes: 2 additions & 2 deletions src/Clompse/Programs/ListServers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ listServersForCloudConnection (CloudConnectionAws conn) = do
Right servers -> pure servers
pure (fmap Providers.ec2InstanceToServer serversEc2 <> fmap (uncurry Providers.lightsailInstanceToServer) serversLightsail)
listServersForCloudConnection (CloudConnectionDo conn) = do
eServers <- runExceptT (Providers.Do.doListDroplets conn)
eServers <- runExceptT (Providers.Do.listServers conn)
case eServers of
Left e -> _log (" ERROR (DO): " <> Z.Text.tshow e) >> pure []
Right servers -> pure (fmap Providers.Do.toServer servers)
Right servers -> pure servers
listServersForCloudConnection (CloudConnectionHetzner conn) = do
eServers <- runExceptT (Providers.Hetzner.listServers conn)
case eServers of
Expand Down
Loading

0 comments on commit 63692f5

Please sign in to comment.