cmd

package
v2.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IssueMSG is a default message to pass to the user
	IssueMSG = " Please open up a Github issue to report this error! https://github.com/karl-cardenas-coding/go-clean-lambda"
)

Variables

View Source
var (
	// VersionString is the version of the CLI
	VersionString string = "0.0.0"
	// ProfileFlag is the AWS crendentials profile passed in
	ProfileFlag string
	// CredentialsFile is a boolean for the credentials provider logic
	CredentialsFile bool
	// RegionFlag is the AWS Region to target for the execution
	RegionFlag string
	// Retain is the number of versions to retain excluding $LATEST
	Retain int8
	// Verbose is to enable debug output
	Verbose bool
	// DryRun is to enable a preview of what an actual execution would do
	DryRun bool
	// LambdaListFile points a file that contains a listof Lambdas to delete
	LambdaListFile string
	// MoreLambdaDetails is to show information about the Lambda being worked on
	MoreLambdaDetails bool
	// SizeIEC is used to display the size in IEC units
	SizeIEC bool
	// CliConfig is the struct that holds the CLI configuration
	GlobalCliConfig cliConfig
	// HTTPClient is the HTTP client to use for the AWS API calls
	GlobalHTTPClient *http.Client
	// UserAgent is the value to use for the User-Agent header
	UserAgent string
	// SkipAliases indicates that lambda versions attached to an alias should be skipped from deletion
	SkipAliases bool
)
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Print the current version number of go-lambda-cleanup",
	Long:  `Prints the current version number of go-lambda-cleanup`,
	RunE: func(cmd *cobra.Command, args []string) error {
		version := fmt.Sprintf("go-lambda-cleanup %s", VersionString)
		log.Info(version)
		_, message, err := checkForNewRelease(GlobalHTTPClient, VersionString, UserAgent, url)
		if err != nil {
			log.Error(err)
			return err
		}
		log.Info(message)
		return err
	},
}

Functions

func Execute

func Execute()

Execute is the main execution function

Types

type Assets

type Assets struct {
	URL                string    `json:"url"`
	ID                 int       `json:"id"`
	NodeID             string    `json:"node_id"`
	Name               string    `json:"name"`
	Label              string    `json:"label"`
	Uploader           Uploader  `json:"uploader"`
	ContentType        string    `json:"content_type"`
	State              string    `json:"state"`
	Size               int       `json:"size"`
	DownloadCount      int       `json:"download_count"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
	BrowserDownloadURL string    `json:"browser_download_url"`
}

type Author

type Author struct {
	Login             string `json:"login"`
	ID                int    `json:"id"`
	NodeID            string `json:"node_id"`
	AvatarURL         string `json:"avatar_url"`
	GravatarID        string `json:"gravatar_id"`
	URL               string `json:"url"`
	HTMLURL           string `json:"html_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	OrganizationsURL  string `json:"organizations_url"`
	ReposURL          string `json:"repos_url"`
	EventsURL         string `json:"events_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	Type              string `json:"type"`
	SiteAdmin         bool   `json:"site_admin"`
}

type Release

type Release struct {
	URL             string    `json:"url"`
	AssetsURL       string    `json:"assets_url"`
	UploadURL       string    `json:"upload_url"`
	HTMLURL         string    `json:"html_url"`
	ID              int       `json:"id"`
	NodeID          string    `json:"node_id"`
	TagName         string    `json:"tag_name"`
	TargetCommitish string    `json:"target_commitish"`
	Name            string    `json:"name"`
	Draft           bool      `json:"draft"`
	Author          Author    `json:"author"`
	Prerelease      bool      `json:"prerelease"`
	CreatedAt       time.Time `json:"created_at"`
	PublishedAt     time.Time `json:"published_at"`
	Assets          []Assets  `json:"assets"`
	TarballURL      string    `json:"tarball_url"`
	ZipballURL      string    `json:"zipball_url"`
	Body            string    `json:"body"`
}

Github Release Structure (v3)

type Uploader

type Uploader struct {
	Login             string `json:"login"`
	ID                int    `json:"id"`
	NodeID            string `json:"node_id"`
	AvatarURL         string `json:"avatar_url"`
	GravatarID        string `json:"gravatar_id"`
	URL               string `json:"url"`
	HTMLURL           string `json:"html_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	OrganizationsURL  string `json:"organizations_url"`
	ReposURL          string `json:"repos_url"`
	EventsURL         string `json:"events_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	Type              string `json:"type"`
	SiteAdmin         bool   `json:"site_admin"`
}

Jump to

Keyboard shortcuts

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