Add missing KMS handlers for version, apis and metrics (#2376)
This commit is contained in:
@@ -29,6 +29,13 @@ import (
|
||||
)
|
||||
|
||||
func registerKMSHandlers(api *operations.ConsoleAPI) {
|
||||
registerKMSStatusHandlers(api)
|
||||
registerKMSKeyHandlers(api)
|
||||
registerKMSPolicyHandlers(api)
|
||||
registerKMSIdentityHandlers(api)
|
||||
}
|
||||
|
||||
func registerKMSStatusHandlers(api *operations.ConsoleAPI) {
|
||||
api.KmsKMSStatusHandler = kmsAPI.KMSStatusHandlerFunc(func(params kmsAPI.KMSStatusParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSStatusResponse(session, params)
|
||||
if err != nil {
|
||||
@@ -36,9 +43,144 @@ func registerKMSHandlers(api *operations.ConsoleAPI) {
|
||||
}
|
||||
return kmsAPI.NewKMSStatusOK().WithPayload(resp)
|
||||
})
|
||||
registerKMSKeyHandlers(api)
|
||||
registerKMSPolicyHandlers(api)
|
||||
registerKMSIdentityHandlers(api)
|
||||
|
||||
api.KmsKMSMetricsHandler = kmsAPI.KMSMetricsHandlerFunc(func(params kmsAPI.KMSMetricsParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSMetricsResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSMetricsDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return kmsAPI.NewKMSMetricsOK().WithPayload(resp)
|
||||
})
|
||||
|
||||
api.KmsKMSAPIsHandler = kmsAPI.KMSAPIsHandlerFunc(func(params kmsAPI.KMSAPIsParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSAPIsResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSAPIsDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return kmsAPI.NewKMSAPIsOK().WithPayload(resp)
|
||||
})
|
||||
|
||||
api.KmsKMSVersionHandler = kmsAPI.KMSVersionHandlerFunc(func(params kmsAPI.KMSVersionParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSVersionResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSVersionDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return kmsAPI.NewKMSVersionOK().WithPayload(resp)
|
||||
})
|
||||
}
|
||||
|
||||
func GetKMSStatusResponse(session *models.Principal, params kmsAPI.KMSStatusParams) (*models.KmsStatusResponse, *models.Error) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return kmsStatus(ctx, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func kmsStatus(ctx context.Context, minioClient MinioAdmin) (*models.KmsStatusResponse, *models.Error) {
|
||||
st, err := minioClient.kmsStatus(ctx)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsStatusResponse{
|
||||
DefaultKeyID: st.DefaultKeyID,
|
||||
Name: st.Name,
|
||||
Endpoints: parseStatusEndpoints(st.Endpoints),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseStatusEndpoints(endpoints map[string]madmin.ItemState) (kmsEndpoints []*models.KmsEndpoint) {
|
||||
for key, value := range endpoints {
|
||||
kmsEndpoints = append(kmsEndpoints, &models.KmsEndpoint{URL: key, Status: string(value)})
|
||||
}
|
||||
return kmsEndpoints
|
||||
}
|
||||
|
||||
func GetKMSMetricsResponse(session *models.Principal, params kmsAPI.KMSMetricsParams) (*models.KmsMetricsResponse, *models.Error) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return kmsMetrics(ctx, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func kmsMetrics(ctx context.Context, minioClient MinioAdmin) (*models.KmsMetricsResponse, *models.Error) {
|
||||
metrics, err := minioClient.kmsMetrics(ctx)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsMetricsResponse{
|
||||
RequestOK: &metrics.RequestOK,
|
||||
RequestErr: &metrics.RequestErr,
|
||||
RequestFail: &metrics.RequestFail,
|
||||
RequestActive: &metrics.RequestActive,
|
||||
AuditEvents: &metrics.AuditEvents,
|
||||
ErrorEvents: &metrics.ErrorEvents,
|
||||
LatencyHistogram: nil,
|
||||
Uptime: &metrics.UpTime,
|
||||
Cpus: &metrics.CPUs,
|
||||
UsableCPUs: &metrics.UsableCPUs,
|
||||
Threads: &metrics.Threads,
|
||||
HeapAlloc: &metrics.HeapAlloc,
|
||||
HeapObjects: metrics.HeapObjects,
|
||||
StackAlloc: &metrics.StackAlloc,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func GetKMSAPIsResponse(session *models.Principal, params kmsAPI.KMSAPIsParams) (*models.KmsAPIsResponse, *models.Error) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return kmsAPIs(ctx, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func kmsAPIs(ctx context.Context, minioClient MinioAdmin) (*models.KmsAPIsResponse, *models.Error) {
|
||||
apis, err := minioClient.kmsAPIs(ctx)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsAPIsResponse{
|
||||
Results: parseApis(apis),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseApis(apis []madmin.KMSAPI) (data []*models.KmsAPI) {
|
||||
for _, api := range apis {
|
||||
data = append(data, &models.KmsAPI{
|
||||
Method: api.Method,
|
||||
Path: api.Path,
|
||||
MaxBody: api.MaxBody,
|
||||
Timeout: api.Timeout,
|
||||
})
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
func GetKMSVersionResponse(session *models.Principal, params kmsAPI.KMSVersionParams) (*models.KmsVersionResponse, *models.Error) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return kmsVersion(ctx, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func kmsVersion(ctx context.Context, minioClient MinioAdmin) (*models.KmsVersionResponse, *models.Error) {
|
||||
version, err := minioClient.kmsVersion(ctx)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsVersionResponse{
|
||||
Version: version.Version,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func registerKMSKeyHandlers(api *operations.ConsoleAPI) {
|
||||
@@ -83,35 +225,6 @@ func registerKMSKeyHandlers(api *operations.ConsoleAPI) {
|
||||
})
|
||||
}
|
||||
|
||||
func GetKMSStatusResponse(session *models.Principal, params kmsAPI.KMSStatusParams) (*models.KmsStatusResponse, *models.Error) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return kmsStatus(ctx, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func kmsStatus(ctx context.Context, minioClient MinioAdmin) (*models.KmsStatusResponse, *models.Error) {
|
||||
st, err := minioClient.kmsStatus(ctx)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsStatusResponse{
|
||||
DefaultKeyID: st.DefaultKeyID,
|
||||
Name: st.Name,
|
||||
Endpoints: parseStatusEndpoints(st.Endpoints),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseStatusEndpoints(endpoints map[string]madmin.ItemState) (kmsEndpoints []*models.KmsEndpoint) {
|
||||
for key, value := range endpoints {
|
||||
kmsEndpoints = append(kmsEndpoints, &models.KmsEndpoint{URL: key, Status: string(value)})
|
||||
}
|
||||
return kmsEndpoints
|
||||
}
|
||||
|
||||
func GetKMSCreateKeyResponse(session *models.Principal, params kmsAPI.KMSCreateKeyParams) *models.Error {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
|
||||
@@ -35,6 +35,18 @@ func (ac adminClientMock) kmsStatus(ctx context.Context) (madmin.KMSStatus, erro
|
||||
return madmin.KMSStatus{Name: "name", DefaultKeyID: "key", Endpoints: map[string]madmin.ItemState{"localhost": madmin.ItemState("online")}}, nil
|
||||
}
|
||||
|
||||
func (ac adminClientMock) kmsAPIs(ctx context.Context) ([]madmin.KMSAPI, error) {
|
||||
return []madmin.KMSAPI{{Method: "GET", Path: "/mock"}}, nil
|
||||
}
|
||||
|
||||
func (ac adminClientMock) kmsMetrics(ctx context.Context) (*madmin.KMSMetrics, error) {
|
||||
return &madmin.KMSMetrics{}, nil
|
||||
}
|
||||
|
||||
func (ac adminClientMock) kmsVersion(ctx context.Context) (*madmin.KMSVersion, error) {
|
||||
return &madmin.KMSVersion{Version: "test-version"}, nil
|
||||
}
|
||||
|
||||
func (ac adminClientMock) createKey(ctx context.Context, key string) error {
|
||||
return nil
|
||||
}
|
||||
@@ -147,6 +159,9 @@ func (suite *KMSTestSuite) TestRegisterKMSHandlers() {
|
||||
|
||||
func (suite *KMSTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) {
|
||||
suite.assert.Nil(api.KmsKMSStatusHandler)
|
||||
suite.assert.Nil(api.KmsKMSMetricsHandler)
|
||||
suite.assert.Nil(api.KmsKMSAPIsHandler)
|
||||
suite.assert.Nil(api.KmsKMSVersionHandler)
|
||||
suite.assert.Nil(api.KmsKMSCreateKeyHandler)
|
||||
suite.assert.Nil(api.KmsKMSImportKeyHandler)
|
||||
suite.assert.Nil(api.KmsKMSListKeysHandler)
|
||||
@@ -166,6 +181,9 @@ func (suite *KMSTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) {
|
||||
|
||||
func (suite *KMSTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) {
|
||||
suite.assert.NotNil(api.KmsKMSStatusHandler)
|
||||
suite.assert.NotNil(api.KmsKMSMetricsHandler)
|
||||
suite.assert.NotNil(api.KmsKMSAPIsHandler)
|
||||
suite.assert.NotNil(api.KmsKMSVersionHandler)
|
||||
suite.assert.NotNil(api.KmsKMSCreateKeyHandler)
|
||||
suite.assert.NotNil(api.KmsKMSImportKeyHandler)
|
||||
suite.assert.NotNil(api.KmsKMSListKeysHandler)
|
||||
@@ -203,6 +221,66 @@ func (suite *KMSTestSuite) TestKMSStatusWithoutError() {
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSMetricsHandlerWithError() {
|
||||
params, api := suite.initKMSMetricsRequest()
|
||||
response := api.KmsKMSMetricsHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSMetricsDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSMetricsRequest() (params kmsAPI.KMSMetricsParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSMetricsWithoutError() {
|
||||
ctx := context.Background()
|
||||
res, err := kmsMetrics(ctx, suite.adminClient)
|
||||
suite.assert.NotNil(res)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSAPIsHandlerWithError() {
|
||||
params, api := suite.initKMSAPIsRequest()
|
||||
response := api.KmsKMSAPIsHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSAPIsDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSAPIsRequest() (params kmsAPI.KMSAPIsParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSAPIsWithoutError() {
|
||||
ctx := context.Background()
|
||||
res, err := kmsAPIs(ctx, suite.adminClient)
|
||||
suite.assert.NotNil(res)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSVersionHandlerWithError() {
|
||||
params, api := suite.initKMSVersionRequest()
|
||||
response := api.KmsKMSVersionHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSVersionDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSVersionRequest() (params kmsAPI.KMSVersionParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSVersionWithoutError() {
|
||||
ctx := context.Background()
|
||||
res, err := kmsVersion(ctx, suite.adminClient)
|
||||
suite.assert.NotNil(res)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSCreateKeyHandlerWithError() {
|
||||
params, api := suite.initKMSCreateKeyRequest()
|
||||
response := api.KmsKMSCreateKeyHandler.Handle(params, &models.Principal{})
|
||||
|
||||
@@ -126,6 +126,9 @@ type MinioAdmin interface {
|
||||
|
||||
// KMS
|
||||
kmsStatus(ctx context.Context) (madmin.KMSStatus, error)
|
||||
kmsMetrics(ctx context.Context) (*madmin.KMSMetrics, error)
|
||||
kmsAPIs(ctx context.Context) ([]madmin.KMSAPI, error)
|
||||
kmsVersion(ctx context.Context) (*madmin.KMSVersion, error)
|
||||
createKey(ctx context.Context, key string) error
|
||||
importKey(ctx context.Context, key string, content []byte) error
|
||||
listKeys(ctx context.Context, pattern string) ([]madmin.KMSKeyInfo, error)
|
||||
@@ -575,6 +578,18 @@ func (ac AdminClient) kmsStatus(ctx context.Context) (madmin.KMSStatus, error) {
|
||||
return ac.Client.KMSStatus(ctx)
|
||||
}
|
||||
|
||||
func (ac AdminClient) kmsMetrics(ctx context.Context) (*madmin.KMSMetrics, error) {
|
||||
return ac.Client.KMSMetrics(ctx)
|
||||
}
|
||||
|
||||
func (ac AdminClient) kmsAPIs(ctx context.Context) ([]madmin.KMSAPI, error) {
|
||||
return ac.Client.KMSAPIs(ctx)
|
||||
}
|
||||
|
||||
func (ac AdminClient) kmsVersion(ctx context.Context) (*madmin.KMSVersion, error) {
|
||||
return ac.Client.KMSVersion(ctx)
|
||||
}
|
||||
|
||||
func (ac AdminClient) createKey(ctx context.Context, key string) error {
|
||||
return ac.Client.CreateKey(ctx, key)
|
||||
}
|
||||
|
||||
@@ -2787,6 +2787,29 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/kms/apis": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"KMS"
|
||||
],
|
||||
"summary": "KMS apis",
|
||||
"operationId": "KMSAPIs",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/kmsAPIsResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/kms/describe-self/identity": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -3057,6 +3080,29 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/kms/metrics": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"KMS"
|
||||
],
|
||||
"summary": "KMS metrics",
|
||||
"operationId": "KMSMetrics",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/kmsMetricsResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/kms/policies": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -3267,6 +3313,29 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/kms/version": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"KMS"
|
||||
],
|
||||
"summary": "KMS version",
|
||||
"operationId": "KMSVersion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/kmsVersionResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/list-external-buckets": {
|
||||
"post": {
|
||||
"tags": [
|
||||
@@ -5705,6 +5774,34 @@ func init() {
|
||||
"kmDeleteKeyRequest": {
|
||||
"type": "object"
|
||||
},
|
||||
"kmsAPI": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"maxBody": {
|
||||
"type": "integer"
|
||||
},
|
||||
"method": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"timeout": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsAPIsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"results": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/kmsAPI"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsAssignPolicyRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -5868,6 +5965,14 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsLatencyHistogram": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"duration": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsListIdentitiesResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -5901,6 +6006,68 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsMetricsResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"requestOK",
|
||||
"requestErr",
|
||||
"requestFail",
|
||||
"requestActive",
|
||||
"auditEvents",
|
||||
"errorEvents",
|
||||
"latencyHistogram",
|
||||
"uptime",
|
||||
"cpus",
|
||||
"usableCPUs",
|
||||
"threads",
|
||||
"heapAlloc",
|
||||
"stackAlloc"
|
||||
],
|
||||
"properties": {
|
||||
"auditEvents": {
|
||||
"type": "integer"
|
||||
},
|
||||
"cpus": {
|
||||
"type": "integer"
|
||||
},
|
||||
"errorEvents": {
|
||||
"type": "integer"
|
||||
},
|
||||
"heapAlloc": {
|
||||
"type": "integer"
|
||||
},
|
||||
"heapObjects": {
|
||||
"type": "integer"
|
||||
},
|
||||
"latencyHistogram": {
|
||||
"$ref": "#/definitions/kmsLatencyHistogram"
|
||||
},
|
||||
"requestActive": {
|
||||
"type": "integer"
|
||||
},
|
||||
"requestErr": {
|
||||
"type": "integer"
|
||||
},
|
||||
"requestFail": {
|
||||
"type": "integer"
|
||||
},
|
||||
"requestOK": {
|
||||
"type": "integer"
|
||||
},
|
||||
"stackAlloc": {
|
||||
"type": "integer"
|
||||
},
|
||||
"threads": {
|
||||
"type": "integer"
|
||||
},
|
||||
"uptime": {
|
||||
"type": "integer"
|
||||
},
|
||||
"usableCPUs": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsPolicyInfo": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -5955,6 +6122,14 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsVersionResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"license": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -10739,6 +10914,29 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/kms/apis": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"KMS"
|
||||
],
|
||||
"summary": "KMS apis",
|
||||
"operationId": "KMSAPIs",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/kmsAPIsResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/kms/describe-self/identity": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -11009,6 +11207,29 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/kms/metrics": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"KMS"
|
||||
],
|
||||
"summary": "KMS metrics",
|
||||
"operationId": "KMSMetrics",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/kmsMetricsResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/kms/policies": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -11219,6 +11440,29 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/kms/version": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"KMS"
|
||||
],
|
||||
"summary": "KMS version",
|
||||
"operationId": "KMSVersion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/kmsVersionResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/list-external-buckets": {
|
||||
"post": {
|
||||
"tags": [
|
||||
@@ -13783,6 +14027,34 @@ func init() {
|
||||
"kmDeleteKeyRequest": {
|
||||
"type": "object"
|
||||
},
|
||||
"kmsAPI": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"maxBody": {
|
||||
"type": "integer"
|
||||
},
|
||||
"method": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"timeout": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsAPIsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"results": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/kmsAPI"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsAssignPolicyRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -13946,6 +14218,14 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsLatencyHistogram": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"duration": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsListIdentitiesResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -13979,6 +14259,68 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsMetricsResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"requestOK",
|
||||
"requestErr",
|
||||
"requestFail",
|
||||
"requestActive",
|
||||
"auditEvents",
|
||||
"errorEvents",
|
||||
"latencyHistogram",
|
||||
"uptime",
|
||||
"cpus",
|
||||
"usableCPUs",
|
||||
"threads",
|
||||
"heapAlloc",
|
||||
"stackAlloc"
|
||||
],
|
||||
"properties": {
|
||||
"auditEvents": {
|
||||
"type": "integer"
|
||||
},
|
||||
"cpus": {
|
||||
"type": "integer"
|
||||
},
|
||||
"errorEvents": {
|
||||
"type": "integer"
|
||||
},
|
||||
"heapAlloc": {
|
||||
"type": "integer"
|
||||
},
|
||||
"heapObjects": {
|
||||
"type": "integer"
|
||||
},
|
||||
"latencyHistogram": {
|
||||
"$ref": "#/definitions/kmsLatencyHistogram"
|
||||
},
|
||||
"requestActive": {
|
||||
"type": "integer"
|
||||
},
|
||||
"requestErr": {
|
||||
"type": "integer"
|
||||
},
|
||||
"requestFail": {
|
||||
"type": "integer"
|
||||
},
|
||||
"requestOK": {
|
||||
"type": "integer"
|
||||
},
|
||||
"stackAlloc": {
|
||||
"type": "integer"
|
||||
},
|
||||
"threads": {
|
||||
"type": "integer"
|
||||
},
|
||||
"uptime": {
|
||||
"type": "integer"
|
||||
},
|
||||
"usableCPUs": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsPolicyInfo": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -14033,6 +14375,14 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"kmsVersionResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"license": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -265,6 +265,9 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
InspectInspectHandler: inspect.InspectHandlerFunc(func(params inspect.InspectParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation inspect.Inspect has not yet been implemented")
|
||||
}),
|
||||
KmsKMSAPIsHandler: k_m_s.KMSAPIsHandlerFunc(func(params k_m_s.KMSAPIsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSAPIs has not yet been implemented")
|
||||
}),
|
||||
KmsKMSAssignPolicyHandler: k_m_s.KMSAssignPolicyHandlerFunc(func(params k_m_s.KMSAssignPolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSAssignPolicy has not yet been implemented")
|
||||
}),
|
||||
@@ -307,12 +310,18 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
KmsKMSListPoliciesHandler: k_m_s.KMSListPoliciesHandlerFunc(func(params k_m_s.KMSListPoliciesParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSListPolicies has not yet been implemented")
|
||||
}),
|
||||
KmsKMSMetricsHandler: k_m_s.KMSMetricsHandlerFunc(func(params k_m_s.KMSMetricsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSMetrics has not yet been implemented")
|
||||
}),
|
||||
KmsKMSSetPolicyHandler: k_m_s.KMSSetPolicyHandlerFunc(func(params k_m_s.KMSSetPolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSSetPolicy has not yet been implemented")
|
||||
}),
|
||||
KmsKMSStatusHandler: k_m_s.KMSStatusHandlerFunc(func(params k_m_s.KMSStatusParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSStatus has not yet been implemented")
|
||||
}),
|
||||
KmsKMSVersionHandler: k_m_s.KMSVersionHandlerFunc(func(params k_m_s.KMSVersionParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSVersion has not yet been implemented")
|
||||
}),
|
||||
UserListAUserServiceAccountsHandler: user.ListAUserServiceAccountsHandlerFunc(func(params user.ListAUserServiceAccountsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user.ListAUserServiceAccounts has not yet been implemented")
|
||||
}),
|
||||
@@ -686,6 +695,8 @@ type ConsoleAPI struct {
|
||||
GroupGroupInfoHandler group.GroupInfoHandler
|
||||
// InspectInspectHandler sets the operation handler for the inspect operation
|
||||
InspectInspectHandler inspect.InspectHandler
|
||||
// KmsKMSAPIsHandler sets the operation handler for the k m s a p is operation
|
||||
KmsKMSAPIsHandler k_m_s.KMSAPIsHandler
|
||||
// KmsKMSAssignPolicyHandler sets the operation handler for the k m s assign policy operation
|
||||
KmsKMSAssignPolicyHandler k_m_s.KMSAssignPolicyHandler
|
||||
// KmsKMSCreateKeyHandler sets the operation handler for the k m s create key operation
|
||||
@@ -714,10 +725,14 @@ type ConsoleAPI struct {
|
||||
KmsKMSListKeysHandler k_m_s.KMSListKeysHandler
|
||||
// KmsKMSListPoliciesHandler sets the operation handler for the k m s list policies operation
|
||||
KmsKMSListPoliciesHandler k_m_s.KMSListPoliciesHandler
|
||||
// KmsKMSMetricsHandler sets the operation handler for the k m s metrics operation
|
||||
KmsKMSMetricsHandler k_m_s.KMSMetricsHandler
|
||||
// KmsKMSSetPolicyHandler sets the operation handler for the k m s set policy operation
|
||||
KmsKMSSetPolicyHandler k_m_s.KMSSetPolicyHandler
|
||||
// KmsKMSStatusHandler sets the operation handler for the k m s status operation
|
||||
KmsKMSStatusHandler k_m_s.KMSStatusHandler
|
||||
// KmsKMSVersionHandler sets the operation handler for the k m s version operation
|
||||
KmsKMSVersionHandler k_m_s.KMSVersionHandler
|
||||
// UserListAUserServiceAccountsHandler sets the operation handler for the list a user service accounts operation
|
||||
UserListAUserServiceAccountsHandler user.ListAUserServiceAccountsHandler
|
||||
// BucketListAccessRulesWithBucketHandler sets the operation handler for the list access rules with bucket operation
|
||||
@@ -1118,6 +1133,9 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.InspectInspectHandler == nil {
|
||||
unregistered = append(unregistered, "inspect.InspectHandler")
|
||||
}
|
||||
if o.KmsKMSAPIsHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSAPIsHandler")
|
||||
}
|
||||
if o.KmsKMSAssignPolicyHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSAssignPolicyHandler")
|
||||
}
|
||||
@@ -1160,12 +1178,18 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.KmsKMSListPoliciesHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSListPoliciesHandler")
|
||||
}
|
||||
if o.KmsKMSMetricsHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSMetricsHandler")
|
||||
}
|
||||
if o.KmsKMSSetPolicyHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSSetPolicyHandler")
|
||||
}
|
||||
if o.KmsKMSStatusHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSStatusHandler")
|
||||
}
|
||||
if o.KmsKMSVersionHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSVersionHandler")
|
||||
}
|
||||
if o.UserListAUserServiceAccountsHandler == nil {
|
||||
unregistered = append(unregistered, "user.ListAUserServiceAccountsHandler")
|
||||
}
|
||||
@@ -1705,6 +1729,10 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/admin/inspect"] = inspect.NewInspect(o.context, o.InspectInspectHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/apis"] = k_m_s.NewKMSAPIs(o.context, o.KmsKMSAPIsHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -1761,6 +1789,10 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/policies"] = k_m_s.NewKMSListPolicies(o.context, o.KmsKMSListPoliciesHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/metrics"] = k_m_s.NewKMSMetrics(o.context, o.KmsKMSMetricsHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -1772,6 +1804,10 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/version"] = k_m_s.NewKMSVersion(o.context, o.KmsKMSVersionHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/user/{name}/service-accounts"] = user.NewListAUserServiceAccounts(o.context, o.UserListAUserServiceAccountsHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
|
||||
88
restapi/operations/k_m_s/k_m_s_a_p_is.go
Normal file
88
restapi/operations/k_m_s/k_m_s_a_p_is.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// KMSAPIsHandlerFunc turns a function with the right signature into a k m s a p is handler
|
||||
type KMSAPIsHandlerFunc func(KMSAPIsParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSAPIsHandlerFunc) Handle(params KMSAPIsParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSAPIsHandler interface for that can handle valid k m s a p is params
|
||||
type KMSAPIsHandler interface {
|
||||
Handle(KMSAPIsParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSAPIs creates a new http.Handler for the k m s a p is operation
|
||||
func NewKMSAPIs(ctx *middleware.Context, handler KMSAPIsHandler) *KMSAPIs {
|
||||
return &KMSAPIs{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSAPIs swagger:route GET /kms/apis KMS kMSAPIs
|
||||
|
||||
KMS apis
|
||||
*/
|
||||
type KMSAPIs struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSAPIsHandler
|
||||
}
|
||||
|
||||
func (o *KMSAPIs) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSAPIsParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
63
restapi/operations/k_m_s/k_m_s_a_p_is_parameters.go
Normal file
63
restapi/operations/k_m_s/k_m_s_a_p_is_parameters.go
Normal file
@@ -0,0 +1,63 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// NewKMSAPIsParams creates a new KMSAPIsParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSAPIsParams() KMSAPIsParams {
|
||||
|
||||
return KMSAPIsParams{}
|
||||
}
|
||||
|
||||
// KMSAPIsParams contains all the bound params for the k m s a p is operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSAPIs
|
||||
type KMSAPIsParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewKMSAPIsParams() beforehand.
|
||||
func (o *KMSAPIsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
135
restapi/operations/k_m_s/k_m_s_a_p_is_responses.go
Normal file
135
restapi/operations/k_m_s/k_m_s_a_p_is_responses.go
Normal file
@@ -0,0 +1,135 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// KMSAPIsOKCode is the HTTP code returned for type KMSAPIsOK
|
||||
const KMSAPIsOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSAPIsOK A successful response.
|
||||
|
||||
swagger:response kMSAPIsOK
|
||||
*/
|
||||
type KMSAPIsOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.KmsAPIsResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSAPIsOK creates KMSAPIsOK with default headers values
|
||||
func NewKMSAPIsOK() *KMSAPIsOK {
|
||||
|
||||
return &KMSAPIsOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s a p is o k response
|
||||
func (o *KMSAPIsOK) WithPayload(payload *models.KmsAPIsResponse) *KMSAPIsOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s a p is o k response
|
||||
func (o *KMSAPIsOK) SetPayload(payload *models.KmsAPIsResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSAPIsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSAPIsDefault Generic error response.
|
||||
|
||||
swagger:response kMSAPIsDefault
|
||||
*/
|
||||
type KMSAPIsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSAPIsDefault creates KMSAPIsDefault with default headers values
|
||||
func NewKMSAPIsDefault(code int) *KMSAPIsDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSAPIsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s a p is default response
|
||||
func (o *KMSAPIsDefault) WithStatusCode(code int) *KMSAPIsDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s a p is default response
|
||||
func (o *KMSAPIsDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s a p is default response
|
||||
func (o *KMSAPIsDefault) WithPayload(payload *models.Error) *KMSAPIsDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s a p is default response
|
||||
func (o *KMSAPIsDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSAPIsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
104
restapi/operations/k_m_s/k_m_s_a_p_is_urlbuilder.go
Normal file
104
restapi/operations/k_m_s/k_m_s_a_p_is_urlbuilder.go
Normal file
@@ -0,0 +1,104 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// KMSAPIsURL generates an URL for the k m s a p is operation
|
||||
type KMSAPIsURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *KMSAPIsURL) WithBasePath(bp string) *KMSAPIsURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *KMSAPIsURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSAPIsURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/apis"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *KMSAPIsURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *KMSAPIsURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSAPIsURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSAPIsURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSAPIsURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *KMSAPIsURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
88
restapi/operations/k_m_s/k_m_s_metrics.go
Normal file
88
restapi/operations/k_m_s/k_m_s_metrics.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// KMSMetricsHandlerFunc turns a function with the right signature into a k m s metrics handler
|
||||
type KMSMetricsHandlerFunc func(KMSMetricsParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSMetricsHandlerFunc) Handle(params KMSMetricsParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSMetricsHandler interface for that can handle valid k m s metrics params
|
||||
type KMSMetricsHandler interface {
|
||||
Handle(KMSMetricsParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSMetrics creates a new http.Handler for the k m s metrics operation
|
||||
func NewKMSMetrics(ctx *middleware.Context, handler KMSMetricsHandler) *KMSMetrics {
|
||||
return &KMSMetrics{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSMetrics swagger:route GET /kms/metrics KMS kMSMetrics
|
||||
|
||||
KMS metrics
|
||||
*/
|
||||
type KMSMetrics struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSMetricsHandler
|
||||
}
|
||||
|
||||
func (o *KMSMetrics) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSMetricsParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
63
restapi/operations/k_m_s/k_m_s_metrics_parameters.go
Normal file
63
restapi/operations/k_m_s/k_m_s_metrics_parameters.go
Normal file
@@ -0,0 +1,63 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// NewKMSMetricsParams creates a new KMSMetricsParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSMetricsParams() KMSMetricsParams {
|
||||
|
||||
return KMSMetricsParams{}
|
||||
}
|
||||
|
||||
// KMSMetricsParams contains all the bound params for the k m s metrics operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSMetrics
|
||||
type KMSMetricsParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewKMSMetricsParams() beforehand.
|
||||
func (o *KMSMetricsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
135
restapi/operations/k_m_s/k_m_s_metrics_responses.go
Normal file
135
restapi/operations/k_m_s/k_m_s_metrics_responses.go
Normal file
@@ -0,0 +1,135 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// KMSMetricsOKCode is the HTTP code returned for type KMSMetricsOK
|
||||
const KMSMetricsOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSMetricsOK A successful response.
|
||||
|
||||
swagger:response kMSMetricsOK
|
||||
*/
|
||||
type KMSMetricsOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.KmsMetricsResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSMetricsOK creates KMSMetricsOK with default headers values
|
||||
func NewKMSMetricsOK() *KMSMetricsOK {
|
||||
|
||||
return &KMSMetricsOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s metrics o k response
|
||||
func (o *KMSMetricsOK) WithPayload(payload *models.KmsMetricsResponse) *KMSMetricsOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s metrics o k response
|
||||
func (o *KMSMetricsOK) SetPayload(payload *models.KmsMetricsResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSMetricsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSMetricsDefault Generic error response.
|
||||
|
||||
swagger:response kMSMetricsDefault
|
||||
*/
|
||||
type KMSMetricsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSMetricsDefault creates KMSMetricsDefault with default headers values
|
||||
func NewKMSMetricsDefault(code int) *KMSMetricsDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSMetricsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s metrics default response
|
||||
func (o *KMSMetricsDefault) WithStatusCode(code int) *KMSMetricsDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s metrics default response
|
||||
func (o *KMSMetricsDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s metrics default response
|
||||
func (o *KMSMetricsDefault) WithPayload(payload *models.Error) *KMSMetricsDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s metrics default response
|
||||
func (o *KMSMetricsDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSMetricsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
104
restapi/operations/k_m_s/k_m_s_metrics_urlbuilder.go
Normal file
104
restapi/operations/k_m_s/k_m_s_metrics_urlbuilder.go
Normal file
@@ -0,0 +1,104 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// KMSMetricsURL generates an URL for the k m s metrics operation
|
||||
type KMSMetricsURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *KMSMetricsURL) WithBasePath(bp string) *KMSMetricsURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *KMSMetricsURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSMetricsURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/metrics"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *KMSMetricsURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *KMSMetricsURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSMetricsURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSMetricsURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSMetricsURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *KMSMetricsURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
88
restapi/operations/k_m_s/k_m_s_version.go
Normal file
88
restapi/operations/k_m_s/k_m_s_version.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// KMSVersionHandlerFunc turns a function with the right signature into a k m s version handler
|
||||
type KMSVersionHandlerFunc func(KMSVersionParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSVersionHandlerFunc) Handle(params KMSVersionParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSVersionHandler interface for that can handle valid k m s version params
|
||||
type KMSVersionHandler interface {
|
||||
Handle(KMSVersionParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSVersion creates a new http.Handler for the k m s version operation
|
||||
func NewKMSVersion(ctx *middleware.Context, handler KMSVersionHandler) *KMSVersion {
|
||||
return &KMSVersion{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSVersion swagger:route GET /kms/version KMS kMSVersion
|
||||
|
||||
KMS version
|
||||
*/
|
||||
type KMSVersion struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSVersionHandler
|
||||
}
|
||||
|
||||
func (o *KMSVersion) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSVersionParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
63
restapi/operations/k_m_s/k_m_s_version_parameters.go
Normal file
63
restapi/operations/k_m_s/k_m_s_version_parameters.go
Normal file
@@ -0,0 +1,63 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// NewKMSVersionParams creates a new KMSVersionParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSVersionParams() KMSVersionParams {
|
||||
|
||||
return KMSVersionParams{}
|
||||
}
|
||||
|
||||
// KMSVersionParams contains all the bound params for the k m s version operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSVersion
|
||||
type KMSVersionParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewKMSVersionParams() beforehand.
|
||||
func (o *KMSVersionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
135
restapi/operations/k_m_s/k_m_s_version_responses.go
Normal file
135
restapi/operations/k_m_s/k_m_s_version_responses.go
Normal file
@@ -0,0 +1,135 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// KMSVersionOKCode is the HTTP code returned for type KMSVersionOK
|
||||
const KMSVersionOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSVersionOK A successful response.
|
||||
|
||||
swagger:response kMSVersionOK
|
||||
*/
|
||||
type KMSVersionOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.KmsVersionResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSVersionOK creates KMSVersionOK with default headers values
|
||||
func NewKMSVersionOK() *KMSVersionOK {
|
||||
|
||||
return &KMSVersionOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s version o k response
|
||||
func (o *KMSVersionOK) WithPayload(payload *models.KmsVersionResponse) *KMSVersionOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s version o k response
|
||||
func (o *KMSVersionOK) SetPayload(payload *models.KmsVersionResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSVersionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSVersionDefault Generic error response.
|
||||
|
||||
swagger:response kMSVersionDefault
|
||||
*/
|
||||
type KMSVersionDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSVersionDefault creates KMSVersionDefault with default headers values
|
||||
func NewKMSVersionDefault(code int) *KMSVersionDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSVersionDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s version default response
|
||||
func (o *KMSVersionDefault) WithStatusCode(code int) *KMSVersionDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s version default response
|
||||
func (o *KMSVersionDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s version default response
|
||||
func (o *KMSVersionDefault) WithPayload(payload *models.Error) *KMSVersionDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s version default response
|
||||
func (o *KMSVersionDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSVersionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
104
restapi/operations/k_m_s/k_m_s_version_urlbuilder.go
Normal file
104
restapi/operations/k_m_s/k_m_s_version_urlbuilder.go
Normal file
@@ -0,0 +1,104 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// KMSVersionURL generates an URL for the k m s version operation
|
||||
type KMSVersionURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *KMSVersionURL) WithBasePath(bp string) *KMSVersionURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *KMSVersionURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSVersionURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/version"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *KMSVersionURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *KMSVersionURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSVersionURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSVersionURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSVersionURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *KMSVersionURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
Reference in New Issue
Block a user