mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
cms: clean up model file (#87179)
* move CreateAccessTokenResponseDTO to api.go * remove unused types * run make swagger-clean && make openapi3-gen
This commit is contained in:
parent
0f3080ecb8
commit
6a3ab71d77
@ -72,7 +72,7 @@ func (cma *CloudMigrationAPI) CreateToken(c *contextmodel.ReqContext) response.R
|
||||
return response.Error(http.StatusInternalServerError, "creating gcom access token", err)
|
||||
}
|
||||
|
||||
return response.JSON(http.StatusOK, cloudmigration.CreateAccessTokenResponseDTO(resp))
|
||||
return response.JSON(http.StatusOK, CreateAccessTokenResponseDTO(resp))
|
||||
}
|
||||
|
||||
// swagger:route GET /cloudmigration/migration migrations getMigrationList
|
||||
@ -325,5 +325,9 @@ type CloudMigrationRunListResponse struct {
|
||||
// swagger:response cloudMigrationCreateTokenResponse
|
||||
type CloudMigrationCreateTokenResponse struct {
|
||||
// in: body
|
||||
Body cloudmigration.CreateAccessTokenResponseDTO
|
||||
Body CreateAccessTokenResponseDTO
|
||||
}
|
||||
|
||||
type CreateAccessTokenResponseDTO struct {
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
@ -11,10 +11,6 @@ type NoopServiceImpl struct{}
|
||||
|
||||
var _ cloudmigration.Service = (*NoopServiceImpl)(nil)
|
||||
|
||||
func (s *NoopServiceImpl) MigrateDatasources(ctx context.Context, request *cloudmigration.MigrateDatasourcesRequest) (*cloudmigration.MigrateDatasourcesResponse, error) {
|
||||
return nil, cloudmigration.ErrFeatureDisabledError
|
||||
}
|
||||
|
||||
func (s *NoopServiceImpl) CreateToken(ctx context.Context) (cloudmigration.CreateAccessTokenResponse, error) {
|
||||
return cloudmigration.CreateAccessTokenResponse{}, cloudmigration.ErrFeatureDisabledError
|
||||
}
|
||||
|
@ -10,6 +10,6 @@ import (
|
||||
|
||||
func Test_NoopServiceDoesNothing(t *testing.T) {
|
||||
s := &NoopServiceImpl{}
|
||||
_, e := s.MigrateDatasources(context.Background(), &cloudmigration.MigrateDatasourcesRequest{})
|
||||
_, e := s.CreateToken(context.Background())
|
||||
assert.ErrorIs(t, e, cloudmigration.ErrFeatureDisabledError)
|
||||
}
|
||||
|
@ -29,24 +29,6 @@ type CloudMigration struct {
|
||||
Updated time.Time `json:"updated"`
|
||||
}
|
||||
|
||||
type MigratedResourceResult struct {
|
||||
Status string `json:"status"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type MigrationResult struct {
|
||||
Status string `json:"status"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type MigratedResource struct {
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id"`
|
||||
RefID string `json:"refID"`
|
||||
Name string `json:"name"`
|
||||
Result MigratedResourceResult `json:"result"`
|
||||
}
|
||||
|
||||
type CloudMigrationRun struct {
|
||||
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
|
||||
UID string `json:"uid" xorm:"uid"`
|
||||
@ -71,13 +53,6 @@ type CloudMigrationRunList struct {
|
||||
Runs []MigrateDataResponseListDTO `json:"runs"`
|
||||
}
|
||||
|
||||
// swagger:parameters createMigration
|
||||
type CloudMigrationRequestParams struct {
|
||||
// required: true
|
||||
// in: body
|
||||
Body CloudMigrationRequest `json:"body"`
|
||||
}
|
||||
|
||||
type CloudMigrationRequest struct {
|
||||
AuthToken string `json:"authToken"`
|
||||
}
|
||||
@ -93,34 +68,12 @@ type CloudMigrationListResponse struct {
|
||||
Migrations []CloudMigrationResponse `json:"migrations"`
|
||||
}
|
||||
|
||||
type MigrateDatasourcesRequest struct {
|
||||
MigrateToPDC bool
|
||||
MigrateCredentials bool
|
||||
}
|
||||
|
||||
type MigrateDatasourcesResponse struct {
|
||||
DatasourcesMigrated int
|
||||
}
|
||||
|
||||
type MigrateDatasourcesRequestDTO struct {
|
||||
MigrateToPDC bool `json:"migrateToPDC"`
|
||||
MigrateCredentials bool `json:"migrateCredentials"`
|
||||
}
|
||||
|
||||
type MigrateDatasourcesResponseDTO struct {
|
||||
DatasourcesMigrated int `json:"datasourcesMigrated"`
|
||||
}
|
||||
|
||||
// access token
|
||||
|
||||
type CreateAccessTokenResponse struct {
|
||||
Token string
|
||||
}
|
||||
|
||||
type CreateAccessTokenResponseDTO struct {
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
type Base64EncodedTokenPayload struct {
|
||||
Token string
|
||||
Instance Base64HGInstance
|
||||
|
@ -3055,14 +3055,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"CloudMigrationRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"authToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CloudMigrationResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -2322,16 +2322,6 @@
|
||||
],
|
||||
"summary": "Create a migration.",
|
||||
"operationId": "createMigration",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CloudMigrationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/cloudMigrationResponse"
|
||||
@ -13020,14 +13010,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"CloudMigrationRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"authToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CloudMigrationResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -3657,14 +3657,6 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"CloudMigrationRequest": {
|
||||
"properties": {
|
||||
"authToken": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"CloudMigrationResponse": {
|
||||
"properties": {
|
||||
"created": {
|
||||
@ -14962,17 +14954,6 @@
|
||||
},
|
||||
"post": {
|
||||
"operationId": "createMigration",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CloudMigrationRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true,
|
||||
"x-originalParamName": "body"
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/components/responses/cloudMigrationResponse"
|
||||
|
Loading…
Reference in New Issue
Block a user