1d3b728766
The same was that our Admin API handles project and account deletions currently, we would like to have the same checks on the user-facing API. This PR adds the same checks to the console service. General more applicable checks have been moved directly into the payments service. In addition it adds the BucketsDB to the console DB, to have easier access and avoiding import cycles with the metainfo package. A small cleanup around our unnecessary monkit imports made it in as well. Change-Id: I8769b01c2271c1687fbd2269a738a41764216e51
34 lines
1.3 KiB
Go
34 lines
1.3 KiB
Go
// Copyright (C) 2020 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package console
|
|
|
|
import (
|
|
"context"
|
|
|
|
"storj.io/common/macaroon"
|
|
"storj.io/common/storj"
|
|
"storj.io/common/uuid"
|
|
"storj.io/storj/satellite/metainfo/metabase"
|
|
)
|
|
|
|
// Buckets is the interface for the database to interact with buckets.
|
|
//
|
|
// architecture: Database
|
|
type Buckets interface {
|
|
// Create creates a new bucket.
|
|
CreateBucket(ctx context.Context, bucket storj.Bucket) (_ storj.Bucket, err error)
|
|
// Get returns an existing bucket.
|
|
GetBucket(ctx context.Context, bucketName []byte, projectID uuid.UUID) (bucket storj.Bucket, err error)
|
|
// GetBucketID returns an existing bucket id.
|
|
GetBucketID(ctx context.Context, bucket metabase.BucketLocation) (id uuid.UUID, err error)
|
|
// UpdateBucket updates an existing bucket.
|
|
UpdateBucket(ctx context.Context, bucket storj.Bucket) (_ storj.Bucket, err error)
|
|
// Delete deletes a bucket.
|
|
DeleteBucket(ctx context.Context, bucketName []byte, projectID uuid.UUID) (err error)
|
|
// List returns all buckets for a project.
|
|
ListBuckets(ctx context.Context, projectID uuid.UUID, listOpts storj.BucketListOptions, allowedBuckets macaroon.AllowedBuckets) (bucketList storj.BucketList, err error)
|
|
// CountBuckets returns the number of buckets a project currently has.
|
|
CountBuckets(ctx context.Context, projectID uuid.UUID) (int, error)
|
|
}
|