scenarios

package
v0.0.0-...-9f83508 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IScenarioHelper

type IScenarioHelper interface {
	GetName() string
}

IScenarioHelper abstracts input and wait functions from a scenario so that they can be mocked for unit testing.

type Movie

type Movie struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
	Year  int    `json:"year"`
}

Movie makes it easier to use Movie objects given in json format.

type RedshiftBasicsScenario

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

RedshiftBasicsScenario separates the steps of this scenario into individual functions so that they are simpler to read and understand.

func RedshiftBasics

func RedshiftBasics(sdkConfig aws.Config, questioner demotools.IQuestioner, pauser demotools.IPausable, filesystem demotools.IFileSystem, helper IScenarioHelper) RedshiftBasicsScenario

RedshiftBasics constructs a new Redshift Basics runner.

func (*RedshiftBasicsScenario) PopulateMoviesTable

func (runner *RedshiftBasicsScenario) PopulateMoviesTable(ctx context.Context, clusterId string, databaseName string, tableName string, userName string, fileName string)

PopulateMoviesTable reads data from the <fileName> file and inserts records into the "Movies" table.

func (*RedshiftBasicsScenario) QueryMoviesByYear

func (runner *RedshiftBasicsScenario) QueryMoviesByYear(ctx context.Context, clusterId string, databaseName string, tableName string, userName string, year int)

QueryMoviesByYear retrieves only movies from the "Movies" table which match the given year.

func (*RedshiftBasicsScenario) Run

func (runner *RedshiftBasicsScenario) Run(ctx context.Context)

Run runs the RedshiftBasics interactive example that shows you how to use Amazon Redshift and how to interact with its common endpoints.

0. Retrieve username and password information to access Redshift. 1. Create a cluster. 2. Wait for the cluster to become available. 3. List the available databases in the region. 4. Create a table named "Movies" in the "dev" database. 5. Populate the movies table from the "movies.json" file. 6. Query the movies table by year. 7. Modify the cluster's maintenance window. 8. Optionally clean up all resources created during this demo.

This example creates an Amazon Redshift service client from the specified sdkConfig so that you can replace it with a mocked or stubbed config for unit testing.

It uses a questioner from the `demotools` package to get input during the example. This package can be found in the ..\..\demotools folder of this repo.

type ScenarioHelper

type ScenarioHelper struct {
	Prefix string
	Random *rand.Rand
}

func (ScenarioHelper) GetName

func (helper ScenarioHelper) GetName() string

GetName returns a unique name formed of a prefix and a random number.

type SecretsManager

type SecretsManager struct {
	SecretsManagerClient *secretsmanager.Client
}

SecretsManager is used to retrieve username and password information from a secure service.

type User

type User struct {
	Username string `json:"userName"`
	Password string `json:"userPassword"`
}

User makes it easier to get the User data back from SecretsManager and use it later.

Jump to

Keyboard shortcuts

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