client

package
v0.0.0-...-d828d93 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package client for aws-sdk-go This package provides the methods to create a fake Dynamodb client for aws-sdk-go (v1) library.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidTableName when the provided table name is invalid
	ErrInvalidTableName = errors.New("invalid table name")
	// ErrResourceNotFoundException when the requested resource is not found
	ErrResourceNotFoundException = errors.New("requested resource not found")
)
View Source
var (

	// ErrForcedFailure when the error is forced
	// Deprecated: use EmulateFailure instead
	ErrForcedFailure = errors.New("forced failure response")
)

Functions

func ActiveForceFailure

func ActiveForceFailure(client dynamodbiface.DynamoDBAPI)

ActiveForceFailure active force operation to fail

func AddIndex

func AddIndex(client dynamodbiface.DynamoDBAPI, tableName, indexName, partitionKey, rangeKey string) error

AddIndex add a new index to the table table

func AddTable

func AddTable(client dynamodbiface.DynamoDBAPI, tableName, partitionKey, rangeKey string) error

AddTable add a new table

func ClearTable

func ClearTable(client dynamodbiface.DynamoDBAPI, tableName string) error

ClearTable removes all data from a specific table

func DeactiveForceFailure

func DeactiveForceFailure(client dynamodbiface.DynamoDBAPI)

DeactiveForceFailure deactive force operation to fail

func EmulateFailure

func EmulateFailure(client dynamodbiface.DynamoDBAPI, condition FailureCondition)

EmulateFailure forces the fake client to fail

func SetItemCollectionMetrics

func SetItemCollectionMetrics(client dynamodbiface.DynamoDBAPI, itemCollectionMetrics map[string][]*dynamodb.ItemCollectionMetrics)

SetItemCollectionMetrics set the value of the property itemCollectionMetrics

Types

type Client

type Client struct {
	dynamodbiface.DynamoDBAPI
	// contains filtered or unexported fields
}

Client define a mock struct to be used

func NewClient

func NewClient() *Client

NewClient initializes dynamodb client with a mock

func (*Client) ActivateDebug

func (fd *Client) ActivateDebug()

ActivateDebug it activates the debug mode

func (*Client) ActivateNativeInterpreter

func (fd *Client) ActivateNativeInterpreter()

ActivateNativeInterpreter it activates the debug mode

func (*Client) BatchWriteItem

func (fd *Client) BatchWriteItem(input *dynamodb.BatchWriteItemInput) (*dynamodb.BatchWriteItemOutput, error)

BatchWriteItem mock response for dynamodb

func (*Client) BatchWriteItemWithContext

func (fd *Client) BatchWriteItemWithContext(ctx aws.Context, input *dynamodb.BatchWriteItemInput, opts ...request.Option) (*dynamodb.BatchWriteItemOutput, error)

BatchWriteItemWithContext mock response for dynamodb

func (*Client) CreateTable

func (fd *Client) CreateTable(input *dynamodb.CreateTableInput) (*dynamodb.CreateTableOutput, error)

CreateTable creates a new table

func (*Client) CreateTableWithContext

func (fd *Client) CreateTableWithContext(ctx aws.Context, input *dynamodb.CreateTableInput, opt ...request.Option) (*dynamodb.CreateTableOutput, error)

CreateTableWithContext creates a new table

func (*Client) DeleteItem

func (fd *Client) DeleteItem(input *dynamodb.DeleteItemInput) (*dynamodb.DeleteItemOutput, error)

DeleteItem mock response for dynamodb

func (*Client) DeleteItemWithContext

func (fd *Client) DeleteItemWithContext(ctx aws.Context, input *dynamodb.DeleteItemInput, opts ...request.Option) (*dynamodb.DeleteItemOutput, error)

DeleteItemWithContext mock response for dynamodb

func (*Client) DeleteTable

func (fd *Client) DeleteTable(input *dynamodb.DeleteTableInput) (*dynamodb.DeleteTableOutput, error)

DeleteTable deletes a table

func (*Client) DeleteTableWithContext

func (fd *Client) DeleteTableWithContext(ctx aws.Context, input *dynamodb.DeleteTableInput, opt ...request.Option) (*dynamodb.DeleteTableOutput, error)

DeleteTableWithContext deletes a table

func (*Client) DescribeTable

func (fd *Client) DescribeTable(input *dynamodb.DescribeTableInput) (*dynamodb.DescribeTableOutput, error)

DescribeTable returns information about the table

func (*Client) DescribeTableWithContext

func (fd *Client) DescribeTableWithContext(ctx aws.Context, input *dynamodb.DescribeTableInput, ops ...request.Option) (*dynamodb.DescribeTableOutput, error)

DescribeTableWithContext uses DescribeTableDescribeTable to return information about the table

func (*Client) GetItem

func (fd *Client) GetItem(input *dynamodb.GetItemInput) (*dynamodb.GetItemOutput, error)

GetItem mock response for dynamodb

func (*Client) GetItemWithContext

func (fd *Client) GetItemWithContext(ctx aws.Context, input *dynamodb.GetItemInput, opt ...request.Option) (*dynamodb.GetItemOutput, error)

GetItemWithContext mock response for dynamodb

func (*Client) GetNativeInterpreter

func (fd *Client) GetNativeInterpreter() *interpreter.Native

GetNativeInterpreter returns native interpreter

func (*Client) PutItem

func (fd *Client) PutItem(input *dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error)

PutItem mock response for dynamodb

func (*Client) PutItemWithContext

func (fd *Client) PutItemWithContext(ctx aws.Context, input *dynamodb.PutItemInput, opts ...request.Option) (*dynamodb.PutItemOutput, error)

PutItemWithContext mock response for dynamodb

func (*Client) Query

func (fd *Client) Query(input *dynamodb.QueryInput) (*dynamodb.QueryOutput, error)

Query mock response for dynamodb

func (*Client) QueryWithContext

func (fd *Client) QueryWithContext(ctx aws.Context, input *dynamodb.QueryInput, opt ...request.Option) (*dynamodb.QueryOutput, error)

QueryWithContext mock response for dynamodb

func (*Client) Scan

func (fd *Client) Scan(input *dynamodb.ScanInput) (*dynamodb.ScanOutput, error)

Scan mock scan operation

func (*Client) ScanWithContext

func (fd *Client) ScanWithContext(ctx aws.Context, input *dynamodb.ScanInput, opt ...request.Option) (*dynamodb.ScanOutput, error)

ScanWithContext mock scan operation

func (*Client) SetInterpreter

func (fd *Client) SetInterpreter(i interpreter.Interpreter)

SetInterpreter assigns a native interpreter

func (*Client) TransactWriteItems

TransactWriteItems mock response for dynamodb

func (*Client) TransactWriteItemsWithContext

func (fd *Client) TransactWriteItemsWithContext(ctx aws.Context, input *dynamodb.TransactWriteItemsInput, opts ...request.Option) (*dynamodb.TransactWriteItemsOutput, error)

TransactWriteItemsWithContext mock response for dynamodb

func (*Client) UpdateItem

func (fd *Client) UpdateItem(input *dynamodb.UpdateItemInput) (*dynamodb.UpdateItemOutput, error)

UpdateItem mock response for dynamodb

func (*Client) UpdateItemWithContext

func (fd *Client) UpdateItemWithContext(ctx aws.Context, input *dynamodb.UpdateItemInput, opts ...request.Option) (*dynamodb.UpdateItemOutput, error)

UpdateItemWithContext mock response for dynamodb

func (*Client) UpdateTable

func (fd *Client) UpdateTable(input *dynamodb.UpdateTableInput) (*dynamodb.UpdateTableOutput, error)

UpdateTable update a table

func (*Client) UpdateTableWithContext

func (fd *Client) UpdateTableWithContext(ctx aws.Context, input *dynamodb.UpdateTableInput, opts ...request.Option) (*dynamodb.UpdateTableOutput, error)

UpdateTableWithContext update a table

type FailureCondition

type FailureCondition string

FailureCondition describe the failure condtion to emulate

const (
	// FailureConditionNone emulates the system is working
	FailureConditionNone FailureCondition = "none"
	// FailureConditionInternalServerError emulates dynamodb having internal issues
	FailureConditionInternalServerError FailureCondition = "internal_server"
	// FailureConditionDeprecated returns the old error
	FailureConditionDeprecated FailureCondition = "deprecated"
)

Jump to

Keyboard shortcuts

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