* API: Using go-swagger for extracting OpenAPI specification from source code
* Merge Grafana Alerting spec
* Include enterprise endpoints (if enabled)
* Serve SwaggerUI under feature flag
* Fix building dev docker images
* Configure swaggerUI
* Add missing json tags
Co-authored-by: Ying WANG <ying.wang@grafana.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
(cherry picked from commit 35fe58de37)
This commit is contained in:
committed by
GitHub
parent
c6a58003d1
commit
08ad99c36e
@@ -0,0 +1,190 @@
|
||||
package definitions
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/services/libraryelements"
|
||||
)
|
||||
|
||||
// swagger:route GET /library-elements library_elements getLibraryElements
|
||||
//
|
||||
// Get all library elements.
|
||||
//
|
||||
// Returns a list of all library elements the authenticated user has permission to view.
|
||||
// Use the `perPage` query parameter to control the maximum number of library elements returned; the default limit is `100`.
|
||||
// You can also use the `page` query parameter to fetch library elements from any page other than the first one.
|
||||
//
|
||||
// Responses:
|
||||
// 200: getLibraryElementsResponse
|
||||
// 401: unauthorisedError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:route GET /library-elements/{library_element_uid} library_elements getLibraryElementByUID
|
||||
//
|
||||
// Get library element by UID.
|
||||
//
|
||||
// Returns a library element with the given UID.
|
||||
//
|
||||
// Responses:
|
||||
// 200: getLibraryElementResponse
|
||||
// 401: unauthorisedError
|
||||
// 404: notFoundError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:route GET /library-elements/name/{library_element_name} library_elements getLibraryElementByName
|
||||
//
|
||||
// Get library element by name.
|
||||
//
|
||||
// Returns a library element with the given name.
|
||||
//
|
||||
// Responses:
|
||||
// 200: getLibraryElementResponse
|
||||
// 401: unauthorisedError
|
||||
// 404: notFoundError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:route GET /library-elements/{library_element_uid}/connections/ library_elements getLibraryElementConnections
|
||||
//
|
||||
// Get library element connections.
|
||||
//
|
||||
// Returns a list of connections for a library element based on the UID specified.
|
||||
//
|
||||
// Responses:
|
||||
// 200: getLibraryElementConnectionsResponse
|
||||
// 401: unauthorisedError
|
||||
// 404: notFoundError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:route POST /library-elements library_elements createLibraryElement
|
||||
//
|
||||
// Create library element.
|
||||
//
|
||||
// Creates a new library element.
|
||||
//
|
||||
// Responses:
|
||||
// 200: getLibraryElementResponse
|
||||
// 400: badRequestError
|
||||
// 401: unauthorisedError
|
||||
// 403: forbiddenError
|
||||
// 404: notFoundError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:route PATCH /library-elements/{library_element_uid} library_elements updateLibraryElement
|
||||
//
|
||||
// Update library element.
|
||||
//
|
||||
// Updates an existing library element identified by uid.
|
||||
//
|
||||
// Responses:
|
||||
// 200: getLibraryElementResponse
|
||||
// 400: badRequestError
|
||||
// 401: unauthorisedError
|
||||
// 403: forbiddenError
|
||||
// 404: notFoundError
|
||||
// 412: preconditionFailedError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:route DELETE /library-elements/{library_element_uid} library_elements deleteLibraryElementByUID
|
||||
//
|
||||
// Delete library element.
|
||||
//
|
||||
// Deletes an existing library element as specified by the UID. This operation cannot be reverted.
|
||||
// You cannot delete a library element that is connected. This operation cannot be reverted.
|
||||
//
|
||||
// Responses:
|
||||
// 200: okResponse
|
||||
// 400: badRequestError
|
||||
// 401: unauthorisedError
|
||||
// 403: forbiddenError
|
||||
// 404: notFoundError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:parameters getLibraryElementByUID getLibraryElementConnections updateLibraryElement deleteLibraryElementByUID
|
||||
type LibraryElementByUID struct {
|
||||
// in:path
|
||||
// required:true
|
||||
UID string `json:"library_element_uid"`
|
||||
}
|
||||
|
||||
// swagger:parameters getLibraryElementByName
|
||||
type LibraryElementByName struct {
|
||||
// in:path
|
||||
// required:true
|
||||
Name string `json:"library_element_name"`
|
||||
}
|
||||
|
||||
// swagger:parameters getLibraryElements
|
||||
type GetLibraryElementsParams struct {
|
||||
// Part of the name or description searched for.
|
||||
// in:query
|
||||
// required:false
|
||||
SearchString string `json:"searchString"`
|
||||
// Kind of element to search for.
|
||||
// in:query
|
||||
// required:false
|
||||
// Description:
|
||||
// * 1 - library panels
|
||||
// * 2 - library variables
|
||||
// enum: 1,2
|
||||
Kind int `json:"kind"`
|
||||
// Sort order of elements.
|
||||
// in:query
|
||||
// required:false
|
||||
// Description:
|
||||
// * alpha-asc: ascending
|
||||
// * alpha-desc: descending
|
||||
// Enum: alpha-asc,alpha-desc
|
||||
SortDirection string `json:"sortDirection"`
|
||||
// A comma separated list of types to filter the elements by
|
||||
// in:query
|
||||
// required:false
|
||||
TypeFilter string `json:"typeFilter"`
|
||||
// Element UID to exclude from search results.
|
||||
// in:query
|
||||
// required:false
|
||||
ExcludeUID string `json:"excludeUid"`
|
||||
// A comma separated list of folder ID(s) to filter the elements by.
|
||||
// in:query
|
||||
// required:false
|
||||
FolderFilter string `json:"folderFilter"`
|
||||
// The number of results per page.
|
||||
// in:query
|
||||
// required:false
|
||||
// default: 100
|
||||
PerPage int `json:"perPage"`
|
||||
// The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.
|
||||
// in:query
|
||||
// required:false
|
||||
// default: 1
|
||||
Page int `json:"page"`
|
||||
}
|
||||
|
||||
// swagger:parameters createLibraryElement
|
||||
type CreateLibraryElementParam struct {
|
||||
// in:body
|
||||
// required:true
|
||||
Body libraryelements.CreateLibraryElementCommand `json:"body"`
|
||||
}
|
||||
|
||||
// swagger:parameters updateLibraryElement
|
||||
type UpdateLibraryElementParam struct {
|
||||
// in:body
|
||||
// required:true
|
||||
Body libraryelements.PatchLibraryElementCommand `json:"body"`
|
||||
}
|
||||
|
||||
// swagger:response getLibraryElementsResponse
|
||||
type GetLibraryElementsResponse struct {
|
||||
// in: body
|
||||
Body libraryelements.LibraryElementSearchResponse `json:"body"`
|
||||
}
|
||||
|
||||
// swagger:response getLibraryElementResponse
|
||||
type GetLibraryElementResponse struct {
|
||||
// in: body
|
||||
Body libraryelements.LibraryElementResponse `json:"body"`
|
||||
}
|
||||
|
||||
// swagger:response getLibraryElementConnectionsResponse
|
||||
type GetLibraryElementConnectionsResponse struct {
|
||||
// in: body
|
||||
Body libraryelements.LibraryElementConnectionsResponse `json:"body"`
|
||||
}
|
||||
Reference in New Issue
Block a user