r2

package
v2.0.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketDeleteParams

type BucketDeleteParams struct {
	// Account ID
	AccountID param.Field[string] `path:"account_id,required"`
}

type BucketDeleteResponse

type BucketDeleteResponse = interface{}

type BucketDeleteResponseEnvelope

type BucketDeleteResponseEnvelope struct {
	Errors   []BucketDeleteResponseEnvelopeErrors `json:"errors,required"`
	Messages []string                             `json:"messages,required"`
	Result   BucketDeleteResponse                 `json:"result,required"`
	// Whether the API call was successful
	Success BucketDeleteResponseEnvelopeSuccess `json:"success,required"`
	JSON    bucketDeleteResponseEnvelopeJSON    `json:"-"`
}

func (*BucketDeleteResponseEnvelope) UnmarshalJSON

func (r *BucketDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type BucketDeleteResponseEnvelopeErrors

type BucketDeleteResponseEnvelopeErrors struct {
	Code    int64                                  `json:"code,required"`
	Message string                                 `json:"message,required"`
	JSON    bucketDeleteResponseEnvelopeErrorsJSON `json:"-"`
}

func (*BucketDeleteResponseEnvelopeErrors) UnmarshalJSON

func (r *BucketDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)

type BucketDeleteResponseEnvelopeSuccess

type BucketDeleteResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	BucketDeleteResponseEnvelopeSuccessTrue BucketDeleteResponseEnvelopeSuccess = true
)

type BucketGetParams

type BucketGetParams struct {
	// Account ID
	AccountID param.Field[string] `path:"account_id,required"`
}

type BucketGetResponseEnvelope

type BucketGetResponseEnvelope struct {
	Errors   []BucketGetResponseEnvelopeErrors `json:"errors,required"`
	Messages []string                          `json:"messages,required"`
	// A single R2 bucket
	Result R2Bucket `json:"result,required"`
	// Whether the API call was successful
	Success BucketGetResponseEnvelopeSuccess `json:"success,required"`
	JSON    bucketGetResponseEnvelopeJSON    `json:"-"`
}

func (*BucketGetResponseEnvelope) UnmarshalJSON

func (r *BucketGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type BucketGetResponseEnvelopeErrors

type BucketGetResponseEnvelopeErrors struct {
	Code    int64                               `json:"code,required"`
	Message string                              `json:"message,required"`
	JSON    bucketGetResponseEnvelopeErrorsJSON `json:"-"`
}

func (*BucketGetResponseEnvelopeErrors) UnmarshalJSON

func (r *BucketGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)

type BucketGetResponseEnvelopeSuccess

type BucketGetResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	BucketGetResponseEnvelopeSuccessTrue BucketGetResponseEnvelopeSuccess = true
)

type BucketListParams

type BucketListParams struct {
	// Account ID
	AccountID param.Field[string] `path:"account_id,required"`
	// Pagination cursor received during the last List Buckets call. R2 buckets are
	// paginated using cursors instead of page numbers.
	Cursor param.Field[string] `query:"cursor"`
	// Direction to order buckets
	Direction param.Field[BucketListParamsDirection] `query:"direction"`
	// Bucket names to filter by. Only buckets with this phrase in their name will be
	// returned.
	NameContains param.Field[string] `query:"name_contains"`
	// Field to order buckets by
	Order param.Field[BucketListParamsOrder] `query:"order"`
	// Maximum number of buckets to return in a single call
	PerPage param.Field[float64] `query:"per_page"`
	// Bucket name to start searching after. Buckets are ordered lexicographically.
	StartAfter param.Field[string] `query:"start_after"`
}

func (BucketListParams) URLQuery

func (r BucketListParams) URLQuery() (v url.Values)

URLQuery serializes BucketListParams's query parameters as `url.Values`.

type BucketListParamsDirection

type BucketListParamsDirection string

Direction to order buckets

const (
	BucketListParamsDirectionAsc  BucketListParamsDirection = "asc"
	BucketListParamsDirectionDesc BucketListParamsDirection = "desc"
)

type BucketListParamsOrder

type BucketListParamsOrder string

Field to order buckets by

const (
	BucketListParamsOrderName BucketListParamsOrder = "name"
)

type BucketNewParams

type BucketNewParams struct {
	// Account ID
	AccountID param.Field[string] `path:"account_id,required"`
	// Name of the bucket
	Name param.Field[string] `json:"name,required"`
	// Location of the bucket
	LocationHint param.Field[BucketNewParamsLocationHint] `json:"locationHint"`
}

func (BucketNewParams) MarshalJSON

func (r BucketNewParams) MarshalJSON() (data []byte, err error)

type BucketNewParamsLocationHint

type BucketNewParamsLocationHint string

Location of the bucket

const (
	BucketNewParamsLocationHintApac BucketNewParamsLocationHint = "apac"
	BucketNewParamsLocationHintEeur BucketNewParamsLocationHint = "eeur"
	BucketNewParamsLocationHintEnam BucketNewParamsLocationHint = "enam"
	BucketNewParamsLocationHintWeur BucketNewParamsLocationHint = "weur"
	BucketNewParamsLocationHintWnam BucketNewParamsLocationHint = "wnam"
)

type BucketNewResponseEnvelope

type BucketNewResponseEnvelope struct {
	Errors   []BucketNewResponseEnvelopeErrors `json:"errors,required"`
	Messages []string                          `json:"messages,required"`
	// A single R2 bucket
	Result R2Bucket `json:"result,required"`
	// Whether the API call was successful
	Success BucketNewResponseEnvelopeSuccess `json:"success,required"`
	JSON    bucketNewResponseEnvelopeJSON    `json:"-"`
}

func (*BucketNewResponseEnvelope) UnmarshalJSON

func (r *BucketNewResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type BucketNewResponseEnvelopeErrors

type BucketNewResponseEnvelopeErrors struct {
	Code    int64                               `json:"code,required"`
	Message string                              `json:"message,required"`
	JSON    bucketNewResponseEnvelopeErrorsJSON `json:"-"`
}

func (*BucketNewResponseEnvelopeErrors) UnmarshalJSON

func (r *BucketNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)

type BucketNewResponseEnvelopeSuccess

type BucketNewResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	BucketNewResponseEnvelopeSuccessTrue BucketNewResponseEnvelopeSuccess = true
)

type BucketService

type BucketService struct {
	Options []option.RequestOption
}

BucketService contains methods and other services that help with interacting with the cloudflare API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBucketService method instead.

func NewBucketService

func NewBucketService(opts ...option.RequestOption) (r *BucketService)

NewBucketService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*BucketService) Delete

func (r *BucketService) Delete(ctx context.Context, bucketName string, body BucketDeleteParams, opts ...option.RequestOption) (res *BucketDeleteResponse, err error)

Deletes an existing R2 bucket.

func (*BucketService) Get

func (r *BucketService) Get(ctx context.Context, bucketName string, query BucketGetParams, opts ...option.RequestOption) (res *R2Bucket, err error)

Gets metadata for an existing R2 bucket.

func (*BucketService) List

Lists all R2 buckets on your account

func (*BucketService) ListAutoPaging

Lists all R2 buckets on your account

func (*BucketService) New

func (r *BucketService) New(ctx context.Context, params BucketNewParams, opts ...option.RequestOption) (res *R2Bucket, err error)

Creates a new R2 bucket.

type Error

type Error = apierror.Error

type R2Bucket

type R2Bucket struct {
	// Creation timestamp
	CreationDate string `json:"creation_date"`
	// Location of the bucket
	Location R2BucketLocation `json:"location"`
	// Name of the bucket
	Name string       `json:"name"`
	JSON r2BucketJSON `json:"-"`
}

A single R2 bucket

func (*R2Bucket) UnmarshalJSON

func (r *R2Bucket) UnmarshalJSON(data []byte) (err error)

type R2BucketLocation

type R2BucketLocation string

Location of the bucket

const (
	R2BucketLocationApac R2BucketLocation = "apac"
	R2BucketLocationEeur R2BucketLocation = "eeur"
	R2BucketLocationEnam R2BucketLocation = "enam"
	R2BucketLocationWeur R2BucketLocation = "weur"
	R2BucketLocationWnam R2BucketLocation = "wnam"
)

type R2Service

type R2Service struct {
	Options []option.RequestOption
	Buckets *BucketService
	Sippy   *SippyService
}

R2Service contains methods and other services that help with interacting with the cloudflare API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewR2Service method instead.

func NewR2Service

func NewR2Service(opts ...option.RequestOption) (r *R2Service)

NewR2Service generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type R2Sippy

type R2Sippy struct {
	// Details about the configured destination bucket
	Destination R2SippyDestination `json:"destination"`
	// State of Sippy for this bucket
	Enabled bool `json:"enabled"`
	// Details about the configured source bucket
	Source R2SippySource `json:"source"`
	JSON   r2SippyJSON   `json:"-"`
}

func (*R2Sippy) UnmarshalJSON

func (r *R2Sippy) UnmarshalJSON(data []byte) (err error)

type R2SippyDestination

type R2SippyDestination struct {
	// ID of the Cloudflare API token used when writing objects to this bucket
	AccessKeyID string `json:"accessKeyId"`
	Account     string `json:"account"`
	// Name of the bucket on the provider
	Bucket   string                     `json:"bucket"`
	Provider R2SippyDestinationProvider `json:"provider"`
	JSON     r2SippyDestinationJSON     `json:"-"`
}

Details about the configured destination bucket

func (*R2SippyDestination) UnmarshalJSON

func (r *R2SippyDestination) UnmarshalJSON(data []byte) (err error)

type R2SippyDestinationProvider

type R2SippyDestinationProvider string
const (
	R2SippyDestinationProviderR2 R2SippyDestinationProvider = "r2"
)

type R2SippySource

type R2SippySource struct {
	// Name of the bucket on the provider
	Bucket   string                `json:"bucket"`
	Provider R2SippySourceProvider `json:"provider"`
	// Region where the bucket resides (AWS only)
	Region string            `json:"region,nullable"`
	JSON   r2SippySourceJSON `json:"-"`
}

Details about the configured source bucket

func (*R2SippySource) UnmarshalJSON

func (r *R2SippySource) UnmarshalJSON(data []byte) (err error)

type R2SippySourceProvider

type R2SippySourceProvider string
const (
	R2SippySourceProviderAws R2SippySourceProvider = "aws"
	R2SippySourceProviderGcs R2SippySourceProvider = "gcs"
)

type SippyDeleteParams

type SippyDeleteParams struct {
	// Account ID
	AccountID param.Field[string] `path:"account_id,required"`
}

type SippyDeleteResponse

type SippyDeleteResponse struct {
	Enabled SippyDeleteResponseEnabled `json:"enabled"`
	JSON    sippyDeleteResponseJSON    `json:"-"`
}

func (*SippyDeleteResponse) UnmarshalJSON

func (r *SippyDeleteResponse) UnmarshalJSON(data []byte) (err error)

type SippyDeleteResponseEnabled

type SippyDeleteResponseEnabled bool
const (
	SippyDeleteResponseEnabledFalse SippyDeleteResponseEnabled = false
)

type SippyDeleteResponseEnvelope

type SippyDeleteResponseEnvelope struct {
	Errors   []SippyDeleteResponseEnvelopeErrors `json:"errors,required"`
	Messages []string                            `json:"messages,required"`
	Result   SippyDeleteResponse                 `json:"result,required"`
	// Whether the API call was successful
	Success SippyDeleteResponseEnvelopeSuccess `json:"success,required"`
	JSON    sippyDeleteResponseEnvelopeJSON    `json:"-"`
}

func (*SippyDeleteResponseEnvelope) UnmarshalJSON

func (r *SippyDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type SippyDeleteResponseEnvelopeErrors

type SippyDeleteResponseEnvelopeErrors struct {
	Code    int64                                 `json:"code,required"`
	Message string                                `json:"message,required"`
	JSON    sippyDeleteResponseEnvelopeErrorsJSON `json:"-"`
}

func (*SippyDeleteResponseEnvelopeErrors) UnmarshalJSON

func (r *SippyDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)

type SippyDeleteResponseEnvelopeSuccess

type SippyDeleteResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	SippyDeleteResponseEnvelopeSuccessTrue SippyDeleteResponseEnvelopeSuccess = true
)

type SippyGetParams

type SippyGetParams struct {
	// Account ID
	AccountID param.Field[string] `path:"account_id,required"`
}

type SippyGetResponseEnvelope

type SippyGetResponseEnvelope struct {
	Errors   []SippyGetResponseEnvelopeErrors `json:"errors,required"`
	Messages []string                         `json:"messages,required"`
	Result   R2Sippy                          `json:"result,required"`
	// Whether the API call was successful
	Success SippyGetResponseEnvelopeSuccess `json:"success,required"`
	JSON    sippyGetResponseEnvelopeJSON    `json:"-"`
}

func (*SippyGetResponseEnvelope) UnmarshalJSON

func (r *SippyGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type SippyGetResponseEnvelopeErrors

type SippyGetResponseEnvelopeErrors struct {
	Code    int64                              `json:"code,required"`
	Message string                             `json:"message,required"`
	JSON    sippyGetResponseEnvelopeErrorsJSON `json:"-"`
}

func (*SippyGetResponseEnvelopeErrors) UnmarshalJSON

func (r *SippyGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)

type SippyGetResponseEnvelopeSuccess

type SippyGetResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	SippyGetResponseEnvelopeSuccessTrue SippyGetResponseEnvelopeSuccess = true
)

type SippyService

type SippyService struct {
	Options []option.RequestOption
}

SippyService contains methods and other services that help with interacting with the cloudflare API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSippyService method instead.

func NewSippyService

func NewSippyService(opts ...option.RequestOption) (r *SippyService)

NewSippyService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SippyService) Delete

func (r *SippyService) Delete(ctx context.Context, bucketName string, body SippyDeleteParams, opts ...option.RequestOption) (res *SippyDeleteResponse, err error)

Disables Sippy on this bucket

func (*SippyService) Get

func (r *SippyService) Get(ctx context.Context, bucketName string, query SippyGetParams, opts ...option.RequestOption) (res *R2Sippy, err error)

Gets configuration for Sippy for an existing R2 bucket.

func (*SippyService) Update

func (r *SippyService) Update(ctx context.Context, bucketName string, params SippyUpdateParams, opts ...option.RequestOption) (res *R2Sippy, err error)

Sets configuration for Sippy for an existing R2 bucket.

type SippyUpdateParams

type SippyUpdateParams struct {
	// Account ID
	AccountID   param.Field[string]                       `path:"account_id,required"`
	Destination param.Field[SippyUpdateParamsDestination] `json:"destination"`
	Source      param.Field[SippyUpdateParamsSource]      `json:"source"`
}

func (SippyUpdateParams) MarshalJSON

func (r SippyUpdateParams) MarshalJSON() (data []byte, err error)

type SippyUpdateParamsDestination

type SippyUpdateParamsDestination struct {
	// ID of a Cloudflare API token. This is the value labelled "Access Key ID" when
	// creating an API token from the
	// [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens).
	//
	// Sippy will use this token when writing objects to R2, so it is best to scope
	// this token to the bucket you're enabling Sippy for.
	AccessKeyID param.Field[string]                               `json:"accessKeyId"`
	Provider    param.Field[SippyUpdateParamsDestinationProvider] `json:"provider"`
	// Value of a Cloudflare API token. This is the value labelled "Secret Access Key"
	// when creating an API token from the
	// [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens).
	//
	// Sippy will use this token when writing objects to R2, so it is best to scope
	// this token to the bucket you're enabling Sippy for.
	SecretAccessKey param.Field[string] `json:"secretAccessKey"`
}

func (SippyUpdateParamsDestination) MarshalJSON

func (r SippyUpdateParamsDestination) MarshalJSON() (data []byte, err error)

type SippyUpdateParamsDestinationProvider

type SippyUpdateParamsDestinationProvider string
const (
	SippyUpdateParamsDestinationProviderR2 SippyUpdateParamsDestinationProvider = "r2"
)

type SippyUpdateParamsSource

type SippyUpdateParamsSource struct {
	// Access Key ID of an IAM credential (ideally scoped to a single S3 bucket)
	AccessKeyID param.Field[string] `json:"accessKeyId"`
	// Name of the GCS bucket
	Bucket param.Field[string] `json:"bucket"`
	// Client email of an IAM credential (ideally scoped to a single GCS bucket)
	ClientEmail param.Field[string] `json:"clientEmail"`
	// Private Key of an IAM credential (ideally scoped to a single GCS bucket)
	PrivateKey param.Field[string]                          `json:"privateKey"`
	Provider   param.Field[SippyUpdateParamsSourceProvider] `json:"provider"`
	// Name of the AWS availability zone
	Region param.Field[string] `json:"region"`
	// Secret Access Key of an IAM credential (ideally scoped to a single S3 bucket)
	SecretAccessKey param.Field[string] `json:"secretAccessKey"`
}

func (SippyUpdateParamsSource) MarshalJSON

func (r SippyUpdateParamsSource) MarshalJSON() (data []byte, err error)

type SippyUpdateParamsSourceProvider

type SippyUpdateParamsSourceProvider string
const (
	SippyUpdateParamsSourceProviderGcs SippyUpdateParamsSourceProvider = "gcs"
	SippyUpdateParamsSourceProviderAws SippyUpdateParamsSourceProvider = "aws"
)

type SippyUpdateResponseEnvelope

type SippyUpdateResponseEnvelope struct {
	Errors   []SippyUpdateResponseEnvelopeErrors `json:"errors,required"`
	Messages []string                            `json:"messages,required"`
	Result   R2Sippy                             `json:"result,required"`
	// Whether the API call was successful
	Success SippyUpdateResponseEnvelopeSuccess `json:"success,required"`
	JSON    sippyUpdateResponseEnvelopeJSON    `json:"-"`
}

func (*SippyUpdateResponseEnvelope) UnmarshalJSON

func (r *SippyUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type SippyUpdateResponseEnvelopeErrors

type SippyUpdateResponseEnvelopeErrors struct {
	Code    int64                                 `json:"code,required"`
	Message string                                `json:"message,required"`
	JSON    sippyUpdateResponseEnvelopeErrorsJSON `json:"-"`
}

func (*SippyUpdateResponseEnvelopeErrors) UnmarshalJSON

func (r *SippyUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)

type SippyUpdateResponseEnvelopeSuccess

type SippyUpdateResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	SippyUpdateResponseEnvelopeSuccessTrue SippyUpdateResponseEnvelopeSuccess = true
)

Jump to

Keyboard shortcuts

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