Documentation ¶
Overview ¶
Grafana construct for cdk8s.
Index ¶
- func Dashboard_IsConstruct(x interface{}) *bool
- func DataSource_IsConstruct(x interface{}) *bool
- func Grafana_IsConstruct(x interface{}) *bool
- func NewDashboard_Override(d Dashboard, scope constructs.Construct, id *string, props *DashboardProps)
- func NewDataSource_Override(d DataSource, scope constructs.Construct, id *string, props *DataSourceProps)
- func NewGrafana_Override(g Grafana, scope constructs.Construct, id *string, props *GrafanaProps)
- type AccessType
- type Dashboard
- type DashboardProps
- type DataSource
- type DataSourceProps
- type Grafana
- type GrafanaPlugin
- type GrafanaProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dashboard_IsConstruct ¶
func Dashboard_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func DataSource_IsConstruct ¶
func DataSource_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func Grafana_IsConstruct ¶
func Grafana_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func NewDashboard_Override ¶
func NewDashboard_Override(d Dashboard, scope constructs.Construct, id *string, props *DashboardProps)
func NewDataSource_Override ¶
func NewDataSource_Override(d DataSource, scope constructs.Construct, id *string, props *DataSourceProps)
func NewGrafana_Override ¶
func NewGrafana_Override(g Grafana, scope constructs.Construct, id *string, props *GrafanaProps)
Types ¶
type AccessType ¶
type AccessType string
Mode for accessing a data source. See: https://grafana.com/docs/grafana/latest/administration/provisioning/#example-data-source-config-file
const ( // Access via proxy. AccessType_PROXY AccessType = "PROXY" // Access directly (via server or browser in UI). AccessType_DIRECT AccessType = "DIRECT" )
type Dashboard ¶
type Dashboard interface { constructs.Construct // The tree node. Node() constructs.Node // Adds one or more plugins. AddPlugins(plugins ...*GrafanaPlugin) // Returns a string representation of this construct. ToString() *string }
A Grafana dashboard. See: https://grafana.com/docs/grafana/latest/http_api/dashboard/
func NewDashboard ¶
func NewDashboard(scope constructs.Construct, id *string, props *DashboardProps) Dashboard
type DashboardProps ¶
type DashboardProps struct { // Title of the dashboard. Title *string `field:"required" json:"title" yaml:"title"` // Specify a mapping from data source variables to data source names. // // This is only needed if you are importing an existing dashboard's JSON // and it specifies variables within an "__inputs" field. // // Example: // { DS_PROMETHEUS: "my-prometheus-ds" } // // Default: - no data source variables. // DataSourceVariables *map[string]*string `field:"optional" json:"dataSourceVariables" yaml:"dataSourceVariables"` // Group dashboards into folders. // Default: - default folder. // Folder *string `field:"optional" json:"folder" yaml:"folder"` // All other dashboard customizations. // See: https://grafana.com/docs/grafana/latest/dashboards/json-model/ // JsonModel *map[string]interface{} `field:"optional" json:"jsonModel" yaml:"jsonModel"` // Labels to apply to the kubernetes resource. // // When adding a dashboard to a Grafana instance using `grafana.addDashboard`, // labels provided to Grafana will be automatically applied. Otherwise, // labels must be added manually. // Default: - no labels. // Labels *map[string]*string `field:"optional" json:"labels" yaml:"labels"` // Namespace to apply to the kubernetes resource. // // When adding a dashboard to a Grafana instance using `grafana.addDashboard`, // the namespace will be automatically inherited. // Default: - undefined (will be assigned to the 'default' namespace). // Namespace *string `field:"optional" json:"namespace" yaml:"namespace"` // Specify plugins required by the dashboard. Plugins *[]*GrafanaPlugin `field:"optional" json:"plugins" yaml:"plugins"` // Auto-refresh interval. // Default: - 5 seconds. // RefreshRate cdk8s.Duration `field:"optional" json:"refreshRate" yaml:"refreshRate"` // Time range for the dashboard, e.g. last 6 hours, last 7 days, etc. // Default: - 6 hours. // TimeRange cdk8s.Duration `field:"optional" json:"timeRange" yaml:"timeRange"` }
type DataSource ¶
type DataSource interface { constructs.Construct // Name of the data source. Name() *string // The tree node. Node() constructs.Node // Returns a string representation of this construct. ToString() *string }
A Grafana data source. See: https://grafana.com/docs/grafana/latest/administration/provisioning/#example-data-source-config-file
func NewDataSource ¶
func NewDataSource(scope constructs.Construct, id *string, props *DataSourceProps) DataSource
type DataSourceProps ¶
type DataSourceProps struct { // Access type of the data source. Access AccessType `field:"required" json:"access" yaml:"access"` // Name of the data source. Name *string `field:"required" json:"name" yaml:"name"` // Type of the data source. Type *string `field:"required" json:"type" yaml:"type"` // Description of the data source. // Default: - no description. // Description *string `field:"optional" json:"description" yaml:"description"` // Labels to apply to the kubernetes resource. // // When adding a data source to a Grafana instance using `grafana.addDataSource`, // labels provided to Grafana will be automatically applied. Otherwise, // labels must be added manually. // Default: - no labels. // Labels *map[string]*string `field:"optional" json:"labels" yaml:"labels"` // Namespace to apply to the kubernetes resource. // // When adding a data source to a Grafana instance using `grafana.addDataSource`, // the namespace will be automatically inherited. // Default: - undefined (will be assigned to the 'default' namespace). // Namespace *string `field:"optional" json:"namespace" yaml:"namespace"` // URL of the data source. // // Most resources besides the 'testdata' data source // type require this field in order to retrieve data. // Default: - default url for data source type. // Url *string `field:"optional" json:"url" yaml:"url"` }
type Grafana ¶
type Grafana interface { constructs.Construct // The tree node. Node() constructs.Node // Creates a dashboard associated with a particular data source. // // By default, // labels are automatically added so that the data source is detected by // Grafana. AddDashboard(id *string, props *DashboardProps) Dashboard // Adds a data source. // // By default, labels are automatically added so that // the data source is detected by Grafana. AddDataSource(id *string, props *DataSourceProps) DataSource // Returns a string representation of this construct. ToString() *string }
A Grafana instance.
func NewGrafana ¶
func NewGrafana(scope constructs.Construct, id *string, props *GrafanaProps) Grafana
type GrafanaPlugin ¶
type GrafanaProps ¶
type GrafanaProps struct { // Default admin password. // Default: "secret". // AdminPassword *string `field:"optional" json:"adminPassword" yaml:"adminPassword"` // Default admin username. // Default: "root". // AdminUser *string `field:"optional" json:"adminUser" yaml:"adminUser"` // Default data source - equivalent to calling `grafana.addDataSource`. // Default: - no data source added. // DefaultDataSource *DataSourceProps `field:"optional" json:"defaultDataSource" yaml:"defaultDataSource"` // Specify a custom image for Grafana. // Default: "public.ecr.aws/ubuntu/grafana:latest" // Image *string `field:"optional" json:"image" yaml:"image"` // Create an ingress to provide external access to the Grafana cluster. // Default: true. // Ingress *bool `field:"optional" json:"ingress" yaml:"ingress"` // Labels to apply to all Grafana resources. // Default: - { app: "grafana" }. // Labels *map[string]*string `field:"optional" json:"labels" yaml:"labels"` // Namespace to apply to all Grafana resources. // // The Grafana Operator must be // installed in this namespace for resources to be recognized. // Default: - undefined (will be assigned to the 'default' namespace). // Namespace *string `field:"optional" json:"namespace" yaml:"namespace"` // Require login in order to view or manage dashboards. // Default: false. // RequireLogin *bool `field:"optional" json:"requireLogin" yaml:"requireLogin"` // Type of service to be created (NodePort, ClusterIP or LoadBalancer). // Default: ClusterIP. // ServiceType *string `field:"optional" json:"serviceType" yaml:"serviceType"` }