EC2

package
v1.17.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AwsxAMIPanelCmd = &cobra.Command{
	Use:   "ami_panel",
	Short: "Retrieve Amazon Machine Images (AMIs) details",
	Long:  `Command to retrieve Amazon Machine Images (AMIs) details including fields like Name, AMIName, AMIId, Source, Owner, Visibility, Platform, RootDeviceType, and Status.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from AMI panel command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, amiDetailsResp, err := GetAMIDetails(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting AMI details: ", err)
				return
			}
			if responseType == "frame" {
				for _, detail := range amiDetailsResp {
					fmt.Printf("%+v\n", *detail)
				}
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxAutoScalingGroupCmd = &cobra.Command{
	Use:   "autoscaling_groups",
	Short: "get autoscaling groups details",
	Long:  `command to get autoscaling groups details`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, autoScalingGroupsResp, err := GetAutoScalingGroupsDetail(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting autoscaling groups details: ", err)
				return
			}
			if responseType == "frame" {
				for _, detail := range autoScalingGroupsResp {
					fmt.Printf("%+v\n", *detail)
				}
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxCpuReservedPanelCmd = &cobra.Command{
	Use:   "cpu_reserved_panel",
	Short: "get cpu reserved metrics data",
	Long:  `command to get cpu reserved metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetEC2CPUReservationData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu reserved data : ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxDiskIOOperationsMbPerSecCmd = &cobra.Command{
	Use:   "disk_io_operations_panel",
	Short: "Get disk I/O metrics for EC2 instances in bytes",
	Long:  `Command to get disk I/O metrics data (DiskReadBytes and DiskWriteBytes) for EC2 instances with Timestamps in bytes`,
	Run: func(cmd *cobra.Command, args []string) {
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")

			_, cloudwatchMetricResp, err := GetDiskIOOperationsMbPerSecPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting disk I/O operations overview: ", err)
				return
			}

			if responseType == "frame" {

				fmt.Println(cloudwatchMetricResp)
			}
		}
	},
}
View Source
var AwsxEC2ActiveInstanceCountCmd = &cobra.Command{
	Use:   "active_instances_count",
	Short: "Retrieve count of active EC2 instances",
	Long:  `Command to retrieve count of active (running) EC2 instances`,

	Run: func(cmd *cobra.Command, args []string) {
		authFlag, clientAuth, err := HandleAuths(cmd)
		if err != nil {
			log.Println("Error during authentication:", err)
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			summary, _, err := GetEC2ActiveInstanceCount(clientAuth)
			if err != nil {
				log.Println("Error getting EC2 instance summary:", err)
				return
			}

			if responseType == "frame" {
				fmt.Println(summary)
			} else {
				printResp := fmt.Sprintf("Active Instance Count: %d", summary)
				fmt.Println(printResp)
			}
		}
	},
}

AwsxEC2ActiveInstanceCountCmd defines the command for retrieving the count of active EC2 instances

View Source
var AwsxEC2CPUUsageCmd = &cobra.Command{
	Use:   "vcpu_count_panel",
	Short: "Get CPU credit usage and CPU utilization for EC2 instances",
	Long:  `Command to get CPU credit usage and CPU utilization for EC2 instances, displaying CPU credit usage in vCPUs and CPU utilization in percentage.`,
	Run: func(cmd *cobra.Command, args []string) {
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			_ = cmd.Help()
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetEC2CPUCreditUsage(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting CPU usage data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxEC2CpuUtilizationPerInstanceTypeCommmand = &cobra.Command{
	Use:   "cpu_utilization_per_type",
	Short: "get cpu utilization per instance type metrics data",
	Long:  `command to cpu utilization per instance type metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, resp, err := CpuUtilizationPerInstanceType(cmd, clientAuth, nil, nil)
			if err != nil {
				log.Println("Error getting cpu utilization per instance type data : ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(jsonResp)
			} else {
				fmt.Println(resp)
			}
		}
	},
}
View Source
var AwsxEC2DiskIOPerformanceCmd = &cobra.Command{
	Use:   "disk_io_performance_panel",
	Short: "get disk I/O performance metrics data",
	Long:  `command to get disk I/O performance metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetDiskReadPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting disk I/O performance metrics: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEC2DiskReadBytesCommmand = &cobra.Command{
	Use:   "disk_read_bytes_per_type",
	Short: "get disk read bytes metrics data",
	Long:  `command to get disk read bytes metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, resp, err := DiskReadBytesData(cmd, clientAuth, nil, nil)
			if err != nil {
				log.Println("Error getting disk read bytes data : ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(jsonResp)
			} else {
				fmt.Println(resp)
			}
		}
	},
}
View Source
var AwsxEC2DiskReadOpsPerInstanceTypeCommmand = &cobra.Command{
	Use:   "disk_read_ops_per_type",
	Short: "get disk read ops per instance type metrics data",
	Long:  `command to disk read ops per instance type metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, resp, err := DiskReadOpsPerInstanceType(cmd, clientAuth, nil, nil)
			if err != nil {
				log.Println("Error getting disk read ops per instance type data : ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(jsonResp)
			} else {
				fmt.Println(resp)
			}
		}
	},
}
View Source
var AwsxEC2DiskWriteBytesCommmand = &cobra.Command{
	Use:   "disk_write_bytes_per_type",
	Short: "get disk write bytes metrics data",
	Long:  `command to get disk write bytes metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, resp, err := DiskWriteBytesData(cmd, clientAuth, nil, nil)
			if err != nil {
				log.Println("Error getting disk write bytes data : ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(jsonResp)
			} else {
				fmt.Println(resp)
			}
		}
	},
}
View Source
var AwsxEC2DiskWriteOpsPerInstanceTypeCommmand = &cobra.Command{
	Use:   "disk_write_ops_per_type",
	Short: "get disk write ops per instance type metrics data",
	Long:  `command to disk write ops per instance type metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, resp, err := DiskWriteOpsPerInstanceType(cmd, clientAuth, nil, nil)
			if err != nil {
				log.Println("Error getting disk write ops per instance type data : ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(jsonResp)
			} else {
				fmt.Println(resp)
			}
		}
	},
}
View Source
var AwsxEC2InstanceEventsCmd = &cobra.Command{

	Use:   "ec2_instance_events_panel",
	Short: "Get ec2 instance events logs data",
	Long:  `Command to get ec2 instance events logs data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running ec2 instance events  panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetEc2InstanceEventsData(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxEC2ListOfInstancesFailureCmd = &cobra.Command{

	Use:   "list_of_instances_failure_panel",
	Short: "Get list of instances failure logs data",
	Long:  `Command to get list of instances failure logs data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running list of instances failure panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetListOfInstancesFailureData(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxEC2NetworkInInstanceTypeCommmand = &cobra.Command{
	Use:   "network_in_per_type",
	Short: "get network in per instance type metrics data",
	Long:  `command to network in per instance type metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, resp, err := NetworkInPerInstanceType(cmd, clientAuth, nil, nil)
			if err != nil {
				log.Println("Error getting network in per instance type data : ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(jsonResp)
			} else {
				fmt.Println(resp)
			}
		}
	},
}
View Source
var AwsxEC2NetworkOutInstanceTypeCommmand = &cobra.Command{
	Use:   "network_out_per_type",
	Short: "get network in per instance type metrics data",
	Long:  `command to network in per instance type metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, resp, err := NetworkOutPerInstanceType(cmd, clientAuth, nil, nil)
			if err != nil {
				log.Println("Error getting network out per instance type data : ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(jsonResp)
			} else {
				fmt.Println(resp)
			}
		}
	},
}
View Source
var AwsxEC2NetworkTrafficCmd = &cobra.Command{
	Use:   "network_traffic_panel",
	Short: "get network traffic metrics data",
	Long:  `command to get network traffic metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err, _ := GetNetworkTrafficPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network traffic data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEC2NetworkTrafficCmdAllinstances = &cobra.Command{
	Use:   "network_traffic_count_panel",
	Short: "Get network traffic metrics data",
	Long:  `Command to get network traffic metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			networkTraffic, err := GetNetworkTrafficNewPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network traffic data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println("This cli is for only json output")
			} else {
				jsonResp, err := json.Marshal(networkTraffic)
				if err != nil {
					log.Println("Error marshalling network traffic data: ", err)
					return
				}
				fmt.Println(string(jsonResp))
			}
		}
	},
}
View Source
var AwsxECSDiskIOOperationsCmd = &cobra.Command{
	Use:   "disk_io_operations_mbps_panel",
	Short: "Get disk I/O operations metrics data in MB/s",
	Long:  `Command to get disk I/O operations metrics data in MB/s, including read and write operations for EC2.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running Disk I/O operations panel command in MB/s")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetEC2DiskIOOperationsMBpsPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting disk I/O operations metrics in MB/s: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2CpuSysTimeCmd = &cobra.Command{
	Use:   "cpu_sys_time_utilization_panel",
	Short: "get cpu sys time utilization metrics data",
	Long:  `command to get cpu sys time utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCPUUsageSysPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu sys time utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2CpuUsageIdleCmd = &cobra.Command{
	Use:   "cpu_usage_Idle_utilization_panel",
	Short: "get cpu usage idle utilization metrics data",
	Long:  `command to get cpu usage idle utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command..")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCPUUsageIdlePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu usage idle utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2CpuUsageNiceCmd = &cobra.Command{
	Use:   "cpu_usage_nice_utilization_panel",
	Short: "get cpu usage nice utilization metrics data",
	Long:  `command to get cpu usage nice utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCPUUsageNicePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2CpuUsageUserCmd = &cobra.Command{
	Use:   "cpu_usage_user_utilization_panel",
	Short: "get cpu usage user utilization metrics data",
	Long:  `command to get cpu usage user utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCPUUsageUserPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu usage user panel utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2CpuUtilizationAcrossAllInstanceCmd = &cobra.Command{
	Use:   "total_cpu_utilization_panel",
	Short: "get cpu utilization metrics data for all instances",
	Long:  `command to get cpu utilization metrics data for all instances`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCpuUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2CpuUtilizationCmd = &cobra.Command{
	Use:   "cpu_utilization_panel",
	Short: "get cpu utilization metrics data",
	Long:  `command to get cpu utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCpuUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2CpuUtilizationGraphsAllInstanceCmd = &cobra.Command{
	Use:   "cpu_utilization_graph_all_instance_panel",
	Short: "get cpu utilization all instance graph metrics data",
	Long:  `command to get cpu utilization all instance graph metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCpuUtilizationGraphAllInstancePanel(cmd, "", clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization graph: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2CpuUtilizationGraphsCmd = &cobra.Command{
	Use:   "cpu_utilization_graph_panel",
	Short: "get cpu utilization graph metrics data",
	Long:  `command to get cpu utilization graph metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemoryUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization graph: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2CustomAlertPanelCmd = &cobra.Command{
	Use:   "custom_alert_panel",
	Short: "get custom alerts for EC2 security group changes",
	Long:  `command to get custom alerts for EC2 security group changes`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from custom alert panel")

		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			cloudwatchMetric, err := GetEc2CustomAlertPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting custom alerts: ", err)
				return
			}
			fmt.Println(cloudwatchMetric)
		}
	},
}
View Source
var AwsxEc2DataTransferInByInstancesId = &cobra.Command{
	Use:   "data_transfer_in_graph_all_instance_panel",
	Short: "Get data transfer in for all instances",
	Long:  `Command to get data transfer in graph metrics for all EC2 instances`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running Data Transfer In Command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")

			jsonResp, cloudwatchMetricResp, err := GetDataTransferINInstancesIdPanel(cmd, "", clientAuth, nil)
			if err != nil {
				log.Println("Error getting data transfer in graph: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxEc2DataTransferOutByInstancesId = &cobra.Command{
	Use:   "data_transfer_out_graph_all_instance_panel",
	Short: "Get data transfer out for all instances",
	Long:  `Command to get data transfer in graph metrics for all EC2 instances`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running Data Transfer Out Command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			responseBody := ""
			jsonResp, cloudwatchMetricResp, err := GetDataTransferOUTInstancesIdPanel(cmd, responseBody, clientAuth, nil)
			if err != nil {
				log.Println("Error getting data transfer Out graph: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxEc2DiskAvailableCmd = &cobra.Command{
	Use:   "disk_available_panel",
	Short: "get disk available metrics data",
	Long:  `command to get disk available metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricData, err := GetDiskAvailablePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting disk available utilization: ", err)
				return
			}
			if responseType == "frame" {

				fmt.Println(cloudwatchMetricData)
			} else {

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxEc2DiskReadCmd = &cobra.Command{
	Use:   "disk_read_panel",
	Short: "get disk read metrics data",
	Long:  `command to get disk read metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetDiskReadPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting disk read  utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2DiskStorageUtilizationInstanceCmd = &cobra.Command{
	Use:   "disk_storage_utilization_instance_id_panel",
	Short: "Get disk storage utilization for all instances",
	Long:  `Command to get disk storage utilization metrics for all instances.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running disk storage utilization panel")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetDiskStorageUtilizationAllInstancePanel(cmd, "", clientAuth, nil)
			if err != nil {
				log.Println("Error getting disk storage utilization data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxEc2DiskUsedCmd = &cobra.Command{
	Use:   "disk_used_panel",
	Short: "get disk used metrics data",
	Long:  `command to get disk used metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetDiskUsedPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting disk read  utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2DiskUtilizationCmd = &cobra.Command{
	Use:   "disk_used_panel",
	Short: "get disk used metrics data",
	Long:  `command to get disk used metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetDiskUtilizationData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting disk read utilization: ", err)
				return
			}
			if responseType == "frame" {

				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxEc2DiskUtilizationCountPercentCmd = &cobra.Command{
	Use:   "disk_utilization_count_percent_panel",
	Short: "get disk utilization metrics data",
	Long:  `command to get disk utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetDiskUtilizationCountPercentData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting disk utilization: ", err)
				return
			}
			if responseType == "frame" {

				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxEc2DiskWriteCmd = &cobra.Command{
	Use:   "disk_write_panel",
	Short: "get disk write metrics data",
	Long:  `command to get disk write metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetDiskWritePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2ErrorRatePanelCmd = &cobra.Command{
	Use:   "error_panel",
	Short: "Get Lambda error metrics data",
	Long:  `Command to retrieve error metrics for AWS Lambda functions`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Executing Lambda error metrics command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			cmd.Help()
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetInstanceErrorRatePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Printf("Error fetching Lambda error data: %v\n", err)
				return
			}

			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}

AwsxLambdaErrorCmd defines the CLI command for retrieving Lambda error metrics

View Source
var AwsxEc2ErrorTrackingPanelCmd = &cobra.Command{

	Use:   "error_tracking_panel",
	Short: "Get error tracking panel metrics data",
	Long:  `Command to get error tracking panel metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running error tracking panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			results, err := GetErrorTrackingPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error in getting instance error rate panel: ", err)
				return
			}

			fmt.Println(results)
		}
	},
}
View Source
var AwsxEc2InactiveInstanceCmd = &cobra.Command{

	Use:   "inactive_instances_panel",
	Short: "Get inactive instances count metrics data",
	Long:  `Command to get inactive instance count metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running instance count panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetInactiveInstancesCountPanel(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxEc2InstanceCountCmd = &cobra.Command{
	Use:   "instance_count_panel",
	Short: "Get instance count metrics data",
	Long:  `Command to get instance count metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running instance count panel command")

		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			if err := cmd.Help(); err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, err := GetInstanceCountPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting instance count data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(jsonResp)
			} else {
				fmt.Println(jsonResp)
			}

		}
	},
}
View Source
var AwsxEc2InstanceHealthCheckCmd = &cobra.Command{

	Use:   "ec2_instance_health_check_panel",
	Short: "Get ec2 instance health check data",
	Long:  `Command to get ec2 instance health check data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running ec2 instance health check panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetEc2InstanceHealthCheckData(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxEc2InstanceHealthCheckNewCmd = &cobra.Command{
	Use:   "instance_health_check_new",
	Short: "Get EC2 instance health check data",
	Long:  `Command to get EC2 instance health check data including counts of healthy and unhealthy instances`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running instance health check command...")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			healthCheck, err := GetInstanceHealthCheckNew(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network traffic data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println("This cli is for only json output")
			} else {
				jsonResp, err := json.Marshal(&healthCheck)
				if err != nil {
					log.Println("Error marshalling network traffic data: ", err)
					return
				}
				fmt.Println(string(jsonResp))
			}
		}
	},
}
View Source
var AwsxEc2InstanceOverallHealthCmd = &cobra.Command{
	Use:   "instance_health_check_new",
	Short: "Get EC2 instance health check data",
	Long:  `Command to get EC2 instance health check data including counts of healthy and unhealthy instances`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running instance health check command...")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			healthCheck, err := GetInstanceOverallHealth(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting instance health data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println("This CLI is for JSON output only")
			} else {
				fmt.Println(healthCheck)
			}
		}
	},
}
View Source
var AwsxEc2InstanceRunningHourCmd = &cobra.Command{

	Use:   "instance_stop_count_panel",
	Short: "Get instance stop count metrics data",
	Long:  `Command to get instance stop count metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running instance stop count panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetInstanceRunningHour(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxEc2InstanceStartCmd = &cobra.Command{

	Use: "instance_start_count_panel",

	Short: "get instance start count metrics data",

	Long: `command to get instance start count metrics data`,

	Run: func(cmd *cobra.Command, args []string) {

		fmt.Println("running from child command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {

			log.Printf("Error during authentication: %v\n", err)

			err := cmd.Help()

			if err != nil {

				return
			}

			return
		}
		if authFlag {
			panel, err := GetInstanceStartCountPanel(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)

		}

	},
}
View Source
var AwsxEc2InstanceStatebyInstanceIdCmd = &cobra.Command{

	Use:   "ec2_instance_state_by_instanceid_panel",
	Short: "Get ec2 instance state by instanceid logs data",
	Long:  `Command to get ec2 instance state by instanceid logs data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running ec2 instance state by instanceid  panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetInstanceStateByInstanceIdData(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxEc2InstanceStatusCmd = &cobra.Command{
	Use:   "instance_status_panel",
	Short: "get instance status metrics data",
	Long:  `command to get instance status metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")

		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {

			instanceStatus, err := GetInstanceStatus(cmd, clientAuth)
			if err != nil {
				log.Fatalf("Error getting instance status: %v", err)
			}

			fmt.Printf("Instance ID: %s, Instance Type: %s, Availability Zone: %s, State: %s, System Checks Status: %s, Custom Alert: %t, Health Percentage: %.2f%%\n",
				instanceStatus.InstanceID, instanceStatus.InstanceType, instanceStatus.AvailabilityZone, instanceStatus.State, instanceStatus.SystemChecksStatus, instanceStatus.CustomAlert, instanceStatus.HealthPercentage)
		}
	},
}
View Source
var AwsxEc2InstanceStopCmd = &cobra.Command{

	Use:   "instance_stop_count_panel",
	Short: "Get instance stop count metrics data",
	Long:  `Command to get instance stop count metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running instance stop count panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetInstanceStopCountPanel(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxEc2InstanceStoppedHourCmd = &cobra.Command{

	Use:   "instance_stop_count_panel",
	Short: "Get instance stop count metrics data",
	Long:  `Command to get instance stop count metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running instance stop count panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetInstanceStoppedCountPanel(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxEc2InstanceTerminatedCountCmd = &cobra.Command{

	Use:   "instance_terminated_count_panel",
	Short: "Get instance terminated count metrics data",
	Long:  `Command to get instance terminated count metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running instance terminated count panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetInstanceTerminatedCountPanel(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxEc2InstancesByAZCmd = &cobra.Command{
	Use:   "instances_by_az_panel",
	Short: "Get EC2 instances by availability zone",
	Long:  `Command to get EC2 instances by availability zone`,

	Run: func(cmd *cobra.Command, args []string) {
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, instanceCounts, err := GetInstancesByAvailabilityZone(clientAuth)
			if err != nil {
				log.Println("Error getting EC2 instances by availability zone: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(instanceCounts)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2LatencyCmd = &cobra.Command{
	Use:   "latency_panel",
	Short: "get latency metrics data",
	Long:  `command to get latency metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetLatencyPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2LatestSuccessfulEventsCmd = &cobra.Command{

	Use:   "latest_sucessful_events_panel",
	Short: "Get latest successful events metrics data",
	Long:  `Command to get latest successful events metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running latest successful events count panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetLatestSucessfulEventsCountPanel(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxEc2MemCachedCmd = &cobra.Command{
	Use:   "memory_cached_panel",
	Short: "get memory cache metrics data",
	Long:  `command to get memory cache metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemUsageTotal(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2MemoryUsageFreeCmd = &cobra.Command{
	Use:   "memory_usage_free_utilization_panel",
	Short: "get cpu memory usage free utilization metrics data",
	Long:  `command to get cpu usage free utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemUsageFreePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2MemoryUsageTotalCmd = &cobra.Command{
	Use:   "memory_usage_panel",
	Short: "get memory usage metrics data",
	Long:  `command to get memory usage metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemUsageTotal(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2MemoryUsageUsedCmd = &cobra.Command{
	Use:   "memory_usage_used__utilization_panel",
	Short: "get memory usage used metrics data",
	Long:  `command to get memory usage used metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemUsageUsed(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting memory usage used: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2MemoryUtilizationCmd = &cobra.Command{
	Use:   "memory_utilization_panel",
	Short: "get memory utilization metrics data",
	Long:  `command to get memory utilization metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemoryUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting memory utilization: ", err)
				fmt.Println("null")
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2MemoryUtilizationCountCmd = &cobra.Command{
	Use:   "memory_utilization_count_panel",
	Short: "get memory utilization metrics new data",
	Long:  `command to get memory utilization metrics new data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemoryUtilizationNew2Panel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting memory utilization data: ", err)
				fmt.Println("null")
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2MemoryUtilizationForAllInstancesCmd = &cobra.Command{
	Use:   "memory_utilization_panel",
	Short: "get memory utilization metrics data",
	Long:  `command to get memory utilization metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemoryUtilizationForAllInstancesPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting memory utilization: ", err)
				fmt.Println("null")
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2MemoryUtilizationGraphCmd = &cobra.Command{
	Use:   "memory_utilization_graph_panel",
	Short: "get memory utilization graph metrics data",
	Long:  `command to get memory utilization graph metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemoryUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting memory utilization graph: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2MemoryUtilizationNewCmd = &cobra.Command{
	Use:   "memory_utilization_panel",
	Short: "get memory utilization metrics data",
	Long:  `command to get memory utilization metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemoryUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting memory utilization: ", err)
				fmt.Println("null")
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2NetworkInAllInstanceCmd = &cobra.Command{
	Use:   "incoming_network_traffic_by_instance_id_panel",
	Short: "get network in  all instance graph metrics data",
	Long:  `command to get network id  all instance graph metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCpuUtilizationGraphAllInstancePanel(cmd, "", clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization graph: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2NetworkInBytesCmd = &cobra.Command{
	Use:   "network_inbytes_utilization_panel",
	Short: "get network inbytes metrics data",
	Long:  `command to get network inbytes metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetNetworkInBytesPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network inbytes metrics data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2NetworkInPacketsCmd = &cobra.Command{
	Use:   "network_inpackets_utilization_panel",
	Short: "get network inpackets utilization metrics data",
	Long:  `command to get network inpackets utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetNetworkInPacketsPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network inpackets metric data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2NetworkInboundCmd = &cobra.Command{
	Use:   "network_in_bound_panel",
	Short: "get network in bound metrics data",
	Long:  `command to get network in bound metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetNetworkInBoundPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network in bytes metrics data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2NetworkLatencyCmd = &cobra.Command{
	Use:   "network_latency_panel",
	Short: "Get network latency metrics data for EC2",
	Long:  `Command to get average and maximum network latency metrics from AWS CloudWatch for EC2`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from EC2 network latency command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			if helpErr := cmd.Help(); helpErr != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetEc2NetworkLatencyData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting EC2 network latency data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxEc2NetworkOutAllInstanceCmd = &cobra.Command{
	Use:   "outgoing_network_traffic_by_instance_id_panel",
	Short: "get network out all instance graph metrics data",
	Long:  `command to get network out all instance graph metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCpuUtilizationGraphAllInstancePanel(cmd, "", clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization graph: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2NetworkOutBytesCmd = &cobra.Command{
	Use:   "network_outbytes_utilization_panel",
	Short: "get network outbytes utilization metrics data",
	Long:  `command to get network out bytes utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetNetworkOutBytesPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network outbytes metrics data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2NetworkOutPacketsCmd = &cobra.Command{
	Use:   "network_outpackets_utilization_panel",
	Short: "get network outpackts utilization metrics data",
	Long:  `command to get network outpackets utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetNetworkOutPacketsPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network outpackets metric data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2NetworkOutboundCmd = &cobra.Command{
	Use:   "network_out_bound_panel",
	Short: "get network out bound metrics data",
	Long:  `command to get network out bound metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetNetworkOutBoundPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network in bytes metrics data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2NetworkThroughputCmd = &cobra.Command{
	Use:   "network_throughput_panel",
	Short: "get network throughput metrics data",
	Long:  `command to get network throughput metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetNetworkThroughputPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network throughput data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxEc2NetworkUtilizationAcrossAllInstanceCmd = &cobra.Command{
	Use:   "total_network_utilization_panel",
	Short: "get network utilization metrics data for all instances",
	Long:  `command to get network utilization metrics data for all instances`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetNetworkUtilizationAcrossAllInstancesPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2NetworkUtilizationCmd = &cobra.Command{
	Use:   "network_utilization_panel",
	Short: "get network utilization metrics data",
	Long:  `command to get network utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetNetworkUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2StorageUtilizationCmd = &cobra.Command{
	Use:   "Storage_utilization_panel",
	Short: "get storage utilization metrics data",
	Long:  `command to get storage utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetStorageUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2StorageUtilizationCountCmd = &cobra.Command{
	Use:   "storage_utilization_panel",
	Short: "get storage utilization metrics",
	Long:  `command to get storage utilization metrics`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from storage utilization command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetStorageUtilizationCountPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting storage utilization data: ", err)
				fmt.Println("null")
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxEc2ThrottlesRequestCountCmd = &cobra.Command{
	Use:   "throttles_request_count_panel",
	Short: "get throttle requests panel ",
	Long:  `command to get throttle request panel `,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from throttle count panel")

		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			cloudwatchMetric, err := GetEc2CustomAlertPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting custom alerts: ", err)
				return
			}
			fmt.Println(cloudwatchMetric)
		}
	},
}
View Source
var AwsxEc2TotalCpuUtilizationAcrossAllInstanceCmd = &cobra.Command{
	Use:   "total_cpu_utilization_across_all_instance_panel",
	Short: "get cpu utilization across all instance metrics data",
	Long:  `command to get cpu utilization across all instance metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command..")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCPUUtilizationAcrossAllInstancePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization across all instance : ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2hostedServicesCmd = &cobra.Command{
	Use:   "EC2",
	Short: "A brief description of your application",
	Long:  `A longer description that spans multiple lines and likely contains examples and usage of using your application.`,
	Run: func(cmd *cobra.Command, args []string) {
		queryName, _ := cmd.Flags().GetString("query")
		elementType, _ := cmd.Flags().GetString("elementType")

		if queryName == "hosted_services_overview_panel" && (elementType == "EC2" || elementType == "AWS/EC2") {
			_, err := GetHostedServicesData(cmd)
			if err != nil {
				return
			}
		}
	},
}

AwsxEc2hostedServicesCmd represents the EC2 command.

View Source
var AwsxElasticIpPanelCmd = &cobra.Command{
	Use:   "elastic_ip_panel",
	Short: "Retrieve Elastic IP details",
	Long:  `Command to retrieve Elastic IP details including fields like Name, Allocated IPv4 Address, Allocation ID, and Associated Instance ID.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from Elastic IP panel command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, elasticIpDetailsResp, err := GetElasticIpDetails(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Elastic IP details: ", err)
				return
			}
			if responseType == "frame" {
				for _, detail := range elasticIpDetailsResp {
					fmt.Printf("%+v\n", *detail)
				}
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxGetOverAllCostOfEc2 = &cobra.Command{
	Use:   "getTotalCostOfTheEc2",
	Short: "Get cost of all cost of a EC2",
	Long:  `Retrieve the total cost of EC2 using AWS Cost Explorer.`,
	Run: func(cmd *cobra.Command, args []string) {
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Println("Error during authentication:", err)
			cmd.Help()
			return
		}

		if authFlag {

			costData, err := GetOverAllCostOfEc2(cmd, clientAuth)
			if err != nil {
				log.Println("Error getting cost data: ", err)
				return
			}
			fmt.Println(costData)

		} else {
			log.Println("Authentication failed. Exiting...")
		}
	},
}
View Source
var AwsxGetRegionalCostDistribution = &cobra.Command{
	Use:   "getTotalRegionCostData",
	Short: "Get total cost of all regions",
	Long:  "Retrieve the total cost of specified regions using AWS Cost Explorer.",
	Run: func(cmd *cobra.Command, args []string) {
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Println("Error during authentication:", err)
			cmd.Help()
			return
		}

		if authFlag {
			regions, err := GetAllRegions(clientAuth)
			if err != nil {
				log.Println("Error fetching regions:", err)
				return
			}

			var costDataResponses []CostOfEachRegion
			var allRegionsTotal float64

			for _, region := range regions {
				totalMonthlyCost, err := GetAllRegionCost(cmd, clientAuth, region)
				if err != nil {
					log.Println("Error getting cost data for region", region, ":", err)
					continue
				}

				costDataResponses = append(costDataResponses, CostOfEachRegion{
					Region:    region,
					TotalCost: totalMonthlyCost,
				})
				allRegionsTotal += totalMonthlyCost
			}

			response := CostDataResponse{
				RegionTotalCosts: costDataResponses,
				AllRegionsTotal:  allRegionsTotal,
			}

			fmt.Printf("Response: %+v\n", response)
		} else {
			log.Println("Authentication failed. Exiting...")
		}
	},
}

Command to get total region cost data

View Source
var AwsxInstanceAvailabilityCmd = &cobra.Command{
	Use:   "instance_availability_panel",
	Short: "Retrieve EC2 Instances availability details",
	Long:  `Command to retrieve EC2 Instance availability details including fields like InstanceID, AvailabilityZone, InstanceName, State, and StateReason.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from Instance Availability Panel command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, err := GetInstanceAvailabilityDetails(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Instance availability details: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(jsonResp)

			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxInstanceAvailabilityZoneCmd = &cobra.Command{
	Use:   "instance_availalbility_zones_panel",
	Short: "gets total insatances and availability zones percentage",
	Long:  `Command to get total insatances and availability zones percentage`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetInstanceAvailabilityZonesData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting instance availalbility zones data : ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxInstanceEvents1Cmd = &cobra.Command{

	Use:   "ec2_instance_events_panel",
	Short: "Get ec2 instance events logs data",
	Long:  `Command to get ec2 instance events logs data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running ec2 instance events  panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetInstanceEvents1Data(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxInstanceFailureCountCmd = &cobra.Command{

	Use:   "instance_failure_count_panel",
	Short: "Get instance failure count metrics data",
	Long:  `Command to get instance failure count metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running instance failure count panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetInstanceFailureCountPanel(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxInstanceLaunchedInAvailabilityZoneCmd = &cobra.Command{

	Use:   "ec2_instances_launched_in_availabilityzone_panel",
	Short: "Get ec2 instances launched in availabilityzone logs data",
	Long:  `Command to get ec2 instances launched in availabilityzone logs data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running ec2 instances launched in availability zones panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetInstancesLaunchedInAvailabilityZone(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxInstanceSummaryCmd = &cobra.Command{
	Use:   "ec2_instance_summary_panel",
	Short: "Retrieve EC2 Instances Summary details",
	Long:  `Command to retrieve EC2 Instance summary details including fields like InstanceID, AvailabilityZone, InstanceName, State, and StateReason.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from Instance Summary Details Panel command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, err := GetInstanceSummaryDetails(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Instance Summary details: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(jsonResp)

			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxInstancesPanelCmd = &cobra.Command{
	Use:   "instances_panel",
	Short: "Retrieve EC2 Instances details",
	Long:  `Command to retrieve EC2 Instances details including fields like InstanceID, InstanceName, and AvailabilityZone.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from Instances panel command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, instanceDetailsResp, err := GetInstanceDetails(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Instance details: ", err)
				return
			}
			if responseType == "frame" {
				for _, detail := range instanceDetailsResp {
					fmt.Printf("%+v\n", *detail)
				}
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxKeyPairsPanelCmd = &cobra.Command{
	Use:   "key_pairs_panel",
	Short: "Retrieve EC2 key pairs",
	Long:  `Command to retrieve EC2 Key Pairs details including fields like Key Pairs Name,Type and Created Time.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from key pairs panel command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, keyPairsResp, err := GetKeyPairsDetails(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Key Pair details: ", err)
				return
			}
			if responseType == "frame" {
				for _, detail := range keyPairsResp {
					fmt.Printf("%+v\n", *detail)
				}
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxMemoryUtilizationCmd = &cobra.Command{
	Use:   "memory_utilization_panel",
	Short: "Get memory utilization metrics data",
	Long:  `Command to get memory utilization metrics data for EC2 instances using CloudWatch metrics`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running Memory Utilization Panel")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting memory utilization: ", err)
				return
			}
			if responseType == "frame" {

				for _, metricData := range cloudwatchMetricResp {

					for i := range metricData.MetricDataResults[0].Timestamps {
						timestamp := metricData.MetricDataResults[0].Timestamps[i]
						memUsedBytes := *metricData.MetricDataResults[0].Values[i]
						memUsedGB := memUsedBytes / (1024 * 1024 * 1024)
						fmt.Printf("Timestamp: %s, Memory Utilization: %.2f GB\n", timestamp, memUsedGB)
					}
				}
			} else {

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxNetworkConnectivityCmd = &cobra.Command{
	Use:   "instance_connectivity_panel",
	Short: "gets connectivity of instances",
	Long:  `Command to get connectivity of instances`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetConnectivityData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting connectivity of instances : ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxNetworkTrafficMbPerSecCmd = &cobra.Command{
	Use:   "network_traffic_panel",
	Short: "Get network traffic metrics for EC2 instances in MB/s",
	Long:  `Command to get network traffic metrics data (NetworkIn and NetworkOut) for EC2 instances with Timestamp in MB per second`,

	Run: func(cmd *cobra.Command, args []string) {
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			_, cloudwatchMetricResp, err := GetNetworkTrafficMbPerSecPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network traffic overview: ", err)
				return
			}

			if responseType == "frame" {
				for _, metricData := range cloudwatchMetricResp {

					for i := range metricData.MetricDataResults[0].Timestamps {
						incomingTraffic := *metricData.MetricDataResults[0].Values[i] / 1048576
						outgoingTraffic := *metricData.MetricDataResults[1].Values[i] / 1048576
						fmt.Printf("Network In: %.6f MB/Sec, Network Out: %.6f MB/Sec\n", incomingTraffic, outgoingTraffic)
					}
				}
			} else {
				fmt.Println("Invalid response type. Use 'frame' for output.")
			}
		}
	},
}
View Source
var AwsxSecurityGroupDetailsCmd = &cobra.Command{

	Use:   "security_group_details_panel",
	Short: "Get ec2 security group details logs data",
	Long:  `Command to get ec2 security group details logs data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running ec2 security group details  panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetSecurityGroupDetails(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxSecurityGroupPanelCmd = &cobra.Command{
	Use:   "security_group_panel",
	Short: "Retrieve Security Group Inbound and Outbound Rule Count",
	Long:  `Command to retrieve Security Group Inbound and Outbound Rule Count, including fields like Security Group Name, Inbound Rule Count, and Outbound Rule Count.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from Security Group panel command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, securityGroupDetailsResp, err := GetSecurityGroupDetail(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Security Group details: ", err)
				return
			}
			if responseType == "frame" {
				for _, detail := range securityGroupDetailsResp {
					fmt.Printf("%+v\n", *detail)
				}
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxSnapshotsPanelCmd = &cobra.Command{
	Use:   "snapshots_panel",
	Short: "Retrieve EC2 Snapshots details",
	Long:  `Command to retrieve EC2 Snapshots details including fields like Name, SnapshotId, VolumeSize, and Description.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from Snapshots panel command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, snapshotDetailsResp, err := GetSnapshotDetails(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Snapshot details: ", err)
				return
			}
			if responseType == "frame" {
				for _, detail := range snapshotDetailsResp {
					fmt.Printf("%+v\n", *detail)
				}
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxSuccessfulEventsInEc2Cmd = &cobra.Command{

	Use:   "successful_events_in_ec2panel",
	Short: "Get successful events in ec2 logs data",
	Long:  `Command to get successful events in ec2 logs data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running successful events in ec2  panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetSuccessfulEventsInEc2(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxTotalInstanceRunTimeByInstanceIdCmd = &cobra.Command{

	Use:   "total_instance_run_time_by_instanceid_panel",
	Short: "Get total instance run time by instanceid logs data",
	Long:  `Command to get total instance run time by instanceid logs data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running total instance run time by instanceid  panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetTotalInstanceRunTimeByInstanceIdCount(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxTotalInstanceStopTimeByInstanceIdCmd = &cobra.Command{

	Use:   "ec2_instance_events_panel",
	Short: "Get ec2 instance events logs data",
	Long:  `Command to get ec2 instance events logs data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running ec2 instance events  panel command")

		var authFlag bool
		var clientAuth *model.Auth
		var err error
		authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)

		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			panel, err := GetTotalInstanceStopTimeByInstanceIdCount(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxVolumesPanelCmd = &cobra.Command{
	Use:   "volumes_panel",
	Short: "Retrieve EC2 Volumes details",
	Long:  `Command to retrieve EC2 Volumes details including fields like Name, VolumeId, Type, Created, and Volume State.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from Volumes panel command")
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, volumeDetailsResp, err := GetVolumeDetails(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Volume details: ", err)
				return
			}
			if responseType == "frame" {
				for _, detail := range volumeDetailsResp {
					fmt.Printf("%+v\n", *detail)
				}
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var Ec2AlarmandNotificationCmd = &cobra.Command{
	Use:   "ec2_alerts_and_notifications_panel",
	Short: "Retrieve recent alerts and notifications related to EC2 instance availability",
	Long:  `Command to retrieve recent alerts and notifications related to EC2 instance availability`,

	Run: func(cmd *cobra.Command, args []string) {
		authFlag, clientAuth, err := handleAuth(cmd)
		if err != nil {
			log.Println("Error during authentication:", err)
			return
		}

		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			notifications, err := GetEC2AlertsAndNotifications(cmd, clientAuth)
			if err != nil {
				log.Println("Error getting alerts and notifications:", err)
				return
			}

			if responseType == "frame" {
				printFrame(notifications)
			} else {
				printJSON(notifications)
			}
		}
	},
}
View Source
var GetCostDataPerInstanceTypeCmd = &cobra.Command{
	Use:   "cost_by_instance_type",
	Short: "Get cost of EC2 instances by instance type",
	Long:  `Retrieve the cost for EC2 instances grouped by instance type using AWS Cost Explorer.`,
	Run: func(cmd *cobra.Command, args []string) {
		authFlag, clientAuth, err := authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Println("Error during authentication:", err)
			cmd.Help()
			return
		}

		if authFlag {
			responseType, _ := cmd.Flags().GetString("responseType")
			costData, err := GetCostPerInstanceType(cmd, clientAuth)
			if err != nil {
				log.Println("Error getting EC2 cost data:", err)
				return
			}

			if responseType == "frame" {

				fmt.Println(costData)
			} else {

				fmt.Println(costData)
			}
		} else {
			log.Println("Authentication failed. Exiting...")
		}
	},
}

Functions

func GetAllNetworkMetricData added in v1.12.0

func GetAllNetworkMetricData(clientAuth *model.Auth, elementType string, startTime, endTime *time.Time, metricName string, cloudWatchClient *cloudwatch.CloudWatch) (*cloudwatch.GetMetricDataOutput, error)

func GetAllRegionCost added in v1.15.5

func GetAllRegionCost(cmd *cobra.Command, clientAuth *model.Auth, region string) (float64, error)

GetAllRegionCost retrieves the cost for each region

func GetAllRegions added in v1.15.5

func GetAllRegions(clientAuth *model.Auth) ([]string, error)

GetAllRegions retrieves all available regions

func GetBackupStatus added in v1.12.0

func GetBackupStatus(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, error)

func GetCPUUsageIdlePanel added in v1.2.2

func GetCPUUsageIdlePanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetCPUUsageNicePanel added in v1.2.2

func GetCPUUsageNicePanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetCPUUsageSysPanel added in v1.2.2

func GetCPUUsageSysPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetCPUUsageUserPanel added in v1.2.0

func GetCPUUsageUserPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetCPUUtilizationAcrossAllInstancePanel added in v1.13.8

func GetCPUUtilizationAcrossAllInstancePanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetCostPerInstanceType added in v1.15.3

func GetCostPerInstanceType(cmd *cobra.Command, clientAuth *model.Auth) (string, error)

func GetCpuUtilizationAcrossAllInstancesPanel added in v1.12.2

func GetCpuUtilizationAcrossAllInstancesPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetCpuUtilizationGraphAllInstancePanel added in v1.13.7

func GetCpuUtilizationGraphAllInstancePanel(cmd *cobra.Command, responseBody string, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetCpuUtilizationGraphPanel added in v1.6.0

func GetCpuUtilizationGraphPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetCpuUtilizationPanel added in v1.0.7

func GetCpuUtilizationPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDataTransferINInstancesIdPanel added in v1.14.2

func GetDataTransferINInstancesIdPanel(cmd *cobra.Command, responseBody string, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDataTransferOUTInstancesIdPanel added in v1.14.2

func GetDataTransferOUTInstancesIdPanel(cmd *cobra.Command, responseBody string, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskAvailablePanel added in v1.2.2

func GetDiskAvailablePanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskIOOperationsMbPerSecPanel added in v1.14.2

func GetDiskIOOperationsMbPerSecPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskReadPanel added in v1.1.6

func GetDiskReadPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskStorageUtilizationAllInstancePanel added in v1.14.3

func GetDiskStorageUtilizationAllInstancePanel(cmd *cobra.Command, responseBody string, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskUsedPanel added in v1.2.2

func GetDiskUsedPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskUtilizationCountPercentData added in v1.14.3

func GetDiskUtilizationCountPercentData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskUtilizationData added in v1.12.0

func GetDiskUtilizationData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskWritePanel added in v1.1.7

func GetDiskWritePanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetEC2CPUCreditUsage added in v1.16.4

func GetEC2CPUCreditUsage(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

GetEC2CPUUsage collects the CPU Credit Usage (in vCPUs) and CPU Utilization (in percentage) for EC2 instances.

func GetEC2CPUReservationData added in v1.12.0

func GetEC2CPUReservationData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetEC2DiskIOOperationsMBpsPanel added in v1.12.6

func GetEC2DiskIOOperationsMBpsPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetEC2DiskIOPerformancePanel added in v1.7.2

func GetEC2DiskIOPerformancePanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetEc2CustomAlertPanel added in v1.4.8

func GetEc2CustomAlertPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetEc2InstanceEventsData added in v1.11.9

func GetEc2InstanceEventsData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetEc2InstanceHealthCheckData added in v1.11.9

func GetEc2InstanceHealthCheckData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetEc2NetworkLatencyData added in v1.13.8

func GetEc2NetworkLatencyData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetEc2throttleCountPanel added in v1.12.6

func GetEc2throttleCountPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetErrorTrackingPanel added in v1.11.9

func GetErrorTrackingPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetInactiveInstancesCountPanel added in v1.11.9

func GetInactiveInstancesCountPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetInstanceAvailabilityDetails added in v1.12.2

func GetInstanceAvailabilityDetails(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, error)

func GetInstanceCountPanel added in v1.12.0

func GetInstanceCountPanel(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, error)

func GetInstanceErrorRatePanel added in v1.4.6

func GetInstanceErrorRatePanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatchlogs.CloudWatchLogs) (string, map[string]interface{}, error)

GetLambdaErrorData retrieves Lambda error metrics and calculates percentage change

func GetInstanceEvents1Data added in v1.12.4

func GetInstanceEvents1Data(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetInstanceFailureCountPanel added in v1.11.9

func GetInstanceFailureCountPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetInstanceHealthCheckNew added in v1.12.0

func GetInstanceHealthCheckNew(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, error)

func GetInstanceOverallHealth added in v1.12.4

func GetInstanceOverallHealth(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, error)

func GetInstanceRunningHour added in v1.6.8

func GetInstanceRunningHour(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetInstanceStartCountPanel added in v1.2.4

func GetInstanceStartCountPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetInstanceStateByInstanceIdData added in v1.12.4

func GetInstanceStateByInstanceIdData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetInstanceStopCountPanel added in v1.2.4

func GetInstanceStopCountPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetInstanceStoppedCountPanel added in v1.6.8

func GetInstanceStoppedCountPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetInstanceSummaryDetails added in v1.13.9

func GetInstanceSummaryDetails(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, error)

func GetInstanceTerminatedCountPanel added in v1.11.9

func GetInstanceTerminatedCountPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetInstancesByAvailabilityZone added in v1.12.6

func GetInstancesByAvailabilityZone(clientAuth *model.Auth) (string, map[string]interface{}, error)

func GetInstancesLaunchedInAvailabilityZone added in v1.12.4

func GetInstancesLaunchedInAvailabilityZone(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetLatencyMetricData added in v1.2.4

func GetLatencyMetricData(clientAuth *model.Auth, instanceID, elementType string, startTime, endTime *time.Time, statistic string, metricName string, cloudWatchClient *cloudwatch.CloudWatch) (*cloudwatch.GetMetricDataOutput, error)

func GetLatencyPanel added in v1.2.4

func GetLatencyPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetLatestSucessfulEventsCountPanel added in v1.11.9

func GetLatestSucessfulEventsCountPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetListOfInstancesFailureData added in v1.11.9

func GetListOfInstancesFailureData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetMemCachePanel added in v1.2.2

func GetMemCachePanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetMemUsageFreePanel added in v1.2.2

func GetMemUsageFreePanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetMemUsageTotal added in v1.2.2

func GetMemUsageTotal(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetMemUsageUsed added in v1.2.2

func GetMemUsageUsed(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetMemUtilizationPanel added in v1.14.4

func GetMemUtilizationPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetMemoryUtilizationForAllInstancesPanel added in v1.12.2

func GetMemoryUtilizationForAllInstancesPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetMemoryUtilizationGraphPanel added in v1.6.0

func GetMemoryUtilizationGraphPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetMemoryUtilizationNew2Panel added in v1.12.6

func GetMemoryUtilizationNew2Panel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetMemoryUtilizationNewPanel added in v1.12.0

func GetMemoryUtilizationNewPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetMemoryUtilizationPanel added in v1.1.6

func GetMemoryUtilizationPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkInBoundPanel added in v1.2.4

func GetNetworkInBoundPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkInBytesPanel added in v1.1.8

func GetNetworkInBytesPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkInGraphAllInstancePanel added in v1.13.8

func GetNetworkInGraphAllInstancePanel(cmd *cobra.Command, responseBody string, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkInPacketsPanel added in v1.1.6

func GetNetworkInPacketsPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkMetricData added in v1.1.1

func GetNetworkMetricData(clientAuth *model.Auth, elementType string, startTime, endTime *time.Time, metricName string, cloudWatchClient *cloudwatch.CloudWatch) (*cloudwatch.GetMetricDataOutput, error)

func GetNetworkOutBoundPanel added in v1.2.4

func GetNetworkOutBoundPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkOutBytesPanel added in v1.2.0

func GetNetworkOutBytesPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkOutGraphAllInstancePanel added in v1.13.8

func GetNetworkOutGraphAllInstancePanel(cmd *cobra.Command, responseBody string, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkOutPacketsPanel added in v1.1.6

func GetNetworkOutPacketsPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkThroughputMetricData added in v1.2.4

func GetNetworkThroughputMetricData(clientAuth *model.Auth, instanceID, elementType string, startTime, endTime *time.Time, statistic, metricName string, cloudWatchClient *cloudwatch.CloudWatch) (*cloudwatch.GetMetricDataOutput, error)

func GetNetworkThroughputPanel added in v1.2.4

func GetNetworkThroughputPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkTrafficMbPerSecPanel added in v1.13.9

func GetNetworkTrafficMbPerSecPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkTrafficNewPanel added in v1.12.0

func GetNetworkTrafficNewPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, error)

func GetNetworkTrafficPanel added in v1.7.3

func GetNetworkTrafficPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkUtilizationAcrossAllInstancesPanel added in v1.12.2

func GetNetworkUtilizationAcrossAllInstancesPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkUtilizationPanel added in v1.1.1

func GetNetworkUtilizationPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetOverAllCostOfEc2 added in v1.15.3

func GetOverAllCostOfEc2(cmd *cobra.Command, clientAuth *model.Auth) (*costexplorer.MetricValue, error)

func GetSecurityGroupData added in v1.12.6

func GetSecurityGroupData(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, error)

func GetSecurityGroupDetails added in v1.12.4

func GetSecurityGroupDetails(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetStorageUtilizationCountPanel added in v1.12.6

func GetStorageUtilizationCountPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetStorageUtilizationPanel added in v1.7.2

func GetStorageUtilizationPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetSuccessfulEventsInEc2 added in v1.12.4

func GetSuccessfulEventsInEc2(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetTotalInstanceRunTimeByInstanceIdCount added in v1.12.4

func GetTotalInstanceRunTimeByInstanceIdCount(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetTotalInstanceStopTimeByInstanceIdCount added in v1.12.4

func GetTotalInstanceStopTimeByInstanceIdCount(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchLogs *cloudwatchlogs.CloudWatchLogs) ([]*cloudwatchlogs.GetQueryResultsOutput, error)

func GetTotalNetworkUtilizationData added in v1.12.2

func GetTotalNetworkUtilizationData(clientAuth *model.Auth, elementType string, startTime, endTime *time.Time, statistic string, metricName string, cloudWatchClient *cloudwatch.CloudWatch) (*cloudwatch.GetMetricDataOutput, error)

func GetformatCostData added in v1.15.5

func GetformatCostData(result *costexplorer.GetCostAndUsageOutput) float64

GetformatCostData processes the cost data returned from the API

func HandleAuths added in v1.11.9

func HandleAuths(cmd *cobra.Command) (bool, *model.Auth, error)

handleAuths handles the authentication process

func ProcesQuerysResults added in v1.12.4

func ProcessQuerieResults added in v1.12.4

func ProcessQuerieResultss added in v1.12.4

func ProcessQuerieResultss(results []*cloudwatchlogs.GetQueryResultsOutput) []*cloudwatchlogs.GetQueryResultsOutput

func ProcessQueriesResults added in v1.12.4

func ProcessQueriesResults(results []*cloudwatchlogs.GetQueryResultsOutput) []*cloudwatchlogs.GetQueryResultsOutput

func ProcessQueriessResults added in v1.12.4

func ProcessQueriessResults(results []*cloudwatchlogs.GetQueryResultsOutput) []*cloudwatchlogs.GetQueryResultsOutput

func ProcessQueryResults added in v1.10.0

func ProcessQueryResultss added in v1.11.9

func ProcessQueryResultz added in v1.11.9

func ProcessQuerysResult added in v1.11.9

func ProcessQuerysResults added in v1.12.4

func ProcessQuerysResultss added in v1.11.9

func ProcessQuerysResultss(results []*cloudwatchlogs.GetQueryResultsOutput) []*cloudwatchlogs.GetQueryResultsOutput

func ProcessQuerysResultzss added in v1.11.9

func ProcessQuerysResultzss(results []*cloudwatchlogs.GetQueryResultsOutput) []*cloudwatchlogs.GetQueryResultsOutput

func ProcesssQuerysResults added in v1.12.4

func ProcesssQuerysResults(results []*cloudwatchlogs.GetQueryResultsOutput) []*cloudwatchlogs.GetQueryResultsOutput

Types

type AMIDetails added in v1.12.4

type AMIDetails struct {
	Name           string `json:"Name"`
	AMIName        string `json:"AMIName"`
	AMIId          string `json:"AMIId"`
	Source         string `json:"Source"`
	Owner          string `json:"Owner"`
	Visibility     string `json:"Visibility"`
	Platform       string `json:"Platform"`
	RootDeviceType string `json:"RootDeviceType"`
	Status         string `json:"Status"`
}

func GetAMIDetails added in v1.12.4

func GetAMIDetails(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, []*AMIDetails, error)

type AutoScalingCounts added in v1.12.0

type AutoScalingCounts struct {
	AutoScalingActiveCounts int `json:"auto_scaling_active_counts"`
	LaunchConfigCount       int `json:"launch_config_count"`
}

func GetAutoScalingInfo added in v1.12.0

func GetAutoScalingInfo(cmd *cobra.Command, clientAuth *model.Auth, autoScalingClient *autoscaling.AutoScaling, ec2Client *ec2.EC2) (string, []AutoScalingCounts, error)

type AutoScalingGroupDetail added in v1.13.6

type AutoScalingGroupDetail struct {
	AutoScalingGroupName    string `json:"AutoScalingGroupName"`
	LaunchConfigurationName string `json:"LaunchConfigurationName"`
	InstanceType            string `json:"InstanceType"`
	MinSize                 int64  `json:"MinSize"`
	MaxSize                 int64  `json:"MaxSize"`
	DesiredCapacity         int64  `json:"DesiredCapacity"`
	HealthCheckType         string `json:"HealthCheckType"`
}

func GetAutoScalingGroupsDetail added in v1.13.6

func GetAutoScalingGroupsDetail(cmd *cobra.Command, clientAuth *model.Auth, autoScalingClient *autoscaling.AutoScaling) (string, []*AutoScalingGroupDetail, error)

type CloudElement added in v1.13.7

type CloudElement struct {
	InstanceId string `json:"InstanceId"`
}

type CloudElement1 added in v1.13.8

type CloudElement1 struct {
	InstanceId string `json:"InstanceId"`
}

type CloudElement2 added in v1.13.8

type CloudElement2 struct {
	InstanceId string `json:"InstanceId"`
}

type CloudElementId added in v1.14.3

type CloudElementId struct {
	InstanceId string `json:"InstanceId"`
}

type CloudElementNetworkIn added in v1.14.2

type CloudElementNetworkIn struct {
	InstanceId string `json:"InstanceId"`
}

type CloudElementNetworkOut added in v1.14.2

type CloudElementNetworkOut struct {
	InstanceId string `json:"InstanceId"`
}

type CostDataResponse added in v1.15.6

type CostDataResponse struct {
	RegionTotalCosts []CostOfEachRegion `json:"region_total_costs"`
	AllRegionsTotal  float64            `json:"all_regions_total"`
}

CostDataResponse holds the response data for total costs

type CostOfEachRegion added in v1.15.6

type CostOfEachRegion struct {
	Region    string  `json:"region"`
	TotalCost float64 `json:"total_monthly_cost"`
}

CostOfEachRegion holds the total cost for each region

type CostPerType added in v1.15.3

type CostPerType struct {
	InstanceType string `json:"InstanceType"`
	Cost         string `json:"Cost"`
}

type DiscReadBytesRes added in v1.12.0

type DiscReadBytesRes struct {
	InstanceType string
	Bytes        int64
}

func DiskReadBytesData added in v1.12.0

func DiskReadBytesData(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2, cloudWatchClient *cloudwatch.CloudWatch) (string, []DiscReadBytesRes, error)

type DiscWriteBytesRes added in v1.12.0

type DiscWriteBytesRes struct {
	InstanceType string
	Bytes        int64
}

func DiskWriteBytesData added in v1.12.0

func DiskWriteBytesData(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2, cloudWatchClient *cloudwatch.CloudWatch) (string, []DiscWriteBytesRes, error)

type DiskUtilization added in v1.12.0

type DiskUtilization struct {
	UsedSpace float64 `json:"usedSpace"`
	FreeSpace float64 `json:"freeSpace"`
}

DiskUtilization holds the used and free space information

type DiskUtilizationDetails added in v1.14.3

type DiskUtilizationDetails struct {
	RootVolume float64 `json:"rootVolume"`
	DataVolume float64 `json:"dataVolume"`
}

type EC2AlarmNotification added in v1.16.8

type EC2AlarmNotification struct {
	Timestamp   time.Time `json:"Timestamp"`
	Alert       string    `json:"Alert"`
	Description string    `json:"Description"`
}

func GetEC2AlertsAndNotifications added in v1.16.8

func GetEC2AlertsAndNotifications(cmd *cobra.Command, clientAuth *model.Auth) ([]EC2AlarmNotification, error)

type EC2InstanceSummary added in v1.13.5

type EC2InstanceSummary struct {
	ActiveInstanceCount int `json:"activeInstanceCount"`
}

func GetEC2ActiveInstanceCount added in v1.11.9

func GetEC2ActiveInstanceCount(clientAuth *model.Auth) (string, *EC2InstanceSummary, error)

GetEC2ActiveInstanceCount retrieves the count of active (running) EC2 instances

type Ec2CpuUtilizationResult added in v1.12.0

type Ec2CpuUtilizationResult struct {
	InstanceType string
	Items        map[time.Time]float64
}

func CpuUtilizationPerInstanceType added in v1.12.0

func CpuUtilizationPerInstanceType(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2, cloudWatchClient *cloudwatch.CloudWatch) (string, []Ec2CpuUtilizationResult, error)

type Ec2DiskReadOpsResult added in v1.12.0

type Ec2DiskReadOpsResult struct {
	InstanceType string
	Items        map[time.Time]float64
}

func DiskReadOpsPerInstanceType added in v1.12.0

func DiskReadOpsPerInstanceType(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2, cloudWatchClient *cloudwatch.CloudWatch) (string, []Ec2DiskReadOpsResult, error)

type Ec2DiskWriteOpsResult added in v1.12.0

type Ec2DiskWriteOpsResult struct {
	InstanceType string
	Items        map[time.Time]float64
}

func DiskWriteOpsPerInstanceType added in v1.12.0

func DiskWriteOpsPerInstanceType(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2, cloudWatchClient *cloudwatch.CloudWatch) (string, []Ec2DiskWriteOpsResult, error)

type Ec2InstanceOutputData added in v1.12.0

type Ec2InstanceOutputData struct {
	InstanceType string
	InstanceId   string
}

type Ec2Latency added in v1.2.4

type Ec2Latency struct {
	InboundTraffic  float64 `json:"inboundTraffic"`
	OutboundTraffic float64 `json:"outboundTraffic"`
	DataTransferred float64 `json:"dataTransferred"`
	Latency         float64 `json:"latency"`
}

type Ec2NetworkInResult added in v1.12.0

type Ec2NetworkInResult struct {
	InstanceType string
	Items        map[time.Time]float64
}

func NetworkInPerInstanceType added in v1.12.0

func NetworkInPerInstanceType(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2, cloudWatchClient *cloudwatch.CloudWatch) (string, []Ec2NetworkInResult, error)

type Ec2NetworkOutResult added in v1.12.0

type Ec2NetworkOutResult struct {
	InstanceType string
	Items        map[time.Time]float64
}

func NetworkOutPerInstanceType added in v1.12.0

func NetworkOutPerInstanceType(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2, cloudWatchClient *cloudwatch.CloudWatch) (string, []Ec2NetworkOutResult, error)

type ElasticIpDetails added in v1.12.5

type ElasticIpDetails struct {
	Name                 string `json:"Name"`
	AllocatedIPv4Address string `json:"AllocatedIPv4Address"`
	AllocationID         string `json:"AllocationId"`
	AssociatedInstanceID string `json:"AssociatedInstanceId"`
}

func GetElasticIpDetails added in v1.12.5

func GetElasticIpDetails(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, []*ElasticIpDetails, error)

type HealthCheck added in v1.12.0

type HealthCheck struct {
	HealthyInstancesCount   int `json:"HealthyInstancesCount"`
	UnhealthyInstancesCount int `json:"UnhealthyInstancesCount"`
}

HealthCheck struct to hold instance health data

type HostedSerivcesOverView added in v1.5.6

type HostedSerivcesOverView struct {
	ServiceName  string `json:"serviceName"`
	HealthStatus string `json:"healthStatus"`
	ResponseTime string `json:"responseTime"`
	ErrorRate    string `json:"errorRate"`
	Availability string `json:"availability"`
	Throughput   string `json:"throughput"`
}

ServiceStatus represents the status of a service.

func GetHostedServicesData added in v1.4.8

func GetHostedServicesData(cmd *cobra.Command) ([]HostedSerivcesOverView, error)

type Instance added in v1.12.2

type Instance struct {
	InstanceName     string
	InstanceType     string
	AvailabilityZone string
	Status           string
	DisconnectReason string
}

func GetConnectivityData added in v1.12.2

func GetConnectivityData(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, []Instance, error)

func GetConnectivityDetails added in v1.12.2

func GetConnectivityDetails(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) ([]Instance, error)

type InstanceAvailabilityDetail added in v1.13.8

type InstanceAvailabilityDetail struct {
	InstanceID       string `json:"InstanceID"`
	InstanceName     string `json:"InstanceName"`
	AvailabilityZone string `json:"AvailabilityZone"`
	State            string `json:"State"`
	StateReason      string `json:"StateReason"`
}

type InstanceBackupStatus added in v1.12.0

type InstanceBackupStatus struct {
	SuccessfulBackups int `json:"SuccessfulBackups"`
	MissedBackups     int `json:"MissedBackups"`
}

type InstanceCounts added in v1.12.0

type InstanceCounts struct {
	RunningInstances int
	StoppedInstances int
}

InstanceCounts struct to hold the counts of running and stopped instances

type InstanceDetail added in v1.12.5

type InstanceDetail struct {
	InstanceID       string `json:"InstanceID"` // Changed to InstanceID
	InstanceName     string `json:"InstanceName"`
	AvailabilityZone string `json:"AvailabilityZone"`
}

func GetInstanceDetails added in v1.12.5

func GetInstanceDetails(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, []*InstanceDetail, error)

type InstanceInfo added in v1.5.4

type InstanceInfo struct {
	InstanceID         string
	InstanceType       string
	AvailabilityZone   string
	State              string
	SystemChecksStatus string
	CustomAlert        bool
	HealthPercentage   float64
}

func GetInstanceStatus added in v1.2.7

func GetInstanceStatus(cmd *cobra.Command, clientauth *model.Auth) (InstanceInfo, error)

type InstanceSecurityGroupStatus added in v1.12.6

type InstanceSecurityGroupStatus struct {
	WebServerCount      int `json:"WebServerCount"`
	DatabaseServerCount int `json:"DatabaseServerCount"`
}

type InstanceSummaryDetails added in v1.13.9

type InstanceSummaryDetails struct {
	InstanceName     string `json:"InstanceName"`
	InstanceID       string `json:"InstanceID"`
	InstanceType     string `json:"InstanceType"`
	AvailabilityZone string `json:"AvailabilityZone"`
	Status           string `json:"Status"`
}

type KeyPairsDetails added in v1.12.5

type KeyPairsDetails struct {
	Name        string `json:"Name"`
	KeyPairType string `json:"Type"`
	CreatedTime string `json:"Created Time"`
}

func GetKeyPairsDetails added in v1.12.5

func GetKeyPairsDetails(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, []*KeyPairsDetails, error)

type Latency added in v1.12.0

type Latency struct {
	Average float64 `json:"average"`
	Maximum float64 `json:"maximum"`
}

type NetworkResult added in v1.1.1

type NetworkResult struct {
	InboundTraffic  float64 `json:"InboundTraffic"`
	OutboundTraffic float64 `json:"OutboundTraffic"`
	DataTransferred float64 `json:"DataTransferred"`
}

type NetworkThroughputData added in v1.2.4

type NetworkThroughputData struct {
	RawData []struct {
		Timestamp time.Time
		Value     float64
	} `json:"NetworkThroughputData"`
}

type NetworkTraffic added in v1.7.4

type NetworkTraffic struct {
	Inbound []struct {
		Timestamp time.Time
		Value     float64
	} `json:"network_inbound"`
	Outbound []struct {
		Timestamp time.Time
		Value     float64
	} `json:"network_outbound"`
}

type NetworkTrafficALL added in v1.12.0

type NetworkTrafficALL struct {
	InboundTraffic  float64 `json:"inbound_traffic"`
	OutboundTraffic float64 `json:"outbound_traffic"`
}

type OverallHealthCheck added in v1.12.4

type OverallHealthCheck struct {
	TotalInstancesCount    int `json:"TotalInstancesCount"`
	HealthyInstancesCount  int `json:"HealthyInstancesCount"`
	CriticalInstancesCount int `json:"CriticalInstancesCount"`
	WarningInstancesCount  int `json:"WarningInstancesCount"`
}

OverallHealthCheck struct to hold instance health data

type SecurityGroupDetails added in v1.12.5

type SecurityGroupDetails struct {
	SecurityGroupName string `json:"SecurityGroupName"`
	InboundRuleCount  int    `json:"InboundRuleCount"`
	OutboundRuleCount int    `json:"OutboundRuleCount"`
}

func GetSecurityGroupDetail added in v1.12.5

func GetSecurityGroupDetail(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, []*SecurityGroupDetails, error)

type SnapshotDetails added in v1.12.5

type SnapshotDetails struct {
	Name        string `json:"Name"`
	SnapshotId  string `json:"SnapshotId"`
	VolumeSize  int64  `json:"VolumeSize"`
	Description string `json:"Description"`
}

func GetSnapshotDetails added in v1.12.5

func GetSnapshotDetails(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, []*SnapshotDetails, error)

type StorageResult added in v1.7.2

type StorageResult struct {
	RootVolumeUtilization float64 `json:"RootVolumeUsage"`
	EBS1VolumeUtilization float64 `json:"EBSVolume1Usage"`
	EBS2VolumeUtilization float64 `json:"EBSVolume2Usage"`
}

type Summary added in v1.12.2

type Summary struct {
	TotalInstances int        `json:"total_instances"`
	Zones          []ZoneInfo `json:"zones"`
}

func GetEc2InstanceDetails added in v1.12.2

func GetEc2InstanceDetails(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (Summary, error)

func GetInstanceAvailabilityZonesData added in v1.12.2

func GetInstanceAvailabilityZonesData(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, Summary, error)

type VolumeDetails added in v1.12.5

type VolumeDetails struct {
	Name        string `json:"Name"`
	VolumeId    string `json:"VolumeId"`
	Type        string `json:"Type"`
	Created     string `json:"Created"`
	VolumeState string `json:"VolumeState"`
}

func GetVolumeDetails added in v1.12.5

func GetVolumeDetails(cmd *cobra.Command, clientAuth *model.Auth, ec2Client *ec2.EC2) (string, []*VolumeDetails, error)

type ZoneInfo added in v1.12.2

type ZoneInfo struct {
	AvailabilityZone string  `json:"availability_zone"`
	InstanceCount    int     `json:"instance_count"`
	Percentage       float64 `json:"percentage"`
}

Source Files

Jump to

Keyboard shortcuts

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