Go API client for go_client
The Grafana backend exposes an HTTP API, the same API is used by the frontend to do everything from saving dashboards, creating users and updating data sources.
Overview
This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.
- API version: 0.0.1
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.GoClientCodegen For more information, please visit https://grafana.com
Installation
Put the package under your project folder and add the following in import:
import "./go_client"
Documentation for API Endpoints
All URIs are relative to http://localhost:10081/api
Class | Method | HTTP request | Description |
---|---|---|---|
AdminApi | GetSettings | Get /admin/settings | Fetch settings. |
AdminApi | GetStats | Get /admin/stats | Fetch Grafana Stats. |
AdminApi | PauseAllAlerts | Post /admin/pause-all-alerts | Pause/unpause all (legacy) alerts. |
AdminLdapApi | GetLDAPStatus | Get /admin/ldap/status | Attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not. |
AdminLdapApi | GetLDAPUser | Get /admin/ldap/{user_name} | Finds an user based on a username in LDAP. This helps illustrate how would the particular user be mapped in Grafana when synced. |
AdminLdapApi | ReloadLDAP | Post /admin/ldap/reload | Reloads the LDAP configuration. |
AdminLdapApi | SyncLDAPUser | Post /admin/ldap/sync/{user_id} | Enables a single Grafana user to be synchronized against LDAP. |
AdminProvisioningApi | ReloadProvisionedAccessControl | Post /admin/provisioning/accesscontrol/reload | Reload access control provisioning configurations. |
AdminProvisioningApi | ReloadProvisionedAlertNotifiers | Post /admin/provisioning/notifications/reload | Reload legacy alert notifier provisioning configurations. |
AdminProvisioningApi | ReloadProvisionedDashboards | Post /admin/provisioning/dashboards/reload | Reload dashboard provisioning configurations. |
AdminProvisioningApi | ReloadProvisionedDatasources | Post /admin/provisioning/datasources/reload | Reload datasource provisioning configurations. |
AdminProvisioningApi | ReloadProvisionedPlugins | Post /admin/provisioning/plugins/reload | Reload plugin provisioning configurations. |
AdminUsersApi | CreateUser | Post /admin/users | Create new user. |
AdminUsersApi | DeleteUser | Delete /admin/users/{user_id} | Delete global User. |
AdminUsersApi | DisableUser | Post /admin/users/{user_id}/disable | Disable user. |
AdminUsersApi | EnableUser | Post /admin/users/{user_id}/enable | Enable user. |
AdminUsersApi | GetAuthTokens | Get /admin/users/{user_id}/auth-tokens | Return a list of all auth tokens (devices) that the user currently have logged in from. |
AdminUsersApi | GetUserQuota | Get /admin/users/{user_id}/quotas | Fetch user quota. |
AdminUsersApi | LogoutUser | Post /admin/users/{user_id}/logout | Logout user revokes all auth tokens (devices) for the user. User of issued auth tokens (devices) will no longer be logged in and will be required to authenticate again upon next activity. |
AdminUsersApi | RevokeAuthToken | Post /admin/users/{user_id}/revoke-auth-token | Revoke auth token for user. |
AdminUsersApi | SetPassword | Put /admin/users/{user_id}/password | Set password for user. |
AdminUsersApi | SetPermissions | Put /admin/users/{user_id}/permissions | Set permissions for user. |
AdminUsersApi | UpdateUserQuota | Put /admin/users/{user_id}/quotas/{quota_target} | Update user quota. |
AnnotationsApi | CreateAnnotation | Post /annotations | Create Annotation. |
AnnotationsApi | CreateGraphiteAnnotation | Post /annotations/graphite | Create Annotation in Graphite format. |
AnnotationsApi | DeleteAnnotation | Delete /annotations/{annotation_id} | Delete Annotation By ID. |
AnnotationsApi | GetAnnotationTags | Get /annotations/tags | Find Annotations Tags. |
AnnotationsApi | GetAnnotations | Get /annotations | Find Annotations. |
AnnotationsApi | MassDeleteAnnotations | Post /annotations/mass-delete | Delete multiple annotations. |
AnnotationsApi | PatchAnnotation | Patch /annotations/{annotation_id} | Patch Annotation |
AnnotationsApi | UpdateAnnotation | Put /annotations/{annotation_id} | Update Annotation. |
ApikeysApi | AddAPIkey | Post /auth/keys | Creates an API key. |
ApikeysApi | DeleteAPIkey | Delete /auth/keys/{id} | Delete API key. |
ApikeysApi | GetAPIkeys | Get /auth/keys | Get auth keys. |
DashboardPermissionsApi | GetDashboardPermissions | Get /dashboards/id/{DashboardID}/permissions | Gets all existing permissions for the given dashboard. |
DashboardPermissionsApi | PostDashboardPermissions | Post /dashboards/id/{DashboardID}/permissions | Updates permissions for a dashboard. |
DashboardVersionsApi | GetDashboardVersion | Get /dashboards/id/{DashboardID}/versions/{DashboardVersionID} | Get a specific dashboard version. |
DashboardVersionsApi | GetDashboardVersions | Get /dashboards/id/{DashboardID}/versions | Gets all existing versions for the dashboard. |
DashboardVersionsApi | RestoreDashboardVersion | Post /dashboards/id/{DashboardID}/restore | Restore a dashboard to a given dashboard version. |
DashboardsApi | CalcDashboardDiff | Post /dashboards/calculate-diff | Perform diff on two dashboards. |
DashboardsApi | DeleteDashboardByUID | Delete /dashboards/uid/{uid} | Delete dashboard by uid. |
DashboardsApi | GetDashboardByUID | Get /dashboards/uid/{uid} | Get dashboard by uid. |
DashboardsApi | GetDashboardTags | Get /dashboards/tags | Get all dashboards tags of an organisation. |
DashboardsApi | GetHomeDashboard | Get /dashboards/home | Get home dashboard. |
DashboardsApi | ImportDashboard | Post /dashboards/import | Import dashboard. |
DashboardsApi | PostDashboard | Post /dashboards/db | Create / Update dashboard |
DashboardsApi | TrimDashboard | Post /dashboards/trim | Trim defaults from dashboard. |
DatasourcesApi | AddDatasource | Post /datasources | Create a data source. |
DatasourcesApi | DatasourceProxyDELETEcalls | Delete /datasources/proxy/{datasource_id}/{datasource_proxy_route} | Data source proxy DELETE calls. |
DatasourcesApi | DatasourceProxyGETcalls | Get /datasources/proxy/{datasource_id}/{datasource_proxy_route} | Data source proxy GET calls. |
DatasourcesApi | DatasourceProxyPOSTcalls | Post /datasources/proxy/{datasource_id}/{datasource_proxy_route} | Data source proxy POST calls. |
DatasourcesApi | DeleteDatasourceByID | Delete /datasources/{datasource_id} | Delete an existing data source by id. |
DatasourcesApi | DeleteDatasourceByName | Delete /datasources/name/{datasource_name} | Delete an existing data source by name. |
DatasourcesApi | DeleteDatasourceByUID | Delete /datasources/uid/{datasource_uid} | Delete an existing data source by UID. |
DatasourcesApi | GetDatasourceByID | Get /datasources/{datasource_id} | Get a single data source by Id. |
DatasourcesApi | GetDatasourceByName | Get /datasources/name/{datasource_name} | Get a single data source by Name. |
DatasourcesApi | GetDatasourceByUID | Get /datasources/uid/{datasource_uid} | Get a single data source by UID. |
DatasourcesApi | GetDatasourceIdByName | Get /datasources/id/{datasource_name} | Get data source Id by Name. |
DatasourcesApi | GetDatasources | Get /datasources | Get all data sources. |
DatasourcesApi | QueryDatasource | Post /tsdb/query | Query metrics. |
DatasourcesApi | UpdateDatasource | Put /datasources/{datasource_id} | Update an existing data source. |
FolderPermissionsApi | GetFolderPermissions | Get /folders/{folder_uid}/permissions | Gets all existing permissions for the folder with the given `uid`. |
FolderPermissionsApi | UpdateFolderPermissions | Post /folders/{folder_uid}/permissions | Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request. |
FoldersApi | CreateFolder | Post /folders | Create folder. |
FoldersApi | DeleteFolder | Delete /folders/{folder_uid} | Delete folder. |
FoldersApi | GetFolderByID | Get /folders/id/{folder_id} | Get folder by id. |
FoldersApi | GetFolderByUID | Get /folders/{folder_uid} | Get folder by uid. |
FoldersApi | GetFolders | Get /folders | Get all folders. |
FoldersApi | UpdateFolder | Put /folders/{folder_uid} | Update folder. |
LegacyAlertingApi | GetAlertByID | Get /alerts/{alert_id} | Get alert by ID. |
LegacyAlertingApi | GetAlerts | Get /alerts | Get legacy alerts. |
LegacyAlertingApi | GetDashboardStates | Get /alerts/states-for-dashboard | Get alert states for a dashboard. |
LegacyAlertingApi | PauseAlert | Post /alerts/{alert_id}/pause | Pause/unpause alert by id. |
LegacyAlertingApi | TestAlert | Post /alerts/test | Test alert. |
LegacyNotificationChannelsApi | CreateAlertNotificationChannel | Post /alert-notifications | Create notification channel. |
LegacyNotificationChannelsApi | DeleteAlertNotificationChannel | Delete /alert-notifications/{notification_channel_id} | Delete alert notification by ID. |
LegacyNotificationChannelsApi | DeleteAlertNotificationChannelByUID | Delete /alert-notifications/uid/{notification_channel_uid} | Delete alert notification by UID. |
LegacyNotificationChannelsApi | GetAlertNotificationChannelByID | Get /alert-notifications/{notification_channel_id} | Get notification channel by ID. |
LegacyNotificationChannelsApi | GetAlertNotificationChannelByUID | Get /alert-notifications/uid/{notification_channel_uid} | Get notification channel by UID |
LegacyNotificationChannelsApi | GetAlertNotificationChannels | Get /alert-notifications | Get all notification channels. |
LegacyNotificationChannelsApi | LookupAlertNotificationChannels | Get /alert-notifications/lookup | Get all notification channels (lookup) |
LegacyNotificationChannelsApi | NotificationChannelTest | Post /alert-notifications/test | Test notification channel. |
LegacyNotificationChannelsApi | UpdateAlertNotificationChannel | Put /alert-notifications/{notification_channel_id} | Update notification channel by ID. |
LegacyNotificationChannelsApi | UpdateAlertNotificationChannelBYUID | Put /alert-notifications/uid/{notification_channel_uid} | Update notification channel by UID. |
LibraryElementsApi | CreateLibraryElement | Post /library-elements | Create library element. |
LibraryElementsApi | DeleteLibraryElementByUID | Delete /library-elements/{library_element_uid} | Delete library element. |
LibraryElementsApi | GetLibraryElementByName | Get /library-elements/name/{library_element_name} | Get library element by name. |
LibraryElementsApi | GetLibraryElementByUID | Get /library-elements/{library_element_uid} | Get library element by UID. |
LibraryElementsApi | GetLibraryElementConnections | Get /library-elements/{library_element_uid}/connections/ | Get library element connections. |
LibraryElementsApi | GetLibraryElements | Get /library-elements | Get all library elements. |
LibraryElementsApi | UpdateLibraryElement | Patch /library-elements/{library_element_uid} | Update library element. |
OrgApi | AddOrgUser | Post /org/users | Add a new user to the current organization |
OrgApi | DeleteOrgUser | Delete /org/users/{user_id} | Delete user in current organization |
OrgApi | GetOrg | Get /org | |
OrgApi | GetOrgUsers | Get /org/users | Get all users within the current organization. |
OrgApi | LookupOrgUsers | Get /org/users/lookup | Get all users within the current organization (lookup) |
OrgApi | UpdateOrg | Put /org | Update current Organization. |
OrgApi | UpdateOrgAddress | Put /org/address | Update current Organization's address. |
OrgApi | UpdateOrgUser | Patch /org/users/{user_id} | Updates the given user |
OrgInvitesApi | AddInvite | Post /org/invites | Add invite. |
OrgInvitesApi | GetInvites | Get /org/invites | Get pending invites. |
OrgInvitesApi | RevokeInvite | Delete /org/{invitation_code}/invites | Revoke invite. |
OrgPreferencesApi | GetOrgPreferences | Get /org/preferences | Get Current Org Prefs. |
OrgPreferencesApi | UpdateOrgPreferences | Put /org/preferences | Update Current Org Prefs. |
OrgsApi | AdminAddOrgUser | Post /orgs/{org_id}/users | Add a new user to the current organization |
OrgsApi | AdminDeleteOrg | Delete /orgs/{org_id} | Delete Organization. |
OrgsApi | AdminDeleteOrgUser | Delete /orgs/{org_id}/users/{user_id} | Delete user in current organization |
OrgsApi | AdminGetOrgUsers | Get /orgs/{org_id}/users | Get Users in Organization. |
OrgsApi | AdminUpdateOrg | Put /orgs/{org_id} | Update Organization. |
OrgsApi | AdminUpdateOrgAddress | Put /orgs/{org_id}/address | Update Organization's address. |
OrgsApi | AdminUpdateOrgUser | Patch /orgs/{org_id}/users/{user_id} | Update Users in Organization. |
OrgsApi | CreateOrg | Post /orgs | Create Organization. |
OrgsApi | GetOrgByID | Get /orgs/{org_id} | Get Organization by ID. |
OrgsApi | GetOrgByName | Get /orgs/name/{org_name} | Get Organization by ID. |
OrgsApi | GetOrgQuota | Get /orgs/{org_id}/quotas | Fetch Organization quota. |
OrgsApi | SearchOrg | Get /orgs | |
OrgsApi | UpdateOrgQuota | Put /orgs/{org_id}/quotas/{quota_target} | Update user quota. |
SearchApi | Search | Get /search | |
SearchApi | SearchSorting | Get /search/sorting | |
SnapshotApi | CreateSnapshot | Post /snapshots | When creating a snapshot using the API, you have to provide the full dashboard payload including the snapshot data. This endpoint is designed for the Grafana UI. |
SnapshotApi | DeleteSnapshotByDeleteKey | Get /snapshots-delete/{deleteKey} | Delete Snapshot by deleteKey. |
SnapshotApi | DeleteSnapshotByKey | Delete /snapshots/{key} | Delete Snapshot by Key. |
SnapshotApi | GetSnapshotByKey | Get /snapshots/{key} | Get Snapshot by Key. |
SnapshotApi | GetSnapshotSharingOptions | Get /snapshot/shared-options | Get snapshot sharing settings. |
SnapshotApi | GetSnapshots | Get /dashboard/snapshots | List snapshots. |
TeamsApi | AddTeamMember | Post /teams/{team_id}/members | Add Team Member. |
TeamsApi | CreateTeam | Post /teams | Add Team. |
TeamsApi | DeleteTeamByID | Delete /teams/{team_id} | Delete Team By ID. |
TeamsApi | GetTeam | Get /teams/{team_id} | Get Team By ID. |
TeamsApi | GetTeamMembers | Get /teams/{team_id}/members | Get Team Members. |
TeamsApi | GetTeamPreferences | Get /teams/{team_id}/preferences | Get Team Preferences. |
TeamsApi | RemoveTeamMember | Delete /teams/{team_id}/members/{user_id} | Remove Member From Team. |
TeamsApi | SearchTeams | Get /teams/search | Team Search With Paging. |
TeamsApi | UpdateTeam | Put /teams/{team_id} | Update Team. |
TeamsApi | UpdateTeamMember | Put /teams/{team_id}/members/{user_id} | Update Team Member. |
TeamsApi | UpdateTeamPreferences | Put /teams/{team_id}/preferences | Update Team Preferences. |
UserApi | ChangeUserPassword | Put /user/password | Change Password. |
UserApi | ClearHelpFlags | Get /user/helpflags/clear | Clear user help flag. |
UserApi | GetSignedInUser | Get /user | Get signed in User. |
UserApi | GetSignedInUserAuthTokens | Get /user/auth-tokens | Auth tokens of the actual User. |
UserApi | GetSignedInUserOrgList | Get /user/orgs | Organizations of the actual User. |
UserApi | GetSignedInUserTeamList | Get /user/teams | Teams that the actual User is member of. |
UserApi | GetUserQuotas | Get /user/quotas | Fetch user quota. |
UserApi | RevokeSignedINAuthTokenCmd | Post /user/revoke-auth-token | Revoke an auth token of the actual User. |
UserApi | SetHelpFlag | Put /user/helpflags/{flag_id} | Set user help flag. |
UserApi | StarDashboard | Post /user/stars/dashboard/{dashboard_id} | Star a dashboard. |
UserApi | UnstarDashboard | Delete /user/stars/dashboard/{dashboard_id} | Unstar a dashboard. |
UserApi | UpdateSignedInUser | Put /user | Update signed in User. |
UserApi | UserSetUsingOrg | Post /user/using/{org_id} | Switch user context for signed in user. |
UserPreferencesApi | GetUserPreferences | Get /user/preferences | Get user preferences. |
UserPreferencesApi | UpdateUserPreferences | Put /user/preferences | Update user preferences. |
UsersApi | GetUserByID | Get /users/{user_id} | Get user by id. |
UsersApi | GetUserByLoginOrEmail | Get /users/lookup | Get user by login or email. |
UsersApi | GetUserOrgList | Get /users/{user_id}/orgs | Get organizations for user. |
UsersApi | GetUserTeams | Get /users/{user_id}/teams | Get teams for user. |
UsersApi | SearchUsers | Get /users | Get users. |
UsersApi | SearchUsersWithPaging | Get /users/search | Get users with paging. |
UsersApi | UpdateUser | Put /users/{user_id} | Update user. |
Documentation For Models
- AddApiKeyCommand
- AddDataSourceCommand
- AddInviteForm
- AddOrgUserCommand
- AddTeamMemberCommand
- Address
- AdminCreateUserForm
- AdminStats
- AdminUpdateUserPasswordForm
- AdminUpdateUserPermissionsForm
- Alert
- AlertListItemDto
- AlertNotification
- AlertNotificationLookup
- AlertStateInfoDto
- AlertStateType
- AlertTestCommand
- AlertTestResult
- AlertTestResultLog
- ApiKeyDto
- Body
- CalculateDiffTarget
- ChangeUserPasswordCommand
- CreateAlertNotificationCommand
- CreateDashboardSnapshotCommand
- CreateFolderCommand
- CreateLibraryElementCommand
- CreateOrgCommand
- CreateTeamCommand
- Dashboard
- DashboardAclInfoDto
- DashboardAclUpdateItem
- DashboardFullWithMeta
- DashboardMeta
- DashboardRedirect
- DashboardSnapshotDto
- DashboardTagCloudItem
- DashboardVersionDto
- DashboardVersionMeta
- DataFrames
- DataQueryResult
- DataResponse
- DataRowValues
- DataSource
- DataSourceList
- DataSourceListItemDto
- DataTable
- DataTableColumn
- DataTimePoint
- DataTimeSeries
- DataTimeSeriesPoints
- DataTimeSeriesSlice
- DeleteAnnotationsCmd
- DsAccess
- Duration
- ErrorResponseBody
- EvalMatch
- FindTagsResult
- Float
- Folder
- FolderSearchHit
- GetAnnotationTagsResponse
- GetHomeDashboardResponse
- Hit
- HitList
- HitType
- ImportDashboardCommand
- ImportDashboardInput
- InlineResponse200
- InlineResponse2001
- InlineResponse20010
- InlineResponse20011
- InlineResponse20012
- InlineResponse20013
- InlineResponse20014
- InlineResponse20015
- InlineResponse20016
- InlineResponse2002
- InlineResponse2003
- InlineResponse2004
- InlineResponse2005
- InlineResponse2006
- InlineResponse2007
- InlineResponse2008
- InlineResponse2009
- ItemDto
- Json
- LibraryElementConnectionDto
- LibraryElementConnectionsResponse
- LibraryElementDto
- LibraryElementDtoMeta
- LibraryElementDtoMetaUser
- LibraryElementResponse
- LibraryElementSearchResponse
- LibraryElementSearchResult
- MetricRequest
- NewApiKeyResult
- NotificationTestCommand
- OrgDetailsDto
- OrgDto
- OrgUserDto
- PatchAnnotationsCmd
- PatchLibraryElementCommand
- PauseAlertCommand
- PauseAllAlertsCommand
- PermissionType
- PostAnnotationsCmd
- PostGraphiteAnnotationsCmd
- Prefs
- RevokeAuthTokenCmd
- RoleType
- SaveDashboardCommand
- SearchTeamQueryResult
- SearchUserQueryResult
- SettingsBag
- SuccessResponseBody
- TagsDto
- TeamDto
- TeamMemberDto
- TempUserDto
- TempUserStatus
- TrimDashboardCommand
- TrimDashboardFullWithMeta
- UpdateAlertNotificationCommand
- UpdateAlertNotificationWithUidCommand
- UpdateAnnotationsCmd
- UpdateDashboardAclCommand
- UpdateDataSourceCommand
- UpdateFolderCommand
- UpdateOrgAddressForm
- UpdateOrgForm
- UpdateOrgQuotaCmd
- UpdateOrgUserCommand
- UpdatePrefsCmd
- UpdateTeamCommand
- UpdateTeamMemberCommand
- UpdateUserCommand
- UpdateUserQuotaCmd
- UserIdDto
- UserLookupDto
- UserOrgDto
- UserProfileDto
- UserQuotaDto
- UserSearchHitDto
- UserToken
Documentation For Authorization
api_key
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
basic
- Type: HTTP basic authentication
Example
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)