Documentation ¶
Index ¶
- Constants
- Variables
- type GrafanaHTTPAPI
- func (c *GrafanaHTTPAPI) Clone() *GrafanaHTTPAPI
- func (c *GrafanaHTTPAPI) OrgID() int64
- func (c *GrafanaHTTPAPI) SetTransport(transport runtime.ClientTransport)
- func (c *GrafanaHTTPAPI) WithHTTPClient(client *http.Client) *GrafanaHTTPAPI
- func (c *GrafanaHTTPAPI) WithOrgID(orgID int64) *GrafanaHTTPAPI
- func (c *GrafanaHTTPAPI) WithRetries(numRetries int, retryTimeout time.Duration, retryStatusCodes ...string) *GrafanaHTTPAPI
- type TransportConfig
Constants ¶
const ( // DefaultHost is the default Host // found in Meta (info) section of spec file DefaultHost string = "localhost" // DefaultBasePath is the default BasePath // found in Meta (info) section of spec file DefaultBasePath string = "/api" // Optional property that specifies the org. // For more info, see: https://grafana.com/docs/grafana/latest/developers/http_api/auth/ OrgIDHeader = "X-Grafana-Org-Id" )
Variables ¶
var Default = NewHTTPClient(nil)
Default grafana HTTP API HTTP client.
var DefaultSchemes = []string{"http", "https"}
DefaultSchemes are the default schemes found in Meta (info) section of spec file
Functions ¶
This section is empty.
Types ¶
type GrafanaHTTPAPI ¶
type GrafanaHTTPAPI struct { AccessControl access_control.ClientService AccessControlProvisioning access_control_provisioning.ClientService Admin admin.ClientService AdminLDAP admin_ldap.ClientService AdminProvisioning admin_provisioning.ClientService AdminUsers admin_users.ClientService Annotations annotations.ClientService APIKeys api_keys.ClientService Correlations correlations.ClientService DashboardPermissions dashboard_permissions.ClientService DashboardPublic dashboard_public.ClientService DashboardVersions dashboard_versions.ClientService Dashboards dashboards.ClientService Datasources datasources.ClientService Devices devices.ClientService Ds ds.ClientService Enterprise enterprise.ClientService FolderPermissions folder_permissions.ClientService Folders folders.ClientService GetCurrentOrg get_current_org.ClientService GroupAttributeSync group_attribute_sync.ClientService Health health.ClientService LDAPDebug ldap_debug.ClientService LibraryElements library_elements.ClientService Licensing licensing.ClientService Migrations migrations.ClientService Org org.ClientService OrgInvites org_invites.ClientService OrgPreferences org_preferences.ClientService Orgs orgs.ClientService Playlists playlists.ClientService Provisioning provisioning.ClientService QueryHistory query_history.ClientService RecordingRules recording_rules.ClientService Reports reports.ClientService Saml saml.ClientService Search search.ClientService ServiceAccounts service_accounts.ClientService SignedInUser signed_in_user.ClientService SigningKeys signing_keys.ClientService Snapshots snapshots.ClientService SsoSettings sso_settings.ClientService SyncTeamGroups sync_team_groups.ClientService Teams teams.ClientService User user.ClientService UserPreferences user_preferences.ClientService Users users.ClientService Transport runtime.ClientTransport // contains filtered or unexported fields }
GrafanaHTTPAPI is a client for grafana HTTP API
func New ¶
func New(transport runtime.ClientTransport, cfg *TransportConfig, formats strfmt.Registry) *GrafanaHTTPAPI
New creates a new grafana HTTP API client
func NewHTTPClient ¶
func NewHTTPClient(formats strfmt.Registry) *GrafanaHTTPAPI
NewHTTPClient creates a new grafana HTTP API HTTP client.
func NewHTTPClientWithConfig ¶
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *GrafanaHTTPAPI
NewHTTPClientWithConfig creates a new grafana HTTP API HTTP client, using a customizable transport config.
func (*GrafanaHTTPAPI) Clone ¶
func (c *GrafanaHTTPAPI) Clone() *GrafanaHTTPAPI
Clone creates a clone of the grafana HTTP API client. This new client can then be modified independently of the original client with the With* methods.
func (*GrafanaHTTPAPI) OrgID ¶
func (c *GrafanaHTTPAPI) OrgID() int64
OrgID returns the organization ID that was set in the transport config
func (*GrafanaHTTPAPI) SetTransport ¶
func (c *GrafanaHTTPAPI) SetTransport(transport runtime.ClientTransport)
SetTransport changes the transport on the client and all its subresources
func (*GrafanaHTTPAPI) WithHTTPClient ¶
func (c *GrafanaHTTPAPI) WithHTTPClient(client *http.Client) *GrafanaHTTPAPI
WithHTTPClient sets the used net/http client and returns the API client
func (*GrafanaHTTPAPI) WithOrgID ¶
func (c *GrafanaHTTPAPI) WithOrgID(orgID int64) *GrafanaHTTPAPI
WithOrgID sets the organization ID and returns the client
func (*GrafanaHTTPAPI) WithRetries ¶
func (c *GrafanaHTTPAPI) WithRetries(numRetries int, retryTimeout time.Duration, retryStatusCodes ...string) *GrafanaHTTPAPI
WithRetries sets retry parameters and returns the client
type TransportConfig ¶
type TransportConfig struct { // Host is the doman name or IP address of the host that serves the API. Host string // BasePath is the URL prefix for all API paths, relative to the host root. BasePath string // Schemes are the transfer protocols used by the API (http or https). Schemes []string // APIKey is an optional API key or service account token. APIKey string // BasicAuth is optional basic auth credentials. BasicAuth *url.Userinfo // OrgID provides an optional organization ID. // OrgID is only supported with BasicAuth since API keys are already org-scoped. OrgID int64 // TLSConfig provides an optional configuration for a TLS client TLSConfig *tls.Config // NumRetries contains the optional number of attempted retries NumRetries int // RetryTimeout sets an optional time to wait before retrying a request RetryTimeout time.Duration // RetryStatusCodes contains the optional list of status codes to retry // Use "x" as a wildcard for a single digit (default: [429, 5xx]) RetryStatusCodes []string // HTTPHeaders contains an optional map of HTTP headers to add to each request HTTPHeaders map[string]string // Debug sets the optional debug mode for the transport Debug bool // Client sets the net/http client used for the transport Client *http.Client }
TransportConfig contains the transport related info, found in the meta section of the spec file.
func DefaultTransportConfig ¶
func DefaultTransportConfig() *TransportConfig
DefaultTransportConfig creates a TransportConfig with the default settings taken from the meta section of the spec file.
func (*TransportConfig) WithBasePath ¶
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig
WithBasePath overrides the default basePath, provided by the meta section of the spec file.
func (*TransportConfig) WithHost ¶
func (cfg *TransportConfig) WithHost(host string) *TransportConfig
WithHost overrides the default host, provided by the meta section of the spec file.
func (*TransportConfig) WithSchemes ¶
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig
WithSchemes overrides the default schemes, provided by the meta section of the spec file.