Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertR2TokenToS3Credentials(tokenId string, tokenValue string) (accessKey, secretKey string)
- type Cloudflare
- func (c *Cloudflare) CheckBucketExists(ctx *core.Context, bucketName string) (bool, error)
- func (c *Cloudflare) CheckBucketExistsNoLock(ctx *core.Context, bucketName string, api *cloudflare.API) (bool, error)
- func (c *Cloudflare) CreateR2Bucket(ctx *core.Context, bucketName string) error
- func (c *Cloudflare) DeleteR2Bucket(ctx *core.Context, bucketToDelete *s3_ns.Bucket) error
- func (c *Cloudflare) GetCreateS3CredentialsForSingleBucket(ctx *core.Context, bucketName string, projectId core.ProjectID) (_ singleR2BucketCredentials, finalErr error)
- func (c *Cloudflare) GetHighPermsS3Credentials(ctx *core.Context) (accessKey, secretKey string, resultOk bool)
- func (c *Cloudflare) GetUpToDateTempTokens(ctx context.Context) (HighPermsCloudflareTokens, error)
- func (c *Cloudflare) R2PermGroups() []cloudflare.APITokenPermissionGroups
- func (c *Cloudflare) S3EndpointForR2() core.Host
- func (c *Cloudflare) TempTokens() HighPermsCloudflareTokens
- type DevSideConfig
- type HighPermsCloudflareTokens
Constants ¶
View Source
const ( R2_TOKEN_POST_CREATION_DELAY = 1500 * time.Millisecond R2_BUCKET_POST_CREATION_DELAY = 100 * time.Millisecond R2_PERM_GROUPS_FETCH_WAITING_TIMEOUT = 5 * time.Second )
Variables ¶
View Source
var (
ErrMissingHighPermsR2Token = errors.New("missing high-permissions R2 token")
)
View Source
var (
ErrNoR2Token = errors.New("no R2 token")
)
Functions ¶
Types ¶
type Cloudflare ¶
type Cloudflare struct {
// contains filtered or unexported fields
}
TODO: explanaton
func New ¶
func New(projectId core.ProjectID, config *DevSideConfig) (*Cloudflare, error)
func (*Cloudflare) CheckBucketExists ¶
func (*Cloudflare) CheckBucketExistsNoLock ¶
func (c *Cloudflare) CheckBucketExistsNoLock(ctx *core.Context, bucketName string, api *cloudflare.API) (bool, error)
func (*Cloudflare) CreateR2Bucket ¶
func (c *Cloudflare) CreateR2Bucket(ctx *core.Context, bucketName string) error
func (*Cloudflare) DeleteR2Bucket ¶
func (*Cloudflare) GetCreateS3CredentialsForSingleBucket ¶
func (c *Cloudflare) GetCreateS3CredentialsForSingleBucket( ctx *core.Context, bucketName string, projectId core.ProjectID, ) (_ singleR2BucketCredentials, finalErr error)
GetCreateS3CredentialsForSingleBucket creates the bucket bucketName if it does not exist & returns credentials to access the bucket.
func (*Cloudflare) GetHighPermsS3Credentials ¶
func (c *Cloudflare) GetHighPermsS3Credentials(ctx *core.Context) (accessKey, secretKey string, resultOk bool)
func (*Cloudflare) GetUpToDateTempTokens ¶
func (c *Cloudflare) GetUpToDateTempTokens(ctx context.Context) (HighPermsCloudflareTokens, error)
func (*Cloudflare) R2PermGroups ¶
func (c *Cloudflare) R2PermGroups() []cloudflare.APITokenPermissionGroups
func (*Cloudflare) S3EndpointForR2 ¶
func (c *Cloudflare) S3EndpointForR2() core.Host
func (*Cloudflare) TempTokens ¶
func (c *Cloudflare) TempTokens() HighPermsCloudflareTokens
type DevSideConfig ¶
type HighPermsCloudflareTokens ¶
type HighPermsCloudflareTokens struct { //permissions: list/create/delete buckets + any object operations R2Token *providertypes.TempToken `json:"r2Token,omitempty"` }
Click to show internal directories.
Click to hide internal directories.