RDS

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AwsxDBConnectionCountCmd = &cobra.Command{
	Use:   "db_connection_count_panel",
	Short: "Get db connection count metrics data",
	Long:  `Command to get db connection metrics count data from AWS CloudWatch`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child 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 := GetDBConnectionCountData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting db connection count data: ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxDBInstanceHealthCheckCmd = &cobra.Command{

	Use:   "dbinstance_health_check_panel",
	Short: "get dbinstance health check metrics data",
	Long:  `command to get dbinstance status metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")

		var authFlag, _, 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 {
			check, err := GetDBInstanceHealthCheck()
			if err != nil {
				log.Printf("Error getting instance status: %v", err)
			}
			fmt.Println(check)
		}
	},
}
View Source
var AwsxDataBaseConnectionCountGraphCmd = &cobra.Command{
	Use:   "database_connection_count_graph_panel",
	Short: "Get database connection metrics data for RDS instances",
	Long:  `Command to get database connection metrics data for RDS 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 := GetDataBaseConnectionCountGraphPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting database connection: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxDatabaseStatusPanelCmd = &cobra.Command{
	Use:   "database_status_panel",
	Short: "Retrieve RDS database instance details",
	Long:  `Command to retrieve RDS database instance details including fields like Instance Name, Engine, Size, Maintenance, and Database Status.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from Database Status 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, dbDetailsResp, err := GetDatabaseDetails(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Database details: ", err)
				return
			}
			if responseType == "frame" {
				for _, detail := range dbDetailsResp {
					fmt.Printf("%+v\n", *detail)
				}
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}

Define the Cobra command for the database status panel

View Source
var AwsxErrorAnalysisCountCmd = &cobra.Command{

	Use:   "error_analysis_panel",
	Short: "Get error analysis  logs data",
	Long:  `Command to get error analysis 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 := GetErrorAnalysisCount(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxNetworkTransmitPanelCmd = &cobra.Command{
	Use:   "network_transmit_panel",
	Short: "Get network transmit metrics data",
	Long:  `Command to get network transmit metrics data from AWS CloudWatch`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from network transmit panel 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 := GetNetworkTransmitData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network transmit data: ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSActiveConnectionCountPanelCmd = &cobra.Command{

	Use: "active_connection_count_panel",

	Short: "get Active Connection Count data",

	Long: `command to get Active Connection Count logs 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 := GetRDSActiveConnectionCount(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)

		}

	},
}
View Source
var AwsxRDSCPUCreditBalanceCmd = &cobra.Command{
	Use:   "cpu_credit_balance_panel",
	Short: "Get CPU credit balance metrics data for RDS instances",
	Long:  `Command to get CPU credit balance metrics data for RDS 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 := GetCPUCreditBalancePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting CPU credit balance: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSCPUCreditUsageCmd = &cobra.Command{
	Use:   "cpu_credit_usage_panel",
	Short: "Get CPU credit usage metrics data for RDS instances",
	Long:  `Command to get CPU credit usage metrics data for RDS 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 := GetCPUCreditUsagePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting CPU credit usage: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSCPUSurplusCreditBalanceCmd = &cobra.Command{
	Use:   "cpu_surplus_credit_balance",
	Short: "Get CPU Surplus Credit Balance metrics data for RDS instances",
	Long:  `Command to get CPU Surplus Credit Balance metrics data for RDS 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 := GetCPUSurplusCreditBalance(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting CPU Surplus Credit Balance: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}

Define a CLI command to get CPU Surplus Credit Balance for RDS instances

View Source
var AwsxRDSConnectionOverviewCmd = &cobra.Command{
	Use:   "database_connections_overview_panel",
	Short: "Get database connection overview data",
	Long:  `Command to get database connection overview data, including available, max, and idle connections.`,

	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)
			if err := cmd.Help(); err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetRDSConnectionOverviewPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting connection overview data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSCpuUtilizationCmd = &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 := GetRDSCpuUtilizationPanel(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 AwsxRDSCpuUtilizationCountCmd = &cobra.Command{
	Use:   "cpu_utilization_count_panel",
	Short: "Get CPU utilization percentage metrics data",
	Long:  `Command to get CPU utilization percentage metrics data for RDS instances`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child 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 := GetRDSCpuUtilizationCountData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting CPU utilization percentage data: ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSCpuUtilizationGraphCmd = &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 := GetRDSCPUUtilizationGraphPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization graph data : ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSCpuUtilizationPercentPanelCmd = &cobra.Command{
	Use:   "cpu_utilization_percent_panel",
	Short: "Get CPU utilization (percent) metrics data",
	Long:  `Command to get CPU utilization (percent) metrics data for RDS 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 := GetRDSCPUUtilizationPercentPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting CPU utilization (percent): ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSDBLoadCPUCmd = &cobra.Command{
	Use:   "db_load_cpu_panel",
	Short: "get CPU load in database operations",
	Long:  `command to get CPU load in database operations`,

	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 := GetRDSDBLoadCPU(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting CPU load data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSDBLoadCmd = &cobra.Command{
	Use:   "db_load_panel",
	Short: "get database workload overview metrics data",
	Long:  `Command to get database workload overview 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 := GetRDSDBLoadPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting database workload overview data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSDBLoadNonCPUCmd = &cobra.Command{
	Use:   "db_load_non_cpu_panel",
	Short: "get non-cpu load in database operations",
	Long:  `command to get non-cpu load in database operations`,

	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 := GetRDSDBLoadNonCPU(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting non-cpu load data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSDataTransferCmd = &cobra.Command{
	Use:   "data_transfer_overview_panel",
	Short: "Get data transfer metrics for RDS instances",
	Long:  `Command to get data transfer metrics data (NetworkTransmitThroughput and NetworkReceiveThroughput) for RDS instances with Timestamp`,

	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 := GetDataTransferOverviewPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting data transfer overview: ", err)
				return
			}

			if responseType == "frame" {
				for _, metricData := range cloudwatchMetricResp {
					for i, timestamp := range metricData.MetricDataResults[0].Timestamps {
						transmitThroughput := *metricData.MetricDataResults[0].Values[i]
						receiveThroughput := *metricData.MetricDataResults[1].Values[i]
						fmt.Printf("Timestamp: %v, Network Transmit Throughput: %f, Network Receive Throughput: %f\n", timestamp, transmitThroughput, receiveThroughput)
					}
				}
			} else {
				fmt.Println("Invalid response type. Use 'frame' for output.")
			}
		}
	},
}
View Source
var AwsxRDSDatabaseConnectionsCmd = &cobra.Command{
	Use:   "database_connections_panel",
	Short: "get database connections metrics data",
	Long:  `command to get database connections 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 := GetDatabaseConnectionsPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting database connections: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSDiskQueueDepthCmd = &cobra.Command{
	Use:   "disk_queue_depth_panel",
	Short: "get disk queue depth metrics data",
	Long:  `command to get disk queue depth 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 := GetRDSDiskQueueDepthPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting disk queue depth data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSErrorAnalysisCmd = &cobra.Command{
	Use:   "error_analysis_panel",
	Short: "Get error analysis panel for RDS instances",
	Long:  `Command to retrieve error analysis panel for RDS instances`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running error analysis 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 {
			data, err := GetErrorAnalysisData(cmd, clientAuth, nil)
			if err != nil {

				return
			}
			fmt.Println(data)
		}
	},
}
View Source
var AwsxRDSErrorCountPanelCmd = &cobra.Command{

	Use: "error_count_panel",

	Short: "get Error Count data",

	Long: `command to get Error Count logs 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 := GetRDSErrorCountData(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)

		}

	},
}
View Source
var AwsxRDSErrorRateAnalysisCmd = &cobra.Command{
	Use:   "error_rate_analysis",
	Short: "Get Error Count data",
	Long:  `Command to get Error Count logs 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)
			_ = cmd.Help()
			return
		}

		if authFlag {
			panel, err := GetRDSErrorRateAnalysis(cmd, clientAuth, nil)
			if err != nil {
				log.Printf("Error getting RDS error rate analysis: %v\n", err)
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxRDSFreeStorageSpaceCmd = &cobra.Command{
	Use:   "free_storage_space_panel",
	Short: "get free storage space metrics data",
	Long:  `command to get free storage space 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 := GetRDSFreeStorageSpacePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting free storage space data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSFreeStorageSpaceMBPerSecPanelCmd = &cobra.Command{
	Use:   "free_storage_space_mb_per_sec_panel",
	Short: "Get Free Storage Space mb per secmetrics data",
	Long:  `Command to get Free Storage Space (MB/sec) metrics data for RDS 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 := GetRDSFreeStorageSpaceMBPerSecPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Free Storage Space (MB/sec): ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSFreeableMemoryCmd = &cobra.Command{
	Use:   "freeable_memory_panel",
	Short: "get freeable memory metrics data",
	Long:  `command to get freeable memory 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 := GetRDSFreeableMemoryPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting freeable memory data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSIndexSizeCmd = &cobra.Command{
	Use:   "index_size_panel",
	Short: "Get index size metrics data",
	Long:  `Command to get index size 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 := GetIndexSizePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting index size: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSInstanceByRegionCmd = &cobra.Command{
	Use:   "region_wise_db_instance_availability_panel",
	Short: "Gets RDS instances by region",
	Long:  `Command to get AWS RDS (DB) instances by region`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running RDS Instances by Region 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, instanceCounts, err := GetRDSInstancesByRegion(clientAuth)
			if err != nil {
				log.Println("Error getting RDS instances by region: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(instanceCounts)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSIopsCmd = &cobra.Command{
	Use:   "iops_panel",
	Short: "get iops metrics data",
	Long:  `command to get iops 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, _ := GetRDSIopsPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting iops data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSLatencyAnalysisCmd = &cobra.Command{
	Use:   "latency_analysis_panel",
	Short: "get latency analysis data",
	Long:  `command to get latency analysis 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 := GetRDSLatencyAnalysisData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting latency analysis data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSLatencyCountCmd = &cobra.Command{
	Use:   "latency_count_panel",
	Short: "Get latency count metrics data",
	Long:  `Command to get latency count data from AWS CloudWatch`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running latency count 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 := GetRDSLatencyCountData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting latency count data: ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSMemoryAvailabilityPanelCmd = &cobra.Command{
	Use:   "memory_availability_panel",
	Short: "Get Memory Availability (FreeableMemory) metrics data",
	Long:  `Command to get Memory Availability (FreeableMemory) metrics data for RDS 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 := GetRDSMemoryAvailabilityPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Memory Availability (FreeableMemory): ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSMemoryUsageCountCmd = &cobra.Command{
	Use:   "Memory_used_count_panel",
	Short: "Get memory used count metrics data",
	Long:  `Command to get memory used metrics count data from AWS CloudWatch`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child 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 := GetRDSMemoryUsageCountData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting RDS Memory used count data: ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSMemoryUtilizationCmd = &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 := GetRDSMemoryUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting memory utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSNetworkReceiveThroughputCmd = &cobra.Command{
	Use:   "network_receive_throughput_panel",
	Short: "get network receive throughput metrics data",
	Long:  `Command to get network receive 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 := GetRDSNetworkReceiveThroughputPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network receive throughput data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSNetworkReceivedPanelCmd = &cobra.Command{
	Use:   "network_received_panel",
	Short: "Get Network Received metrics data",
	Long:  `Command to get Network Received metrics data for RDS instances`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child 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 := GetRDSNetworkReceivedPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Network Received data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSNetworkTrafficCmd = &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, _ := GetRDSNetworkTrafficPanel(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 AwsxRDSNetworkTransmitThroughputCmd = &cobra.Command{
	Use:   "network_transmit_throughput_panel",
	Short: "get network transmit throughput metrics data",
	Long:  `Command to get network transmit 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 := GetRDSNetworkTransmitThroughputPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network transmit throughput data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSNetworkUtilizationCmd = &cobra.Command{
	Use:   "network_utilization_panel",
	Short: "get network utilization RDS metrics data",
	Long:  `command to get network utilization RDS 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 := GetRDSNetworkUtilizationPanel(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 AwsxRDSPerformanceOverviewCmd = &cobra.Command{
	Use:   "performance_overview",
	Short: "get performance overview data",
	Long:  `command to get performance overview 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 := GetRDSPerformanceOverviewPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting performance overview data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}

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

	Use:   "rds_postgresql_error_logs_panel",
	Short: "Get rds postgresql error logs data",
	Long:  `Command to get rds postgresql error 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 := GetRDSPostgreSqlErrorLogs(cmd, clientAuth, nil)
			if err != nil {
				return
			}
			fmt.Println(panel)
		}
	},
}
View Source
var AwsxRDSQueryResponseTimeCmd = &cobra.Command{
	Use:   "query_response_time_panel",
	Short: "Get query response time metrics data for RDS instances",
	Long:  `Command to get query response time metrics data (Total Latency) for RDS instances`,

	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, cloudwatchMetricResp, err := GetCPUCreditBalancePanel(cmd, clientAuth, nil)

			if err != nil {
				log.Println("Error getting query response time: ", err)
				return
			}

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

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSQueryResponseTimeCountCmd = &cobra.Command{
	Use:   "query_response_time_count_panel",
	Short: "Get query response time count metrics data for RDS instances",
	Long:  `Command to get query response time count metrics data (Total Count) for RDS instances`,

	Run: func(cmd *cobra.Command, args []string) {
		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 := GetQueryResponseTimeCountPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting query response time count: ", err)
				return
			}

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

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSReadIOPSCmd = &cobra.Command{
	Use:   "read_iops_panel",
	Short: "Get read IOPS metrics data",
	Long:  `Command to get read IOPS 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 := GetRDSReadIOPSPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network transmit throughput data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSReplicationLagCountCmd = &cobra.Command{
	Use:   "replication_lag_count_panel",
	Short: "Get replication lag count metrics data for RDS instances",
	Long:  `Command to get replication lag count metrics data (using OldestReplicationSlotLag) for RDS instances`,

	Run: func(cmd *cobra.Command, args []string) {
		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 := GetReplicationLagCountPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting replication lag count: ", err)
				return
			}

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

				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSReplicationSlotDiskUsageCmd = &cobra.Command{
	Use:   "replication_slot_disk_usage_panel",
	Short: "get replication slot disk usage metrics data",
	Long:  `command to get replication slot disk 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, _ := GetRDSReplicationSlotDiskUsagePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting replication slot disk usage data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSRequestLatencyCmd = &cobra.Command{
	Use:   "request_latency_overview_panel",
	Short: "Get request latency metrics data for RDS instances",
	Long:  `Command to get request latency metrics data (Read Latency and Write Latency) for RDS instances with Timestamp`,

	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 := GetRequestLatencyOverviewPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting request latency overview: ", err)
				return
			}

			if responseType == "frame" {
				for _, metricData := range cloudwatchMetricResp {
					for i, timestamp := range metricData.MetricDataResults[0].Timestamps {
						readLatency := *metricData.MetricDataResults[0].Values[i]
						writeLatency := *metricData.MetricDataResults[1].Values[i]
						fmt.Printf("Timestamp: %v, Read Latency: %f, Write Latency: %f\n", timestamp, readLatency, writeLatency)
					}
				}
			} else {
				fmt.Println("Invalid response type. Use 'frame' for output.")
			}
		}
	},
}
View Source
var AwsxRDSStorageUsageCountPanelCmd = &cobra.Command{
	Use:   "storage_usage_count_panel",
	Short: "Get storage usage count panel metrics data",
	Long:  `Command to get storage usage count panel metrics count data from AWS CloudWatch`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child 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 := GetRDSStorageUsageCountData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting storage usage count data: ", err)
				return
			}
			if responseType == "json" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRDSStorageUtilizationCmd = &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 := GetRDSStorageUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting storage utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSSurplusCreditsChargedCmd = &cobra.Command{
	Use:   "cpu_surplus_credit_balance",
	Short: "Get CPU Surplus Credit Balance metrics data for RDS instances",
	Long:  `Command to get CPU Surplus Credit Balance metrics data for RDS 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 := GetCPUSurplusCreditCharged(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting CPU Surplus Credit Balance: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}

Define a CLI command to get CPU Surplus Credit Balance for RDS instances

View Source
var AwsxRDSTransactionBreakdownCmd = &cobra.Command{
	Use:   "transaction_breakdown_panel",
	Short: "Get transaction breakdown data",
	Long:  `Command to get read IOPS metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child command")
		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")
			metricsData, _, err := GetRDSTransactionBreakdown(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting read IOPS metrics data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println("This cli response type json")
			} else {
				fmt.Println(metricsData)
			}
		}
	},
}
View Source
var AwsxRDSTransactionLogsDiskCmd = &cobra.Command{
	Use:   "transaction_logs_disk_usage_panel",
	Short: "get transation logs disk usage metrics data",
	Long:  `command to get transaction logs disk 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 := GetTransactionLogsDiskUsagePanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting logs disk usage: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSTransactionLogsGenCmd = &cobra.Command{
	Use:   "transaction_logs_generation_panel",
	Short: "get transation logs generation metrics data",
	Long:  `command to get transaction logs generation 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 := GetTransactionLogsGenerationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting transaction logs generation: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRDSUptimeCmd = &cobra.Command{
	Use:   "rds_uptime_panel",
	Short: "get uptime metrics data for RDS",
	Long:  `command to get uptime metrics data for RDS`,

	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 {
			jsonResp, _, err := GetRDSUptimeData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting RDS uptime data: ", err)
				return
			}
			fmt.Println(jsonResp)
		}
	},
}
View Source
var AwsxRDSWriteIOPSCmd = &cobra.Command{
	Use:   "write_iops_panel",
	Short: "Get write IOPS metrics data",
	Long:  `Command to get write IOPS 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 := GetRDSReadIOPSPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting network transmit throughput data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxRdsDatabaseThroughputCmd = &cobra.Command{
	Use:   "database_throughput_panel",
	Short: "Get throughput metrics data for RDS",
	Long:  `Command to get throughput metrics data from AWS CloudWatch for RDS`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child 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")
			totalThroughputPoints, cloudwatchMetricData, err := GetRdsDatabaseThroughputCmd(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting RDS throughput data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricData)
			} else {
				fmt.Println(totalThroughputPoints)
			}
		}
	},
}
View Source
var AwsxRdsErrorLogsCmd = &cobra.Command{
	Use:   "rds_error_logs",
	Short: "Get recent error logs for RDS instances",
	Long:  `Command to retrieve recent error logs for RDS instances`,
	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 {
			data, err := GetRdsErrorLogsPanel(cmd, clientAuth, nil)
			if err != nil {

				return
			}
			fmt.Println(data)
		}
	},
}
View Source
var AwsxRdsIndexSizeCountCmd = &cobra.Command{
	Use:   "index_size_count_panel",
	Short: "Get index size count metrics data for RDS",
	Long:  `Command to get index size count metrics data from AWS CloudWatch for RDS`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running RDS index size count 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 := GetRdsIndexSizeCountData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting RDS index size data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRdsReadIopsCountCmd = &cobra.Command{
	Use:   "read_iops_count_panel",
	Short: "Get read IOPS count metrics data for RDS",
	Long:  `Command to get read IOPS metrics count data from AWS CloudWatch for RDS`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running RDS read IOPS 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 := GetRdsReadIopsCountData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting RDS read IOPS data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRdsServicesPanelCmd = &cobra.Command{
	Use:   "rds_services_panel",
	Short: "Retrieve counts of various RDS services and features",
	Long:  `Command to retrieve counts of various RDS services and features including Databases, Query Editor, Performance Insights, Snapshots, Exports in Amazon S3, Automated Backups, Reserved Instances, Proxies, Subnet Groups, Parameter Groups, Option Groups, Custom Engine Versions, Zero-ETL Integrations, Events, Event Subscriptions, Recommendations, and Certificate Updates.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from RDS Services 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, servicesCountsResp, err := GetRdsServicesCounts(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting RDS services counts: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(servicesCountsResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}

Define the command to retrieve RDS Services counts

View Source
var AwsxRdsThroughputCmd = &cobra.Command{
	Use:   "throughput_count_panel",
	Short: "Get throughput metrics data for RDS",
	Long:  `Command to get throughput metrics data from AWS CloudWatch for RDS`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child 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 := GetRdsThroughputData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting RDS throughput data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRdsWriteIopsCmd = &cobra.Command{
	Use:   "write_iops_count_panel",
	Short: "Get write IOPS count metrics data for RDS",
	Long:  `Command to get write IOPS metrics count data from AWS CloudWatch for RDS`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running RDS write IOPS 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 := GetRDSWriteIopsCountData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting RDS write IOPS data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var AwsxRecentEventLogsCmd = &cobra.Command{
	Use:   "recent_event_logs",
	Short: "Get recent event logs",
	Long:  `Command to retrieve recent event logs`,
	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 {
			data, err := GetRecentEventLogsPanel(cmd, clientAuth, nil)
			if err != nil {

				return
			}
			fmt.Println(data)

		}
	},
}
View Source
var AwsxStorageVolumeSizeCmd = &cobra.Command{
	Use:   "storage_volume_size_panel",
	Short: "Retrieve RDS storage volume sizes in TB",
	Long:  `Command to retrieve RDS storage volume sizes in terabytes (TB).`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from storage volume size command for RDS")
		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 {
			totalSize, err := GetStorageVolumeSizes(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting RDS storage volume sizes: ", err)
				return
			}
			fmt.Println(totalSize)
		}
	},
}
View Source
var AwsxSubnetGroupsPanelCmd = &cobra.Command{
	Use:   "subnet_groups_panel",
	Short: "Retrieve RDS Subnet Groups details",
	Long:  `Command to retrieve RDS Subnet Groups details including fields like Name, Description, Status, and VPC.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from Subnet Groups 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, subnetGroupDetailsResp, err := GetSubnetGroupDetails(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting Subnet Group details: ", err)
				return
			}
			if responseType == "frame" {
				for _, detail := range subnetGroupDetailsResp {
					fmt.Printf("%+v\n", *detail)
				}
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}
View Source
var ListScheduleOverviewCmd = &cobra.Command{
	Use:   "ListScheduleOverview",
	Short: "List schedule overview",
	Run: func(cmd *cobra.Command, args []string) {
		_, err := ListScheduleOverview()
		if err != nil {
			return
		}
	},
}
View Source
var ListScheduleOverviewNewCmd = &cobra.Command{
	Use:   "ListScheduleOverview",
	Short: "List maintenance schedule overview for RDS",
	Run: func(cmd *cobra.Command, args []string) {
		overview, err := ListScheduleOverview()
		if err != nil {
			log.Fatalf("Error retrieving schedule overview: %v", err)
			return
		}

		jsonData, err := json.MarshalIndent(overview, "", "  ")
		if err != nil {
			log.Fatalf("Error marshalling JSON: %v", err)
		}
		fmt.Println(string(jsonData))
	},
}
View Source
var RdsAlarmandNotificationcmd = &cobra.Command{
	Use:   "rds_alerts_and_notifications_panel",
	Short: "Retrieve recent alerts and notifications related to RDS instance availability",
	Long:  `Command to retrieve recent alerts and notifications related to RDS 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 := GetAlertsAndNotificationsPanel(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 SystemSnapshotsPanelCmd = &cobra.Command{
	Use:   "system_snapshots_panel",
	Short: "gets system snapshots panel",
	Long:  `Command to get system snapshots data for RDS instances.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Running from child 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, snapshotDataResp, err := GetSystemSnapshotData(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting CLI data: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(snapshotDataResp)
			} else {
				fmt.Println(jsonResp)
			}
		}
	},
}

Functions

func GetCPUCreditBalancePanel added in v1.7.5

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

func GetCPUCreditUsagePanel added in v1.7.5

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

func GetCPUSurplusCreditBalance added in v1.7.6

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

Function to get CPU Surplus Credit Balance metrics data

func GetCPUSurplusCreditCharged added in v1.7.6

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

Function to get CPU Surplus Credit Balance metrics data

func GetDBConnectionCountData added in v1.12.6

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

func GetDataBaseConnectionCountGraphPanel added in v1.12.6

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

func GetDataTransferOverviewPanel added in v1.12.6

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

func GetDatabaseConnectionsMetricValues added in v1.9.6

func GetDatabaseConnectionsMetricValues(clientAuth *model.Auth, startTime, endTime *time.Time, DBInstanceIdentifier string, cloudWatchClient *cloudwatch.CloudWatch) (float64, float64, error)

func GetDatabaseConnectionsPanel added in v1.7.4

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

func GetErrorAnalysisCount added in v1.12.6

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

func GetErrorAnalysisData added in v1.9.6

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

Function to retrieve error analysis panel data

func GetIndexSizePanel added in v1.7.5

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

func GetIopsMetricData added in v1.7.5

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

func GetMetricDatas added in v1.8.1

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

func GetNetworkMetricData

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

func GetNetworkTransmitData added in v1.12.6

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

func GetQueryResponseTimeCountPanel added in v1.12.6

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

func GetQueryResponseTimePanel added in v1.12.6

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

func GetRDSActiveConnectionCount added in v1.12.6

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

func GetRDSCPUUtilizationGraphPanel added in v1.7.5

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

func GetRDSCPUUtilizationPercentPanel added in v1.12.6

func GetRDSCPUUtilizationPercentPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string][]map[string]interface{}, error)

func GetRDSConnectionOverviewPanel added in v1.12.6

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

func GetRDSCpuUtilizationCountData added in v1.12.6

func GetRDSCpuUtilizationCountData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string][]map[string]interface{}, error)

func GetRDSCpuUtilizationPanel

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

func GetRDSDBLoadCPU added in v1.7.7

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

func GetRDSDBLoadNonCPU added in v1.7.7

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

func GetRDSDBLoadPanel added in v1.7.7

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

func GetRDSDiskQueueDepthPanel added in v1.7.5

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

func GetRDSErrorCountData added in v1.12.6

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

func GetRDSErrorRateAnalysis added in v1.14.6

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

func GetRDSFreeStorageSpaceMBPerSecPanel added in v1.12.6

func GetRDSFreeStorageSpaceMBPerSecPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string][]map[string]interface{}, error)

func GetRDSFreeStorageSpacePanel

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

func GetRDSFreeableMemoryPanel

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

func GetRDSInstancesByRegion added in v1.12.6

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

func GetRDSIopsPanel added in v1.7.5

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

func GetRDSLatencyAnalysisData added in v1.8.1

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

func GetRDSLatencyCountData added in v1.12.6

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

func GetRDSMemoryAvailabilityPanel added in v1.12.6

func GetRDSMemoryAvailabilityPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string][]map[string]interface{}, error)

func GetRDSMemoryUsageCountData added in v1.13.6

func GetRDSMemoryUsageCountData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string][]map[string]interface{}, error)

func GetRDSMemoryUtilizationPanel added in v1.10.9

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

func GetRDSNetworkReceiveThroughputPanel added in v1.7.5

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

func GetRDSNetworkReceivedPanel added in v1.12.6

func GetRDSNetworkReceivedPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string][]map[string]interface{}, error)

func GetRDSNetworkTrafficPanel

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

func GetRDSNetworkTransmitThroughputPanel added in v1.7.5

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

func GetRDSNetworkUtilizationPanel

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

func GetRDSPerformanceOverviewPanel added in v1.12.6

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

func GetRDSPostgreSqlErrorLogs added in v1.12.6

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

func GetRDSReadIOPSPanel added in v1.7.10

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

func GetRDSReplicationSlotDiskUsagePanel added in v1.7.5

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

func GetRDSStorageUsageCountData added in v1.12.6

func GetRDSStorageUsageCountData(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string][]map[string]interface{}, error)

func GetRDSStorageUtilizationMetricData added in v1.7.10

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

func GetRDSStorageUtilizationPanel added in v1.7.10

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

func GetRDSUptimeData added in v1.9.6

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

func GetRDSWriteIOPSPanel added in v1.7.10

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

func GetRDSWriteIopsCountData added in v1.13.2

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

func GetRdsDatabaseThroughputCmd added in v1.12.6

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

func GetRdsErrorLogsPanel added in v1.9.3

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

func GetRdsIndexSizeCountData added in v1.12.6

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

func GetRdsReadIopsCountData added in v1.12.6

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

func GetRdsThroughputData added in v1.12.6

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

func GetRecentEventLogsPanel added in v1.10.2

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

func GetReplicationLagCountPanel added in v1.12.6

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

func GetReplicationSlotDiskUsageMetricData added in v1.7.5

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

func GetRequestLatencyOverviewPanel added in v1.12.6

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

func GetStorageVolumeSizes added in v1.14.5

func GetStorageVolumeSizes(cmd *cobra.Command, clientAuth *model.Auth, rdsClient *rds.RDS) (string, error)

func GetSystemSnapshotData added in v1.12.6

func GetSystemSnapshotData(cmd *cobra.Command, clientAuth *model.Auth, rdsClient *rds.RDS) (string, []*rds.DBSnapshot, error)

func GetTransactionLogsDiskUsagePanel added in v1.8.4

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

func GetTransactionLogsGenerationPanel added in v1.8.4

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

func ProcessQuerysResult added in v1.12.6

func ProcessQuerysResults added in v1.12.6

Types

type AlarmNotification added in v1.7.4

type AlarmNotification struct {
	AlertID   string    `json:"AlertId"`
	AlertType string    `json:"AlertType"`
	QueryText string    `json:"QueryText"`
	Timestamp time.Time `json:"Timestamp"`
}

func GetAlertsAndNotificationsPanel added in v1.13.0

func GetAlertsAndNotificationsPanel(cmd *cobra.Command, clientAuth *model.Auth) ([]AlarmNotification, error)

type DataTransferOverviewResult added in v1.12.6

type DataTransferOverviewResult struct {
	Timestamp                 time.Time
	NetworkTransmitThroughput float64
	NetworkReceiveThroughput  float64
}

type DatabaseDetails added in v1.12.6

type DatabaseDetails struct {
	InstanceName      string `json:"InstanceName"`
	Engine            string `json:"Engine"`
	Size              string `json:"Size"`
	Maintenance       string `json:"Maintenance"`
	DatabaseStatus    string `json:"DatabaseStatus"`
	MaintenanceWindow string `json:"MaintenanceWindow"`
}

DatabaseDetails represents the structure for database status details

func GetDatabaseDetails added in v1.12.6

func GetDatabaseDetails(cmd *cobra.Command, clientAuth *model.Auth, rdsClient *rds.RDS) (string, []*DatabaseDetails, error)

Function to retrieve database instance details

type IOPS added in v1.7.5

type IOPS struct {
	WriteIOPS []struct {
		Timestamp time.Time
		Value     float64
	} `json:"read_iops"`
	ReadIOPS []struct {
		Timestamp time.Time
		Value     float64
	} `json:"write_iops"`
}

type InstanceHealthCheckData added in v1.7.4

type InstanceHealthCheckData struct {
	InstanceID           string
	InstanceType         string
	AvailabilityZone     string
	InstanceStatus       string
	CpuUtilization       string
	DiskSpaceUtilization string
	SystemChecks         string
	InstanceChecks       string
	Alarm                string
	SystemCheck          string
	InstanceCheck        string
}

func GetDBInstanceHealthCheck added in v1.7.4

func GetDBInstanceHealthCheck() ([]InstanceHealthCheckData, error)

type LatencyOverviewResult added in v1.12.6

type LatencyOverviewResult struct {
	Timestamp    time.Time
	ReadLatency  float64
	WriteLatency float64
}

type MetricResults added in v1.9.6

type MetricResults struct {
	TimeSeriesData map[string]string `json:"timeSeriesData"`
}

type NetworkResult

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

type NetworkTraffic

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

type QueryResponseTimeCountResult added in v1.12.6

type QueryResponseTimeCountResult struct {
	Timestamp         time.Time `json:"Timestamp"`
	ReadLatencyCount  int       `json:"ReadLatencyCount"`
	WriteLatencyCount int       `json:"WriteLatencyCount"`
	TotalCount        int       `json:"TotalCount"`
}

type QueryResponseTimeResult added in v1.12.6

type QueryResponseTimeResult struct {
	Timestamp    time.Time `json:"Timestamp"`
	TotalLatency float64   `json:"TotalLatency"`
}

type RdsServicesCounts added in v1.12.6

type RdsServicesCounts struct {
	DatabaseCount            int `json:"DatabaseCount"`
	QueryEditorCount         int `json:"QueryEditorCount"`
	PerformanceInsightsCount int `json:"PerformanceInsightsCount"`
	SnapshotCount            int `json:"SnapshotCount"`
	ExportS3Count            int `json:"ExportS3Count"`
	AutomatedBackupCount     int `json:"AutomatedBackupCount"`
	ReservedInstanceCount    int `json:"ReservedInstanceCount"`
	ProxyCount               int `json:"ProxyCount"`
	SubnetGroupCount         int `json:"SubnetGroupCount"`
	ParameterGroupCount      int `json:"ParameterGroupCount"`
	OptionGroupCount         int `json:"OptionGroupCount"`
	CustomEngineVersionCount int `json:"CustomEngineVersionCount"`
	ZeroETLIntegrationCount  int `json:"ZeroETLIntegrationCount"`
	EventCount               int `json:"EventCount"`
	EventSubscriptionCount   int `json:"EventSubscriptionCount"`
	RecommendationCount      int `json:"RecommendationCount"`
	CertificateUpdateCount   int `json:"CertificateUpdateCount"`
}

Structure to hold counts for RDS services and features

func GetRdsServicesCounts added in v1.12.6

func GetRdsServicesCounts(cmd *cobra.Command, clientAuth *model.Auth, rdsClient *rds.RDS) (string, *RdsServicesCounts, error)

GetRdsServicesCounts retrieves and counts the various RDS services and features

type ReplicationLagCountResult added in v1.12.6

type ReplicationLagCountResult struct {
	Timestamp           time.Time `json:"Timestamp"`
	ReplicationLagCount int       `json:"ReplicationLagCount"`
}

type ReplicationSlotDiskUsage added in v1.7.5

type ReplicationSlotDiskUsage struct {
	Timestamp time.Time
	Value     float64
}

type ScheduleOverview added in v1.8.8

type ScheduleOverview struct {
	MaintenanceType string `json:"MAINTENANCE TYPE"`
	Description     string `json:"DESCRIPTION"`
	StartTime       string `json:"START TIME"`
	EndTime         string `json:"END TIME"`
}

func ListScheduleOverview added in v1.8.8

func ListScheduleOverview() ([]ScheduleOverview, error)

type ScheduleOverviewNew added in v1.12.6

type ScheduleOverviewNew struct {
	MaintenanceType string `json:"MaintenanceType"`
	Schedule        string `json:"Schedule"`
	Description     string `json:"Description"`
	StartTime       string `json:"StartTime"`
	EndTime         string `json:"EndTime"`
	AdditionalNotes string `json:"AdditionalNotes"`
	Impact          string `json:"Impact"`
	Status          string `json:"Status"`
}

func ListScheduleOverviewNew added in v1.12.6

func ListScheduleOverviewNew() ([]ScheduleOverviewNew, error)

type StatusCount added in v1.12.6

type StatusCount struct {
	Available   int `json:"available"`
	Unavailable int `json:"unavailable"`
}

func GetAvailabilityHistoryCount added in v1.12.6

func GetAvailabilityHistoryCount(cmd *cobra.Command, clientAuth *model.Auth, rdsClient *rds.RDS) (string, *StatusCount, error)

type StorageUtlizationResult added in v1.7.10

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

type SubnetGroupDetails added in v1.12.6

type SubnetGroupDetails struct {
	Name        string `json:"Name"`
	Description string `json:"Description"`
	Status      string `json:"Status"`
	VPC         string `json:"VPC"`
}

func GetSubnetGroupDetails added in v1.12.6

func GetSubnetGroupDetails(cmd *cobra.Command, clientAuth *model.Auth, rdsClient *rds.RDS) (string, []*SubnetGroupDetails, error)

type SystemSnapshots added in v1.12.6

type SystemSnapshots struct {
	SnapshotName           string
	DBInstance             string
	SnapshotCreationTime   string
	DBInstanceCreationTime string
}

type TimeSeriesData added in v1.8.1

type TimeSeriesData struct {
	Timestamp time.Time
	Latency   float64
}

type TransactionData added in v1.12.6

type TransactionData struct {
	TotalTransaction string `json:"total_transaction"`
	ReadTransaction  string `json:"read_transaction"`
	WriteTransaction string `json:"write_transaction"`
}

Struct to hold the transaction data

func GetRDSTransactionBreakdown added in v1.12.6

func GetRDSTransactionBreakdown(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, []TransactionData, error)

Source Files

Jump to

Keyboard shortcuts

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