cloudapi

package
v0.0.0-...-13ce33a Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultProjectName is the default name for projects.
	DefaultProjectName = "default"
	// DefaultDirName is the default directory for reporting
	// if no directory was specified by the user.
	DefaultDirName = ".atlas"
)

Variables

This section is empty.

Functions

func NewContext

func NewContext(parent context.Context, c *Client) context.Context

NewContext returns a new context with the given Client attached.

func RedactedURL

func RedactedURL(s string) (string, error)

RedactedURL returns a URL string with the userinfo redacted.

func SetHeader

func SetHeader(req *http.Request, token string)

SetHeader sets header fields for cloud requests.

func SetVersion

func SetVersion(v, flavor string)

SetVersion allow cmdapi to set the version of the CLI provided at build time.

func UserAgent

func UserAgent() string

UserAgent is the value the CLI uses in the User-Agent HTTP header.

Types

type CheckStmtInput

type CheckStmtInput struct {
	Stmt  string  `json:"stmt"`
	Error *string `json:"error,omitempty"`
}

CheckStmtInput represents the input type for a statement check.

type Client

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

Client is a client for the Atlas Cloud API.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func New

func New(endpoint, token string) *Client

New creates a new Client for the Atlas Cloud API.

func (*Client) Dir

func (c *Client) Dir(ctx context.Context, input DirInput) (migrate.Dir, error)

Dir retrieves a directory from the Atlas Cloud API.

func (*Client) ReportMigration

func (c *Client) ReportMigration(ctx context.Context, input ReportMigrationInput) (string, error)

ReportMigration reports a migration deployment to the Atlas Cloud API.

func (*Client) ReportMigrationSet

func (c *Client) ReportMigrationSet(ctx context.Context, input ReportMigrationSetInput) (string, error)

ReportMigrationSet reports a set of migration deployments to the Atlas Cloud API.

type DeployContextInput

type DeployContextInput struct {
	TriggerType    string `json:"triggerType,omitempty"`
	TriggerVersion string `json:"triggerVersion,omitempty"`
}

DeployContextInput is an input type for describing the context in which `migrate-apply` was used. For example, a GitHub Action with version v1.2.3

type DeployedFileInput

type DeployedFileInput struct {
	Name      string            `json:"name"`
	Content   string            `json:"content"`
	StartTime time.Time         `json:"startTime"`
	EndTime   time.Time         `json:"endTime"`
	Skipped   int               `json:"skipped"`
	Applied   int               `json:"applied"`
	Checks    []FileChecksInput `json:"checks"`
	Error     *StmtErrorInput   `json:"error,omitempty"`
}

DeployedFileInput represents the input type for a deployed file.

type DeployedTargetInput

type DeployedTargetInput struct {
	ID     string `json:"id"`
	Schema string `json:"schema"`
	URL    string `json:"url"` // URL string without userinfo.
}

DeployedTargetInput represents the input type for a deployed target.

type DirInput

type DirInput struct {
	Slug string `json:"slug,omitempty"`
	Name string `json:"name,omitempty"`
	Tag  string `json:"tag,omitempty"`
}

DirInput is the input type for retrieving a single directory.

type FileChecksInput

type FileChecksInput struct {
	Name   string           `json:"name"`
	Start  time.Time        `json:"start"`
	End    time.Time        `json:"end"`
	Checks []CheckStmtInput `json:"checks"`
	Error  *StmtErrorInput  `json:"error,omitempty"`
}

FileChecksInput represents the input type for a file checks.

type ReportMigrationInput

type ReportMigrationInput struct {
	ProjectName    string              `json:"projectName"`
	EnvName        string              `json:"envName"`
	DirName        string              `json:"dirName"`
	AtlasVersion   string              `json:"atlasVersion"`
	Target         DeployedTargetInput `json:"target"`
	StartTime      time.Time           `json:"startTime"`
	EndTime        time.Time           `json:"endTime"`
	FromVersion    string              `json:"fromVersion"`
	ToVersion      string              `json:"toVersion"`
	CurrentVersion string              `json:"currentVersion"`
	Error          *string             `json:"error,omitempty"`
	Files          []DeployedFileInput `json:"files"`
	Log            string              `json:"log"`
	Context        *DeployContextInput `json:"context,omitempty"`
}

ReportMigrationInput represents an input type for reporting a migration deployments.

type ReportMigrationSetInput

type ReportMigrationSetInput struct {
	ID        string                 `json:"id"`
	Planned   int                    `json:"planned"`
	StartTime time.Time              `json:"startTime"`
	EndTime   time.Time              `json:"endTime"`
	Error     *string                `json:"error,omitempty"`
	Log       []ReportStep           `json:"log,omitempty"`
	Completed []ReportMigrationInput `json:"completed,omitempty"`
	Context   *DeployContextInput    `json:"context,omitempty"`
}

ReportMigrationSetInput represents the input type for reporting a set of migration deployments.

type ReportStep

type ReportStep struct {
	Text      string          `json:"text"`
	StartTime time.Time       `json:"startTime"`
	EndTime   time.Time       `json:"endTime"`
	Error     bool            `json:"error,omitempty"`
	Log       []ReportStepLog `json:"log,omitempty"`
}

ReportStep is top-level step in a report.

type ReportStepLog

type ReportStepLog struct {
	Text     string          `json:"text,omitempty"`
	Children []ReportStepLog `json:"children,omitempty"`
}

ReportStepLog is a log entry in a step.

type StmtErrorInput

type StmtErrorInput struct {
	Stmt string `json:"stmt"`
	Text string `json:"text"`
}

StmtErrorInput represents the input type for a statement error.

Jump to

Keyboard shortcuts

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