Subnet cluster registration (#1338)
- Removed old registration flow - Add support for new online and offline cluster registration flow - Support login accounts with mfa enabled - Registration screens Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
This commit is contained in:
282
restapi/admin_subnet.go
Normal file
282
restapi/admin_subnet.go
Normal file
@@ -0,0 +1,282 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 restapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/minio/console/cluster"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/pkg/subnet"
|
||||
"github.com/minio/console/restapi/operations"
|
||||
"github.com/minio/console/restapi/operations/admin_api"
|
||||
"github.com/minio/madmin-go"
|
||||
)
|
||||
|
||||
func registerSubnetHandlers(api *operations.ConsoleAPI) {
|
||||
// Get subnet login handler
|
||||
api.AdminAPISubnetLoginHandler = admin_api.SubnetLoginHandlerFunc(func(params admin_api.SubnetLoginParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetSubnetLoginResponse(session, params)
|
||||
if err != nil {
|
||||
return admin_api.NewSubnetLoginDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return admin_api.NewSubnetLoginOK().WithPayload(resp)
|
||||
})
|
||||
// Get subnet login with MFA handler
|
||||
api.AdminAPISubnetLoginMFAHandler = admin_api.SubnetLoginMFAHandlerFunc(func(params admin_api.SubnetLoginMFAParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetSubnetLoginWithMFAResponse(params)
|
||||
if err != nil {
|
||||
return admin_api.NewSubnetLoginMFADefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return admin_api.NewSubnetLoginMFAOK().WithPayload(resp)
|
||||
})
|
||||
// Get subnet register
|
||||
api.AdminAPISubnetRegisterHandler = admin_api.SubnetRegisterHandlerFunc(func(params admin_api.SubnetRegisterParams, session *models.Principal) middleware.Responder {
|
||||
err := GetSubnetRegisterResponse(session, params)
|
||||
if err != nil {
|
||||
return admin_api.NewSubnetRegisterDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return admin_api.NewSubnetRegisterOK()
|
||||
})
|
||||
// Get subnet info
|
||||
api.AdminAPISubnetInfoHandler = admin_api.SubnetInfoHandlerFunc(func(params admin_api.SubnetInfoParams, session *models.Principal) middleware.Responder {
|
||||
err := GetSubnetInfoResponse(session)
|
||||
if err != nil {
|
||||
return admin_api.NewSubnetInfoDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return admin_api.NewSubnetInfoOK()
|
||||
})
|
||||
// Get subnet registration token
|
||||
api.AdminAPISubnetRegTokenHandler = admin_api.SubnetRegTokenHandlerFunc(func(params admin_api.SubnetRegTokenParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetSubnetRegTokenResponse(session)
|
||||
if err != nil {
|
||||
return admin_api.NewSubnetRegTokenDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return admin_api.NewSubnetRegTokenOK().WithPayload(resp)
|
||||
})
|
||||
}
|
||||
|
||||
func SubnetRegisterWithAPIKey(ctx context.Context, minioClient MinioAdmin, apiKey string) (bool, error) {
|
||||
serverInfo, err := minioClient.serverInfo(ctx)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
subnetAPIKey, err := subnet.Register(httpClient, serverInfo, apiKey, "", "")
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
configStr := "subnet license= api_key=" + subnetAPIKey
|
||||
_, err = minioClient.setConfigKV(ctx, configStr)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
// cluster registered correctly
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func SubnetLogin(client cluster.HTTPClientI, username, password string) (string, string, error) {
|
||||
tokens, err := subnet.Login(client, username, password)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
if tokens.MfaToken != "" {
|
||||
// user needs to complete login flow using mfa
|
||||
return "", tokens.MfaToken, nil
|
||||
}
|
||||
if tokens.AccessToken != "" {
|
||||
// register token to minio
|
||||
return tokens.AccessToken, "", nil
|
||||
}
|
||||
return "", "", errors.New("something went wrong")
|
||||
}
|
||||
|
||||
func GetSubnetLoginResponse(session *models.Principal, params admin_api.SubnetLoginParams) (*models.SubnetLoginResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
httpClient := &cluster.HTTPClient{
|
||||
Client: GetConsoleHTTPClient(),
|
||||
}
|
||||
mAdmin, err := NewMinioAdminClient(session)
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
minioClient := AdminClient{Client: mAdmin}
|
||||
apiKey := params.Body.APIKey
|
||||
if apiKey != "" {
|
||||
registered, err := SubnetRegisterWithAPIKey(ctx, minioClient, apiKey)
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
return &models.SubnetLoginResponse{
|
||||
Registered: registered,
|
||||
Organizations: []*models.SubnetOrganization{},
|
||||
}, nil
|
||||
}
|
||||
username := params.Body.Username
|
||||
password := params.Body.Password
|
||||
if username != "" && password != "" {
|
||||
token, mfa, err := SubnetLogin(httpClient, username, password)
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
return &models.SubnetLoginResponse{
|
||||
MfaToken: mfa,
|
||||
AccessToken: token,
|
||||
Organizations: []*models.SubnetOrganization{},
|
||||
}, nil
|
||||
}
|
||||
return nil, prepareError(ErrorGeneric)
|
||||
}
|
||||
|
||||
type SubnetRegistration struct {
|
||||
AccessToken string
|
||||
MFAToken string
|
||||
Organizations []models.SubnetOrganization
|
||||
}
|
||||
|
||||
func SubnetLoginWithMFA(client cluster.HTTPClientI, username, mfaToken, otp string) (*models.SubnetLoginResponse, error) {
|
||||
tokens, err := subnet.LoginWithMFA(client, username, mfaToken, otp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tokens.AccessToken != "" {
|
||||
organizations, errOrg := subnet.GetOrganizations(client, tokens.AccessToken)
|
||||
if errOrg != nil {
|
||||
return nil, errOrg
|
||||
}
|
||||
return &models.SubnetLoginResponse{
|
||||
AccessToken: tokens.AccessToken,
|
||||
Organizations: organizations,
|
||||
}, nil
|
||||
}
|
||||
return nil, errors.New("something went wrong")
|
||||
}
|
||||
|
||||
func GetSubnetLoginWithMFAResponse(params admin_api.SubnetLoginMFAParams) (*models.SubnetLoginResponse, *models.Error) {
|
||||
client := &cluster.HTTPClient{
|
||||
Client: GetConsoleHTTPClient(),
|
||||
}
|
||||
resp, err := SubnetLoginWithMFA(client, *params.Body.Username, *params.Body.MfaToken, *params.Body.Otp)
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func GetSubnetKeyFromMinIOConfig(ctx context.Context, minioClient MinioAdmin, key string) (string, error) {
|
||||
sh, err := minioClient.helpConfigKV(ctx, "subnet", "", false)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
buf, err := minioClient.getConfigKV(ctx, "subnet")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
tgt, err := madmin.ParseSubSysTarget(buf, sh)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for _, kv := range tgt.KVS {
|
||||
if kv.Key == key {
|
||||
return kv.Value, nil
|
||||
}
|
||||
}
|
||||
return "", errors.New("")
|
||||
}
|
||||
|
||||
func GetSubnetRegister(ctx context.Context, minioClient MinioAdmin, httpClient cluster.HTTPClientI, params admin_api.SubnetRegisterParams) error {
|
||||
serverInfo, err := minioClient.serverInfo(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
subnetAPIKey, err := subnet.Register(httpClient, serverInfo, "", *params.Body.Token, *params.Body.AccountID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
configStr := "subnet license= api_key=" + subnetAPIKey
|
||||
_, err = minioClient.setConfigKV(ctx, configStr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetSubnetRegisterResponse(session *models.Principal, params admin_api.SubnetRegisterParams) *models.Error {
|
||||
ctx := context.Background()
|
||||
mAdmin, err := NewMinioAdminClient(session)
|
||||
if err != nil {
|
||||
return prepareError(err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
client := &cluster.HTTPClient{
|
||||
Client: GetConsoleHTTPClient(),
|
||||
}
|
||||
err = GetSubnetRegister(ctx, adminClient, client, params)
|
||||
if err != nil {
|
||||
return prepareError(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetSubnetInfoResponse(session *models.Principal) *models.Error {
|
||||
ctx := context.Background()
|
||||
mAdmin, err := NewMinioAdminClient(session)
|
||||
if err != nil {
|
||||
return prepareError(err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
apiKey, err := GetSubnetKeyFromMinIOConfig(ctx, adminClient, "api_key")
|
||||
if err != nil {
|
||||
return prepareError(err)
|
||||
}
|
||||
if apiKey == "" {
|
||||
return prepareError(errLicenseNotFound)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetSubnetRegToken(ctx context.Context, minioClient MinioAdmin) (string, error) {
|
||||
serverInfo, err := minioClient.serverInfo(ctx)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
regInfo := subnet.GetClusterRegInfo(serverInfo)
|
||||
regToken, err := subnet.GenerateRegToken(regInfo)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return regToken, nil
|
||||
}
|
||||
|
||||
func GetSubnetRegTokenResponse(session *models.Principal) (*models.SubnetRegTokenResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
mAdmin, err := NewMinioAdminClient(session)
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
token, err := GetSubnetRegToken(ctx, adminClient)
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
return &models.SubnetRegTokenResponse{
|
||||
RegToken: token,
|
||||
}, nil
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 restapi
|
||||
|
||||
import (
|
||||
"github.com/minio/console/cluster"
|
||||
"github.com/minio/console/pkg/subnet"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/restapi/operations"
|
||||
"github.com/minio/console/restapi/operations/admin_api"
|
||||
)
|
||||
|
||||
func registerSubscriptionHandlers(api *operations.ConsoleAPI) {
|
||||
// Get subscription information handler
|
||||
api.AdminAPISubscriptionInfoHandler = admin_api.SubscriptionInfoHandlerFunc(func(params admin_api.SubscriptionInfoParams, session *models.Principal) middleware.Responder {
|
||||
license, err := getSubscriptionInfoResponse()
|
||||
if err != nil {
|
||||
return admin_api.NewSubscriptionInfoDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return admin_api.NewSubscriptionInfoOK().WithPayload(license)
|
||||
})
|
||||
}
|
||||
|
||||
// retrieveLicense returns license from K8S secrets (If console is deployed in operator mode) or from
|
||||
// the configured CONSOLE_SUBNET_LICENSE environment variable
|
||||
func retrieveLicense() string {
|
||||
// If Console is running in Tenant Admin mode retrieve license from env variable
|
||||
license := GetSubnetLicense()
|
||||
return license
|
||||
}
|
||||
|
||||
// subscriptionValidate will validate the provided jwt license against the subnet public key
|
||||
func subscriptionValidate(client cluster.HTTPClientI, license, email, password string) (*models.License, string, error) {
|
||||
licenseInfo, rawLicense, err := subnet.ValidateLicense(client, license, email, password)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return &models.License{
|
||||
Email: licenseInfo.Email,
|
||||
AccountID: licenseInfo.AccountID,
|
||||
StorageCapacity: licenseInfo.StorageCapacity,
|
||||
Plan: licenseInfo.Plan,
|
||||
ExpiresAt: licenseInfo.ExpiresAt.String(),
|
||||
Organization: licenseInfo.Organization,
|
||||
}, rawLicense, nil
|
||||
}
|
||||
|
||||
// getSubscriptionInfoResponse returns information about the current configured subnet license for Console
|
||||
func getSubscriptionInfoResponse() (*models.License, *models.Error) {
|
||||
var licenseInfo *models.License
|
||||
client := &cluster.HTTPClient{
|
||||
Client: GetConsoleHTTPClient(),
|
||||
}
|
||||
licenseKey := retrieveLicense()
|
||||
// validate license key and obtain license info
|
||||
licenseInfo, _, err := subscriptionValidate(client, licenseKey, "", "")
|
||||
if err != nil {
|
||||
return nil, prepareError(errLicenseNotFound, nil, err)
|
||||
}
|
||||
return licenseInfo, nil
|
||||
}
|
||||
@@ -118,8 +118,8 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler {
|
||||
registerAdminBucketRemoteHandlers(api)
|
||||
// Register admin log search
|
||||
registerLogSearchHandlers(api)
|
||||
// Register admin subscription handlers
|
||||
registerSubscriptionHandlers(api)
|
||||
// Register admin subnet handlers
|
||||
registerSubnetHandlers(api)
|
||||
// Register Account handlers
|
||||
registerAdminTiersHandlers(api)
|
||||
|
||||
|
||||
@@ -3212,13 +3212,13 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subscription/info": {
|
||||
"/subnet/info": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Subscription info",
|
||||
"operationId": "SubscriptionInfo",
|
||||
"summary": "Subnet info",
|
||||
"operationId": "SubnetInfo",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
@@ -3235,6 +3235,125 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subnet/login": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Login to subnet",
|
||||
"operationId": "SubnetLogin",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subnetLoginRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subnetLoginResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subnet/login/mfa": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Login to subnet using mfa",
|
||||
"operationId": "SubnetLoginMFA",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subnetLoginMFARequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subnetLoginResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subnet/register": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Register cluster with Subnet",
|
||||
"operationId": "SubnetRegister",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subnetRegisterRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response."
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subnet/registration-token": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Subnet registraton token",
|
||||
"operationId": "SubnetRegToken",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/SubnetRegTokenResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -3575,6 +3694,14 @@ func init() {
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"SubnetRegTokenResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"regToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"accessRule": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -5547,6 +5674,97 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"subnetLoginMFARequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"username",
|
||||
"otp",
|
||||
"mfa_token"
|
||||
],
|
||||
"properties": {
|
||||
"mfa_token": {
|
||||
"type": "string"
|
||||
},
|
||||
"otp": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subnetLoginRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"apiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subnetLoginResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_token": {
|
||||
"type": "string"
|
||||
},
|
||||
"mfa_token": {
|
||||
"type": "string"
|
||||
},
|
||||
"organizations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/subnetOrganization"
|
||||
}
|
||||
},
|
||||
"registered": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subnetOrganization": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accountId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"isAccountOwner": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shortName": {
|
||||
"type": "string"
|
||||
},
|
||||
"subscriptionStatus": {
|
||||
"type": "string"
|
||||
},
|
||||
"userId": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subnetRegisterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"token",
|
||||
"account_id"
|
||||
],
|
||||
"properties": {
|
||||
"account_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tier": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -9061,13 +9279,13 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subscription/info": {
|
||||
"/subnet/info": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Subscription info",
|
||||
"operationId": "SubscriptionInfo",
|
||||
"summary": "Subnet info",
|
||||
"operationId": "SubnetInfo",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
@@ -9084,6 +9302,125 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subnet/login": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Login to subnet",
|
||||
"operationId": "SubnetLogin",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subnetLoginRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subnetLoginResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subnet/login/mfa": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Login to subnet using mfa",
|
||||
"operationId": "SubnetLoginMFA",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subnetLoginMFARequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subnetLoginResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subnet/register": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Register cluster with Subnet",
|
||||
"operationId": "SubnetRegister",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subnetRegisterRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response."
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subnet/registration-token": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Subnet registraton token",
|
||||
"operationId": "SubnetRegToken",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/SubnetRegTokenResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -9490,6 +9827,14 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"SubnetRegTokenResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"regToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"WidgetDetailsOptions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -11516,6 +11861,97 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"subnetLoginMFARequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"username",
|
||||
"otp",
|
||||
"mfa_token"
|
||||
],
|
||||
"properties": {
|
||||
"mfa_token": {
|
||||
"type": "string"
|
||||
},
|
||||
"otp": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subnetLoginRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"apiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subnetLoginResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_token": {
|
||||
"type": "string"
|
||||
},
|
||||
"mfa_token": {
|
||||
"type": "string"
|
||||
},
|
||||
"organizations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/subnetOrganization"
|
||||
}
|
||||
},
|
||||
"registered": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subnetOrganization": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accountId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"isAccountOwner": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shortName": {
|
||||
"type": "string"
|
||||
},
|
||||
"subscriptionStatus": {
|
||||
"type": "string"
|
||||
},
|
||||
"userId": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subnetRegisterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"token",
|
||||
"account_id"
|
||||
],
|
||||
"properties": {
|
||||
"account_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tier": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -30,40 +30,40 @@ import (
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// SubscriptionInfoHandlerFunc turns a function with the right signature into a subscription info handler
|
||||
type SubscriptionInfoHandlerFunc func(SubscriptionInfoParams, *models.Principal) middleware.Responder
|
||||
// SubnetInfoHandlerFunc turns a function with the right signature into a subnet info handler
|
||||
type SubnetInfoHandlerFunc func(SubnetInfoParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn SubscriptionInfoHandlerFunc) Handle(params SubscriptionInfoParams, principal *models.Principal) middleware.Responder {
|
||||
func (fn SubnetInfoHandlerFunc) Handle(params SubnetInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// SubscriptionInfoHandler interface for that can handle valid subscription info params
|
||||
type SubscriptionInfoHandler interface {
|
||||
Handle(SubscriptionInfoParams, *models.Principal) middleware.Responder
|
||||
// SubnetInfoHandler interface for that can handle valid subnet info params
|
||||
type SubnetInfoHandler interface {
|
||||
Handle(SubnetInfoParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewSubscriptionInfo creates a new http.Handler for the subscription info operation
|
||||
func NewSubscriptionInfo(ctx *middleware.Context, handler SubscriptionInfoHandler) *SubscriptionInfo {
|
||||
return &SubscriptionInfo{Context: ctx, Handler: handler}
|
||||
// NewSubnetInfo creates a new http.Handler for the subnet info operation
|
||||
func NewSubnetInfo(ctx *middleware.Context, handler SubnetInfoHandler) *SubnetInfo {
|
||||
return &SubnetInfo{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* SubscriptionInfo swagger:route GET /subscription/info AdminAPI subscriptionInfo
|
||||
/* SubnetInfo swagger:route GET /subnet/info AdminAPI subnetInfo
|
||||
|
||||
Subscription info
|
||||
Subnet info
|
||||
|
||||
*/
|
||||
type SubscriptionInfo struct {
|
||||
type SubnetInfo struct {
|
||||
Context *middleware.Context
|
||||
Handler SubscriptionInfoHandler
|
||||
Handler SubnetInfoHandler
|
||||
}
|
||||
|
||||
func (o *SubscriptionInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
func (o *SubnetInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewSubscriptionInfoParams()
|
||||
var Params = NewSubnetInfoParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
@@ -29,19 +29,19 @@ import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// NewSubscriptionInfoParams creates a new SubscriptionInfoParams object
|
||||
// NewSubnetInfoParams creates a new SubnetInfoParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewSubscriptionInfoParams() SubscriptionInfoParams {
|
||||
func NewSubnetInfoParams() SubnetInfoParams {
|
||||
|
||||
return SubscriptionInfoParams{}
|
||||
return SubnetInfoParams{}
|
||||
}
|
||||
|
||||
// SubscriptionInfoParams contains all the bound params for the subscription info operation
|
||||
// SubnetInfoParams contains all the bound params for the subnet info operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters SubscriptionInfo
|
||||
type SubscriptionInfoParams struct {
|
||||
// swagger:parameters SubnetInfo
|
||||
type SubnetInfoParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
@@ -50,8 +50,8 @@ type SubscriptionInfoParams struct {
|
||||
// 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 NewSubscriptionInfoParams() beforehand.
|
||||
func (o *SubscriptionInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
// To ensure default values, the struct must have been initialized with NewSubnetInfoParams() beforehand.
|
||||
func (o *SubnetInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
@@ -30,14 +30,14 @@ import (
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// SubscriptionInfoOKCode is the HTTP code returned for type SubscriptionInfoOK
|
||||
const SubscriptionInfoOKCode int = 200
|
||||
// SubnetInfoOKCode is the HTTP code returned for type SubnetInfoOK
|
||||
const SubnetInfoOKCode int = 200
|
||||
|
||||
/*SubscriptionInfoOK A successful response.
|
||||
/*SubnetInfoOK A successful response.
|
||||
|
||||
swagger:response subscriptionInfoOK
|
||||
swagger:response subnetInfoOK
|
||||
*/
|
||||
type SubscriptionInfoOK struct {
|
||||
type SubnetInfoOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
@@ -45,25 +45,25 @@ type SubscriptionInfoOK struct {
|
||||
Payload *models.License `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubscriptionInfoOK creates SubscriptionInfoOK with default headers values
|
||||
func NewSubscriptionInfoOK() *SubscriptionInfoOK {
|
||||
// NewSubnetInfoOK creates SubnetInfoOK with default headers values
|
||||
func NewSubnetInfoOK() *SubnetInfoOK {
|
||||
|
||||
return &SubscriptionInfoOK{}
|
||||
return &SubnetInfoOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subscription info o k response
|
||||
func (o *SubscriptionInfoOK) WithPayload(payload *models.License) *SubscriptionInfoOK {
|
||||
// WithPayload adds the payload to the subnet info o k response
|
||||
func (o *SubnetInfoOK) WithPayload(payload *models.License) *SubnetInfoOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subscription info o k response
|
||||
func (o *SubscriptionInfoOK) SetPayload(payload *models.License) {
|
||||
// SetPayload sets the payload to the subnet info o k response
|
||||
func (o *SubnetInfoOK) SetPayload(payload *models.License) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubscriptionInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
func (o *SubnetInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
@@ -74,11 +74,11 @@ func (o *SubscriptionInfoOK) WriteResponse(rw http.ResponseWriter, producer runt
|
||||
}
|
||||
}
|
||||
|
||||
/*SubscriptionInfoDefault Generic error response.
|
||||
/*SubnetInfoDefault Generic error response.
|
||||
|
||||
swagger:response subscriptionInfoDefault
|
||||
swagger:response subnetInfoDefault
|
||||
*/
|
||||
type SubscriptionInfoDefault struct {
|
||||
type SubnetInfoDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
@@ -87,41 +87,41 @@ type SubscriptionInfoDefault struct {
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubscriptionInfoDefault creates SubscriptionInfoDefault with default headers values
|
||||
func NewSubscriptionInfoDefault(code int) *SubscriptionInfoDefault {
|
||||
// NewSubnetInfoDefault creates SubnetInfoDefault with default headers values
|
||||
func NewSubnetInfoDefault(code int) *SubnetInfoDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &SubscriptionInfoDefault{
|
||||
return &SubnetInfoDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the subscription info default response
|
||||
func (o *SubscriptionInfoDefault) WithStatusCode(code int) *SubscriptionInfoDefault {
|
||||
// WithStatusCode adds the status to the subnet info default response
|
||||
func (o *SubnetInfoDefault) WithStatusCode(code int) *SubnetInfoDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the subscription info default response
|
||||
func (o *SubscriptionInfoDefault) SetStatusCode(code int) {
|
||||
// SetStatusCode sets the status to the subnet info default response
|
||||
func (o *SubnetInfoDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subscription info default response
|
||||
func (o *SubscriptionInfoDefault) WithPayload(payload *models.Error) *SubscriptionInfoDefault {
|
||||
// WithPayload adds the payload to the subnet info default response
|
||||
func (o *SubnetInfoDefault) WithPayload(payload *models.Error) *SubnetInfoDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subscription info default response
|
||||
func (o *SubscriptionInfoDefault) SetPayload(payload *models.Error) {
|
||||
// SetPayload sets the payload to the subnet info default response
|
||||
func (o *SubnetInfoDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubscriptionInfoDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
func (o *SubnetInfoDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
@@ -28,15 +28,15 @@ import (
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// SubscriptionInfoURL generates an URL for the subscription info operation
|
||||
type SubscriptionInfoURL struct {
|
||||
// SubnetInfoURL generates an URL for the subnet info operation
|
||||
type SubnetInfoURL 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 *SubscriptionInfoURL) WithBasePath(bp string) *SubscriptionInfoURL {
|
||||
func (o *SubnetInfoURL) WithBasePath(bp string) *SubnetInfoURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
@@ -44,15 +44,15 @@ func (o *SubscriptionInfoURL) WithBasePath(bp string) *SubscriptionInfoURL {
|
||||
// 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 *SubscriptionInfoURL) SetBasePath(bp string) {
|
||||
func (o *SubnetInfoURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *SubscriptionInfoURL) Build() (*url.URL, error) {
|
||||
func (o *SubnetInfoURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subscription/info"
|
||||
var _path = "/subnet/info"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@@ -64,7 +64,7 @@ func (o *SubscriptionInfoURL) Build() (*url.URL, error) {
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *SubscriptionInfoURL) Must(u *url.URL, err error) *url.URL {
|
||||
func (o *SubnetInfoURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -75,17 +75,17 @@ func (o *SubscriptionInfoURL) Must(u *url.URL, err error) *url.URL {
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *SubscriptionInfoURL) String() string {
|
||||
func (o *SubnetInfoURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *SubscriptionInfoURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
func (o *SubnetInfoURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on SubscriptionInfoURL")
|
||||
return nil, errors.New("scheme is required for a full url on SubnetInfoURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on SubscriptionInfoURL")
|
||||
return nil, errors.New("host is required for a full url on SubnetInfoURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
@@ -99,6 +99,6 @@ func (o *SubscriptionInfoURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *SubscriptionInfoURL) StringFull(scheme, host string) string {
|
||||
func (o *SubnetInfoURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
88
restapi/operations/admin_api/subnet_login.go
Normal file
88
restapi/operations/admin_api/subnet_login.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) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetLoginHandlerFunc turns a function with the right signature into a subnet login handler
|
||||
type SubnetLoginHandlerFunc func(SubnetLoginParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn SubnetLoginHandlerFunc) Handle(params SubnetLoginParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// SubnetLoginHandler interface for that can handle valid subnet login params
|
||||
type SubnetLoginHandler interface {
|
||||
Handle(SubnetLoginParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewSubnetLogin creates a new http.Handler for the subnet login operation
|
||||
func NewSubnetLogin(ctx *middleware.Context, handler SubnetLoginHandler) *SubnetLogin {
|
||||
return &SubnetLogin{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* SubnetLogin swagger:route POST /subnet/login AdminAPI subnetLogin
|
||||
|
||||
Login to subnet
|
||||
|
||||
*/
|
||||
type SubnetLogin struct {
|
||||
Context *middleware.Context
|
||||
Handler SubnetLoginHandler
|
||||
}
|
||||
|
||||
func (o *SubnetLogin) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewSubnetLoginParams()
|
||||
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)
|
||||
|
||||
}
|
||||
88
restapi/operations/admin_api/subnet_login_m_f_a.go
Normal file
88
restapi/operations/admin_api/subnet_login_m_f_a.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) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetLoginMFAHandlerFunc turns a function with the right signature into a subnet login m f a handler
|
||||
type SubnetLoginMFAHandlerFunc func(SubnetLoginMFAParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn SubnetLoginMFAHandlerFunc) Handle(params SubnetLoginMFAParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// SubnetLoginMFAHandler interface for that can handle valid subnet login m f a params
|
||||
type SubnetLoginMFAHandler interface {
|
||||
Handle(SubnetLoginMFAParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewSubnetLoginMFA creates a new http.Handler for the subnet login m f a operation
|
||||
func NewSubnetLoginMFA(ctx *middleware.Context, handler SubnetLoginMFAHandler) *SubnetLoginMFA {
|
||||
return &SubnetLoginMFA{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* SubnetLoginMFA swagger:route POST /subnet/login/mfa AdminAPI subnetLoginMFA
|
||||
|
||||
Login to subnet using mfa
|
||||
|
||||
*/
|
||||
type SubnetLoginMFA struct {
|
||||
Context *middleware.Context
|
||||
Handler SubnetLoginMFAHandler
|
||||
}
|
||||
|
||||
func (o *SubnetLoginMFA) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewSubnetLoginMFAParams()
|
||||
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)
|
||||
|
||||
}
|
||||
102
restapi/operations/admin_api/subnet_login_m_f_a_parameters.go
Normal file
102
restapi/operations/admin_api/subnet_login_m_f_a_parameters.go
Normal file
@@ -0,0 +1,102 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewSubnetLoginMFAParams creates a new SubnetLoginMFAParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewSubnetLoginMFAParams() SubnetLoginMFAParams {
|
||||
|
||||
return SubnetLoginMFAParams{}
|
||||
}
|
||||
|
||||
// SubnetLoginMFAParams contains all the bound params for the subnet login m f a operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters SubnetLoginMFA
|
||||
type SubnetLoginMFAParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.SubnetLoginMFARequest
|
||||
}
|
||||
|
||||
// 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 NewSubnetLoginMFAParams() beforehand.
|
||||
func (o *SubnetLoginMFAParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.SubnetLoginMFARequest
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(context.Background())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
133
restapi/operations/admin_api/subnet_login_m_f_a_responses.go
Normal file
133
restapi/operations/admin_api/subnet_login_m_f_a_responses.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetLoginMFAOKCode is the HTTP code returned for type SubnetLoginMFAOK
|
||||
const SubnetLoginMFAOKCode int = 200
|
||||
|
||||
/*SubnetLoginMFAOK A successful response.
|
||||
|
||||
swagger:response subnetLoginMFAOK
|
||||
*/
|
||||
type SubnetLoginMFAOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.SubnetLoginResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubnetLoginMFAOK creates SubnetLoginMFAOK with default headers values
|
||||
func NewSubnetLoginMFAOK() *SubnetLoginMFAOK {
|
||||
|
||||
return &SubnetLoginMFAOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subnet login m f a o k response
|
||||
func (o *SubnetLoginMFAOK) WithPayload(payload *models.SubnetLoginResponse) *SubnetLoginMFAOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subnet login m f a o k response
|
||||
func (o *SubnetLoginMFAOK) SetPayload(payload *models.SubnetLoginResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubnetLoginMFAOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*SubnetLoginMFADefault Generic error response.
|
||||
|
||||
swagger:response subnetLoginMFADefault
|
||||
*/
|
||||
type SubnetLoginMFADefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubnetLoginMFADefault creates SubnetLoginMFADefault with default headers values
|
||||
func NewSubnetLoginMFADefault(code int) *SubnetLoginMFADefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &SubnetLoginMFADefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the subnet login m f a default response
|
||||
func (o *SubnetLoginMFADefault) WithStatusCode(code int) *SubnetLoginMFADefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the subnet login m f a default response
|
||||
func (o *SubnetLoginMFADefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subnet login m f a default response
|
||||
func (o *SubnetLoginMFADefault) WithPayload(payload *models.Error) *SubnetLoginMFADefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subnet login m f a default response
|
||||
func (o *SubnetLoginMFADefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubnetLoginMFADefault) 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/admin_api/subnet_login_m_f_a_urlbuilder.go
Normal file
104
restapi/operations/admin_api/subnet_login_m_f_a_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) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetLoginMFAURL generates an URL for the subnet login m f a operation
|
||||
type SubnetLoginMFAURL 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 *SubnetLoginMFAURL) WithBasePath(bp string) *SubnetLoginMFAURL {
|
||||
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 *SubnetLoginMFAURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *SubnetLoginMFAURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subnet/login/mfa"
|
||||
|
||||
_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 *SubnetLoginMFAURL) 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 *SubnetLoginMFAURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *SubnetLoginMFAURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on SubnetLoginMFAURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on SubnetLoginMFAURL")
|
||||
}
|
||||
|
||||
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 *SubnetLoginMFAURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
102
restapi/operations/admin_api/subnet_login_parameters.go
Normal file
102
restapi/operations/admin_api/subnet_login_parameters.go
Normal file
@@ -0,0 +1,102 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewSubnetLoginParams creates a new SubnetLoginParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewSubnetLoginParams() SubnetLoginParams {
|
||||
|
||||
return SubnetLoginParams{}
|
||||
}
|
||||
|
||||
// SubnetLoginParams contains all the bound params for the subnet login operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters SubnetLogin
|
||||
type SubnetLoginParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.SubnetLoginRequest
|
||||
}
|
||||
|
||||
// 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 NewSubnetLoginParams() beforehand.
|
||||
func (o *SubnetLoginParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.SubnetLoginRequest
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(context.Background())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
133
restapi/operations/admin_api/subnet_login_responses.go
Normal file
133
restapi/operations/admin_api/subnet_login_responses.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetLoginOKCode is the HTTP code returned for type SubnetLoginOK
|
||||
const SubnetLoginOKCode int = 200
|
||||
|
||||
/*SubnetLoginOK A successful response.
|
||||
|
||||
swagger:response subnetLoginOK
|
||||
*/
|
||||
type SubnetLoginOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.SubnetLoginResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubnetLoginOK creates SubnetLoginOK with default headers values
|
||||
func NewSubnetLoginOK() *SubnetLoginOK {
|
||||
|
||||
return &SubnetLoginOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subnet login o k response
|
||||
func (o *SubnetLoginOK) WithPayload(payload *models.SubnetLoginResponse) *SubnetLoginOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subnet login o k response
|
||||
func (o *SubnetLoginOK) SetPayload(payload *models.SubnetLoginResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubnetLoginOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*SubnetLoginDefault Generic error response.
|
||||
|
||||
swagger:response subnetLoginDefault
|
||||
*/
|
||||
type SubnetLoginDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubnetLoginDefault creates SubnetLoginDefault with default headers values
|
||||
func NewSubnetLoginDefault(code int) *SubnetLoginDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &SubnetLoginDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the subnet login default response
|
||||
func (o *SubnetLoginDefault) WithStatusCode(code int) *SubnetLoginDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the subnet login default response
|
||||
func (o *SubnetLoginDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subnet login default response
|
||||
func (o *SubnetLoginDefault) WithPayload(payload *models.Error) *SubnetLoginDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subnet login default response
|
||||
func (o *SubnetLoginDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubnetLoginDefault) 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/admin_api/subnet_login_urlbuilder.go
Normal file
104
restapi/operations/admin_api/subnet_login_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) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetLoginURL generates an URL for the subnet login operation
|
||||
type SubnetLoginURL 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 *SubnetLoginURL) WithBasePath(bp string) *SubnetLoginURL {
|
||||
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 *SubnetLoginURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *SubnetLoginURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subnet/login"
|
||||
|
||||
_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 *SubnetLoginURL) 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 *SubnetLoginURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *SubnetLoginURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on SubnetLoginURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on SubnetLoginURL")
|
||||
}
|
||||
|
||||
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 *SubnetLoginURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
88
restapi/operations/admin_api/subnet_reg_token.go
Normal file
88
restapi/operations/admin_api/subnet_reg_token.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) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetRegTokenHandlerFunc turns a function with the right signature into a subnet reg token handler
|
||||
type SubnetRegTokenHandlerFunc func(SubnetRegTokenParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn SubnetRegTokenHandlerFunc) Handle(params SubnetRegTokenParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// SubnetRegTokenHandler interface for that can handle valid subnet reg token params
|
||||
type SubnetRegTokenHandler interface {
|
||||
Handle(SubnetRegTokenParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewSubnetRegToken creates a new http.Handler for the subnet reg token operation
|
||||
func NewSubnetRegToken(ctx *middleware.Context, handler SubnetRegTokenHandler) *SubnetRegToken {
|
||||
return &SubnetRegToken{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* SubnetRegToken swagger:route GET /subnet/registration-token AdminAPI subnetRegToken
|
||||
|
||||
Subnet registraton token
|
||||
|
||||
*/
|
||||
type SubnetRegToken struct {
|
||||
Context *middleware.Context
|
||||
Handler SubnetRegTokenHandler
|
||||
}
|
||||
|
||||
func (o *SubnetRegToken) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewSubnetRegTokenParams()
|
||||
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/admin_api/subnet_reg_token_parameters.go
Normal file
63
restapi/operations/admin_api/subnet_reg_token_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) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NewSubnetRegTokenParams creates a new SubnetRegTokenParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewSubnetRegTokenParams() SubnetRegTokenParams {
|
||||
|
||||
return SubnetRegTokenParams{}
|
||||
}
|
||||
|
||||
// SubnetRegTokenParams contains all the bound params for the subnet reg token operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters SubnetRegToken
|
||||
type SubnetRegTokenParams 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 NewSubnetRegTokenParams() beforehand.
|
||||
func (o *SubnetRegTokenParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
133
restapi/operations/admin_api/subnet_reg_token_responses.go
Normal file
133
restapi/operations/admin_api/subnet_reg_token_responses.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetRegTokenOKCode is the HTTP code returned for type SubnetRegTokenOK
|
||||
const SubnetRegTokenOKCode int = 200
|
||||
|
||||
/*SubnetRegTokenOK A successful response.
|
||||
|
||||
swagger:response subnetRegTokenOK
|
||||
*/
|
||||
type SubnetRegTokenOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.SubnetRegTokenResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubnetRegTokenOK creates SubnetRegTokenOK with default headers values
|
||||
func NewSubnetRegTokenOK() *SubnetRegTokenOK {
|
||||
|
||||
return &SubnetRegTokenOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subnet reg token o k response
|
||||
func (o *SubnetRegTokenOK) WithPayload(payload *models.SubnetRegTokenResponse) *SubnetRegTokenOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subnet reg token o k response
|
||||
func (o *SubnetRegTokenOK) SetPayload(payload *models.SubnetRegTokenResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubnetRegTokenOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*SubnetRegTokenDefault Generic error response.
|
||||
|
||||
swagger:response subnetRegTokenDefault
|
||||
*/
|
||||
type SubnetRegTokenDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubnetRegTokenDefault creates SubnetRegTokenDefault with default headers values
|
||||
func NewSubnetRegTokenDefault(code int) *SubnetRegTokenDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &SubnetRegTokenDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the subnet reg token default response
|
||||
func (o *SubnetRegTokenDefault) WithStatusCode(code int) *SubnetRegTokenDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the subnet reg token default response
|
||||
func (o *SubnetRegTokenDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subnet reg token default response
|
||||
func (o *SubnetRegTokenDefault) WithPayload(payload *models.Error) *SubnetRegTokenDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subnet reg token default response
|
||||
func (o *SubnetRegTokenDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubnetRegTokenDefault) 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/admin_api/subnet_reg_token_urlbuilder.go
Normal file
104
restapi/operations/admin_api/subnet_reg_token_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) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetRegTokenURL generates an URL for the subnet reg token operation
|
||||
type SubnetRegTokenURL 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 *SubnetRegTokenURL) WithBasePath(bp string) *SubnetRegTokenURL {
|
||||
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 *SubnetRegTokenURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *SubnetRegTokenURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subnet/registration-token"
|
||||
|
||||
_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 *SubnetRegTokenURL) 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 *SubnetRegTokenURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *SubnetRegTokenURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on SubnetRegTokenURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on SubnetRegTokenURL")
|
||||
}
|
||||
|
||||
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 *SubnetRegTokenURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
88
restapi/operations/admin_api/subnet_register.go
Normal file
88
restapi/operations/admin_api/subnet_register.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) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetRegisterHandlerFunc turns a function with the right signature into a subnet register handler
|
||||
type SubnetRegisterHandlerFunc func(SubnetRegisterParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn SubnetRegisterHandlerFunc) Handle(params SubnetRegisterParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// SubnetRegisterHandler interface for that can handle valid subnet register params
|
||||
type SubnetRegisterHandler interface {
|
||||
Handle(SubnetRegisterParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewSubnetRegister creates a new http.Handler for the subnet register operation
|
||||
func NewSubnetRegister(ctx *middleware.Context, handler SubnetRegisterHandler) *SubnetRegister {
|
||||
return &SubnetRegister{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* SubnetRegister swagger:route POST /subnet/register AdminAPI subnetRegister
|
||||
|
||||
Register cluster with Subnet
|
||||
|
||||
*/
|
||||
type SubnetRegister struct {
|
||||
Context *middleware.Context
|
||||
Handler SubnetRegisterHandler
|
||||
}
|
||||
|
||||
func (o *SubnetRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewSubnetRegisterParams()
|
||||
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)
|
||||
|
||||
}
|
||||
102
restapi/operations/admin_api/subnet_register_parameters.go
Normal file
102
restapi/operations/admin_api/subnet_register_parameters.go
Normal file
@@ -0,0 +1,102 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewSubnetRegisterParams creates a new SubnetRegisterParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewSubnetRegisterParams() SubnetRegisterParams {
|
||||
|
||||
return SubnetRegisterParams{}
|
||||
}
|
||||
|
||||
// SubnetRegisterParams contains all the bound params for the subnet register operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters SubnetRegister
|
||||
type SubnetRegisterParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.SubnetRegisterRequest
|
||||
}
|
||||
|
||||
// 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 NewSubnetRegisterParams() beforehand.
|
||||
func (o *SubnetRegisterParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.SubnetRegisterRequest
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(context.Background())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
113
restapi/operations/admin_api/subnet_register_responses.go
Normal file
113
restapi/operations/admin_api/subnet_register_responses.go
Normal file
@@ -0,0 +1,113 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetRegisterOKCode is the HTTP code returned for type SubnetRegisterOK
|
||||
const SubnetRegisterOKCode int = 200
|
||||
|
||||
/*SubnetRegisterOK A successful response.
|
||||
|
||||
swagger:response subnetRegisterOK
|
||||
*/
|
||||
type SubnetRegisterOK struct {
|
||||
}
|
||||
|
||||
// NewSubnetRegisterOK creates SubnetRegisterOK with default headers values
|
||||
func NewSubnetRegisterOK() *SubnetRegisterOK {
|
||||
|
||||
return &SubnetRegisterOK{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubnetRegisterOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(200)
|
||||
}
|
||||
|
||||
/*SubnetRegisterDefault Generic error response.
|
||||
|
||||
swagger:response subnetRegisterDefault
|
||||
*/
|
||||
type SubnetRegisterDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubnetRegisterDefault creates SubnetRegisterDefault with default headers values
|
||||
func NewSubnetRegisterDefault(code int) *SubnetRegisterDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &SubnetRegisterDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the subnet register default response
|
||||
func (o *SubnetRegisterDefault) WithStatusCode(code int) *SubnetRegisterDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the subnet register default response
|
||||
func (o *SubnetRegisterDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subnet register default response
|
||||
func (o *SubnetRegisterDefault) WithPayload(payload *models.Error) *SubnetRegisterDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subnet register default response
|
||||
func (o *SubnetRegisterDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubnetRegisterDefault) 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/admin_api/subnet_register_urlbuilder.go
Normal file
104
restapi/operations/admin_api/subnet_register_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) 2021 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 admin_api
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SubnetRegisterURL generates an URL for the subnet register operation
|
||||
type SubnetRegisterURL 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 *SubnetRegisterURL) WithBasePath(bp string) *SubnetRegisterURL {
|
||||
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 *SubnetRegisterURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *SubnetRegisterURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subnet/register"
|
||||
|
||||
_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 *SubnetRegisterURL) 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 *SubnetRegisterURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *SubnetRegisterURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on SubnetRegisterURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on SubnetRegisterURL")
|
||||
}
|
||||
|
||||
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 *SubnetRegisterURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -350,8 +350,20 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
UserAPIShareObjectHandler: user_api.ShareObjectHandlerFunc(func(params user_api.ShareObjectParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user_api.ShareObject has not yet been implemented")
|
||||
}),
|
||||
AdminAPISubscriptionInfoHandler: admin_api.SubscriptionInfoHandlerFunc(func(params admin_api.SubscriptionInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.SubscriptionInfo has not yet been implemented")
|
||||
AdminAPISubnetInfoHandler: admin_api.SubnetInfoHandlerFunc(func(params admin_api.SubnetInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.SubnetInfo has not yet been implemented")
|
||||
}),
|
||||
AdminAPISubnetLoginHandler: admin_api.SubnetLoginHandlerFunc(func(params admin_api.SubnetLoginParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.SubnetLogin has not yet been implemented")
|
||||
}),
|
||||
AdminAPISubnetLoginMFAHandler: admin_api.SubnetLoginMFAHandlerFunc(func(params admin_api.SubnetLoginMFAParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.SubnetLoginMFA has not yet been implemented")
|
||||
}),
|
||||
AdminAPISubnetRegTokenHandler: admin_api.SubnetRegTokenHandlerFunc(func(params admin_api.SubnetRegTokenParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.SubnetRegToken has not yet been implemented")
|
||||
}),
|
||||
AdminAPISubnetRegisterHandler: admin_api.SubnetRegisterHandlerFunc(func(params admin_api.SubnetRegisterParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.SubnetRegister has not yet been implemented")
|
||||
}),
|
||||
AdminAPITiersListHandler: admin_api.TiersListHandlerFunc(func(params admin_api.TiersListParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.TiersList has not yet been implemented")
|
||||
@@ -616,8 +628,16 @@ type ConsoleAPI struct {
|
||||
AdminAPISetPolicyMultipleHandler admin_api.SetPolicyMultipleHandler
|
||||
// UserAPIShareObjectHandler sets the operation handler for the share object operation
|
||||
UserAPIShareObjectHandler user_api.ShareObjectHandler
|
||||
// AdminAPISubscriptionInfoHandler sets the operation handler for the subscription info operation
|
||||
AdminAPISubscriptionInfoHandler admin_api.SubscriptionInfoHandler
|
||||
// AdminAPISubnetInfoHandler sets the operation handler for the subnet info operation
|
||||
AdminAPISubnetInfoHandler admin_api.SubnetInfoHandler
|
||||
// AdminAPISubnetLoginHandler sets the operation handler for the subnet login operation
|
||||
AdminAPISubnetLoginHandler admin_api.SubnetLoginHandler
|
||||
// AdminAPISubnetLoginMFAHandler sets the operation handler for the subnet login m f a operation
|
||||
AdminAPISubnetLoginMFAHandler admin_api.SubnetLoginMFAHandler
|
||||
// AdminAPISubnetRegTokenHandler sets the operation handler for the subnet reg token operation
|
||||
AdminAPISubnetRegTokenHandler admin_api.SubnetRegTokenHandler
|
||||
// AdminAPISubnetRegisterHandler sets the operation handler for the subnet register operation
|
||||
AdminAPISubnetRegisterHandler admin_api.SubnetRegisterHandler
|
||||
// AdminAPITiersListHandler sets the operation handler for the tiers list operation
|
||||
AdminAPITiersListHandler admin_api.TiersListHandler
|
||||
// UserAPIUpdateBucketLifecycleHandler sets the operation handler for the update bucket lifecycle operation
|
||||
@@ -1002,8 +1022,20 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.UserAPIShareObjectHandler == nil {
|
||||
unregistered = append(unregistered, "user_api.ShareObjectHandler")
|
||||
}
|
||||
if o.AdminAPISubscriptionInfoHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.SubscriptionInfoHandler")
|
||||
if o.AdminAPISubnetInfoHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.SubnetInfoHandler")
|
||||
}
|
||||
if o.AdminAPISubnetLoginHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.SubnetLoginHandler")
|
||||
}
|
||||
if o.AdminAPISubnetLoginMFAHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.SubnetLoginMFAHandler")
|
||||
}
|
||||
if o.AdminAPISubnetRegTokenHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.SubnetRegTokenHandler")
|
||||
}
|
||||
if o.AdminAPISubnetRegisterHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.SubnetRegisterHandler")
|
||||
}
|
||||
if o.AdminAPITiersListHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.TiersListHandler")
|
||||
@@ -1508,7 +1540,23 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/subscription/info"] = admin_api.NewSubscriptionInfo(o.context, o.AdminAPISubscriptionInfoHandler)
|
||||
o.handlers["GET"]["/subnet/info"] = admin_api.NewSubnetInfo(o.context, o.AdminAPISubnetInfoHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subnet/login"] = admin_api.NewSubnetLogin(o.context, o.AdminAPISubnetLoginHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subnet/login/mfa"] = admin_api.NewSubnetLoginMFA(o.context, o.AdminAPISubnetLoginMFAHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/subnet/registration-token"] = admin_api.NewSubnetRegToken(o.context, o.AdminAPISubnetRegTokenHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subnet/register"] = admin_api.NewSubnetRegister(o.context, o.AdminAPISubnetRegisterHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user