aws

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetItem

func GetItem[T any](client types.DynamoClientAPI, input *dynamodb.GetItemInput) (*T, error)

func Query

func Query[T any](client types.DynamoClientAPI, input *dynamodb.QueryInput) ([]T, error)

func Scan

func Scan[T any](client types.DynamoClientAPI, input *dynamodb.ScanInput) ([]T, error)

func UpdateItem

func UpdateItem[T any](client types.DynamoClientAPI, table string, key map[string]dynamoTypes.AttributeValue, expr expression.Expression) (*T, error)

Types

type DynamoAPI

type DynamoAPI struct {
	*base.Scoutr
	Client types.DynamoClientAPI
	// contains filtered or unexported fields
}

DynamoAPI : API, based off of Scoutr, used to talk to AWS DynamoDB

func NewDynamoAPI

func NewDynamoAPI(scoutrConfig config.Config, awsConfig aws.Config) DynamoAPI

func (DynamoAPI) Create

func (api DynamoAPI) Create(req types.Request, item map[string]interface{}, validation map[string]types.FieldValidation, requiredFields []string) error

Create : Create an item

func (DynamoAPI) Delete

func (api DynamoAPI) Delete(request types.Request, partitionKey map[string]interface{}) error

Delete : Delete an item

func (*DynamoAPI) DeleteItem

func (api *DynamoAPI) DeleteItem(table string, key map[string]dynamoTypes.AttributeValue, expr *expression.Expression) error

func (DynamoAPI) Get

func (api DynamoAPI) Get(req types.Request, id string) (types.Record, error)

Get : Get an item from the table

func (DynamoAPI) GetAuth

func (api DynamoAPI) GetAuth(id string) (*types.User, error)

GetAuth : Fetch an auth identity from the collection Responses:

  • nil, nil: user does not exist
  • nil, error: error while fetching user
  • user, nil: found user

func (DynamoAPI) GetEntitlements

func (api DynamoAPI) GetEntitlements(entitlementIDs []string) ([]types.User, error)

GetEntitlements: Fetch entitlements from the database

func (DynamoAPI) GetGroup

func (api DynamoAPI) GetGroup(id string) (*types.Group, error)

GetGroup : Fetch a group from the collection Responses:

  • nil, nil: group does not exist
  • nil, error: error while fetching group
  • user, nil: found group

func (DynamoAPI) History

func (api DynamoAPI) History(req types.Request, key string, value string, queryParams map[string][]string, actions []string) ([]types.History, error)

History : Generate record history

func (DynamoAPI) List

func (api DynamoAPI) List(req types.Request) ([]types.Record, error)

List : Lists all items in a table

func (DynamoAPI) ListAuditLogs

func (api DynamoAPI) ListAuditLogs(req types.Request, pathParams map[string]string, queryParams map[string][]string) ([]types.AuditLog, error)

ListAuditLogs : List audit logs

func (DynamoAPI) ListUniqueValues

func (api DynamoAPI) ListUniqueValues(req types.Request, uniqueKey string) ([]string, error)

ListUniqueValues : Lists unique values in a table

func (*DynamoAPI) PutItem

func (api *DynamoAPI) PutItem(table string, item interface{}, expr *expression.Expression) error

func (DynamoAPI) Search

func (api DynamoAPI) Search(req types.Request, key string, values []string) ([]types.Record, error)

Search : Search items in the table

func (DynamoAPI) Update

func (api DynamoAPI) Update(request types.Request, partitionKey map[string]interface{}, item map[string]interface{}, validation map[string]types.FieldValidation, requiredFields []string, auditAction string) (interface{}, error)

Update : Update an item

type DynamoFiltering

type DynamoFiltering struct {
	base.Filtering
}

func NewFilter

func NewFilter() DynamoFiltering

func (*DynamoFiltering) And

func (f *DynamoFiltering) And(condition1, condition2 interface{}) interface{}

And : Takes two conditions and performs an AND operation on them

func (*DynamoFiltering) Between

func (f *DynamoFiltering) Between(key string, values interface{}) (interface{}, error)

Between : Check for records that are between a low and high value

Operator: key__between=["1", "2"]

func (*DynamoFiltering) BuildInExpr

func (f *DynamoFiltering) BuildInExpr(attr string, values []string, negate bool) expression.ConditionBuilder

Build a condition expression using the IN operator If there are more than 100 values, expressions will be split up into 100-value groupings and combined together using the OR operation.

In order to negate the expression (i.e. not in), specify negate = true.

func (*DynamoFiltering) Contains

func (f *DynamoFiltering) Contains(key string, value interface{}) (interface{}, error)

Contains : Check if a value contains a string

func (*DynamoFiltering) Equals

func (f *DynamoFiltering) Equals(key string, value interface{}) (interface{}, error)

Equals : Standard equals operation

func (*DynamoFiltering) Exists

func (f *DynamoFiltering) Exists(key string, value interface{}) (interface{}, error)

Exists : Checks if an attribute exists. Only accepts true/false values. Returns nil for all other values.

func (*DynamoFiltering) GreaterThan

func (f *DynamoFiltering) GreaterThan(key string, value interface{}) (interface{}, error)

GreaterThan : Check if a value is greater than a string

func (*DynamoFiltering) GreaterThanEqual

func (f *DynamoFiltering) GreaterThanEqual(key string, value interface{}) (interface{}, error)

GreaterThanEqual : Check if a value is greater than a string

func (*DynamoFiltering) In

func (f *DynamoFiltering) In(key string, values interface{}) (interface{}, error)

In : Find all records with a list of values

func (*DynamoFiltering) LessThan

func (f *DynamoFiltering) LessThan(key string, value interface{}) (interface{}, error)

LessThan : Check if a value is greater than a string

func (*DynamoFiltering) LessThanEqual

func (f *DynamoFiltering) LessThanEqual(key string, value interface{}) (interface{}, error)

LessThanEqual : Check if a value is greater than a string

func (*DynamoFiltering) NotContains

func (f *DynamoFiltering) NotContains(key string, value interface{}) (interface{}, error)

NotContains : Check for values that do not contain a string

func (*DynamoFiltering) NotEqual

func (f *DynamoFiltering) NotEqual(key string, value interface{}) (interface{}, error)

NotEqual : Standard not equals operation

func (*DynamoFiltering) NotIn

func (f *DynamoFiltering) NotIn(key string, values interface{}) (interface{}, error)

NotIn : Find all records without a list of values

func (*DynamoFiltering) Operations

func (f *DynamoFiltering) Operations() base.OperationMap

Operations : Map of supported operations for this filter provider

func (*DynamoFiltering) Or

func (f *DynamoFiltering) Or(condition1, condition2 interface{}) interface{}

Or : Takes two conditions and performs an OR operation on them

func (*DynamoFiltering) StartsWith

func (f *DynamoFiltering) StartsWith(key string, value interface{}) (interface{}, error)

StartsWith : Find all records that contain items that start with a specific value

Jump to

Keyboard shortcuts

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