Skip to content
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

Feat: added feature to delete an object from multiple buckets on goog… #29

Merged
merged 10 commits into from
Aug 26, 2024
Binary file added .DS_Store
opensaucerer marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
2 changes: 2 additions & 0 deletions bifrost.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ func newGoogleCloudStorage(bc *BridgeConfig) (RainbowBridge, error) {
EnableDebug: bc.EnableDebug,
PublicRead: bc.PublicRead,
UseAsync: bc.UseAsync,
Object: bc.Object,
Buckets: bc.Buckets,
opensaucerer marked this conversation as resolved.
Show resolved Hide resolved
}, nil
}

Expand Down
21 changes: 21 additions & 0 deletions gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,24 @@ Note: for some providers, UploadFolder requires that a default bucket be set in
func (g *GoogleCloudStorage) UploadFolder(foldFace interface{}) ([]*types.UploadedFile, error) {
return nil, nil
}

/*
DeleteObject deletes an object from an array of buckets in the provider's storage and returns an error if one occurs.

Note: DeleteObject requires that an object and an array of buckets to be set in bifrost.BridgeConfig.
*/
func (g *GoogleCloudStorage) DeleteObject() error {

for _, bucketName := range g.Buckets {
bucket := g.Client.Bucket(bucketName)
obj := bucket.Object(g.Object)

if err := obj.Delete(context.Background()); err != nil {
return &errors.BifrostError{
Err: err,
ErrorCode: errors.ErrUnauthorized,
}
}
}
return nil
}
opensaucerer marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions gcs/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ type GoogleCloudStorage struct {
PublicRead bool
// UseAsync enables asynchronous operations with go routines.
UseAsync bool
// Buckets specifics the list of bucket names to interact with
Buckets []string
// Object specifics an object name in a bucket to interact with
Object string
}
9 changes: 9 additions & 0 deletions pinata/pinata.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,12 @@ func (p *PinataCloud) UploadMultiFile(multiFace interface{}) ([]*types.UploadedF

return uploadedFiles, nil
}

/*
DeleteObject deletes an object from an array of buckets in the provider's storage and returns an error if one occurs.

Note: DeleteObject requires that an object and an array of buckets to be set in bifrost.BridgeConfig.
*/
func (p *PinataCloud) DeleteObject() error {
return nil
}
9 changes: 9 additions & 0 deletions s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,12 @@ Note: for some providers, UploadFolder requires that a default bucket be set in
func (s *SimpleStorageService) UploadFolder(foldFace interface{}) ([]*types.UploadedFile, error) {
return nil, nil
}

/*
DeleteObject deletes an object from an array of buckets in the provider's storage and returns an error if one occurs.

Note: DeleteObject requires that an object and an array of buckets to be set in bifrost.BridgeConfig.
*/
func (s *SimpleStorageService) DeleteObject() error {
return nil
}
Binary file added shared/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions shared/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ type BridgeConfig struct {
UseAsync bool
// PinataJWT is the JWT generated for your Pinata cloud account
PinataJWT string
// Buckets specifics the list of bucket names to interact with
Buckets []string
// Object specifics an object name in a bucket to interact with
Object string
}
6 changes: 6 additions & 0 deletions struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ type RainbowBridge interface {
Note: for some providers, UploadFolder requires that a default bucket be set in bifrost.BridgeConfig.
*/
UploadFolder(foldFace interface{}) ([]*types.UploadedFile, error)
/*
DeleteObject deletes an object from an array of buckets in the provider's storage and returns an error if one occurs.

Note: DeleteObject requires that an object and an array of buckets to be set in bifrost.BridgeConfig.
*/
DeleteObject() error
}

// BifrostError is the interface for errors returned by Bifrost.
Expand Down
9 changes: 9 additions & 0 deletions wasabi/wasabi.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,12 @@ Note: for some providers, UploadFolder requires that a default bucket be set in
func (w *WasabiCloudStorage) UploadFolder(foldFace interface{}) ([]*types.UploadedFile, error) {
return nil, nil
}

/*
DeleteObject deletes an object from an array of buckets in the provider's storage and returns an error if one occurs.

Note: DeleteObject requires that an object and an array of buckets to be set in bifrost.BridgeConfig.
*/
func (w *WasabiCloudStorage) DeleteObject() error {
return nil
}