diff --git a/Makefile b/Makefile index b1cc517b409..8bb8bebeb65 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ ensure_go-swagger_mac: -x "github.com/prometheus/alertmanager" \ -i pkg/api/docs/tags.json -swagger-api-spec-mac: gen-go --swagger-api-spec-mac $(MERGED_SPEC_TARGET) validate-api-spec +swagger-api-spec-mac: gen-go --swagger-api-spec-mac $(MERGED_SPEC_TARGET) validate-api-spec-mac validate-api-spec: $(MERGED_SPEC_TARGET) ## Validate API spec docker run --rm -it \ @@ -79,6 +79,9 @@ validate-api-spec: $(MERGED_SPEC_TARGET) ## Validate API spec -w $$(pwd)/pkg/api/docs quay.io/goswagger/swagger:$(SWAGGER_TAG) \ validate /grafana/$(<) +validate-api-spec-mac: $(MERGED_SPEC_TARGET) ## Validate API spec + swagger validate $(<) + clean-api-spec: rm $(SPEC_TARGET) $(MERGED_SPEC_TARGET) diff --git a/pkg/api/docs/definitions/admin.go b/pkg/api/docs/definitions/admin.go index 07d2262886b..999951af967 100644 --- a/pkg/api/docs/definitions/admin.go +++ b/pkg/api/docs/definitions/admin.go @@ -45,7 +45,7 @@ import ( // 500: internalServerError // swagger:parameters pauseAllAlerts -type PauseAllAlertsParam struct { +type PauseAllAlertsParams struct { // in:body // required:true Body dtos.PauseAllAlertsCommand `json:"body"` diff --git a/pkg/api/docs/definitions/admin_ldap.go b/pkg/api/docs/definitions/admin_ldap.go index e3933cce712..47492c595eb 100644 --- a/pkg/api/docs/definitions/admin_ldap.go +++ b/pkg/api/docs/definitions/admin_ldap.go @@ -61,8 +61,15 @@ package definitions // 500: internalServerError // swagger:parameters getLDAPUser -type UserNameParam struct { +type GetLDAPUserParams struct { // in:path // required:true - UserID string `json:"user_name"` + UserName string `json:"user_name"` +} + +// swagger:parameters syncLDAPUser +type SyncLDAPUserParams struct { + // in:path + // required:true + UserID int64 `json:"user_id"` } diff --git a/pkg/api/docs/definitions/admin_users.go b/pkg/api/docs/definitions/admin_users.go index 92581b92b45..899560fdbbd 100644 --- a/pkg/api/docs/definitions/admin_users.go +++ b/pkg/api/docs/definitions/admin_users.go @@ -183,17 +183,75 @@ import ( // 500: internalServerError // swagger:parameters setPassword -type SetPasswordParam struct { +type SetPasswordParams struct { // in:body // required:true Body dtos.AdminUpdateUserPasswordForm `json:"body"` + // in:path + // required:true + UserID int64 `json:"user_id"` } -// swagger:parameters revokeAuthToken revokeSignedINAuthTokenCmd -type RevokeAuthTokenParam struct { +// swagger:parameters deleteUser +type DeleteUserParams struct { + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters enableUser +type EnableUserParams struct { + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters disableUser +type DisableUserParams struct { + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters getUserQuota +type GetUserQuotaParams struct { + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters updateUserQuota +type UpdateUserQuotaParams struct { + // in:path + // required:true + QuotaTarget string `json:"quota_target"` + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters getAuthTokens +type GetAuthTokensParams struct { + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters logoutUser +type LogoutUserParams struct { + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters revokeAuthToken +type RevokeAuthTokenParams struct { // in:body // required:true Body models.RevokeAuthTokenCmd `json:"body"` + // in:path + // required:true + UserID int64 `json:"user_id"` } // swagger:parameters createUser @@ -203,13 +261,6 @@ type CreateUserParam struct { Body dtos.AdminCreateUserForm `json:"body"` } -// swagger:parameters updateUserQuota updateOrgQuota -type TargeQuotaParam struct { - // in:path - // required:true - QuotaTarget string `json:"quota_target"` -} - // swagger:parameters updateUserQuota type UpdateUserQuotaParam struct { // in:body @@ -218,10 +269,13 @@ type UpdateUserQuotaParam struct { } // swagger:parameters setPermissions -type SetPermissionsParam struct { +type SetPermissionsParams struct { // in:body // required:true Body dtos.AdminUpdateUserPermissionsForm `json:"body"` + // in:path + // required:true + UserID int64 `json:"user_id"` } // swagger:response createUserResponse diff --git a/pkg/api/docs/definitions/annotations.go b/pkg/api/docs/definitions/annotations.go index 85a1e60333b..b7fa844daf0 100644 --- a/pkg/api/docs/definitions/annotations.go +++ b/pkg/api/docs/definitions/annotations.go @@ -113,8 +113,15 @@ import ( // 401: unauthorisedError // 500: internalServerError -// swagger:parameters getAnnotation updateAnnotation patchAnnotation deleteAnnotation -type AnnotationIDParam struct { +// swagger:parameters getAnnotation +type GetAnnotationParams struct { + // in:path + // required:true + AnnotationID string `json:"annotation_id"` +} + +// swagger:parameters deleteAnnotation +type DeleteAnnotationParams struct { // in:path // required:true AnnotationID string `json:"annotation_id"` @@ -206,6 +213,9 @@ type CreateGraphiteAnnotationParams struct { // swagger:parameters updateAnnotation type UpdateAnnotationParams struct { + // in:path + // required:true + AnnotationID string `json:"annotation_id"` // in:body // required:true Body dtos.UpdateAnnotationsCmd `json:"body"` @@ -213,6 +223,9 @@ type UpdateAnnotationParams struct { // swagger:parameters patchAnnotation type PatchAnnotationParams struct { + // in:path + // required:true + AnnotationID string `json:"annotation_id"` // in:body // required:true Body dtos.PatchAnnotationsCmd `json:"body"` diff --git a/pkg/api/docs/definitions/dashboard.go b/pkg/api/docs/definitions/dashboard.go index bac5d3b2e08..ddb9423ef38 100644 --- a/pkg/api/docs/definitions/dashboard.go +++ b/pkg/api/docs/definitions/dashboard.go @@ -101,7 +101,21 @@ import ( // 422: unprocessableEntityError // 500: internalServerError -// swagger:parameters getDashboardByUID deleteDashboardByUID getDashboardPermissionsWithUid postDashboardPermissionsWithUid getDashboardVersionByUID +// swagger:parameters getDashboardByUID +type GetDashboardByUIDParams struct { + // in:path + // required:true + UID string `json:"uid"` +} + +// swagger:parameters deleteDashboardByUID +type DeleteDashboardByUIDParams struct { + // in:path + // required:true + UID string `json:"uid"` +} + +// swagger:parameters getDashboardPermissionsWithUid postDashboardPermissionsWithUid getDashboardVersionByUID // swagger:parameters getDashboardVersionsByUID restoreDashboardVersionByUID type UID struct { // in:path diff --git a/pkg/api/docs/definitions/dashboard_permissions.go b/pkg/api/docs/definitions/dashboard_permissions.go index 46ae3e96865..261d3381d78 100644 --- a/pkg/api/docs/definitions/dashboard_permissions.go +++ b/pkg/api/docs/definitions/dashboard_permissions.go @@ -63,11 +63,30 @@ import ( // 404: notFoundError // 500: internalServerError -// swagger:parameters postDashboardPermissions updateFolderPermissions postDashboardPermissionsWithUid -type PostDashboardPermissionsParam struct { +// swagger:parameters getDashboardPermissions +type GetDashboardPermissionsParams struct { + // in:path + DashboardID int64 +} + +// swagger:parameters postDashboardPermissions +type PostDashboardPermissionsParams struct { // in:body // required:true Body dtos.UpdateDashboardAclCommand + // in:path + DashboardID int64 +} + +// swagger:parameters postDashboardPermissionsWithUid +type PostDashboardPermissionsWithUIDParams struct { + // in:body + // required:true + Body dtos.UpdateDashboardAclCommand + // in:path + // required:true + // description: The dashboard UID + UID string `json:"uid"` } // swagger:response getDashboardPermissionsResponse diff --git a/pkg/api/docs/definitions/dashboard_versions.go b/pkg/api/docs/definitions/dashboard_versions.go index 84a938e7386..cc927c0b28f 100644 --- a/pkg/api/docs/definitions/dashboard_versions.go +++ b/pkg/api/docs/definitions/dashboard_versions.go @@ -84,7 +84,7 @@ import ( // 500: internalServerError // swagger:parameters getDashboardVersions getDashboardVersion restoreDashboardVersion -// swagger:parameters getDashboardPermissions postDashboardPermissions +// swagger:parameters getDashboardPermissions // swagger:parameters renderReportPDF type DashboardIdParam struct { // in:path diff --git a/pkg/api/docs/definitions/datasources.go b/pkg/api/docs/definitions/datasources.go index a7262cf64a9..9cb510c020b 100644 --- a/pkg/api/docs/definitions/datasources.go +++ b/pkg/api/docs/definitions/datasources.go @@ -333,7 +333,7 @@ import ( // 404: notFoundError // 500: internalServerError -// swagger:parameters updateDatasourceByID deleteDatasourceByID getDatasourceByID datasourceProxyGETcalls datasourceProxyPOSTcalls datasourceProxyDELETEcalls +// swagger:parameters updateDatasourceByID datasourceProxyDELETEcalls // swagger:parameters checkDatasourceHealthByID fetchDatasourceResourcesByID type DatasourceID struct { // in:path @@ -341,7 +341,31 @@ type DatasourceID struct { DatasourceID string `json:"id"` } -// swagger:parameters updateDatasourceByUID deleteDatasourceByUID getDatasourceByUID datasourceProxyGETByUIDcalls datasourceProxyPOSTByUIDcalls datasourceProxyDELETEByUIDcalls +// swagger:parameters deleteDatasourceByID +type DeleteDatasourceByIDParams struct { + // in:path + // required:true + DatasourceID string `json:"id"` +} + +// swagger:parameters getDatasourceByID +type GetDatasourceByIDParams struct { + // in:path + // required:true + DatasourceID string `json:"id"` +} + +// swagger:parameters datasourceProxyGETcalls +type DatasourceProxyGETcallsParams struct { + // in:path + // required:true + DatasourceProxyRoute string `json:"datasource_proxy_route"` + // in:path + // required:true + DatasourceID string `json:"id"` +} + +// swagger:parameters datasourceProxyDELETEByUIDcalls // swagger:parameters checkDatasourceHealth fetchDatasourceResources type DatasourceUID struct { // in:path @@ -349,15 +373,53 @@ type DatasourceUID struct { DatasourceUID string `json:"uid"` } -// swagger:parameters getDatasourceByName deleteDatasourceByName getDatasourceIdByName -type DatasourceName struct { +// swagger:parameters deleteDatasourceByUID +type DeleteDatasourceByUIDParams struct { + // in:path + // required:true + DatasourceUID string `json:"uid"` +} + +// swagger:parameters getDatasourceByUID +type GetDatasourceByUIDParams struct { + // in:path + // required:true + DatasourceUID string `json:"uid"` +} + +// swagger:parameters datasourceProxyGETByUIDcalls +type DatasourceProxyGETByUIDcallsParams struct { + // in:path + // required:true + DatasourceProxyRoute string `json:"datasource_proxy_route"` + // in:path + // required:true + DatasourceUID string `json:"uid"` +} + +// swagger:parameters getDatasourceByName +type GetDatasourceByNameParams struct { // in:path // required:true DatasourceName string `json:"name"` } -// swagger:parameters datasourceProxyGETcalls datasourceProxyPOSTcalls datasourceProxyDELETEcalls datasourceProxyGETByUIDcalls -// swagger:parameters datasourceProxyPOSTByUIDcalls datasourceProxyDELETEByUIDcalls +// swagger:parameters deleteDatasourceByName +type DeleteDatasourceByNameParams struct { + // in:path + // required:true + DatasourceName string `json:"name"` +} + +// swagger:parameters getDatasourceIdByName +type GetDatasourceIdByNameParams struct { + // in:path + // required:true + DatasourceName string `json:"name"` +} + +// swagger:parameters datasourceProxyDELETEcalls +// swagger:parameters datasourceProxyDELETEByUIDcalls // swagger:parameters fetchDatasourceResources fetchDatasourceResourcesByID type DatasourceProxyRouteParam struct { // in:path @@ -366,24 +428,56 @@ type DatasourceProxyRouteParam struct { } // swagger:parameters datasourceProxyPOSTcalls -type DatasourceProxyParam struct { +type DatasourceProxyPOSTcallsParams struct { // in:body // required:true DatasourceProxyParam interface{} + // in:path + // required:true + DatasourceProxyRoute string `json:"datasource_proxy_route"` + // in:path + // required:true + DatasourceID string `json:"id"` +} + +// swagger:parameters datasourceProxyPOSTByUIDcalls +type DatasourceProxyPOSTByUIDcallsParams struct { + // in:body + // required:true + DatasourceProxyParam interface{} + // in:path + // required:true + DatasourceProxyRoute string `json:"datasource_proxy_route"` + // in:path + // required:true + DatasourceUID string `json:"uid"` } // swagger:parameters addDatasource -type AddDatasourceParam struct { +type AddDatasourceParams struct { // in:body // required:true Body models.AddDataSourceCommand } -// swagger:parameters updateDatasourceByID updateDatasourceByUID -type UpdateDatasource struct { +// swagger:parameters updateDatasourceByID +type UpdateDatasourceParams struct { // in:body // required:true Body models.UpdateDataSourceCommand + // in:path + // required:true + DatasourceID string `json:"id"` +} + +// swagger:parameters updateDatasourceByUID +type UpdateDatasourceByUIDParams struct { + // in:body + // required:true + Body models.UpdateDataSourceCommand + // in:path + // required:true + DatasourceUID string `json:"uid"` } // swagger:response getDatasourcesResponse diff --git a/pkg/api/docs/definitions/folder.go b/pkg/api/docs/definitions/folder.go index 3ce1e9f8110..e2371f8265c 100644 --- a/pkg/api/docs/definitions/folder.go +++ b/pkg/api/docs/definitions/folder.go @@ -95,13 +95,23 @@ type GetFoldersParams struct { } // swagger:parameters getFolderByUID updateFolder deleteFolder -// swagger:parameters getFolderPermissions updateFolderPermissions +// swagger:parameters getFolderPermissions type FolderUIDParam struct { // in:path // required:true FolderUID string `json:"folder_uid"` } +// swagger:parameters updateFolderPermissions +type PostDashboardPermissionsParam struct { + // in:path + // required:true + FolderUID string `json:"folder_uid"` + // in:body + // required:true + Body dtos.UpdateDashboardAclCommand +} + // swagger:parameters getFolderByID type FolderIDParam struct { // in:path diff --git a/pkg/api/docs/definitions/legacy_alert_notifications.go b/pkg/api/docs/definitions/legacy_alert_notifications.go index a4a17a386eb..751b7356f11 100644 --- a/pkg/api/docs/definitions/legacy_alert_notifications.go +++ b/pkg/api/docs/definitions/legacy_alert_notifications.go @@ -108,7 +108,7 @@ import ( // 404: notFoundError // 500: internalServerError -// swagger:route PUT /alert-notifications/uid/{notification_channel_uid} legacy_alerts_notification_channels updateAlertNotificationChannelBYUID +// swagger:route PUT /alert-notifications/uid/{notification_channel_uid} legacy_alerts_notification_channels updateAlertNotificationChannelByUID // // Update notification channel by UID. // @@ -134,46 +134,66 @@ import ( // 404: notFoundError // 500: internalServerError -// swagger:parameters updateAlertNotificationChannel getAlertNotificationChannelByID deleteAlertNotificationChannel -type NotificationIDParam struct { +// swagger:parameters deleteAlertNotificationChannel +type DeleteAlertNotificationChannelParams struct { // in:path // required:true NotificationID int64 `json:"notification_channel_id"` } -// swagger:parameters getAlertNotificationChannelByUID updateAlertNotificationChannelBYUID deleteAlertNotificationChannelByUID -type NotificationUIDParam struct { +// swagger:parameters getAlertNotificationChannelByID +type GetAlertNotificationChannelByIDParams struct { + // in:path + // required:true + NotificationID int64 `json:"notification_channel_id"` +} + +// swagger:parameters deleteAlertNotificationChannelByUID +type DeleteAlertNotificationChannelByUIDParams struct { + // in:path + // required:true + NotificationUID string `json:"notification_channel_uid"` +} + +// swagger:parameters getAlertNotificationChannelByUID +type GetAlertNotificationChannelByUIDParams struct { // in:path // required:true NotificationUID string `json:"notification_channel_uid"` } // swagger:parameters notificationChannelTest -type NotificationChannelTestParam struct { +type NotificationChannelTestParams struct { // in:body // required:true Body dtos.NotificationTestCommand `json:"body"` } // swagger:parameters createAlertNotificationChannel -type CreateAlertNotificationChannelParam struct { +type CreateAlertNotificationChannelParams struct { // in:body // required:true Body models.CreateAlertNotificationCommand `json:"body"` } // swagger:parameters updateAlertNotificationChannel -type UpdateAlertNotificationChannelParam struct { +type UpdateAlertNotificationChannelParams struct { // in:body // required:true Body models.UpdateAlertNotificationCommand `json:"body"` + // in:path + // required:true + NotificationID int64 `json:"notification_channel_id"` } -// swagger:parameters updateAlertNotificationChannelBYUID -type UpdateAlertNotificationChannelBYUIDParam struct { +// swagger:parameters updateAlertNotificationChannelByUID +type UpdateAlertNotificationChannelBYUIDParams struct { // in:body // required:true Body models.UpdateAlertNotificationWithUidCommand `json:"body"` + // in:path + // required:true + NotificationUID string `json:"notification_channel_uid"` } // swagger:response getAlertNotificationChannelsResponse diff --git a/pkg/api/docs/definitions/legacy_alerting.go b/pkg/api/docs/definitions/legacy_alerting.go index 7ddf03fadf9..d591de78f12 100644 --- a/pkg/api/docs/definitions/legacy_alerting.go +++ b/pkg/api/docs/definitions/legacy_alerting.go @@ -58,15 +58,18 @@ import ( // 400: badRequestError // 500: internalServerError -// swagger:parameters getAlertByID pauseAlert -type AlertIDParam struct { +// swagger:parameters getAlertByID +type GetAlertByIDParams struct { // in:path // required:true AlertID string `json:"alert_id"` } // swagger:parameters pauseAlert -type PauseAlertParam struct { +type PauseAlertParams struct { + // in:path + // required:true + AlertID string `json:"alert_id"` // in:body // required:true Body dtos.PauseAlertCommand `json:"body"` @@ -122,13 +125,13 @@ type GetAlertsParams struct { } // swagger:parameters testAlert -type TestAlertParam struct { +type TestAlertParams struct { // in:body Body dtos.AlertTestCommand `json:"body"` } // swagger:parameters getDashboardStates -type GetDashboardStatesParam struct { +type GetDashboardStatesParams struct { // in:query // required: true DashboardID int64 `json:"dashboardId"` diff --git a/pkg/api/docs/definitions/library_elements.go b/pkg/api/docs/definitions/library_elements.go index 414f3683aa2..a350ff3fe36 100644 --- a/pkg/api/docs/definitions/library_elements.go +++ b/pkg/api/docs/definitions/library_elements.go @@ -97,15 +97,36 @@ import ( // 404: notFoundError // 500: internalServerError -// swagger:parameters getLibraryElementByUID getLibraryElementConnections updateLibraryElement deleteLibraryElementByUID +// swagger:parameters getLibraryElementByUID getLibraryElementConnections type LibraryElementByUID struct { // in:path // required:true UID string `json:"library_element_uid"` } +// swagger:parameters getLibraryElementByUID +type GetLibraryElementByUIDParams struct { + // in:path + // required:true + UID string `json:"library_element_uid"` +} + +// swagger:parameters GetLibraryElementConnectionsParams +type GetLibraryElementConnectionsParams struct { + // in:path + // required:true + UID string `json:"library_element_uid"` +} + +// swagger:parameters deleteLibraryElementByUID +type DeleteLibraryElementByUIDParams struct { + // in:path + // required:true + UID string `json:"library_element_uid"` +} + // swagger:parameters getLibraryElementByName -type LibraryElementByName struct { +type LibraryElementByNameParams struct { // in:path // required:true Name string `json:"library_element_name"` @@ -158,7 +179,7 @@ type GetLibraryElementsParams struct { } // swagger:parameters createLibraryElement -type CreateLibraryElementParam struct { +type CreateLibraryElementParams struct { // in:body // required:true Body libraryelements.CreateLibraryElementCommand `json:"body"` @@ -169,6 +190,9 @@ type UpdateLibraryElementParam struct { // in:body // required:true Body libraryelements.PatchLibraryElementCommand `json:"body"` + // in:path + // required:true + UID string `json:"library_element_uid"` } // swagger:response getLibraryElementsResponse diff --git a/pkg/api/docs/definitions/org.go b/pkg/api/docs/definitions/org.go index 08322dc2873..e4bf75ba95c 100644 --- a/pkg/api/docs/definitions/org.go +++ b/pkg/api/docs/definitions/org.go @@ -108,29 +108,39 @@ import ( // 403: forbiddenError // 500: internalServerError -// swagger:parameters updateOrgAddress adminUpdateOrgAddress -type UpdateOrgAddressParam struct { +// swagger:parameters updateOrgAddress +type UpdateOrgAddressParams struct { // in:body // required:true Body dtos.UpdateOrgAddressForm `json:"body"` } -// swagger:parameters updateOrgUser adminUpdateOrgUser -type UpdateOrgUserParam struct { +// swagger:parameters updateOrgUser +type UpdateOrgUserParams struct { // in:body // required:true Body models.UpdateOrgUserCommand `json:"body"` + // in:path + // required:true + UserID int64 `json:"user_id"` } -// swagger:parameters updateOrg adminUpdateOrg -type UpdateOrgParam struct { +// swagger:parameters deleteOrgUser +type DeleteOrgUserParams struct { + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters updateOrg +type UpdateOrgParams struct { // in:body // required:true Body dtos.UpdateOrgForm `json:"body"` } -// swagger:parameters addOrgUser adminAddOrgUser -type AddOrgUserParam struct { +// swagger:parameters addOrgUser +type AddOrgUserParams struct { // in:body // required:true Body models.AddOrgUserCommand `json:"body"` diff --git a/pkg/api/docs/definitions/org_invites.go b/pkg/api/docs/definitions/org_invites.go index 2d8344dc295..12d972820e0 100644 --- a/pkg/api/docs/definitions/org_invites.go +++ b/pkg/api/docs/definitions/org_invites.go @@ -39,14 +39,14 @@ import ( // 500: internalServerError // swagger:parameters addInvite -type AddInviteParam struct { +type AddInviteParams struct { // in:body // required:true Body dtos.AddInviteForm `json:"body"` } // swagger:parameters revokeInvite -type RevokeInviteParam struct { +type RevokeInviteParams struct { // in:path // required:true Code string `json:"invitation_code"` diff --git a/pkg/api/docs/definitions/org_preferences.go b/pkg/api/docs/definitions/org_preferences.go index d8b23225747..fe304b49e65 100644 --- a/pkg/api/docs/definitions/org_preferences.go +++ b/pkg/api/docs/definitions/org_preferences.go @@ -1,5 +1,7 @@ package definitions +import "github.com/grafana/grafana/pkg/api/dtos" + // swagger:route GET /org/preferences org_preferences getOrgPreferences // // Get Current Org Prefs. @@ -31,3 +33,10 @@ package definitions // 401: unauthorisedError // 403: forbiddenError // 500: internalServerError + +// swagger:parameters updateOrgPreferences +type UpdateOrgPreferencesParams struct { + // in:body + // required:true + Body dtos.UpdatePrefsCmd `json:"body"` +} diff --git a/pkg/api/docs/definitions/orgs.go b/pkg/api/docs/definitions/orgs.go index f72924fd5ba..849a21ce675 100644 --- a/pkg/api/docs/definitions/orgs.go +++ b/pkg/api/docs/definitions/orgs.go @@ -1,6 +1,9 @@ package definitions -import "github.com/grafana/grafana/pkg/models" +import ( + "github.com/grafana/grafana/pkg/api/dtos" + "github.com/grafana/grafana/pkg/models" +) // swagger:route GET /orgs/{org_id} orgs getOrgByID // @@ -183,10 +186,82 @@ import "github.com/grafana/grafana/pkg/models" // 404: notFoundError // 500: internalServerError -// swagger:parameters getOrgByID adminUpdateOrg adminUpdateOrgAddress adminDeleteOrg adminGetOrgUsers -// swagger:parameters adminAddOrgUser adminUpdateOrgUser adminDeleteOrgUser -// swagger:parameters getOrgQuota updateOrgQuota userSetUsingOrg -type OrgIDParam struct { +// swagger:parameters getOrgQuota +type GetOrgQuotaParams struct { + // in:path + // required:true + OrgID int64 `json:"org_id"` +} + +// swagger:parameters adminUpdateOrgAddress +type AdminUpdateOrgAddressParams struct { + // in:body + // required:true + Body dtos.UpdateOrgAddressForm `json:"body"` + // in:path + // required:true + OrgID int64 `json:"org_id"` +} + +// swagger:parameters adminUpdateOrgUser +type AdminUpdateOrgUserParams struct { + // in:body + // required:true + Body models.UpdateOrgUserCommand `json:"body"` + // in:path + // required:true + OrgID int64 `json:"org_id"` + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters getOrgByID +type GetOrgByIDParams struct { + // in:path + // required:true + OrgID int64 `json:"org_id"` +} + +// swagger:parameters adminDeleteOrgUser +type AdminDeleteOrgUserParams struct { + // in:path + // required:true + OrgID int64 `json:"org_id"` + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters adminDeleteOrg +type AdminDeleteOrgParams struct { + // in:path + // required:true + OrgID int64 `json:"org_id"` +} + +// swagger:parameters adminGetOrgUsers +type AdminGetOrgUsersParams struct { + // in:path + // required:true + OrgID int64 `json:"org_id"` +} + +// swagger:parameters adminUpdateOrg +type AdminUpdateOrgParams struct { + // in:body + // required:true + Body dtos.UpdateOrgForm `json:"body"` + // in:path + // required:true + OrgID int64 `json:"org_id"` +} + +// swagger:parameters adminAddOrgUser +type AdminAddOrgUserParams struct { + // in:body + // required:true + Body models.AddOrgUserCommand `json:"body"` // in:path // required:true OrgID int64 `json:"org_id"` @@ -206,7 +281,7 @@ type CreateOrgParam struct { Body models.CreateOrgCommand `json:"body"` } -// swagger:parameters searchOrg searchTeams +// swagger:parameters searchOrg type SearchOrgParams struct { // in:query // required:false @@ -229,6 +304,12 @@ type UpdateOrgQuotaParam struct { // in:body // required:true Body models.UpdateOrgQuotaCmd `json:"body"` + // in:path + // required:true + QuotaTarget string `json:"quota_target"` + // in:path + // required:true + OrgID int64 `json:"org_id"` } // swagger:response createOrgResponse diff --git a/pkg/api/docs/definitions/search.go b/pkg/api/docs/definitions/search.go index 1e3ffd29731..799880b54c9 100644 --- a/pkg/api/docs/definitions/search.go +++ b/pkg/api/docs/definitions/search.go @@ -19,7 +19,7 @@ import "github.com/grafana/grafana/pkg/models" // 500: internalServerError // swagger:parameters search -type SearchParameters struct { +type SearchParams struct { // Search Query // in:query // required: false diff --git a/pkg/api/docs/definitions/snapshot.go b/pkg/api/docs/definitions/snapshot.go index 4926595a722..95d78e1ce80 100644 --- a/pkg/api/docs/definitions/snapshot.go +++ b/pkg/api/docs/definitions/snapshot.go @@ -65,7 +65,7 @@ import ( // 401: unauthorisedError // swagger:parameters createSnapshot -type CreateSnapshotParam struct { +type CreateSnapshotParams struct { // in:body // required:true Body models.CreateDashboardSnapshotCommand `json:"body"` @@ -82,14 +82,20 @@ type GetSnapshotsParams struct { Limit int64 `json:"limit"` } -// swagger:parameters getSnapshotByKey deleteSnapshotByKey -type SnapshotByKeyParam struct { +// swagger:parameters getSnapshotByKey +type SnapshotByKeyParams struct { + // in:path + Key string `json:"key"` +} + +// swagger:parameters deleteSnapshotByKey +type DeleteSnapshotByKeyParams struct { // in:path Key string `json:"key"` } // swagger:parameters deleteSnapshotByDeleteKey -type DeleteSnapshotByDeleteKeyParam struct { +type DeleteSnapshotByDeleteKeyParams struct { // in:path DeleteKey string `json:"deleteKey"` } diff --git a/pkg/api/docs/definitions/teams.go b/pkg/api/docs/definitions/teams.go index 90b667abb2b..00e0a2f467f 100644 --- a/pkg/api/docs/definitions/teams.go +++ b/pkg/api/docs/definitions/teams.go @@ -1,6 +1,9 @@ package definitions -import "github.com/grafana/grafana/pkg/models" +import ( + "github.com/grafana/grafana/pkg/api/dtos" + "github.com/grafana/grafana/pkg/models" +) // swagger:route GET /teams/search teams searchTeams // @@ -120,33 +123,97 @@ import "github.com/grafana/grafana/pkg/models" // 401: unauthorisedError // 500: internalServerError -// swagger:parameters getTeam updateTeam deleteTeamByID getTeamMembers addTeamMember updateTeamMember -// swagger:parameters removeTeamMember getTeamPreferences updateTeamPreferences -type TeamIDParam struct { +// swagger:parameters updateTeamPreferences +type UpdateTeamPreferencesParams struct { + // in:path + // required:true + TeamID string `json:"team_id"` + // in:body + // required:true + Body dtos.UpdatePrefsCmd `json:"body"` +} + +// swagger:parameters getTeam +type GetTeamParams struct { // in:path // required:true TeamID string `json:"team_id"` } +// swagger:parameters deleteTeamByID +type DeleteTeamByIDParams struct { + // in:path + // required:true + TeamID string `json:"team_id"` +} + +// swagger:parameters getTeamMembers +type GetTeamMembersParams struct { + // in:path + // required:true + TeamID string `json:"team_id"` +} + +// swagger:parameters getTeamPreferences +type GetTeamPreferencesParams struct { + // in:path + // required:true + TeamID string `json:"team_id"` +} + +// swagger:parameters removeTeamMember +type RemoveTeamMemberParams struct { + // in:path + // required:true + TeamID string `json:"team_id"` + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters searchTeams +type SearchTeamsParams struct { + // in:query + // required:false + // default: 1 + Page int `json:"page"` + // Number of items per page + // The totalCount field in the response can be used for pagination list E.g. if totalCount is equal to 100 teams and the perpage parameter is set to 10 then there are 10 pages of teams. + // in:query + // required:false + // default: 1000 + PerPage int `json:"perpage"` + Name string `json:"name"` + // If set it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded. + // required:false + Query string `json:"query"` +} + // swagger:parameters createTeam -type CreateTeamParam struct { +type CreateTeamParams struct { // in:body // required:true Body models.CreateTeamCommand `json:"body"` } // swagger:parameters updateTeam -type UpdateTeamParam struct { +type UpdateTeamParams struct { // in:body // required:true Body models.UpdateTeamCommand `json:"body"` + // in:path + // required:true + TeamID string `json:"team_id"` } -// swagger:parameters addTeamMemberTeam -type AddTeamMemberParam struct { +// swagger:parameters addTeamMember +type AddTeamMemberParams struct { // in:body // required:true Body models.AddTeamMemberCommand `json:"body"` + // in:path + // required:true + TeamID string `json:"team_id"` } // swagger:parameters updateTeamMember @@ -154,6 +221,12 @@ type UpdateTeamMember struct { // in:body // required:true Body models.UpdateTeamMemberCommand `json:"body"` + // in:path + // required:true + TeamID string `json:"team_id"` + // in:path + // required:true + UserID int64 `json:"user_id"` } // swagger:response searchTeamsResponse diff --git a/pkg/api/docs/definitions/user.go b/pkg/api/docs/definitions/user.go index e63049908d3..9a516678d43 100644 --- a/pkg/api/docs/definitions/user.go +++ b/pkg/api/docs/definitions/user.go @@ -148,7 +148,7 @@ import "github.com/grafana/grafana/pkg/models" // 403: forbiddenError // 500: internalServerError -// swagger:route POST /user/revoke-auth-token signed_in_user revokeSignedINAuthTokenCmd +// swagger:route POST /user/revoke-auth-token signed_in_user revokeSignedInAuthToken // // Revoke an auth token of the actual User. // @@ -161,28 +161,57 @@ import "github.com/grafana/grafana/pkg/models" // 403: forbiddenError // 500: internalServerError -// swagger:parameters starDashboard unstarDashboard -type DashboardIDParam struct { +// swagger:parameters updateSignedInUser +type UpdateSignedInUserParams struct { + // To change the email, name, login, theme, provide another one. + // in:body + // required:true + Body models.UpdateUserCommand `json:"body"` +} + +// swagger:parameters userSetUsingOrg +type UserSetUsingOrgParams struct { + // in:path + // required:true + OrgID int64 `json:"org_id"` +} + +// swagger:parameters starDashboard +type StarDashboardParams struct { + // in:path + // required:true + DashboardID string `json:"dashboard_id"` +} + +// swagger:parameters unstarDashboard +type UnstarDashboardParams struct { // in:path // required:true DashboardID string `json:"dashboard_id"` } // swagger:parameters setHelpFlag -type FlagIDParam struct { +type SetHelpFlagParams struct { // in:path // required:true FlagID string `json:"flag_id"` } -// swagger:parameters updateUser changeUserPassword -type ChangeUserPasswordParam struct { +// swagger:parameters changeUserPassword +type ChangeUserPasswordParams struct { // To change the email, name, login, theme, provide another one. // in:body // required:true Body models.ChangeUserPasswordCommand `json:"body"` } +// swagger:parameters revokeSignedInAuthToken +type RevokeSignedINAuthTokenCmdParams struct { + // in:body + // required:true + Body models.RevokeAuthTokenCmd `json:"body"` +} + // swagger:response helpFlagResponse type HelpFlagResponse struct { // The response message diff --git a/pkg/api/docs/definitions/users.go b/pkg/api/docs/definitions/users.go index 28f9e22873f..a18ebe0dc89 100644 --- a/pkg/api/docs/definitions/users.go +++ b/pkg/api/docs/definitions/users.go @@ -121,33 +121,44 @@ type SearchUsersWithPagingParams struct { Query string `json:"query"` } -// swagger:parameters getUserByID updateUser getUserOrgList getUserTeams -// swagger:parameters setPassword setPermissions deleteUser getAuthTokens logoutUser revokeAuthToken -// swagger:parameters syncLDAPUser disableUser enableUser getUserQuota updateUserQuota -// swagger:parameters updateOrgUser deleteOrgUser adminUpdateOrgUser adminDeleteOrgUser -// swagger:parameters updateTeamMember removeTeamMember -// swagger:parameters listUserRoles addUserRole -// swagger:parameters listUserRoles addUserRole removeUserRole setUserRoles listUserRoles -type UserIDParam struct { +// swagger:parameters getUserByID +type GetUserByIDParams struct { + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters getUserOrgList +type GetUserOrgListParams struct { + // in:path + // required:true + UserID int64 `json:"user_id"` +} + +// swagger:parameters getUserTeams +type GetUserTeamsParams struct { // in:path // required:true UserID int64 `json:"user_id"` } // swagger:parameters getUserByLoginOrEmail -type GetUserByLoginOrEmailParam struct { +type GetUserByLoginOrEmailParams struct { // loginOrEmail of the user // in:query // required:true LoginOrEmail string `json:"loginOrEmail"` } -// swagger:parameters updateUser updateSignedInUser -type UpdateUserParam struct { +// swagger:parameters updateUser +type UpdateUserParams struct { // To change the email, name, login, theme, provide another one. // in:body // required:true Body models.UpdateUserCommand `json:"body"` + // in:path + // required:true + UserID int64 `json:"user_id"` } // swagger:response searchUsersResponse diff --git a/public/api-merged.json b/public/api-merged.json index 2671e83809f..8e606dad2ab 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -75,12 +75,6 @@ "summary": "Remove a built-in role assignment.", "operationId": "removeBuiltinRole", "parameters": [ - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, { "type": "string", "name": "builtinRole", @@ -92,6 +86,12 @@ "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.", "name": "global", "in": "query" + }, + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], "responses": { @@ -142,7 +142,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/SetUserRolesCommand" + "$ref": "#/definitions/CreateRoleWithPermissionsCommand" } } ], @@ -194,12 +194,6 @@ "summary": "Update a custom role.", "operationId": "updateRoleWithPermissions", "parameters": [ - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -207,6 +201,12 @@ "schema": { "$ref": "#/definitions/UpdateRoleCommand" } + }, + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], "responses": { @@ -346,13 +346,6 @@ "summary": "Add team role.", "operationId": "addTeamRole", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "teamId", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -360,6 +353,13 @@ "schema": { "$ref": "#/definitions/AddTeamRoleCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], "responses": { @@ -421,7 +421,7 @@ } } }, - "/access-control/users/{user_id}/roles": { + "/access-control/users/{userId}/roles": { "get": { "description": "Lists the roles that have been directly assigned to a given user. The list does not include built-in roles (Viewer, Editor, Admin or Grafana Admin), and it does not include roles that have been inherited from a team.\n\nYou need to have a permission with action `users.roles:list` and scope `users:id:\u003cuser ID\u003e`.", "tags": ["access_control", "enterprise"], @@ -431,7 +431,7 @@ { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -457,10 +457,18 @@ "summary": "Set user role assignments.", "operationId": "setUserRoles", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SetUserRolesCommand" + } + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -500,7 +508,7 @@ { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -521,29 +529,29 @@ } } }, - "/access-control/users/{user_id}/roles/{roleUID}": { + "/access-control/users/{userId}/roles/{roleUID}": { "delete": { "description": "Revoke a role from a user. For bulk updates consider Set user role assignments.\n\nYou need to have a permission with action `users.roles:remove` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only unassign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to unassign a role which will allow to do that. This is done to prevent escalation of privileges.", "tags": ["access_control", "enterprise"], "summary": "Remove a user role assignment.", "operationId": "removeUserRole", "parameters": [ - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, { "type": "boolean", "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.", "name": "global", "in": "query" }, + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -1333,6 +1341,13 @@ "in": "path", "required": true }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + }, { "name": "body", "in": "body", @@ -1340,13 +1355,6 @@ "schema": { "$ref": "#/definitions/UpdateUserQuotaCmd" } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { @@ -1569,14 +1577,8 @@ "description": "Updates an existing notification channel identified by uid.", "tags": ["legacy_alerts_notification_channels"], "summary": "Update notification channel by UID.", - "operationId": "updateAlertNotificationChannelBYUID", + "operationId": "updateAlertNotificationChannelByUID", "parameters": [ - { - "type": "string", - "name": "notification_channel_uid", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -1584,6 +1586,12 @@ "schema": { "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" } + }, + { + "type": "string", + "name": "notification_channel_uid", + "in": "path", + "required": true } ], "responses": { @@ -1675,13 +1683,6 @@ "summary": "Update notification channel by ID.", "operationId": "updateAlertNotificationChannel", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "notification_channel_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -1689,6 +1690,13 @@ "schema": { "$ref": "#/definitions/UpdateAlertNotificationCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "notification_channel_id", + "in": "path", + "required": true } ], "responses": { @@ -2946,12 +2954,6 @@ "summary": "Updates permissions for a dashboard.", "operationId": "postDashboardPermissionsWithUid", "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - }, { "name": "Body", "in": "body", @@ -2959,6 +2961,12 @@ "schema": { "$ref": "#/definitions/UpdateDashboardAclCommand" } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { @@ -3268,13 +3276,13 @@ "parameters": [ { "type": "string", - "name": "uid", + "name": "datasource_proxy_route", "in": "path", "required": true }, { "type": "string", - "name": "datasource_proxy_route", + "name": "uid", "in": "path", "required": true } @@ -3306,15 +3314,23 @@ "summary": "Data source proxy POST calls.", "operationId": "datasourceProxyPOSTByUIDcalls", "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": { + "type": "object" + } + }, { "type": "string", - "name": "uid", + "name": "datasource_proxy_route", "in": "path", "required": true }, { "type": "string", - "name": "datasource_proxy_route", + "name": "uid", "in": "path", "required": true } @@ -3394,13 +3410,13 @@ "parameters": [ { "type": "string", - "name": "id", + "name": "datasource_proxy_route", "in": "path", "required": true }, { "type": "string", - "name": "datasource_proxy_route", + "name": "id", "in": "path", "required": true } @@ -3434,10 +3450,12 @@ "deprecated": true, "parameters": [ { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": { + "type": "object" + } }, { "type": "string", @@ -3446,12 +3464,10 @@ "required": true }, { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": { - "type": "object" - } + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { @@ -3561,12 +3577,6 @@ "summary": "Update an existing data source.", "operationId": "updateDatasourceByUID", "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - }, { "name": "Body", "in": "body", @@ -3574,6 +3584,12 @@ "schema": { "$ref": "#/definitions/UpdateDataSourceCommand" } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { @@ -3883,12 +3899,6 @@ "operationId": "updateDatasourceByID", "deprecated": true, "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - }, { "name": "Body", "in": "body", @@ -3896,6 +3906,12 @@ "schema": { "$ref": "#/definitions/UpdateDataSourceCommand" } + }, + { + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { @@ -4324,6 +4340,12 @@ "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", "operationId": "updateFolderPermissions", "parameters": [ + { + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + }, { "name": "Body", "in": "body", @@ -4331,12 +4353,6 @@ "schema": { "$ref": "#/definitions/UpdateDashboardAclCommand" } - }, - { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true } ], "responses": { @@ -4569,12 +4585,6 @@ "summary": "Update library element.", "operationId": "updateLibraryElement", "parameters": [ - { - "type": "string", - "name": "library_element_uid", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -4582,6 +4592,12 @@ "schema": { "$ref": "#/definitions/PatchLibraryElementCommand" } + }, + { + "type": "string", + "name": "library_element_uid", + "in": "path", + "required": true } ], "responses": { @@ -5588,6 +5604,14 @@ "summary": "Update user quota.", "operationId": "updateOrgQuota", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgQuotaCmd" + } + }, { "type": "string", "name": "quota_target", @@ -5600,14 +5624,6 @@ "name": "org_id", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgQuotaCmd" - } } ], "responses": { @@ -6572,13 +6588,6 @@ "summary": "Update a report.", "operationId": "updateReport", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "reportID", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -6586,6 +6595,13 @@ "schema": { "$ref": "#/definitions/CreateOrUpdateConfigCmd" } + }, + { + "type": "integer", + "format": "int64", + "name": "reportID", + "in": "path", + "required": true } ], "responses": { @@ -7135,14 +7151,14 @@ { "type": "integer", "format": "int64", - "name": "groupId", + "name": "teamId", "in": "path", "required": true }, { "type": "integer", "format": "int64", - "name": "teamId", + "name": "groupId", "in": "path", "required": true } @@ -7205,12 +7221,6 @@ "summary": "Update Team.", "operationId": "updateTeam", "parameters": [ - { - "type": "string", - "name": "team_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -7218,6 +7228,12 @@ "schema": { "$ref": "#/definitions/UpdateTeamCommand" } + }, + { + "type": "string", + "name": "team_id", + "in": "path", + "required": true } ], "responses": { @@ -7308,6 +7324,14 @@ "summary": "Add Team Member.", "operationId": "addTeamMember", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddTeamMemberCommand" + } + }, { "type": "string", "name": "team_id", @@ -7340,12 +7364,6 @@ "summary": "Update Team Member.", "operationId": "updateTeamMember", "parameters": [ - { - "type": "string", - "name": "team_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -7354,6 +7372,12 @@ "$ref": "#/definitions/UpdateTeamMemberCommand" } }, + { + "type": "string", + "name": "team_id", + "in": "path", + "required": true + }, { "type": "integer", "format": "int64", @@ -7779,7 +7803,7 @@ "description": "Revokes the given auth token (device) for the actual user. User of issued auth token (device) will no longer be logged in and will be required to authenticate again upon next activity.", "tags": ["signed_in_user"], "summary": "Revoke an auth token of the actual User.", - "operationId": "revokeSignedINAuthTokenCmd", + "operationId": "revokeSignedInAuthToken", "parameters": [ { "name": "body", @@ -8064,13 +8088,6 @@ "summary": "Update user.", "operationId": "updateUser", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - }, { "description": "To change the email, name, login, theme, provide another one.", "name": "body", @@ -8079,6 +8096,13 @@ "schema": { "$ref": "#/definitions/UpdateUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { @@ -8167,6 +8191,541 @@ } } } + }, + "/v1/provisioning/alert-rules": { + "post": { + "consumes": ["application/json"], + "tags": ["provisioning"], + "summary": "Create a new alert rule.", + "operationId": "RoutePostAlertRule", + "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/AlertRule" + } + } + ], + "responses": { + "201": { + "description": "AlertRule", + "schema": { + "$ref": "#/definitions/AlertRule" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/v1/provisioning/alert-rules/{UID}": { + "get": { + "tags": ["provisioning"], + "summary": "Get a specific alert rule by UID.", + "operationId": "RouteGetAlertRule", + "parameters": [ + { + "type": "string", + "description": "Alert rule UID", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "AlertRule", + "schema": { + "$ref": "#/definitions/AlertRule" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": ["application/json"], + "tags": ["provisioning"], + "summary": "Update an existing alert rule.", + "operationId": "RoutePutAlertRule", + "parameters": [ + { + "type": "string", + "description": "Alert rule UID", + "name": "UID", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/AlertRule" + } + } + ], + "responses": { + "200": { + "description": "AlertRule", + "schema": { + "$ref": "#/definitions/AlertRule" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": ["provisioning"], + "summary": "Delete a specific alert rule by UID.", + "operationId": "RouteDeleteAlertRule", + "parameters": [ + { + "type": "string", + "description": "Alert rule UID", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The alert rule was deleted successfully." + } + } + } + }, + "/v1/provisioning/contact-points": { + "get": { + "tags": ["provisioning"], + "summary": "Get all the contact points.", + "operationId": "RouteGetContactpoints", + "responses": { + "200": { + "description": "ContactPoints", + "schema": { + "$ref": "#/definitions/ContactPoints" + } + } + } + }, + "post": { + "consumes": ["application/json"], + "tags": ["provisioning"], + "summary": "Create a contact point.", + "operationId": "RoutePostContactpoints", + "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } + } + ], + "responses": { + "202": { + "description": "EmbeddedContactPoint", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/v1/provisioning/contact-points/{UID}": { + "put": { + "consumes": ["application/json"], + "tags": ["provisioning"], + "summary": "Update an existing contact point.", + "operationId": "RoutePutContactpoint", + "parameters": [ + { + "type": "string", + "description": "UID is the contact point unique identifier", + "name": "UID", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } + } + ], + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "consumes": ["application/json"], + "tags": ["provisioning"], + "summary": "Delete a contact point.", + "operationId": "RouteDeleteContactpoints", + "parameters": [ + { + "type": "string", + "description": "UID is the contact point unique identifier", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The contact point was deleted successfully." + } + } + } + }, + "/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": { + "put": { + "consumes": ["application/json"], + "tags": ["provisioning"], + "summary": "Update the interval of a rule group.", + "operationId": "RoutePutAlertRuleGroup", + "parameters": [ + { + "type": "string", + "name": "FolderUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "Group", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } + } + ], + "responses": { + "200": { + "description": "AlertRuleGroup", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/v1/provisioning/mute-timings": { + "get": { + "tags": ["provisioning"], + "summary": "Get all the mute timings.", + "operationId": "RouteGetMuteTimings", + "responses": { + "200": { + "description": "MuteTimings", + "schema": { + "$ref": "#/definitions/MuteTimings" + } + } + } + }, + "post": { + "consumes": ["application/json"], + "tags": ["provisioning"], + "summary": "Create a new mute timing.", + "operationId": "RoutePostMuteTiming", + "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + } + ], + "responses": { + "201": { + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/v1/provisioning/mute-timings/{name}": { + "get": { + "tags": ["provisioning"], + "summary": "Get a mute timing.", + "operationId": "RouteGetMuteTiming", + "parameters": [ + { + "type": "string", + "x-go-name": "Name", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": ["application/json"], + "tags": ["provisioning"], + "summary": "Replace an existing mute timing.", + "operationId": "RoutePutMuteTiming", + "parameters": [ + { + "type": "string", + "x-go-name": "Name", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + } + ], + "responses": { + "200": { + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": ["provisioning"], + "summary": "Delete a mute timing.", + "operationId": "RouteDeleteMuteTiming", + "parameters": [ + { + "type": "string", + "x-go-name": "Name", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The mute timing was deleted successfully." + } + } + } + }, + "/v1/provisioning/policies": { + "get": { + "tags": ["provisioning"], + "summary": "Get the notification policy tree.", + "operationId": "RouteGetPolicyTree", + "responses": { + "200": { + "description": "Route", + "schema": { + "$ref": "#/definitions/Route" + } + } + } + }, + "put": { + "consumes": ["application/json"], + "tags": ["provisioning"], + "summary": "Sets the notification policy tree.", + "operationId": "RoutePutPolicyTree", + "parameters": [ + { + "description": "The new notification routing tree to use", + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/Route" + } + } + ], + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/v1/provisioning/templates": { + "get": { + "tags": ["provisioning"], + "summary": "Get all message templates.", + "operationId": "RouteGetTemplates", + "responses": { + "200": { + "description": "MessageTemplates", + "schema": { + "$ref": "#/definitions/MessageTemplates" + } + }, + "404": { + "description": " Not found." + } + } + } + }, + "/v1/provisioning/templates/{name}": { + "get": { + "tags": ["provisioning"], + "summary": "Get a message template.", + "operationId": "RouteGetTemplate", + "parameters": [ + { + "type": "string", + "x-go-name": "Name", + "description": "Template Name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "MessageTemplate", + "schema": { + "$ref": "#/definitions/MessageTemplate" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": ["application/json"], + "tags": ["provisioning"], + "summary": "Updates an existing template.", + "operationId": "RoutePutTemplate", + "parameters": [ + { + "type": "string", + "x-go-name": "Name", + "description": "Template Name", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MessageTemplateContent" + } + } + ], + "responses": { + "202": { + "description": "MessageTemplate", + "schema": { + "$ref": "#/definitions/MessageTemplate" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": ["provisioning"], + "summary": "Delete a template.", + "operationId": "RouteDeleteTemplate", + "parameters": [ + { + "type": "string", + "x-go-name": "Name", + "description": "Template Name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The template was deleted successfully." + } + } + } } }, "definitions": { @@ -8795,6 +9354,167 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" }, + "AlertRule": { + "type": "object", + "required": [ + "orgID", + "folderUID", + "ruleGroup", + "title", + "condition", + "data", + "noDataState", + "execErrState", + "for" + ], + "properties": { + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-go-name": "Annotations", + "example": { + "runbook_url": "https://supercoolrunbook.com/page/13" + } + }, + "condition": { + "type": "string", + "x-go-name": "Condition", + "example": "A" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/AlertQuery" + }, + "x-go-name": "Data", + "example": [ + { + "datasourceUid": "-100", + "model": { + "conditions": [ + { + "evaluator": { + "params": [0, 0], + "type": "gt" + }, + "operator": { + "type": "and" + }, + "query": { + "params": null + }, + "reducer": { + "params": null, + "type": "avg" + }, + "type": "query" + } + ], + "datasource": { + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "1 == 1", + "hide": false, + "intervalMs": 1000, + "maxDataPoints": 43200, + "refId": "A", + "type": "math" + }, + "queryType": "", + "refId": "A", + "relativeTimeRange": { + "from": 0, + "to": 0 + } + } + ] + }, + "execErrState": { + "description": "\nAlerting AlertingErrState\nError ErrorErrState\nOK OkErrState", + "type": "string", + "enum": ["Alerting", "Error", "OK"], + "x-go-enum-desc": "Alerting AlertingErrState\nError ErrorErrState\nOK OkErrState", + "x-go-name": "ExecErrState" + }, + "folderUID": { + "type": "string", + "x-go-name": "FolderUID", + "example": "project_x" + }, + "for": { + "$ref": "#/definitions/Duration" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-go-name": "Labels", + "example": { + "team": "sre-team-1" + } + }, + "noDataState": { + "description": "\nAlerting Alerting\nNoData NoData\nOK OK", + "type": "string", + "enum": ["Alerting", "NoData", "OK"], + "x-go-enum-desc": "Alerting Alerting\nNoData NoData\nOK OK", + "x-go-name": "NoDataState" + }, + "orgID": { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID" + }, + "provenance": { + "$ref": "#/definitions/Provenance" + }, + "ruleGroup": { + "type": "string", + "maxLength": 190, + "minLength": 1, + "x-go-name": "RuleGroup", + "example": "eval_group_1" + }, + "title": { + "type": "string", + "maxLength": 190, + "minLength": 1, + "x-go-name": "Title", + "example": "Always firing" + }, + "uid": { + "type": "string", + "x-go-name": "UID" + }, + "updated": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated", + "readOnly": true + } + }, + "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" + }, + "AlertRuleGroup": { + "type": "object", + "properties": { + "interval": { + "type": "integer", + "format": "int64", + "x-go-name": "Interval" + } + }, + "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" + }, "AlertStateInfoDTO": { "type": "object", "properties": { @@ -9220,6 +9940,13 @@ } } }, + "ContactPoints": { + "type": "array", + "items": { + "$ref": "#/definitions/EmbeddedContactPoint" + }, + "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" + }, "CreateAlertNotificationCommand": { "type": "object", "properties": { @@ -9696,6 +10423,9 @@ "provisionedExternalId": { "type": "string" }, + "publicDashboardUid": { + "type": "string" + }, "slug": { "type": "string" }, @@ -10216,31 +10946,57 @@ "EmbeddedContactPoint": { "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation.", "type": "object", + "required": ["type", "settings"], "properties": { "disableResolveMessage": { "type": "boolean", - "x-go-name": "DisableResolveMessage" + "x-go-name": "DisableResolveMessage", + "example": false }, "name": { "description": "Name is used as grouping key in the UI. Contact points with the\nsame name will be grouped in the UI.", "type": "string", - "x-go-name": "Name" + "x-go-name": "Name", + "example": "webhook_1" }, "provenance": { "type": "string", - "x-go-name": "Provenance" + "x-go-name": "Provenance", + "readOnly": true }, "settings": { "$ref": "#/definitions/Json" }, "type": { "type": "string", - "x-go-name": "Type" + "enum": [ + "alertmanager", + " dingding", + " discord", + " email", + " googlechat", + " kafka", + " line", + " opsgenie", + " pagerduty", + " pushover", + " sensugo", + " slack", + " teams", + " telegram", + " threema", + " victorops", + " webhook", + " wecom" + ], + "x-go-name": "Type", + "example": "webhook" }, "uid": { - "description": "UID is the unique identifier of the contact point. This will be\nautomatically set be the Grafana.", + "description": "UID is the unique identifier of the contact point. The UID can be\nset by the user.", "type": "string", - "x-go-name": "UID" + "x-go-name": "UID", + "example": "my_external_reference" } }, "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" @@ -10707,6 +11463,13 @@ }, "x-go-name": "InhibitRules" }, + "muteTimeProvenances": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/Provenance" + }, + "x-go-name": "MuteTimeProvenances" + }, "mute_time_intervals": { "type": "array", "items": { @@ -11780,14 +12543,16 @@ "MessageTemplate": { "type": "object", "properties": { - "Name": { - "type": "string" - }, - "Template": { - "type": "string" + "name": { + "type": "string", + "x-go-name": "Name" }, "provenance": { "$ref": "#/definitions/Provenance" + }, + "template": { + "type": "string", + "x-go-name": "Template" } }, "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" @@ -11795,8 +12560,9 @@ "MessageTemplateContent": { "type": "object", "properties": { - "Template": { - "type": "string" + "template": { + "type": "string", + "x-go-name": "Template" } }, "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" @@ -14692,9 +15458,8 @@ "type": "string" }, "URL": { - "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use RawPath, an optional field which only gets\nset if the default encoding is different from Path.\n\nURL's String method uses the EscapedPath method to obtain the path. See the\nEscapedPath method for more details.", "type": "object", - "title": "A URL represents a parsed URL (technically, a URI reference).", + "title": "URL is a custom URL type that allows validation at configuration load time.", "properties": { "ForceQuery": { "type": "boolean" @@ -14727,7 +15492,7 @@ "$ref": "#/definitions/Userinfo" } }, - "x-go-package": "net/url" + "x-go-package": "github.com/prometheus/common/config" }, "UpdateAlertNotificationCommand": { "type": "object", @@ -15300,7 +16065,8 @@ "properties": { "msg": { "type": "string", - "x-go-name": "Msg" + "x-go-name": "Msg", + "example": "error message" } }, "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" @@ -15627,7 +16393,6 @@ "$ref": "#/definitions/Duration" }, "gettableAlert": { - "description": "GettableAlert gettable alert", "type": "object", "required": ["labels", "annotations", "endsAt", "fingerprint", "receivers", "startsAt", "status", "updatedAt"], "properties": { @@ -15677,16 +16442,20 @@ "format": "date-time", "x-go-name": "UpdatedAt" } - } + }, + "x-go-name": "GettableAlert", + "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" }, "gettableAlerts": { - "description": "GettableAlerts gettable alerts", "type": "array", "items": { "$ref": "#/definitions/gettableAlert" - } + }, + "x-go-name": "GettableAlerts", + "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" }, "gettableSilence": { + "description": "GettableSilence gettable silence", "type": "object", "required": ["comment", "createdBy", "endsAt", "matchers", "startsAt", "id", "status", "updatedAt"], "properties": { @@ -15729,17 +16498,14 @@ "format": "date-time", "x-go-name": "UpdatedAt" } - }, - "x-go-name": "GettableSilence", - "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" + } }, "gettableSilences": { + "description": "GettableSilences gettable silences", "type": "array", "items": { "$ref": "#/definitions/gettableSilence" - }, - "x-go-name": "GettableSilences", - "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" + } }, "labelSet": { "description": "LabelSet label set", @@ -15859,7 +16625,6 @@ "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" }, "postableSilence": { - "description": "PostableSilence postable silence", "type": "object", "required": ["comment", "createdBy", "endsAt", "matchers", "startsAt"], "properties": { @@ -15893,10 +16658,11 @@ "format": "date-time", "x-go-name": "StartsAt" } - } + }, + "x-go-name": "PostableSilence", + "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" }, "receiver": { - "description": "Receiver receiver", "type": "object", "required": ["name"], "properties": { @@ -15905,7 +16671,9 @@ "type": "string", "x-go-name": "Name" } - } + }, + "x-go-name": "Receiver", + "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" }, "silence": { "description": "Silence silence", diff --git a/public/api-spec.json b/public/api-spec.json index 7024b925234..75df54dec92 100644 --- a/public/api-spec.json +++ b/public/api-spec.json @@ -75,12 +75,6 @@ "summary": "Remove a built-in role assignment.", "operationId": "removeBuiltinRole", "parameters": [ - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, { "type": "string", "name": "builtinRole", @@ -92,6 +86,12 @@ "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.", "name": "global", "in": "query" + }, + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], "responses": { @@ -142,7 +142,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/SetUserRolesCommand" + "$ref": "#/definitions/CreateRoleWithPermissionsCommand" } } ], @@ -194,12 +194,6 @@ "summary": "Update a custom role.", "operationId": "updateRoleWithPermissions", "parameters": [ - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -207,6 +201,12 @@ "schema": { "$ref": "#/definitions/UpdateRoleCommand" } + }, + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], "responses": { @@ -346,13 +346,6 @@ "summary": "Add team role.", "operationId": "addTeamRole", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "teamId", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -360,6 +353,13 @@ "schema": { "$ref": "#/definitions/AddTeamRoleCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], "responses": { @@ -421,7 +421,7 @@ } } }, - "/access-control/users/{user_id}/roles": { + "/access-control/users/{userId}/roles": { "get": { "description": "Lists the roles that have been directly assigned to a given user. The list does not include built-in roles (Viewer, Editor, Admin or Grafana Admin), and it does not include roles that have been inherited from a team.\n\nYou need to have a permission with action `users.roles:list` and scope `users:id:\u003cuser ID\u003e`.", "tags": ["access_control", "enterprise"], @@ -431,7 +431,7 @@ { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -457,10 +457,18 @@ "summary": "Set user role assignments.", "operationId": "setUserRoles", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SetUserRolesCommand" + } + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -500,7 +508,7 @@ { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -521,29 +529,29 @@ } } }, - "/access-control/users/{user_id}/roles/{roleUID}": { + "/access-control/users/{userId}/roles/{roleUID}": { "delete": { "description": "Revoke a role from a user. For bulk updates consider Set user role assignments.\n\nYou need to have a permission with action `users.roles:remove` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only unassign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to unassign a role which will allow to do that. This is done to prevent escalation of privileges.", "tags": ["access_control", "enterprise"], "summary": "Remove a user role assignment.", "operationId": "removeUserRole", "parameters": [ - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, { "type": "boolean", "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.", "name": "global", "in": "query" }, + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -1333,6 +1341,13 @@ "in": "path", "required": true }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + }, { "name": "body", "in": "body", @@ -1340,13 +1355,6 @@ "schema": { "$ref": "#/definitions/UpdateUserQuotaCmd" } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { @@ -1569,14 +1577,8 @@ "description": "Updates an existing notification channel identified by uid.", "tags": ["legacy_alerts_notification_channels"], "summary": "Update notification channel by UID.", - "operationId": "updateAlertNotificationChannelBYUID", + "operationId": "updateAlertNotificationChannelByUID", "parameters": [ - { - "type": "string", - "name": "notification_channel_uid", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -1584,6 +1586,12 @@ "schema": { "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" } + }, + { + "type": "string", + "name": "notification_channel_uid", + "in": "path", + "required": true } ], "responses": { @@ -1675,13 +1683,6 @@ "summary": "Update notification channel by ID.", "operationId": "updateAlertNotificationChannel", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "notification_channel_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -1689,6 +1690,13 @@ "schema": { "$ref": "#/definitions/UpdateAlertNotificationCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "notification_channel_id", + "in": "path", + "required": true } ], "responses": { @@ -2946,12 +2954,6 @@ "summary": "Updates permissions for a dashboard.", "operationId": "postDashboardPermissionsWithUid", "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - }, { "name": "Body", "in": "body", @@ -2959,6 +2961,12 @@ "schema": { "$ref": "#/definitions/UpdateDashboardAclCommand" } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { @@ -3268,13 +3276,13 @@ "parameters": [ { "type": "string", - "name": "uid", + "name": "datasource_proxy_route", "in": "path", "required": true }, { "type": "string", - "name": "datasource_proxy_route", + "name": "uid", "in": "path", "required": true } @@ -3306,15 +3314,23 @@ "summary": "Data source proxy POST calls.", "operationId": "datasourceProxyPOSTByUIDcalls", "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": { + "type": "object" + } + }, { "type": "string", - "name": "uid", + "name": "datasource_proxy_route", "in": "path", "required": true }, { "type": "string", - "name": "datasource_proxy_route", + "name": "uid", "in": "path", "required": true } @@ -3394,13 +3410,13 @@ "parameters": [ { "type": "string", - "name": "id", + "name": "datasource_proxy_route", "in": "path", "required": true }, { "type": "string", - "name": "datasource_proxy_route", + "name": "id", "in": "path", "required": true } @@ -3434,10 +3450,12 @@ "deprecated": true, "parameters": [ { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": { + "type": "object" + } }, { "type": "string", @@ -3446,12 +3464,10 @@ "required": true }, { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": { - "type": "object" - } + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { @@ -3561,12 +3577,6 @@ "summary": "Update an existing data source.", "operationId": "updateDatasourceByUID", "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - }, { "name": "Body", "in": "body", @@ -3574,6 +3584,12 @@ "schema": { "$ref": "#/definitions/UpdateDataSourceCommand" } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { @@ -3883,12 +3899,6 @@ "operationId": "updateDatasourceByID", "deprecated": true, "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - }, { "name": "Body", "in": "body", @@ -3896,6 +3906,12 @@ "schema": { "$ref": "#/definitions/UpdateDataSourceCommand" } + }, + { + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { @@ -4324,6 +4340,12 @@ "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", "operationId": "updateFolderPermissions", "parameters": [ + { + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + }, { "name": "Body", "in": "body", @@ -4331,12 +4353,6 @@ "schema": { "$ref": "#/definitions/UpdateDashboardAclCommand" } - }, - { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true } ], "responses": { @@ -4569,12 +4585,6 @@ "summary": "Update library element.", "operationId": "updateLibraryElement", "parameters": [ - { - "type": "string", - "name": "library_element_uid", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -4582,6 +4592,12 @@ "schema": { "$ref": "#/definitions/PatchLibraryElementCommand" } + }, + { + "type": "string", + "name": "library_element_uid", + "in": "path", + "required": true } ], "responses": { @@ -5588,6 +5604,14 @@ "summary": "Update user quota.", "operationId": "updateOrgQuota", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgQuotaCmd" + } + }, { "type": "string", "name": "quota_target", @@ -5600,14 +5624,6 @@ "name": "org_id", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgQuotaCmd" - } } ], "responses": { @@ -6572,13 +6588,6 @@ "summary": "Update a report.", "operationId": "updateReport", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "reportID", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -6586,6 +6595,13 @@ "schema": { "$ref": "#/definitions/CreateOrUpdateConfigCmd" } + }, + { + "type": "integer", + "format": "int64", + "name": "reportID", + "in": "path", + "required": true } ], "responses": { @@ -7135,14 +7151,14 @@ { "type": "integer", "format": "int64", - "name": "groupId", + "name": "teamId", "in": "path", "required": true }, { "type": "integer", "format": "int64", - "name": "teamId", + "name": "groupId", "in": "path", "required": true } @@ -7205,12 +7221,6 @@ "summary": "Update Team.", "operationId": "updateTeam", "parameters": [ - { - "type": "string", - "name": "team_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -7218,6 +7228,12 @@ "schema": { "$ref": "#/definitions/UpdateTeamCommand" } + }, + { + "type": "string", + "name": "team_id", + "in": "path", + "required": true } ], "responses": { @@ -7308,6 +7324,14 @@ "summary": "Add Team Member.", "operationId": "addTeamMember", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddTeamMemberCommand" + } + }, { "type": "string", "name": "team_id", @@ -7340,12 +7364,6 @@ "summary": "Update Team Member.", "operationId": "updateTeamMember", "parameters": [ - { - "type": "string", - "name": "team_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -7354,6 +7372,12 @@ "$ref": "#/definitions/UpdateTeamMemberCommand" } }, + { + "type": "string", + "name": "team_id", + "in": "path", + "required": true + }, { "type": "integer", "format": "int64", @@ -7779,7 +7803,7 @@ "description": "Revokes the given auth token (device) for the actual user. User of issued auth token (device) will no longer be logged in and will be required to authenticate again upon next activity.", "tags": ["signed_in_user"], "summary": "Revoke an auth token of the actual User.", - "operationId": "revokeSignedINAuthTokenCmd", + "operationId": "revokeSignedInAuthToken", "parameters": [ { "name": "body", @@ -8064,13 +8088,6 @@ "summary": "Update user.", "operationId": "updateUser", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - }, { "description": "To change the email, name, login, theme, provide another one.", "name": "body", @@ -8079,6 +8096,13 @@ "schema": { "$ref": "#/definitions/UpdateUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { @@ -9441,6 +9465,9 @@ "provisionedExternalId": { "type": "string" }, + "publicDashboardUid": { + "type": "string" + }, "slug": { "type": "string" },