providers

package
v0.0.0-...-c8397f0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DOCKER = "Docker"

	// In the future...
	RDS    = "RDS"
	AURORA = "Aurora"
	AZURE  = "Azure"
	GCP    = "GCP"
)

Variables

View Source
var (

	// The indexes of where the provider questions can be found, these are set
	// when questions are generated.
	ProjectNameIndex  uint8
	AgentVersionIndex uint8
	DBMSIndex         uint8
	DBMSVersionIndex  uint8
)
View Source
var (
	// AgentVersions are a slices of the latest major versions of the Datadog
	// Agent. This should be used to set the Options field when creating a
	// Question with QType, Picker.
	AgentVersions = []string{"latest", "7.54.0", "7.53.0", "7.52.0"}
)

https://hub.docker.com/r/datadog/agent/tags

Functions

func GetAvailableProviders

func GetAvailableProviders() []string

Returns a list of the available providers that this tool currently supports. Note that the order here matters and should match with the provider descriptions in the GetProviderDescriptions function.

func GetProviderDescriptions

func GetProviderDescriptions() []string

Returns the description for each of the supported providers. Note that the order here matters and should match with the providers returned by the GetAvailableProviders function.

Types

type DBMS

type DBMS struct {
	// Name is the name of the DBMS and the value that will used as an option
	// when prompting the user for what DBMS they would like to use.
	Name string
	// contains filtered or unexported fields
}

A DBMS is a struct that contains the details for a particular database management system that we support.

func GetDBMS

func GetDBMS(DBMSName string) DBMS

Returns the concrete DBMS implementation based on the provided input

func MySQLDBMS

func MySQLDBMS() DBMS

Returns the MySQL DBMS concrete implementation

Available Versions: https://hub.docker.com/_/mysql/tags

Supported Versions: https://docs.datadoghq.com/database_monitoring/setup_mysql/selfhosted/?tab=mysql57

func PostgresDBMS

func PostgresDBMS() DBMS

Returns the Postgres DBMS concrete implementation

Available Versions: https://hub.docker.com/_/postgres/tags

Supported Versions: https://docs.datadoghq.com/database_monitoring/setup_postgres/selfhosted/?tab=postgres15

func SQLServerDBMS

func SQLServerDBMS() DBMS

Returns the MySQL DBMS concrete implementation

Available Versions: https://hub.docker.com/_/microsoft-mssql-server

Supported Versions: https://docs.datadoghq.com/database_monitoring/setup_sql_server/selfhosted/?tab=sqlserver2014

type DockerProvider

type DockerProvider struct {
	// QuestionAnswers is a slice of *Question for this provider.
	QuestionAnswers []*Question
	// contains filtered or unexported fields
}

DockerProvider implements the Provider Interface and holds all the required information needed to create a Docker Project.

func GetDockerProvider

func GetDockerProvider() *DockerProvider

GetDockerProvider will initiallize a new DockerProvider instance and return a pointer to it.

func (*DockerProvider) GenerateProject

func (d *DockerProvider) GenerateProject(ddapikey string) error

GenerateProject will generate the project directory on the users machine using the templates and template data.

func (*DockerProvider) GetProviderQuestions

func (d *DockerProvider) GetProviderQuestions() []func() *Question

GetProviderQuestions provides a slice of functions that return a *Question for the provider.

type Provider

type Provider interface {
	GetProviderQuestions() []func() *Question
	GenerateProject(string) error
}

A Provider handles gathering the information required for it to then generate a project structure.

GetProviderQuestions should provide the caller a slice of functions that returns a pointer to a Question when executed. This allows the client to interate over all of the questions that it needs to present to the user.

GenerateProject should create a project directory on the users machine that matches the required files that the provider needs to deploy the sandboxed environment. The name of the project directory should match the string passed to this function.

func GetProvider

func GetProvider(providerName string) Provider

Returns the concrete implementation of the Provider Interface for the provider name passed in.

type Question

type Question struct {
	// QType represents the type of question.
	QType QuestionType

	// Prompt is for the question that will be presented to the user.
	Prompt string

	// DefaultAnswer is the defualt answer for the question. It is only used for
	// the Input Question Type since it's the only question type that accepts an
	// empty answer from the user.
	DefaultAnswer string

	// Options is where all of the available options for the question are kept.
	// This is Only used for the QuestionType Picker
	Options []string

	// Answer is where the answer for the question will be placed.
	Answer string
}

A Question holds all the details relating to a question that a provide needs a order to properly generate a working project.

type QuestionType

type QuestionType int
const (
	Picker QuestionType = iota
	Input
)

type RunnableQuestion

type RunnableQuestion interface {
	Run() error
}

A RunnableQuestion is a question that can be ran to prompt the user for an answer.

Run should be have a *Question receiver and should prompt the user with the question, capture the response and load it into the *Question.Answer field or return an error if an error occured.

Jump to

Keyboard shortcuts

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