Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigureCmd = &cobra.Command{ Use: "configure", Short: "Creates an s3 bucket for the aws-switch state to reside", Run: func(cmd *cobra.Command, args []string) { bucket, err := lib.Configure() if err != nil { fmt.Println(err) os.Exit(1) } else { fmt.Printf("Created and configured bucket \"s3://%s\"\n", bucket) } }, }
View Source
var HaltCmd = &cobra.Command{ Use: "halt", Short: "Halt an aws service", Run: func(cmd *cobra.Command, args []string) { if len(tagsInput) == 0 { fmt.Println("--tags required") os.Exit(1) } tags, err := parseTagsFlag(tagsInput) if err != nil { fmt.Println(err) os.Exit(1) } services, err := lib.GetAWSServices(tags) if err != nil { fmt.Printf("Error getting services: %s\n", err) os.Exit(1) } fmt.Printf("Services to halt: \n\n") for _, service := range services { fmt.Println(service.GetARN()) } fmt.Println() if !autoApprove { if _, err = confirmationPrompt.Run(); err != nil { fmt.Printf("No changes applied. %v\n", err) os.Exit(0) } } for _, service := range services { err := lib.Halt(service) if err != nil { fmt.Printf("Error halting service: %s\n", service.GetARN()) os.Exit(1) } else { fmt.Printf("Halting service: %s\n", service.GetARN()) } } }, }
View Source
var ResumeCmd = &cobra.Command{ Use: "resume", Short: "Resume a halted aws service", Run: func(cmd *cobra.Command, args []string) { if len(tagsInput) == 0 { fmt.Println("--tags required") os.Exit(1) } tags, err := parseTagsFlag(tagsInput) if err != nil { fmt.Println(err) os.Exit(1) } services, err := lib.GetAWSServices(tags) if err != nil { fmt.Printf("Error getting services: %s\n", err) os.Exit(1) } fmt.Printf("Services to resume: \n\n") for _, service := range services { fmt.Println(service.GetARN()) } fmt.Println() if !autoApprove { if _, err = confirmationPrompt.Run(); err != nil { fmt.Printf("No changes applied. %v\n", err) os.Exit(0) } } for _, service := range services { err := lib.Resume(service) if err != nil { fmt.Printf("Error resuming service: %s\n", service.GetARN()) os.Exit(1) } else { fmt.Printf("Resuming service: %s\n", service.GetARN()) } } }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.