cloudflareprovider

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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

func ConvertR2TokenToS3Credentials

func ConvertR2TokenToS3Credentials(tokenId string, tokenValue string) (accessKey, secretKey string)

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 (c *Cloudflare) CheckBucketExists(ctx *core.Context, bucketName string) (bool, error)

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 (c *Cloudflare) DeleteR2Bucket(ctx *core.Context, bucketToDelete *s3_ns.Bucket) error

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 DevSideConfig struct {
	AdditionalTokensApiToken string `json:"additional-tokens-api-token"`
	AccountID                string `json:"account-id"`
}

type HighPermsCloudflareTokens

type HighPermsCloudflareTokens struct {
	//permissions: list/create/delete buckets + any object operations
	R2Token *providertypes.TempToken `json:"r2Token,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL