cmd

package
v0.0.0-...-77c4eb6 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 16 Imported by: 0

README

#CMD

Lats commands

  1. Init
  2. Create RDS Snapshot
  3. Copy RDS Snapshot
  4. Restore RDS Snapshot

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	//CopyRDSSnapshotCmd creates the copy snapshot command.
	CopyRDSSnapshotCmd = &cobra.Command{
		Use:     "CopyRDSSnapshot",
		Aliases: []string{"CopySnapshot"},
		Short:   "Copies a snapshot for a given DB",
		Long:    "Copies a snapshot for an RDS or Aurora database into a new region",
		Run: func(cmd *cobra.Command, args []string) {
			copySnapshot()
		},
	}
)
View Source
var (

	//CreateRDSSnapshotCmd is the args for creating RDS snapshot call
	CreateRDSSnapshotCmd = &cobra.Command{
		Use:     "CreateRDSSnapshot",
		Aliases: []string{"CreateSnapshot"},
		Short:   "Creates a snapshot for a given DB",
		Long:    "Creates a snapshot for an RDS or Aurora database",
		Run: func(cmd *cobra.Command, args []string) {
			CreateSnapshot()
		},
	}
)
View Source
var (

	//RestoreRDSSnapshotCmd restores an RDS snapshot
	RestoreRDSSnapshotCmd = &cobra.Command{
		Use:     "restoreRDSSnapshot",
		Aliases: []string{"RestoreSnapshot"},
		Short:   "Restores an RDS snapshot",
		Long:    "Restores an RDS snapshot",
		Run: func(cmd *cobra.Command, args []string) {
			_, sm := GetState()
			RestoreSnapshot(sm, restoreSnapshotName)
		},
	}
)

Functions

func CreateSnapshot

func CreateSnapshot()

CreateSnapshot generates a snapshot in AWS

func Execute

func Execute()

Execute is the main function for cobra that we will run in our main.go

func FindStack

func FindStack(sm state.StateManager, snapshot string) (*stack.Stack, error)

FindStack get's a stack for creating our new stack when we copy the snapshot

func NewStack

func NewStack(oldStack stack.Stack, name string) *stack.Stack

NewStack generates the new stack that we are going to use

func RestoreSnapshot

func RestoreSnapshot(stateKV state.StateManager, restoreSnapshotName string) error

RestoreSnapshot is the function that restores a snapshot

Types

type Config

type Config struct {
	MainRegion    string `json:"mainRegion"`
	BackupRegion  string `json:"backupRegion"`
	StateFileName string `json:"stateFileName"`
}

Config tells us our regions and where the state file is

func GetState

func GetState() (Config, state.StateManager)

GetState reads in our statefile and config for future processing

type CreateClusterSnapshotInput

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

CreateClusterSnapshotInput input for create snapshot for cluster

type CreateInstanceSnapshotInput

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

CreateInstanceSnapshotInput input for create snapshot for instance

Jump to

Keyboard shortcuts

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