stubclient

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ForcedFailure is a context key used to simulate forced failures in certain methods.
	ForcedFailure = "X_Forced_Failure"
)

Variables

View Source
var ErrUnexpectedError = errors.New("unexpected error")

ErrUnexpectedError represents an unexpected error during the stub implementation.

Functions

func SetBucketTracker

func SetBucketTracker(c s3.Client, tracker BucketTracker)

Types

type BucketTracker

type BucketTracker interface {
	GetObjectStorageBucket(context.Context, string, string) (*linodego.ObjectStorageBucket, error)
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Client

New creates a new instance of the Client with optional object storage objects. This is a stub function.

func (*Client) GetBucketPolicy

func (c *Client) GetBucketPolicy(ctx context.Context, region, bucket string) (string, error)

func (*Client) Prune

func (c *Client) Prune(ctx context.Context, _ string, _ string) error

Prune is a stub function that stubs the behavior of Prune call from s3.Client.

func (*Client) SetBucketPolicy

func (c *Client) SetBucketPolicy(ctx context.Context, region, bucket, policy string) error

type Option

type Option func(c *Client)

Option represents a function that configures a Client.

func WithPolicy

func WithPolicy(region, bucket, policy string) Option

WithPolicy is an option to configure the stub client with a policy for bucket.

type PolicyDocument

type PolicyDocument struct {
	ID        string      `json:"Id"`
	Version   string      `json:"Version"`
	Statement []Statement `json:"Statement"`
}

PolicyDocument represents the structure of an AWS S3 bucket policy.

type Statement

type Statement struct {
	SID       string `json:"Sid"`
	Effect    string `json:"Effect"`
	Action    any    `json:"Action"`    // Can be a string or a slice
	Resource  any    `json:"Resource"`  // Can be a string or a slice
	Principal any    `json:"Principal"` // Can be a string, object, or slice
}

Statement represents an individual statement in the policy.

Jump to

Keyboard shortcuts

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