Documentation ¶
Index ¶
- Constants
- type APIKey
- type Client
- func (c *Client) AuthTest(ctx context.Context, org string) error
- func (c *Client) CreateAPIKey(ctx context.Context, r *CreateAPIKeyInput) (*APIKey, error)
- func (c *Client) CreateGrafanaAPIKey(ctx context.Context, r *CreateGrafanaAPIKeyInput) (*CreateGrafanaAPIKeyOutput, error)
- func (c *Client) CreateStack(ctx context.Context, r *CreateStackInput) (*Stack, error)
- func (c *Client) DeleteAPIKey(ctx context.Context, org string, keyName string) error
- func (c *Client) DeleteStack(ctx context.Context, stackSlug string) error
- func (c *Client) GetAuthedGrafanaClient(ctx context.Context, orgName, stackName string) (*grafana.Client, func() error, error)
- func (c *Client) GetStack(ctx context.Context, org, stackSlug string) (*Stack, error)
- func (c *Client) ListAPIKeys(ctx context.Context, org string) (*ListAPIKeysOutput, error)
- func (c *Client) ListDatasources(ctx context.Context, stack string) (*ListDatasourcesOutput, error)
- func (c *Client) ListStacks(ctx context.Context, org string) (*ListStacksOutput, error)
- type ClientOpt
- type CreateAPIKeyInput
- type CreateGrafanaAPIKeyInput
- type CreateGrafanaAPIKeyOutput
- type CreateStackInput
- type Datasource
- type ListAPIKeysOutput
- type ListDatasourcesOutput
- type ListStacksOutput
- type Stack
Constants ¶
View Source
const ( TempKeyDefaultExpires = 60 TempKeyDefaultPrefix = "terraform-provider-grafanacloud-tmp" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // This client can generate temporary Grafana API admin tokens for the purpose // of reading resources from the Grafana API. Define a time after which these // tokens automatically expire. Note that we'll also try to delete them automatically // after use, but if that fails, this serves as a fallback mechanism to invalidate them. TempKeyExpires time.Duration // Temporarily created Grafana API admin tokens have a prefix so you can identify them // easily, which defaults to the value of constant constant `TempKeyPrefix`. TempKeyPrefix string // contains filtered or unexported fields }
func (*Client) CreateAPIKey ¶
func (*Client) CreateGrafanaAPIKey ¶
func (c *Client) CreateGrafanaAPIKey(ctx context.Context, r *CreateGrafanaAPIKeyInput) (*CreateGrafanaAPIKeyOutput, error)
This function creates a API key inside the Grafana instance running in stack `stack`. It's used in order to provision API keys inside Grafana while just having access to a Grafana Cloud API key.
Plese note that this is a beta feature and might change in the future.
See https://grafana.com/docs/grafana-cloud/api/#create-grafana-api-keys for more information.
func (*Client) CreateStack ¶
func (*Client) DeleteAPIKey ¶
func (*Client) DeleteStack ¶
func (*Client) GetAuthedGrafanaClient ¶
func (c *Client) GetAuthedGrafanaClient(ctx context.Context, orgName, stackName string) (*grafana.Client, func() error, error)
The Grafana Cloud API is disconnected from the Grafana API on the stacks unfortunately. That's why we can't use the Grafana Cloud API key to fully manage API keys on the Grafana API. The only thing we can do is to create a temporary Admin key, and create a Grafana API client with that.
func (*Client) ListAPIKeys ¶
func (*Client) ListDatasources ¶
func (*Client) ListStacks ¶
type ClientOpt ¶
type ClientOpt func(*Client)
func WithTempKeyExpires ¶
func WithTempKeyPrefix ¶
func WithUserAgent ¶
type CreateAPIKeyInput ¶
type CreateStackInput ¶
type Datasource ¶
type Datasource struct { ID int InstanceID int InstanceSlug string Name string Type string URL string BasicAuth int BasicAuthUser string }
func (*Datasource) IsAlertmanager ¶
func (ds *Datasource) IsAlertmanager() bool
type ListAPIKeysOutput ¶
type ListAPIKeysOutput struct {
Items []*APIKey
}
func (*ListAPIKeysOutput) AddKey ¶
func (l *ListAPIKeysOutput) AddKey(k *APIKey)
func (*ListAPIKeysOutput) DeleteByName ¶
func (l *ListAPIKeysOutput) DeleteByName(name string)
func (*ListAPIKeysOutput) FindByName ¶
func (l *ListAPIKeysOutput) FindByName(name string) *APIKey
type ListDatasourcesOutput ¶
type ListDatasourcesOutput struct {
Items []*Datasource
}
type ListStacksOutput ¶
type ListStacksOutput struct {
Items []*Stack
}
func (*ListStacksOutput) AddStack ¶
func (l *ListStacksOutput) AddStack(s *Stack)
func (*ListStacksOutput) DeleteBySlug ¶
func (l *ListStacksOutput) DeleteBySlug(slug string)
func (*ListStacksOutput) FindBySlug ¶
func (l *ListStacksOutput) FindBySlug(slug string) *Stack
Click to show internal directories.
Click to hide internal directories.