Grafana.com API (public).
Looking for GCOM API client packages? You can find them at grafana-com-public-clients repository.
If you have any questions, please contact support in the Grafana Cloud UI.
This spec is in Beta stage, so use it with caution:
- Not all endpoint responses are properly typed for the time being.
- Some request parameter types may not be precise
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: public
- Package version: 1.0.0
- Generator version: 7.7.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import gcom "github.com/grafana/grafana-com-public-clients/go/gcom"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value gcom.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), gcom.ContextServerIndex, 1)
Templated server URL is formatted using default variables from configuration or from context value gcom.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), gcom.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using gcom.ContextOperationServerIndices
and gcom.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), gcom.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), gcom.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
All URIs are relative to /api
Class | Method | HTTP request | Description |
---|---|---|---|
AccesspoliciesAPI | DeleteAccessPolicy | Delete /v1/accesspolicies/{id} | Delete an access policy |
AccesspoliciesAPI | GetAccessPolicies | Get /v1/accesspolicies | Get a list of access policies |
AccesspoliciesAPI | GetAccessPolicy | Get /v1/accesspolicies/{id} | Get an access policy |
AccesspoliciesAPI | GetConfig | Get /v1/accesspolicies/config | Get details about the Cloud Access Policy API |
AccesspoliciesAPI | PostAccessPolicies | Post /v1/accesspolicies | Create a new access policy |
AccesspoliciesAPI | PostAccessPolicy | Post /v1/accesspolicies/{id} | Update an access policy |
InstancesAPI | DelInstanceOAuthAzureAD | Delete /instances/{instanceId}/oauth-azuread | Disable Azure OAuth in an instance |
InstancesAPI | DelInstanceOAuthGithub | Delete /instances/{instanceId}/oauth-github | Disable Github OAuth in an instance |
InstancesAPI | DelInstanceOAuthGoogle | Delete /instances/{instanceId}/oauth-google | Disable Google OAuth in an instance |
InstancesAPI | DelInstanceOAuthOkta | Delete /instances/{instanceId}/oauth-okta | Disable Okta OAuth in an instance |
InstancesAPI | DeleteInstance | Delete /instances/{instanceId} | Deletes an instance |
InstancesAPI | DeleteInstancePlugin | Delete /instances/{instanceId}/plugins/{pluginSlugOrId} | |
InstancesAPI | DeleteInstanceServiceAccount | Delete /instances/{instanceId}/api/serviceaccounts/{serviceAccountId} | Delete a service account on a Grafana instance |
InstancesAPI | DeleteInstanceServiceAccountToken | Delete /instances/{instanceId}/api/serviceaccounts/{serviceAccountId}/tokens/{tokenId} | Delete a service account token on a Grafana instance |
InstancesAPI | GetConnections | Get /instances/{instanceId}/connections | Gets an instance's connectivity information (InfluxDB, OTEL, AWS private link, etc.) |
InstancesAPI | GetInstance | Get /instances/{instanceId} | Gets an instance |
InstancesAPI | GetInstancePlugin | Get /instances/{instanceId}/plugins/{pluginSlugOrId} | |
InstancesAPI | GetInstancePlugins | Get /instances/{instanceId}/plugins | |
InstancesAPI | GetInstanceServiceAccount | Get /instances/{instanceId}/api/serviceaccounts/{serviceAccountId} | Gets a service account on a Grafana instance |
InstancesAPI | GetInstanceServiceAccountTokens | Get /instances/{instanceId}/api/serviceaccounts/{serviceAccountId}/tokens | Get a service account's tokens on a Grafana instance |
InstancesAPI | GetInstanceUsers | Get /instances/{instanceId}/users | Gets instance active users |
InstancesAPI | GetInstances | Get /instances | Get a list of instances |
InstancesAPI | PostInstance | Post /instances/{instanceId} | Updates an instance |
InstancesAPI | PostInstanceOAuthAzureAD | Post /instances/{instanceId}/oauth-azuread | Configure Azure OAuth in an instance |
InstancesAPI | PostInstanceOAuthGithub | Post /instances/{instanceId}/oauth-github | Configure Github OAuth in an instance |
InstancesAPI | PostInstanceOAuthGoogle | Post /instances/{instanceId}/oauth-google | Configure Google OAuth in an instance |
InstancesAPI | PostInstanceOAuthOkta | Post /instances/{instanceId}/oauth-okta | Configure Okta OAuth in an instance |
InstancesAPI | PostInstancePlugin | Post /instances/{instanceId}/plugins/{pluginSlugOrId} | |
InstancesAPI | PostInstancePlugins | Post /instances/{instanceId}/plugins | |
InstancesAPI | PostInstanceServiceAccountTokens | Post /instances/{instanceId}/api/serviceaccounts/{serviceAccountId}/tokens | Creates a service account token on a Grafana instance |
InstancesAPI | PostInstanceServiceAccounts | Post /instances/{instanceId}/api/serviceaccounts | Creates a service account on a Grafana instance |
InstancesAPI | PostInstances | Post /instances | Create a new instance |
OrgsAPI | CheckOrgVisibility | Get /orgs/{slugOrId}/check-visibility | |
OrgsAPI | DelApiKey | Delete /orgs/{slugOrId}/api-keys/{name} | Delete an API key by name |
OrgsAPI | DeleteOrgMember | Delete /orgs/{slugOrId}/members/{usernameOrId} | |
OrgsAPI | GetApiKey | Get /orgs/{slugOrId}/api-keys/{name} | Get an API key by name |
OrgsAPI | GetApiKeys | Get /orgs/{slugOrId}/api-keys | Get an organization's API keys |
OrgsAPI | GetOrg | Get /orgs/{slugOrId} | |
OrgsAPI | GetOrgBilledUsage | Get /orgs/{orgSlugOrId}/billed-usage | Retrieve an org's billed usage for a specific month |
OrgsAPI | GetOrgBilledUsageHistory | Get /orgs/{orgSlugOrId}/billed-usage-history | Retrieve an org's billed usage items for the last 12 months |
OrgsAPI | GetOrgInstances | Get /orgs/{orgSlug}/instances | Get the list of instances belonging to the org |
OrgsAPI | GetOrgMember | Get /orgs/{slugOrId}/members/{usernameOrId} | |
OrgsAPI | GetOrgMembers | Get /orgs/{slugOrId}/members | |
OrgsAPI | PostApiKeys | Post /orgs/{slugOrId}/api-keys | Create an API key. |
OrgsAPI | PostOrgMember | Post /orgs/{slugOrId}/members/{usernameOrId} | |
OrgsAPI | PostOrgMembers | Post /orgs/{slugOrId}/members | |
PluginsAPI | GetPlugin | Get /plugins/{slug} | Fetches a plugin by slug or id |
StackRegionsAPI | GetClosestStackRegion | Get /stack-regions/closest | |
StackRegionsAPI | GetStackRegions | Get /stack-regions | |
TokensAPI | DeleteToken | Delete /v1/tokens/{id} | Delete a token |
TokensAPI | GetToken | Get /v1/tokens/{id} | Get info for a specific token |
TokensAPI | GetTokens | Get /v1/tokens | Get a list of tokens |
TokensAPI | PostToken | Post /v1/tokens/{id} | Update a token |
TokensAPI | PostTokens | Post /v1/tokens | Create a new token |
- AccessPolicyListResponse
- Api
- Api1
- AppPlatform
- AuthAccessPolicy
- AuthAccessPolicyAttributes
- AuthAccessPolicyAttributesLokiQueryPolicy
- AuthAccessPolicyAttributesPdcConfiguration
- AuthAccessPolicyConditions
- AuthAccessPolicyConditionsAllowedSubnetsInner
- AuthAccessPolicyRealmsInner
- AuthAccessPolicyRealmsInnerLabelPoliciesInner
- AuthToken
- AuthTokenWithSecret
- Current
- Current1
- Current2
- ErrorConflict
- ErrorForbidden
- ErrorInvalidCredentials
- ErrorNotFound
- ErrorServiceUnavailable
- FormattedApiApiKey
- FormattedApiApiKeyListResponse
- FormattedApiInstance
- FormattedApiInstanceConnections
- FormattedApiInstancePlugin
- FormattedApiOrgPublic
- FormattedApiPlugin
- FormattedApiStackRegion
- FormattedApiStackRegionAnyOf
- FormattedApiStackRegionAnyOf1
- FormattedOrgMembership
- FormattedOrgMembershipAllowGCloudTrial
- Gateway
- Gateway1
- GetAccessPolicies200Response
- GetInstancePlugins200Response
- GetInstances200Response
- GetStackRegions200Response
- GrafanaNewApiKeyResult
- GrafanaServiceAccountDTO
- GrafanaTokenDTO
- Graphite
- Info
- InstanceUsersResponse
- ItemsInner
- ItemsInner1
- ItemsInner2
- ItemsInner2GrafanaStaffAccess
- ItemsInner2MarketplaceSubscription
- ItemsInner3
- ItemsInner4
- ItemsInnerId
- LinksInner
- LinksInner1
- Metadata
- Mimir
- ModifiedGetOrgBilledUsageResponse
- Next
- OrgBilledUsageHistory
- OrgMemberListResponse
- Otlp
- OtlpPrivateConnectivityInfo
- Pagination
- Payload
- Pdc
- PdcPrivateConnectivityInfo
- PdcPrivateConnectivityInfoAnyOf
- PdcPrivateConnectivityInfoAnyOf1
- PdcPrivateConnectivityInfoAnyOf2
- PostAccessPoliciesRequest
- PostAccessPoliciesRequestAttributes
- PostAccessPoliciesRequestAttributesLokiQueryPolicy
- PostAccessPoliciesRequestAttributesPdcConfiguration
- PostAccessPoliciesRequestConditions
- PostAccessPoliciesRequestRealmsInner
- PostAccessPoliciesRequestRealmsInnerLabelPoliciesInner
- PostAccessPolicyRequest
- PostApiKeysRequest
- PostInstanceOAuthAzureADRequest
- PostInstanceOAuthGithubRequest
- PostInstanceOAuthGoogleRequest
- PostInstanceOAuthOktaRequest
- PostInstancePluginRequest
- PostInstancePluginsRequest
- PostInstanceRequest
- PostInstanceServiceAccountTokensRequest
- PostInstanceServiceAccountsRequest
- PostInstancesRequest
- PostOrgMemberRequest
- PostOrgMembersRequest
- PostTokenRequest
- PostTokensRequest
- PrivateConnectivityInfo
- Subscriptions
- SubscriptionsAnyOf
- SubscriptionsAnyOf1
- SubscriptionsAnyOf2
- TenantsInner
- UsagesInner
Authentication schemes defined for the API:
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), gcom.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime