mirror of
https://github.com/openziti/ziti.git
synced 2026-10-23 12:15:35 +00:00
Merge pull request #656 from openziti/api.spec.split
splits API specs into composable modules
This commit is contained in:
@@ -34,6 +34,14 @@ func ToRestModel(e *errorz.ApiError, requestId string) *rest_model.APIError {
|
||||
}
|
||||
|
||||
if e.Cause != nil {
|
||||
|
||||
//unwrap first error in composite error
|
||||
compositeErr, ok := e.Cause.(*errors.CompositeError)
|
||||
for ok {
|
||||
e.Cause = compositeErr.Errors[0]
|
||||
compositeErr, ok = e.Cause.(*errors.CompositeError)
|
||||
}
|
||||
|
||||
if causeApiError, ok := e.Cause.(*errorz.ApiError); ok {
|
||||
//standard apierror
|
||||
ret.Cause = &rest_model.APIErrorCause{
|
||||
@@ -72,6 +80,9 @@ func ToRestModel(e *errorz.ApiError, requestId string) *rest_model.APIError {
|
||||
Value: fmt.Sprintf("%v", causeFieldErr.Value),
|
||||
},
|
||||
}
|
||||
ret.Code = errorz.CouldNotValidateCode
|
||||
ret.Message = errorz.CouldNotValidateMessage
|
||||
|
||||
} else if genericErr, ok := e.Cause.(GenericCauseError); ok {
|
||||
ret.Cause = &rest_model.APIErrorCause{
|
||||
APIError: rest_model.APIError{
|
||||
|
||||
Vendored
+31
-15
@@ -39,8 +39,10 @@ import (
|
||||
"github.com/openziti/edge/events"
|
||||
"github.com/openziti/edge/internal/cert"
|
||||
"github.com/openziti/edge/internal/jwt"
|
||||
"github.com/openziti/edge/rest_server"
|
||||
"github.com/openziti/edge/rest_server/operations"
|
||||
clientServer "github.com/openziti/edge/rest_client_api_server"
|
||||
clientOperations "github.com/openziti/edge/rest_client_api_server/operations"
|
||||
managementServer "github.com/openziti/edge/rest_management_api_server"
|
||||
managementOperations "github.com/openziti/edge/rest_management_api_server/operations"
|
||||
"github.com/openziti/fabric/controller/network"
|
||||
"github.com/openziti/fabric/controller/xctrl"
|
||||
"github.com/openziti/fabric/controller/xmgmt"
|
||||
@@ -73,7 +75,8 @@ type AppEnv struct {
|
||||
EnrollRegistry model.EnrollmentRegistry
|
||||
Broker *Broker
|
||||
HostController HostController
|
||||
Api *operations.ZitiEdgeAPI
|
||||
ManagementApi *managementOperations.ZitiEdgeManagementAPI
|
||||
ClientApi *clientOperations.ZitiEdgeClientAPI
|
||||
IdentityRefreshMap cmap.ConcurrentMap
|
||||
StartupTime time.Time
|
||||
InstanceId string
|
||||
@@ -276,13 +279,21 @@ func (ae *AppEnv) FillRequestContext(rc *response.RequestContext) error {
|
||||
}
|
||||
|
||||
func NewAppEnv(c *edgeConfig.Config) *AppEnv {
|
||||
swaggerSpec, err := loads.Embedded(rest_server.SwaggerJSON, rest_server.FlatSwaggerJSON)
|
||||
clientSpec, err := loads.Embedded(clientServer.SwaggerJSON, clientServer.FlatSwaggerJSON)
|
||||
if err != nil {
|
||||
pfxlog.Logger().Fatalln(err)
|
||||
}
|
||||
|
||||
api := operations.NewZitiEdgeAPI(swaggerSpec)
|
||||
api.ServeError = ServeError
|
||||
managementSpec, err := loads.Embedded(managementServer.SwaggerJSON, managementServer.FlatSwaggerJSON)
|
||||
if err != nil {
|
||||
pfxlog.Logger().Fatalln(err)
|
||||
}
|
||||
|
||||
clientApi := clientOperations.NewZitiEdgeClientAPI(clientSpec)
|
||||
clientApi.ServeError = ServeError
|
||||
|
||||
managementApi := managementOperations.NewZitiEdgeManagementAPI(managementSpec)
|
||||
managementApi.ServeError = ServeError
|
||||
|
||||
ae := &AppEnv{
|
||||
Config: c,
|
||||
@@ -293,23 +304,25 @@ func NewAppEnv(c *edgeConfig.Config) *AppEnv {
|
||||
InstanceId: cuid.New(),
|
||||
AuthRegistry: &model.AuthProcessorRegistryImpl{},
|
||||
EnrollRegistry: &model.EnrollmentRegistryImpl{},
|
||||
Api: api,
|
||||
ManagementApi: managementApi,
|
||||
ClientApi: clientApi,
|
||||
IdentityRefreshMap: cmap.New(),
|
||||
StartupTime: time.Now().UTC(),
|
||||
}
|
||||
|
||||
api.APIAuthorizer = authorizer{}
|
||||
clientApi.APIAuthorizer = authorizer{}
|
||||
managementApi.APIAuthorizer = authorizer{}
|
||||
|
||||
noOpConsumer := runtime.ConsumerFunc(func(reader io.Reader, data interface{}) error {
|
||||
return nil //do nothing
|
||||
})
|
||||
|
||||
//enrollment consumer, leave content unread, allow modules to read
|
||||
api.ApplicationXPemFileConsumer = noOpConsumer
|
||||
api.ApplicationPkcs10Consumer = noOpConsumer
|
||||
api.ApplicationXPemFileProducer = &PemProducer{}
|
||||
api.TextYamlProducer = &YamlProducer{}
|
||||
api.ZtSessionAuth = func(token string) (principal interface{}, err error) {
|
||||
clientApi.ApplicationXPemFileConsumer = noOpConsumer
|
||||
clientApi.ApplicationPkcs10Consumer = noOpConsumer
|
||||
clientApi.ApplicationXPemFileProducer = &PemProducer{}
|
||||
clientApi.TextYamlProducer = &YamlProducer{}
|
||||
clientApi.ZtSessionAuth = func(token string) (principal interface{}, err error) {
|
||||
principal, err = ae.GetHandlers().ApiSession.ReadByToken(token)
|
||||
|
||||
if err != nil {
|
||||
@@ -323,6 +336,9 @@ func NewAppEnv(c *edgeConfig.Config) *AppEnv {
|
||||
return principal, nil
|
||||
}
|
||||
|
||||
managementApi.TextYamlProducer = &YamlProducer{}
|
||||
managementApi.ZtSessionAuth = clientApi.ZtSessionAuth
|
||||
|
||||
sm := getJwtSigningMethod(c.Api.Identity.ServerCert())
|
||||
key := c.Api.Identity.ServerCert().PrivateKey
|
||||
|
||||
@@ -421,7 +437,7 @@ func (ae *AppEnv) CreateRequestContext(rw http.ResponseWriter, r *http.Request)
|
||||
return requestContext
|
||||
}
|
||||
|
||||
//use own type to avoid collisions
|
||||
// ContextKey is used a custom type to avoid accidental context key collisions
|
||||
type ContextKey string
|
||||
|
||||
const EdgeContextKey = ContextKey("edgeContext")
|
||||
@@ -478,4 +494,4 @@ func (ae *AppEnv) HandleServiceEvent(event *persistence.ServiceEvent) {
|
||||
|
||||
func (ae *AppEnv) HandleServiceUpdatedEventForIdentityId(identityId string) {
|
||||
ae.IdentityRefreshMap.Set(identityId, time.Now().UTC())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ func MapApiSessionToRestModel(ae *env.AppEnv, apiSession *model.ApiSession) (*re
|
||||
}
|
||||
|
||||
func newAuthCheckZitiMfa() *rest_model.AuthQueryDetail {
|
||||
provider := rest_model.MfaProvidersZiti
|
||||
return &rest_model.AuthQueryDetail{
|
||||
TypeID: "MFA",
|
||||
Format: rest_model.MfaFormatsAlphaNumeric,
|
||||
@@ -119,6 +120,6 @@ func newAuthCheckZitiMfa() *rest_model.AuthQueryDetail {
|
||||
HTTPURL: "./authenticate/mfa",
|
||||
MaxLength: model.TotpMaxLength,
|
||||
MinLength: model.TotpMinLength,
|
||||
Provider: rest_model.MfaProvidersZiti,
|
||||
Provider: &provider,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/api_session"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/api_session"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -40,15 +40,15 @@ func NewApiSessionRouter() *ApiSessionHandler {
|
||||
}
|
||||
|
||||
func (ir *ApiSessionHandler) Register(ae *env.AppEnv) {
|
||||
ae.Api.APISessionDeleteAPISessionsHandler = api_session.DeleteAPISessionsHandlerFunc(func(params api_session.DeleteAPISessionsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.APISessionDeleteAPISessionsHandler = api_session.DeleteAPISessionsHandlerFunc(func(params api_session.DeleteAPISessionsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(ir.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.APISessionDetailAPISessionsHandler = api_session.DetailAPISessionsHandlerFunc(func(params api_session.DetailAPISessionsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.APISessionDetailAPISessionsHandler = api_session.DetailAPISessionsHandlerFunc(func(params api_session.DetailAPISessionsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(ir.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.APISessionListAPISessionsHandler = api_session.ListAPISessionsHandlerFunc(func(params api_session.ListAPISessionsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.APISessionListAPISessionsHandler = api_session.ListAPISessionsHandlerFunc(func(params api_session.ListAPISessionsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(ir.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
@@ -63,4 +63,4 @@ func (ir *ApiSessionHandler) Detail(ae *env.AppEnv, rc *response.RequestContext)
|
||||
|
||||
func (ir *ApiSessionHandler) Delete(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
DeleteWithHandler(rc, ae.Handlers.ApiSession)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,9 @@ import (
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/model"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
clientApiAuthentication "github.com/openziti/edge/rest_client_api_server/operations/authentication"
|
||||
managementApiAuthentication "github.com/openziti/edge/rest_management_api_server/operations/authentication"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/authentication"
|
||||
"github.com/openziti/foundation/common/constants"
|
||||
"github.com/openziti/foundation/metrics"
|
||||
"github.com/openziti/foundation/util/errorz"
|
||||
@@ -51,19 +52,27 @@ func NewAuthRouter() *AuthRouter {
|
||||
|
||||
func (ro *AuthRouter) Register(ae *env.AppEnv) {
|
||||
ro.createTimer = ae.GetHostController().GetNetwork().GetMetricsRegistry().Timer("api-session.create")
|
||||
ae.Api.AuthenticationAuthenticateHandler = authentication.AuthenticateHandlerFunc(func(params authentication.AuthenticateParams) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { ro.authHandler(ae, rc, params) }, params.HTTPRequest, "", "", permissions.Always())
|
||||
ae.ClientApi.AuthenticationAuthenticateHandler = clientApiAuthentication.AuthenticateHandlerFunc(func(params clientApiAuthentication.AuthenticateParams) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { ro.authHandler(ae, rc, params.HTTPRequest, params.Method, params.Auth) }, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.Api.AuthenticationAuthenticateMfaHandler = authentication.AuthenticateMfaHandlerFunc(func(params authentication.AuthenticateMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { ro.authMfa(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsPartiallyAuthenticated())
|
||||
ae.ClientApi.AuthenticationAuthenticateMfaHandler = clientApiAuthentication.AuthenticateMfaHandlerFunc(func(params clientApiAuthentication.AuthenticateMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { ro.authMfa(ae, rc, params.MfaAuth) }, params.HTTPRequest, "", "", permissions.IsPartiallyAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.AuthenticationAuthenticateHandler = managementApiAuthentication.AuthenticateHandlerFunc(func(params managementApiAuthentication.AuthenticateParams) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { ro.authHandler(ae, rc, params.HTTPRequest, params.Method, params.Auth) }, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.ManagementApi.AuthenticationAuthenticateMfaHandler = managementApiAuthentication.AuthenticateMfaHandlerFunc(func(params managementApiAuthentication.AuthenticateMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { ro.authMfa(ae, rc, params.MfaAuth) }, params.HTTPRequest, "", "", permissions.IsPartiallyAuthenticated())
|
||||
})
|
||||
}
|
||||
|
||||
func (ro *AuthRouter) authHandler(ae *env.AppEnv, rc *response.RequestContext, params authentication.AuthenticateParams) {
|
||||
func (ro *AuthRouter) authHandler(ae *env.AppEnv, rc *response.RequestContext, httpRequest *http.Request, method string, auth *rest_model.Authenticate) {
|
||||
start := time.Now()
|
||||
logger := pfxlog.Logger()
|
||||
authContext := model.NewAuthContextHttp(params.HTTPRequest, params.Method, params.Auth)
|
||||
authContext := model.NewAuthContextHttp(httpRequest, method, auth)
|
||||
|
||||
identity, err := ae.Handlers.Authenticator.IsAuthorized(authContext)
|
||||
|
||||
@@ -116,8 +125,8 @@ func (ro *AuthRouter) authHandler(ae *env.AppEnv, rc *response.RequestContext, p
|
||||
token := uuid.New().String()
|
||||
configTypes := map[string]struct{}{}
|
||||
|
||||
if params.Auth != nil {
|
||||
configTypes = ae.Handlers.ConfigType.MapConfigTypeNamesToIds(params.Auth.ConfigTypes, identity.Id)
|
||||
if auth != nil {
|
||||
configTypes = ae.Handlers.ConfigType.MapConfigTypeNamesToIds(auth.ConfigTypes, identity.Id)
|
||||
}
|
||||
remoteIpStr := ""
|
||||
if remoteIp, _, err := net.SplitHostPort(rc.Request.RemoteAddr); err == nil {
|
||||
@@ -162,7 +171,7 @@ func (ro *AuthRouter) authHandler(ae *env.AppEnv, rc *response.RequestContext, p
|
||||
apiSession := MapToCurrentApiSessionRestModel(ae, filledApiSession, ae.Config.SessionTimeoutDuration())
|
||||
rc.ApiSession = filledApiSession
|
||||
|
||||
//re-calc session headers as they were not set wwhen ApiSession == NIL
|
||||
//re-calc session headers as they were not set when ApiSession == NIL
|
||||
response.AddSessionHeaders(rc)
|
||||
|
||||
envelope := &rest_model.CurrentAPISessionDetailEnvelope{Data: apiSession, Meta: &rest_model.Meta{}}
|
||||
@@ -174,7 +183,7 @@ func (ro *AuthRouter) authHandler(ae *env.AppEnv, rc *response.RequestContext, p
|
||||
rc.Respond(envelope, http.StatusOK)
|
||||
}
|
||||
|
||||
func (ro *AuthRouter) authMfa(ae *env.AppEnv, rc *response.RequestContext, params authentication.AuthenticateMfaParams) {
|
||||
func (ro *AuthRouter) authMfa(ae *env.AppEnv, rc *response.RequestContext, mfaCode *rest_model.MfaCode) {
|
||||
mfa, err := ae.Handlers.Mfa.ReadByIdentityId(rc.Identity.Id)
|
||||
|
||||
if err != nil {
|
||||
@@ -187,7 +196,7 @@ func (ro *AuthRouter) authMfa(ae *env.AppEnv, rc *response.RequestContext, param
|
||||
return
|
||||
}
|
||||
|
||||
ok, _ := ae.Handlers.Mfa.Verify(mfa, *params.MfaAuth.Code)
|
||||
ok, _ := ae.Handlers.Mfa.Verify(mfa, *mfaCode.Code)
|
||||
|
||||
if !ok {
|
||||
rc.RespondWithError(apierror.NewInvalidMfaTokenError())
|
||||
|
||||
@@ -85,8 +85,8 @@ func MapUpdateAuthenticatorToModel(id string, in *rest_model.AuthenticatorUpdate
|
||||
|
||||
result.SubType = &model.AuthenticatorUpdb{
|
||||
Authenticator: result,
|
||||
Username: string(in.Username),
|
||||
Password: string(in.Password),
|
||||
Username: string(*in.Username),
|
||||
Password: string(*in.Password),
|
||||
Salt: "",
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/authenticator"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/authenticator"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -40,27 +40,27 @@ func NewAuthenticatorRouter() *AuthenticatorRouter {
|
||||
}
|
||||
|
||||
func (r *AuthenticatorRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.AuthenticatorDeleteAuthenticatorHandler = authenticator.DeleteAuthenticatorHandlerFunc(func(params authenticator.DeleteAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.AuthenticatorDeleteAuthenticatorHandler = authenticator.DeleteAuthenticatorHandlerFunc(func(params authenticator.DeleteAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.AuthenticatorDetailAuthenticatorHandler = authenticator.DetailAuthenticatorHandlerFunc(func(params authenticator.DetailAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.AuthenticatorDetailAuthenticatorHandler = authenticator.DetailAuthenticatorHandlerFunc(func(params authenticator.DetailAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.AuthenticatorListAuthenticatorsHandler = authenticator.ListAuthenticatorsHandlerFunc(func(params authenticator.ListAuthenticatorsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.AuthenticatorListAuthenticatorsHandler = authenticator.ListAuthenticatorsHandlerFunc(func(params authenticator.ListAuthenticatorsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.AuthenticatorUpdateAuthenticatorHandler = authenticator.UpdateAuthenticatorHandlerFunc(func(params authenticator.UpdateAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.AuthenticatorUpdateAuthenticatorHandler = authenticator.UpdateAuthenticatorHandlerFunc(func(params authenticator.UpdateAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.AuthenticatorCreateAuthenticatorHandler = authenticator.CreateAuthenticatorHandlerFunc(func(params authenticator.CreateAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.AuthenticatorCreateAuthenticatorHandler = authenticator.CreateAuthenticatorHandlerFunc(func(params authenticator.CreateAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.AuthenticatorPatchAuthenticatorHandler = authenticator.PatchAuthenticatorHandlerFunc(func(params authenticator.PatchAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.AuthenticatorPatchAuthenticatorHandler = authenticator.PatchAuthenticatorHandlerFunc(func(params authenticator.PatchAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/certificate_authority"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/certificate_authority"
|
||||
"github.com/openziti/foundation/storage/boltz"
|
||||
"github.com/openziti/sdk-golang/ziti/config"
|
||||
"github.com/pkg/errors"
|
||||
@@ -50,37 +50,37 @@ func NewCaRouter() *CaRouter {
|
||||
}
|
||||
|
||||
func (r *CaRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.CertificateAuthorityDeleteCaHandler = certificate_authority.DeleteCaHandlerFunc(func(params certificate_authority.DeleteCaParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.CertificateAuthorityDeleteCaHandler = certificate_authority.DeleteCaHandlerFunc(func(params certificate_authority.DeleteCaParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.CertificateAuthorityDetailCaHandler = certificate_authority.DetailCaHandlerFunc(func(params certificate_authority.DetailCaParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.CertificateAuthorityDetailCaHandler = certificate_authority.DetailCaHandlerFunc(func(params certificate_authority.DetailCaParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.CertificateAuthorityListCasHandler = certificate_authority.ListCasHandlerFunc(func(params certificate_authority.ListCasParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.CertificateAuthorityListCasHandler = certificate_authority.ListCasHandlerFunc(func(params certificate_authority.ListCasParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.CertificateAuthorityUpdateCaHandler = certificate_authority.UpdateCaHandlerFunc(func(params certificate_authority.UpdateCaParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.CertificateAuthorityUpdateCaHandler = certificate_authority.UpdateCaHandlerFunc(func(params certificate_authority.UpdateCaParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.CertificateAuthorityCreateCaHandler = certificate_authority.CreateCaHandlerFunc(func(params certificate_authority.CreateCaParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.CertificateAuthorityCreateCaHandler = certificate_authority.CreateCaHandlerFunc(func(params certificate_authority.CreateCaParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.CertificateAuthorityPatchCaHandler = certificate_authority.PatchCaHandlerFunc(func(params certificate_authority.PatchCaParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.CertificateAuthorityPatchCaHandler = certificate_authority.PatchCaHandlerFunc(func(params certificate_authority.PatchCaParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.CertificateAuthorityVerifyCaHandler = certificate_authority.VerifyCaHandlerFunc(func(params certificate_authority.VerifyCaParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.CertificateAuthorityVerifyCaHandler = certificate_authority.VerifyCaHandlerFunc(func(params certificate_authority.VerifyCaParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.VerifyCert(ae, rc, params)
|
||||
}, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.CertificateAuthorityGetCaJwtHandler = certificate_authority.GetCaJwtHandlerFunc(func(params certificate_authority.GetCaJwtParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.CertificateAuthorityGetCaJwtHandler = certificate_authority.GetCaJwtHandlerFunc(func(params certificate_authority.GetCaJwtParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.generateJwt(ae, rc)
|
||||
}, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/config"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/config"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,27 +41,27 @@ func NewConfigRouter() *ConfigRouter {
|
||||
}
|
||||
|
||||
func (r *ConfigRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.ConfigDeleteConfigHandler = config.DeleteConfigHandlerFunc(func(params config.DeleteConfigParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigDeleteConfigHandler = config.DeleteConfigHandlerFunc(func(params config.DeleteConfigParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigDetailConfigHandler = config.DetailConfigHandlerFunc(func(params config.DetailConfigParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigDetailConfigHandler = config.DetailConfigHandlerFunc(func(params config.DetailConfigParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigListConfigsHandler = config.ListConfigsHandlerFunc(func(params config.ListConfigsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigListConfigsHandler = config.ListConfigsHandlerFunc(func(params config.ListConfigsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigUpdateConfigHandler = config.UpdateConfigHandlerFunc(func(params config.UpdateConfigParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigUpdateConfigHandler = config.UpdateConfigHandlerFunc(func(params config.UpdateConfigParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigCreateConfigHandler = config.CreateConfigHandlerFunc(func(params config.CreateConfigParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigCreateConfigHandler = config.CreateConfigHandlerFunc(func(params config.CreateConfigParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigPatchConfigHandler = config.PatchConfigHandlerFunc(func(params config.PatchConfigParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigPatchConfigHandler = config.PatchConfigHandlerFunc(func(params config.PatchConfigParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
@@ -77,7 +77,7 @@ func (r *ConfigRouter) Detail(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
func (r *ConfigRouter) Create(ae *env.AppEnv, rc *response.RequestContext, params config.CreateConfigParams) {
|
||||
if params.Config.Data == nil {
|
||||
ctx := middleware.MatchedRouteFrom(rc.Request)
|
||||
ae.Api.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.Required("data", "body", nil))
|
||||
ae.ManagementApi.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.Required("data", "body", nil))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func (r *ConfigRouter) Delete(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
func (r *ConfigRouter) Update(ae *env.AppEnv, rc *response.RequestContext, params config.UpdateConfigParams) {
|
||||
if params.Config.Data == nil {
|
||||
ctx := middleware.MatchedRouteFrom(rc.Request)
|
||||
ae.Api.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.Required("data", "body", nil))
|
||||
ae.ManagementApi.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.Required("data", "body", nil))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/config"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/config"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,31 +41,31 @@ func NewConfigTypeRouter() *ConfigTypeRouter {
|
||||
}
|
||||
|
||||
func (r *ConfigTypeRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.ConfigDeleteConfigTypeHandler = config.DeleteConfigTypeHandlerFunc(func(params config.DeleteConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigDeleteConfigTypeHandler = config.DeleteConfigTypeHandlerFunc(func(params config.DeleteConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigDetailConfigTypeHandler = config.DetailConfigTypeHandlerFunc(func(params config.DetailConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigDetailConfigTypeHandler = config.DetailConfigTypeHandlerFunc(func(params config.DetailConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigListConfigTypesHandler = config.ListConfigTypesHandlerFunc(func(params config.ListConfigTypesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigListConfigTypesHandler = config.ListConfigTypesHandlerFunc(func(params config.ListConfigTypesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigUpdateConfigTypeHandler = config.UpdateConfigTypeHandlerFunc(func(params config.UpdateConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigUpdateConfigTypeHandler = config.UpdateConfigTypeHandlerFunc(func(params config.UpdateConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigCreateConfigTypeHandler = config.CreateConfigTypeHandlerFunc(func(params config.CreateConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigCreateConfigTypeHandler = config.CreateConfigTypeHandlerFunc(func(params config.CreateConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigPatchConfigTypeHandler = config.PatchConfigTypeHandlerFunc(func(params config.PatchConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigPatchConfigTypeHandler = config.PatchConfigTypeHandlerFunc(func(params config.PatchConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ConfigListConfigsForConfigTypeHandler = config.ListConfigsForConfigTypeHandlerFunc(func(params config.ListConfigsForConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ConfigListConfigsForConfigTypeHandler = config.ListConfigsForConfigTypeHandlerFunc(func(params config.ListConfigsForConfigTypeParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.ListConfigs(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
@@ -82,7 +82,7 @@ func (r *ConfigTypeRouter) Create(ae *env.AppEnv, rc *response.RequestContext, p
|
||||
if params.ConfigType.Schema != nil {
|
||||
if _, ok := params.ConfigType.Schema.(map[string]interface{}); !ok {
|
||||
ctx := middleware.MatchedRouteFrom(rc.Request)
|
||||
ae.Api.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.InvalidType("schema", "body", "object", params.ConfigType.Schema))
|
||||
ae.ManagementApi.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.InvalidType("schema", "body", "object", params.ConfigType.Schema))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func (r *ConfigTypeRouter) Update(ae *env.AppEnv, rc *response.RequestContext, p
|
||||
if params.ConfigType.Schema != nil {
|
||||
if _, ok := params.ConfigType.Schema.(map[string]interface{}); !ok {
|
||||
ctx := middleware.MatchedRouteFrom(rc.Request)
|
||||
ae.Api.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.InvalidType("schema", "body", "object", params.ConfigType.Schema))
|
||||
ae.ManagementApi.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.InvalidType("schema", "body", "object", params.ConfigType.Schema))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -114,12 +114,12 @@ func (r *ConfigTypeRouter) Patch(ae *env.AppEnv, rc *response.RequestContext, pa
|
||||
|
||||
if _, ok := params.ConfigType.Schema.(map[string]interface{}); !ok {
|
||||
ctx := middleware.MatchedRouteFrom(rc.Request)
|
||||
ae.Api.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.InvalidType("schema", "body", "object", params.ConfigType.Schema))
|
||||
ae.ManagementApi.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.InvalidType("schema", "body", "object", params.ConfigType.Schema))
|
||||
return
|
||||
}
|
||||
if params.ConfigType.Schema == nil {
|
||||
ctx := middleware.MatchedRouteFrom(rc.Request)
|
||||
ae.Api.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.Required("schema", "body", nil))
|
||||
ae.ManagementApi.ServeErrorFor(ctx.Operation.ID)(rc.ResponseWriter, rc.Request, errors.Required("schema", "body", nil))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,9 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
clientCurrentApiSession "github.com/openziti/edge/rest_client_api_server/operations/current_api_session"
|
||||
managementCurrentApiSession "github.com/openziti/edge/rest_management_api_server/operations/current_api_session"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/current_api_session"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
@@ -41,36 +42,46 @@ func NewCurrentSessionRouter() *CurrentSessionRouter {
|
||||
}
|
||||
|
||||
func (router *CurrentSessionRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.CurrentAPISessionGetCurrentAPISessionHandler = current_api_session.GetCurrentAPISessionHandlerFunc(func(params current_api_session.GetCurrentAPISessionParams, i interface{}) middleware.Responder {
|
||||
//Client
|
||||
ae.ClientApi.CurrentAPISessionGetCurrentAPISessionHandler = clientCurrentApiSession.GetCurrentAPISessionHandlerFunc(func(params clientCurrentApiSession.GetCurrentAPISessionParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(router.Detail, params.HTTPRequest, "", "", permissions.HasOneOf(permissions.IsAuthenticated(), permissions.IsPartiallyAuthenticated()))
|
||||
})
|
||||
|
||||
ae.Api.CurrentAPISessionDeleteCurrentAPISessionHandler = current_api_session.DeleteCurrentAPISessionHandlerFunc(func(params current_api_session.DeleteCurrentAPISessionParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentAPISessionDeleteCurrentAPISessionHandler = clientCurrentApiSession.DeleteCurrentAPISessionHandlerFunc(func(params clientCurrentApiSession.DeleteCurrentAPISessionParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(router.Delete, params.HTTPRequest, "", "", permissions.HasOneOf(permissions.IsAuthenticated(), permissions.IsPartiallyAuthenticated()))
|
||||
})
|
||||
|
||||
ae.Api.CurrentAPISessionListCurrentAPISessionCertificatesHandler = current_api_session.ListCurrentAPISessionCertificatesHandlerFunc(func(params current_api_session.ListCurrentAPISessionCertificatesParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentAPISessionListCurrentAPISessionCertificatesHandler = clientCurrentApiSession.ListCurrentAPISessionCertificatesHandlerFunc(func(params clientCurrentApiSession.ListCurrentAPISessionCertificatesParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(router.ListCertificates, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentAPISessionCreateCurrentAPISessionCertificateHandler = current_api_session.CreateCurrentAPISessionCertificateHandlerFunc(func(params current_api_session.CreateCurrentAPISessionCertificateParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentAPISessionCreateCurrentAPISessionCertificateHandler = clientCurrentApiSession.CreateCurrentAPISessionCertificateHandlerFunc(func(params clientCurrentApiSession.CreateCurrentAPISessionCertificateParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
router.CreateCertificate(ae, rc, params)
|
||||
}, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentAPISessionDetailCurrentAPISessionCertificateHandler = current_api_session.DetailCurrentAPISessionCertificateHandlerFunc(func(params current_api_session.DetailCurrentAPISessionCertificateParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentAPISessionDetailCurrentAPISessionCertificateHandler = clientCurrentApiSession.DetailCurrentAPISessionCertificateHandlerFunc(func(params clientCurrentApiSession.DetailCurrentAPISessionCertificateParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(router.DetailCertificate, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentAPISessionDeleteCurrentAPISessionCertificateHandler = current_api_session.DeleteCurrentAPISessionCertificateHandlerFunc(func(params current_api_session.DeleteCurrentAPISessionCertificateParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentAPISessionDeleteCurrentAPISessionCertificateHandler = clientCurrentApiSession.DeleteCurrentAPISessionCertificateHandlerFunc(func(params clientCurrentApiSession.DeleteCurrentAPISessionCertificateParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(router.DeleteCertificate, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
// Session Updates
|
||||
ae.Api.CurrentAPISessionListServiceUpdatesHandler = current_api_session.ListServiceUpdatesHandlerFunc(func(params current_api_session.ListServiceUpdatesParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentAPISessionListServiceUpdatesHandler = clientCurrentApiSession.ListServiceUpdatesHandlerFunc(func(params clientCurrentApiSession.ListServiceUpdatesParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(router.ListServiceUpdates, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
//Management
|
||||
ae.ManagementApi.CurrentAPISessionGetCurrentAPISessionHandler = managementCurrentApiSession.GetCurrentAPISessionHandlerFunc(func(params managementCurrentApiSession.GetCurrentAPISessionParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(router.Detail, params.HTTPRequest, "", "", permissions.HasOneOf(permissions.IsAuthenticated(), permissions.IsPartiallyAuthenticated()))
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentAPISessionDeleteCurrentAPISessionHandler = managementCurrentApiSession.DeleteCurrentAPISessionHandlerFunc(func(params managementCurrentApiSession.DeleteCurrentAPISessionParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(router.Delete, params.HTTPRequest, "", "", permissions.HasOneOf(permissions.IsAuthenticated(), permissions.IsPartiallyAuthenticated()))
|
||||
})
|
||||
}
|
||||
|
||||
func (router *CurrentSessionRouter) Detail(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
@@ -110,7 +121,7 @@ func (router *CurrentSessionRouter) ListCertificates(ae *env.AppEnv, rc *respons
|
||||
})
|
||||
}
|
||||
|
||||
func (router *CurrentSessionRouter) CreateCertificate(ae *env.AppEnv, rc *response.RequestContext, params current_api_session.CreateCurrentAPISessionCertificateParams) {
|
||||
func (router *CurrentSessionRouter) CreateCertificate(ae *env.AppEnv, rc *response.RequestContext, params clientCurrentApiSession.CreateCurrentAPISessionCertificateParams) {
|
||||
responder := &ApiSessionCertificateCreateResponder{ae: ae, Responder: rc}
|
||||
CreateWithResponder(rc, responder, CurrentApiSessionCertificateLinkFactory, func() (string, error) {
|
||||
return ae.GetHandlers().ApiSessionCertificate.CreateFromCSR(rc.ApiSession.Id, 12*time.Hour, []byte(*params.SessionCertificate.Csr))
|
||||
@@ -182,9 +193,9 @@ type ApiSessionCertificateCreateResponder struct {
|
||||
ae *env.AppEnv
|
||||
}
|
||||
|
||||
func (nsr *ApiSessionCertificateCreateResponder) RespondWithCreatedId(id string, link rest_model.Link) {
|
||||
func (nsr *ApiSessionCertificateCreateResponder) RespondWithCreatedId(id string, _ rest_model.Link) {
|
||||
sessionCert, _ := nsr.ae.GetHandlers().ApiSessionCertificate.Read(id)
|
||||
certString := string(sessionCert.PEM)
|
||||
certString := sessionCert.PEM
|
||||
|
||||
newSessionEnvelope := &rest_model.CreateCurrentAPISessionCertificateEnvelope{
|
||||
Data: &rest_model.CurrentAPISessionCertificateCreateResponse{
|
||||
|
||||
@@ -51,7 +51,7 @@ func (factory *CurrentIdentityAuthenticatorLinkFactoryImpl) SelfLink(entity mode
|
||||
|
||||
func (factory *CurrentIdentityAuthenticatorLinkFactoryImpl) Links(entity models.Entity) rest_model.Links {
|
||||
return rest_model.Links{
|
||||
EntityNameSelf: factory.SelfLink(entity),
|
||||
EntityNameSelf: factory.SelfLink(entity),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@ func MapUpdateAuthenticatorWithCurrentToModel(id, identityId string, authenticat
|
||||
Tags: authenticator.Tags,
|
||||
Id: id,
|
||||
},
|
||||
CurrentPassword: string(authenticator.CurrentPassword),
|
||||
NewPassword: string(authenticator.Password),
|
||||
CurrentPassword: string(*authenticator.CurrentPassword),
|
||||
NewPassword: string(*authenticator.Password),
|
||||
IdentityId: identityId,
|
||||
Username: string(authenticator.Username),
|
||||
Username: string(*authenticator.Username),
|
||||
}
|
||||
|
||||
return ret
|
||||
@@ -76,7 +76,7 @@ func MapPatchAuthenticatorWithCurrentToModel(id, identityId string, authenticato
|
||||
Tags: authenticator.Tags,
|
||||
Id: id,
|
||||
},
|
||||
CurrentPassword: string(authenticator.CurrentPassword),
|
||||
CurrentPassword: string(*authenticator.CurrentPassword),
|
||||
IdentityId: identityId,
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/current_api_session"
|
||||
clientCurrentApiSession "github.com/openziti/edge/rest_client_api_server/operations/current_api_session"
|
||||
managementCurrentApiSession "github.com/openziti/edge/rest_management_api_server/operations/current_api_session"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/foundation/storage/boltz"
|
||||
)
|
||||
|
||||
@@ -42,20 +44,40 @@ func NewCurrentIdentityAuthenticatorRouter() *CurrentIdentityAuthenticatorRouter
|
||||
}
|
||||
|
||||
func (r *CurrentIdentityAuthenticatorRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.CurrentAPISessionDetailCurrentIdentityAuthenticatorHandler = current_api_session.DetailCurrentIdentityAuthenticatorHandlerFunc(func(params current_api_session.DetailCurrentIdentityAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
//Client
|
||||
|
||||
ae.ClientApi.CurrentAPISessionDetailCurrentIdentityAuthenticatorHandler = clientCurrentApiSession.DetailCurrentIdentityAuthenticatorHandlerFunc(func(params clientCurrentApiSession.DetailCurrentIdentityAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentAPISessionListCurrentIdentityAuthenticatorsHandler = current_api_session.ListCurrentIdentityAuthenticatorsHandlerFunc(func(params current_api_session.ListCurrentIdentityAuthenticatorsParams, _ interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentAPISessionListCurrentIdentityAuthenticatorsHandler = clientCurrentApiSession.ListCurrentIdentityAuthenticatorsHandlerFunc(func(params clientCurrentApiSession.ListCurrentIdentityAuthenticatorsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentAPISessionUpdateCurrentIdentityAuthenticatorHandler = current_api_session.UpdateCurrentIdentityAuthenticatorHandlerFunc(func(params current_api_session.UpdateCurrentIdentityAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
ae.ClientApi.CurrentAPISessionUpdateCurrentIdentityAuthenticatorHandler = clientCurrentApiSession.UpdateCurrentIdentityAuthenticatorHandlerFunc(func(params clientCurrentApiSession.UpdateCurrentIdentityAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params.Authenticator) }, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentAPISessionPatchCurrentIdentityAuthenticatorHandler = current_api_session.PatchCurrentIdentityAuthenticatorHandlerFunc(func(params current_api_session.PatchCurrentIdentityAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
ae.ClientApi.CurrentAPISessionPatchCurrentIdentityAuthenticatorHandler = clientCurrentApiSession.PatchCurrentIdentityAuthenticatorHandlerFunc(func(params clientCurrentApiSession.PatchCurrentIdentityAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params.Authenticator) }, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
//Management
|
||||
|
||||
ae.ManagementApi.CurrentAPISessionDetailCurrentIdentityAuthenticatorHandler = managementCurrentApiSession.DetailCurrentIdentityAuthenticatorHandlerFunc(func(params managementCurrentApiSession.DetailCurrentIdentityAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentAPISessionListCurrentIdentityAuthenticatorsHandler = managementCurrentApiSession.ListCurrentIdentityAuthenticatorsHandlerFunc(func(params managementCurrentApiSession.ListCurrentIdentityAuthenticatorsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentAPISessionUpdateCurrentIdentityAuthenticatorHandler = managementCurrentApiSession.UpdateCurrentIdentityAuthenticatorHandlerFunc(func(params managementCurrentApiSession.UpdateCurrentIdentityAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params.Authenticator) }, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentAPISessionPatchCurrentIdentityAuthenticatorHandler = managementCurrentApiSession.PatchCurrentIdentityAuthenticatorHandlerFunc(func(params managementCurrentApiSession.PatchCurrentIdentityAuthenticatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params.Authenticator) }, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -107,14 +129,14 @@ func (r *CurrentIdentityAuthenticatorRouter) Detail(ae *env.AppEnv, rc *response
|
||||
})
|
||||
}
|
||||
|
||||
func (r *CurrentIdentityAuthenticatorRouter) Update(ae *env.AppEnv, rc *response.RequestContext, params current_api_session.UpdateCurrentIdentityAuthenticatorParams) {
|
||||
func (r *CurrentIdentityAuthenticatorRouter) Update(ae *env.AppEnv, rc *response.RequestContext, authenticator *rest_model.AuthenticatorUpdateWithCurrent) {
|
||||
Update(rc, func(id string) error {
|
||||
return ae.Handlers.Authenticator.UpdateSelf(MapUpdateAuthenticatorWithCurrentToModel(params.ID, rc.Identity.Id, params.Authenticator))
|
||||
return ae.Handlers.Authenticator.UpdateSelf(MapUpdateAuthenticatorWithCurrentToModel(id, rc.Identity.Id, authenticator))
|
||||
})
|
||||
}
|
||||
|
||||
func (r *CurrentIdentityAuthenticatorRouter) Patch(ae *env.AppEnv, rc *response.RequestContext, params current_api_session.PatchCurrentIdentityAuthenticatorParams) {
|
||||
func (r *CurrentIdentityAuthenticatorRouter) Patch(ae *env.AppEnv, rc *response.RequestContext, authenticator *rest_model.AuthenticatorPatchWithCurrent) {
|
||||
Patch(rc, func(id string, fields JsonFields) error {
|
||||
return ae.Handlers.Authenticator.PatchSelf(MapPatchAuthenticatorWithCurrentToModel(params.ID, rc.Identity.Id, params.Authenticator), fields.FilterMaps("tags"))
|
||||
return ae.Handlers.Authenticator.PatchSelf(MapPatchAuthenticatorWithCurrentToModel(id, rc.Identity.Id, authenticator), fields.FilterMaps("tags"))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -24,8 +24,9 @@ import (
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/persistence"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
clientCurrentIdentity "github.com/openziti/edge/rest_client_api_server/operations/current_identity"
|
||||
managementCurrentIdentity "github.com/openziti/edge/rest_management_api_server/operations/current_identity"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/current_identity"
|
||||
"github.com/openziti/foundation/storage/boltz"
|
||||
"github.com/openziti/foundation/util/errorz"
|
||||
"github.com/pkg/errors"
|
||||
@@ -48,51 +49,93 @@ func NewCurrentIdentityRouter() *CurrentIdentityRouter {
|
||||
}
|
||||
|
||||
func (r *CurrentIdentityRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.CurrentIdentityGetCurrentIdentityHandler = current_identity.GetCurrentIdentityHandlerFunc(func(params current_identity.GetCurrentIdentityParams, _ interface{}) middleware.Responder {
|
||||
//Client
|
||||
ae.ClientApi.CurrentIdentityGetCurrentIdentityHandler = clientCurrentIdentity.GetCurrentIdentityHandlerFunc(func(params clientCurrentIdentity.GetCurrentIdentityParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(detailCurrentUser, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentIdentityDeleteMfaHandler = current_identity.DeleteMfaHandlerFunc(func(params current_identity.DeleteMfaParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentIdentityDeleteMfaHandler = clientCurrentIdentity.DeleteMfaHandlerFunc(func(params clientCurrentIdentity.DeleteMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.removeMfa(ae, rc, params)
|
||||
r.removeMfa(ae, rc, params.MfaValidation, params.MfaValidationCode)
|
||||
}, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentIdentityDetailMfaHandler = current_identity.DetailMfaHandlerFunc(func(params current_identity.DetailMfaParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentIdentityDetailMfaHandler = clientCurrentIdentity.DetailMfaHandlerFunc(func(params clientCurrentIdentity.DetailMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.detailMfa, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentIdentityEnrollMfaHandler = current_identity.EnrollMfaHandlerFunc(func(params current_identity.EnrollMfaParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentIdentityEnrollMfaHandler = clientCurrentIdentity.EnrollMfaHandlerFunc(func(params clientCurrentIdentity.EnrollMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.createMfa, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentIdentityVerifyMfaHandler = current_identity.VerifyMfaHandlerFunc(func(params current_identity.VerifyMfaParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentIdentityVerifyMfaHandler = clientCurrentIdentity.VerifyMfaHandlerFunc(func(params clientCurrentIdentity.VerifyMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.verifyMfa(ae, rc, params.MfaValidation)
|
||||
}, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentIdentityDetailMfaQrCodeHandler = current_identity.DetailMfaQrCodeHandlerFunc(func(params current_identity.DetailMfaQrCodeParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentIdentityDetailMfaQrCodeHandler = clientCurrentIdentity.DetailMfaQrCodeHandlerFunc(func(params clientCurrentIdentity.DetailMfaQrCodeParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.detailMfaQrCode, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentIdentityCreateMfaRecoveryCodesHandler = current_identity.CreateMfaRecoveryCodesHandlerFunc(func(params current_identity.CreateMfaRecoveryCodesParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentIdentityCreateMfaRecoveryCodesHandler = clientCurrentIdentity.CreateMfaRecoveryCodesHandlerFunc(func(params clientCurrentIdentity.CreateMfaRecoveryCodesParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.createMfaRecoveryCodes(ae, rc, params.MfaValidation)
|
||||
}, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentIdentityDetailMfaRecoveryCodesHandler = current_identity.DetailMfaRecoveryCodesHandlerFunc(func(params current_identity.DetailMfaRecoveryCodesParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentIdentityDetailMfaRecoveryCodesHandler = clientCurrentIdentity.DetailMfaRecoveryCodesHandlerFunc(func(params clientCurrentIdentity.DetailMfaRecoveryCodesParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.detailMfaRecoveryCodes(ae, rc, params)
|
||||
r.detailMfaRecoveryCodes(ae, rc, params.MfaValidation, params.MfaValidationCode)
|
||||
}, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.CurrentIdentityGetCurrentIdentityEdgeRoutersHandler = current_identity.GetCurrentIdentityEdgeRoutersHandlerFunc(func(params current_identity.GetCurrentIdentityEdgeRoutersParams, i interface{}) middleware.Responder {
|
||||
ae.ClientApi.CurrentIdentityGetCurrentIdentityEdgeRoutersHandler = clientCurrentIdentity.GetCurrentIdentityEdgeRoutersHandlerFunc(func(params clientCurrentIdentity.GetCurrentIdentityEdgeRoutersParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.listEdgeRouters(ae, rc)
|
||||
}, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
//Management
|
||||
ae.ManagementApi.CurrentIdentityGetCurrentIdentityHandler = managementCurrentIdentity.GetCurrentIdentityHandlerFunc(func(params managementCurrentIdentity.GetCurrentIdentityParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(detailCurrentUser, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentIdentityDeleteMfaHandler = managementCurrentIdentity.DeleteMfaHandlerFunc(func(params managementCurrentIdentity.DeleteMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.removeMfa(ae, rc, params.MfaValidation, params.MfaValidationCode)
|
||||
}, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentIdentityDetailMfaHandler = managementCurrentIdentity.DetailMfaHandlerFunc(func(params managementCurrentIdentity.DetailMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.detailMfa, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentIdentityEnrollMfaHandler = managementCurrentIdentity.EnrollMfaHandlerFunc(func(params managementCurrentIdentity.EnrollMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.createMfa, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentIdentityVerifyMfaHandler = managementCurrentIdentity.VerifyMfaHandlerFunc(func(params managementCurrentIdentity.VerifyMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.verifyMfa(ae, rc, params.MfaValidation)
|
||||
}, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentIdentityDetailMfaQrCodeHandler = managementCurrentIdentity.DetailMfaQrCodeHandlerFunc(func(params managementCurrentIdentity.DetailMfaQrCodeParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.detailMfaQrCode, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentIdentityCreateMfaRecoveryCodesHandler = managementCurrentIdentity.CreateMfaRecoveryCodesHandlerFunc(func(params managementCurrentIdentity.CreateMfaRecoveryCodesParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.createMfaRecoveryCodes(ae, rc, params.MfaValidation)
|
||||
}, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ManagementApi.CurrentIdentityDetailMfaRecoveryCodesHandler = managementCurrentIdentity.DetailMfaRecoveryCodesHandlerFunc(func(params managementCurrentIdentity.DetailMfaRecoveryCodesParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.detailMfaRecoveryCodes(ae, rc, params.MfaValidation, params.MfaValidationCode)
|
||||
}, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
}
|
||||
|
||||
func (r *CurrentIdentityRouter) verifyMfa(ae *env.AppEnv, rc *response.RequestContext, body *rest_model.MfaCode) {
|
||||
@@ -187,13 +230,13 @@ func (r *CurrentIdentityRouter) detailMfa(ae *env.AppEnv, rc *response.RequestCo
|
||||
})
|
||||
}
|
||||
|
||||
func (r *CurrentIdentityRouter) removeMfa(ae *env.AppEnv, rc *response.RequestContext, params current_identity.DeleteMfaParams) {
|
||||
func (r *CurrentIdentityRouter) removeMfa(ae *env.AppEnv, rc *response.RequestContext, mfaValidationBody *rest_model.MfaCode, mfaCodeHeader *string) {
|
||||
code := ""
|
||||
|
||||
if params.MfaValidation != nil && params.MfaValidation.Code != nil {
|
||||
code = *params.MfaValidation.Code
|
||||
} else if params.MfaValidationCode != nil {
|
||||
code = *params.MfaValidationCode
|
||||
if mfaValidationBody != nil && mfaValidationBody.Code != nil {
|
||||
code = *mfaValidationBody.Code
|
||||
} else if mfaCodeHeader != nil {
|
||||
code = *mfaCodeHeader
|
||||
}
|
||||
|
||||
err := ae.Handlers.Mfa.DeleteForIdentity(rc.Identity, code)
|
||||
@@ -235,7 +278,7 @@ func (r *CurrentIdentityRouter) detailMfaQrCode(ae *env.AppEnv, rc *response.Req
|
||||
|
||||
rc.ResponseWriter.Header().Set("content-type", "image/png")
|
||||
rc.ResponseWriter.WriteHeader(http.StatusOK)
|
||||
rc.ResponseWriter.Write(png)
|
||||
_, _ = rc.ResponseWriter.Write(png)
|
||||
}
|
||||
|
||||
func (r *CurrentIdentityRouter) createMfaRecoveryCodes(ae *env.AppEnv, rc *response.RequestContext, body *rest_model.MfaCode) {
|
||||
@@ -271,7 +314,7 @@ func (r *CurrentIdentityRouter) createMfaRecoveryCodes(ae *env.AppEnv, rc *respo
|
||||
rc.RespondWithEmptyOk()
|
||||
}
|
||||
|
||||
func (r *CurrentIdentityRouter) detailMfaRecoveryCodes(ae *env.AppEnv, rc *response.RequestContext, params current_identity.DetailMfaRecoveryCodesParams) {
|
||||
func (r *CurrentIdentityRouter) detailMfaRecoveryCodes(ae *env.AppEnv, rc *response.RequestContext, mfaValidationBody *rest_model.MfaCode, mfaCodeHeader *string) {
|
||||
mfa, err := ae.Handlers.Mfa.ReadByIdentityId(rc.Identity.Id)
|
||||
|
||||
if err != nil {
|
||||
@@ -291,10 +334,10 @@ func (r *CurrentIdentityRouter) detailMfaRecoveryCodes(ae *env.AppEnv, rc *respo
|
||||
|
||||
code := ""
|
||||
|
||||
if params.MfaValidation != nil && params.MfaValidation.Code != nil {
|
||||
code = *params.MfaValidation.Code
|
||||
} else if params.MfaValidationCode != nil {
|
||||
code = *params.MfaValidationCode
|
||||
if mfaValidationBody != nil && mfaValidationBody.Code != nil {
|
||||
code = *mfaValidationBody.Code
|
||||
} else if mfaCodeHeader != nil {
|
||||
code = *mfaCodeHeader
|
||||
}
|
||||
|
||||
if code == "" {
|
||||
|
||||
@@ -25,8 +25,8 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/database"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/database"
|
||||
"github.com/openziti/fabric/controller/network"
|
||||
"github.com/openziti/foundation/util/concurrenz"
|
||||
"net/http"
|
||||
@@ -59,19 +59,19 @@ func NewDatabaseRouter() *DatabaseRouter {
|
||||
}
|
||||
|
||||
func (r *DatabaseRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.DatabaseCreateDatabaseSnapshotHandler = database.CreateDatabaseSnapshotHandlerFunc(func(params database.CreateDatabaseSnapshotParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.DatabaseCreateDatabaseSnapshotHandler = database.CreateDatabaseSnapshotHandlerFunc(func(params database.CreateDatabaseSnapshotParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.CreateSnapshot(ae, rc) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.DatabaseCheckDataIntegrityHandler = database.CheckDataIntegrityHandlerFunc(func(params database.CheckDataIntegrityParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.DatabaseCheckDataIntegrityHandler = database.CheckDataIntegrityHandlerFunc(func(params database.CheckDataIntegrityParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.CheckDatastoreIntegrity(ae, rc, false) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.DatabaseFixDataIntegrityHandler = database.FixDataIntegrityHandlerFunc(func(params database.FixDataIntegrityParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.DatabaseFixDataIntegrityHandler = database.FixDataIntegrityHandlerFunc(func(params database.FixDataIntegrityParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.CheckDatastoreIntegrity(ae, rc, true) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.DatabaseDataIntegrityResultsHandler = database.DataIntegrityResultsHandlerFunc(func(params database.DataIntegrityResultsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.DatabaseDataIntegrityResultsHandler = database.DataIntegrityResultsHandlerFunc(func(params database.DataIntegrityResultsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.GetCheckProgress(rc) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ func MapEdgeRouterPolicyToRestEntity(ae *env.AppEnv, _ *response.RequestContext,
|
||||
}
|
||||
|
||||
func MapEdgeRouterPolicyToRestModel(ae *env.AppEnv, policy *model.EdgeRouterPolicy) (*rest_model.EdgeRouterPolicyDetail, error) {
|
||||
semantic := rest_model.Semantic(policy.Semantic)
|
||||
ret := &rest_model.EdgeRouterPolicyDetail{
|
||||
BaseEntity: BaseEntityToRestModel(policy, EdgeRouterPolicyLinkFactory),
|
||||
EdgeRouterRoles: policy.EdgeRouterRoles,
|
||||
@@ -122,7 +123,7 @@ func MapEdgeRouterPolicyToRestModel(ae *env.AppEnv, policy *model.EdgeRouterPoli
|
||||
IdentityRoles: policy.IdentityRoles,
|
||||
IdentityRolesDisplay: GetNamedIdentityRoles(ae.GetHandlers().Identity, policy.IdentityRoles),
|
||||
Name: &policy.Name,
|
||||
Semantic: rest_model.Semantic(policy.Semantic),
|
||||
Semantic: &semantic,
|
||||
IsSystem: &policy.IsSystem,
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/edge_router_policy"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/edge_router_policy"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,36 +41,36 @@ func NewEdgeRouterPolicyRouter() *EdgeRouterPolicyRouter {
|
||||
|
||||
func (r *EdgeRouterPolicyRouter) Register(ae *env.AppEnv) {
|
||||
//CRUD
|
||||
ae.Api.EdgeRouterPolicyDeleteEdgeRouterPolicyHandler = edge_router_policy.DeleteEdgeRouterPolicyHandlerFunc(func(params edge_router_policy.DeleteEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterPolicyDeleteEdgeRouterPolicyHandler = edge_router_policy.DeleteEdgeRouterPolicyHandlerFunc(func(params edge_router_policy.DeleteEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterPolicyDetailEdgeRouterPolicyHandler = edge_router_policy.DetailEdgeRouterPolicyHandlerFunc(func(params edge_router_policy.DetailEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterPolicyDetailEdgeRouterPolicyHandler = edge_router_policy.DetailEdgeRouterPolicyHandlerFunc(func(params edge_router_policy.DetailEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterPolicyListEdgeRouterPoliciesHandler = edge_router_policy.ListEdgeRouterPoliciesHandlerFunc(func(params edge_router_policy.ListEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterPolicyListEdgeRouterPoliciesHandler = edge_router_policy.ListEdgeRouterPoliciesHandlerFunc(func(params edge_router_policy.ListEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterPolicyUpdateEdgeRouterPolicyHandler = edge_router_policy.UpdateEdgeRouterPolicyHandlerFunc(func(params edge_router_policy.UpdateEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterPolicyUpdateEdgeRouterPolicyHandler = edge_router_policy.UpdateEdgeRouterPolicyHandlerFunc(func(params edge_router_policy.UpdateEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterPolicyCreateEdgeRouterPolicyHandler = edge_router_policy.CreateEdgeRouterPolicyHandlerFunc(func(params edge_router_policy.CreateEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterPolicyCreateEdgeRouterPolicyHandler = edge_router_policy.CreateEdgeRouterPolicyHandlerFunc(func(params edge_router_policy.CreateEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterPolicyPatchEdgeRouterPolicyHandler = edge_router_policy.PatchEdgeRouterPolicyHandlerFunc(func(params edge_router_policy.PatchEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterPolicyPatchEdgeRouterPolicyHandler = edge_router_policy.PatchEdgeRouterPolicyHandlerFunc(func(params edge_router_policy.PatchEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
//Additional Lists
|
||||
ae.Api.EdgeRouterPolicyListEdgeRouterPolicyEdgeRoutersHandler = edge_router_policy.ListEdgeRouterPolicyEdgeRoutersHandlerFunc(func(params edge_router_policy.ListEdgeRouterPolicyEdgeRoutersParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterPolicyListEdgeRouterPolicyEdgeRoutersHandler = edge_router_policy.ListEdgeRouterPolicyEdgeRoutersHandlerFunc(func(params edge_router_policy.ListEdgeRouterPolicyEdgeRoutersParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.ListEdgeRouters, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterPolicyListEdgeRouterPolicyIdentitiesHandler = edge_router_policy.ListEdgeRouterPolicyIdentitiesHandlerFunc(func(params edge_router_policy.ListEdgeRouterPolicyIdentitiesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterPolicyListEdgeRouterPolicyIdentitiesHandler = edge_router_policy.ListEdgeRouterPolicyIdentitiesHandlerFunc(func(params edge_router_policy.ListEdgeRouterPolicyIdentitiesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.ListIdentities, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/edge_router"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/edge_router"
|
||||
"github.com/openziti/fabric/controller/models"
|
||||
"github.com/openziti/foundation/storage/ast"
|
||||
)
|
||||
@@ -43,44 +43,44 @@ func NewEdgeRouterRouter() *EdgeRouterRouter {
|
||||
|
||||
func (r *EdgeRouterRouter) Register(ae *env.AppEnv) {
|
||||
//CRUD
|
||||
ae.Api.EdgeRouterDeleteEdgeRouterHandler = edge_router.DeleteEdgeRouterHandlerFunc(func(params edge_router.DeleteEdgeRouterParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterDeleteEdgeRouterHandler = edge_router.DeleteEdgeRouterHandlerFunc(func(params edge_router.DeleteEdgeRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterDetailEdgeRouterHandler = edge_router.DetailEdgeRouterHandlerFunc(func(params edge_router.DetailEdgeRouterParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterDetailEdgeRouterHandler = edge_router.DetailEdgeRouterHandlerFunc(func(params edge_router.DetailEdgeRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterListEdgeRoutersHandler = edge_router.ListEdgeRoutersHandlerFunc(func(params edge_router.ListEdgeRoutersParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterListEdgeRoutersHandler = edge_router.ListEdgeRoutersHandlerFunc(func(params edge_router.ListEdgeRoutersParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterUpdateEdgeRouterHandler = edge_router.UpdateEdgeRouterHandlerFunc(func(params edge_router.UpdateEdgeRouterParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterUpdateEdgeRouterHandler = edge_router.UpdateEdgeRouterHandlerFunc(func(params edge_router.UpdateEdgeRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterCreateEdgeRouterHandler = edge_router.CreateEdgeRouterHandlerFunc(func(params edge_router.CreateEdgeRouterParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterCreateEdgeRouterHandler = edge_router.CreateEdgeRouterHandlerFunc(func(params edge_router.CreateEdgeRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterPatchEdgeRouterHandler = edge_router.PatchEdgeRouterHandlerFunc(func(params edge_router.PatchEdgeRouterParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterPatchEdgeRouterHandler = edge_router.PatchEdgeRouterHandlerFunc(func(params edge_router.PatchEdgeRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
// additional lists
|
||||
ae.Api.EdgeRouterListEdgeRouterEdgeRouterPoliciesHandler = edge_router.ListEdgeRouterEdgeRouterPoliciesHandlerFunc(func(params edge_router.ListEdgeRouterEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterListEdgeRouterEdgeRouterPoliciesHandler = edge_router.ListEdgeRouterEdgeRouterPoliciesHandlerFunc(func(params edge_router.ListEdgeRouterEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listEdgeRouterPolicies, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterListEdgeRouterServiceEdgeRouterPoliciesHandler = edge_router.ListEdgeRouterServiceEdgeRouterPoliciesHandlerFunc(func(params edge_router.ListEdgeRouterServiceEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterListEdgeRouterServiceEdgeRouterPoliciesHandler = edge_router.ListEdgeRouterServiceEdgeRouterPoliciesHandlerFunc(func(params edge_router.ListEdgeRouterServiceEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listServiceEdgeRouterPolicies, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterListEdgeRouterIdentitiesHandler = edge_router.ListEdgeRouterIdentitiesHandlerFunc(func(params edge_router.ListEdgeRouterIdentitiesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterListEdgeRouterIdentitiesHandler = edge_router.ListEdgeRouterIdentitiesHandlerFunc(func(params edge_router.ListEdgeRouterIdentitiesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listIdentities, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EdgeRouterListEdgeRouterServicesHandler = edge_router.ListEdgeRouterServicesHandlerFunc(func(params edge_router.ListEdgeRouterServicesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EdgeRouterListEdgeRouterServicesHandler = edge_router.ListEdgeRouterServicesHandlerFunc(func(params edge_router.ListEdgeRouterServicesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listServices, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ import (
|
||||
"github.com/openziti/edge/controller/persistence"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
cert2 "github.com/openziti/edge/internal/cert"
|
||||
"github.com/openziti/edge/rest_client_api_server/operations/enroll"
|
||||
"github.com/openziti/edge/rest_client_api_server/operations/well_known"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/enroll"
|
||||
"github.com/openziti/edge/rest_server/operations/well_known"
|
||||
"github.com/openziti/foundation/util/errorz"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -53,36 +53,35 @@ func NewEnrollRouter() *EnrollRouter {
|
||||
func (ro *EnrollRouter) Register(ae *env.AppEnv) {
|
||||
|
||||
//Enroll
|
||||
|
||||
ae.Api.EnrollEnrollHandler = enroll.EnrollHandlerFunc(func(params enroll.EnrollParams) middleware.Responder {
|
||||
ae.ClientApi.EnrollEnrollHandler = enroll.EnrollHandlerFunc(func(params enroll.EnrollParams) middleware.Responder {
|
||||
return ae.IsAllowed(ro.enrollHandler, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.Api.EnrollEnrollCaHandler = enroll.EnrollCaHandlerFunc(func(params enroll.EnrollCaParams) middleware.Responder {
|
||||
ae.ClientApi.EnrollEnrollCaHandler = enroll.EnrollCaHandlerFunc(func(params enroll.EnrollCaParams) middleware.Responder {
|
||||
return ae.IsAllowed(ro.enrollHandler, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.Api.EnrollEnrollOttCaHandler = enroll.EnrollOttCaHandlerFunc(func(params enroll.EnrollOttCaParams) middleware.Responder {
|
||||
ae.ClientApi.EnrollEnrollOttCaHandler = enroll.EnrollOttCaHandlerFunc(func(params enroll.EnrollOttCaParams) middleware.Responder {
|
||||
return ae.IsAllowed(ro.enrollHandler, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.Api.EnrollEnrollOttHandler = enroll.EnrollOttHandlerFunc(func(params enroll.EnrollOttParams) middleware.Responder {
|
||||
ae.ClientApi.EnrollEnrollOttHandler = enroll.EnrollOttHandlerFunc(func(params enroll.EnrollOttParams) middleware.Responder {
|
||||
return ae.IsAllowed(ro.enrollHandler, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.Api.EnrollEnrollErOttHandler = enroll.EnrollErOttHandlerFunc(func(params enroll.EnrollErOttParams) middleware.Responder {
|
||||
ae.ClientApi.EnrollEnrollErOttHandler = enroll.EnrollErOttHandlerFunc(func(params enroll.EnrollErOttParams) middleware.Responder {
|
||||
return ae.IsAllowed(ro.enrollHandler, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
// Extend Enrollment
|
||||
ae.Api.EnrollExtendRouterEnrollmentHandler = enroll.ExtendRouterEnrollmentHandlerFunc(func(params enroll.ExtendRouterEnrollmentParams) middleware.Responder {
|
||||
ae.ClientApi.EnrollExtendRouterEnrollmentHandler = enroll.ExtendRouterEnrollmentHandlerFunc(func(params enroll.ExtendRouterEnrollmentParams) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
ro.extendRouterEnrollment(ae, rc, params)
|
||||
}, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
// Utility, well-known
|
||||
ae.Api.WellKnownListWellKnownCasHandler = well_known.ListWellKnownCasHandlerFunc(func(params well_known.ListWellKnownCasParams) middleware.Responder {
|
||||
ae.ClientApi.WellKnownListWellKnownCasHandler = well_known.ListWellKnownCasHandlerFunc(func(params well_known.ListWellKnownCasParams) middleware.Responder {
|
||||
return ae.IsAllowed(ro.getCaCerts, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/enrollment"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/enrollment"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,15 +41,15 @@ func NewEnrollmentRouter() *EnrollmentRouter {
|
||||
|
||||
func (r *EnrollmentRouter) Register(ae *env.AppEnv) {
|
||||
|
||||
ae.Api.EnrollmentDeleteEnrollmentHandler = enrollment.DeleteEnrollmentHandlerFunc(func(params enrollment.DeleteEnrollmentParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EnrollmentDeleteEnrollmentHandler = enrollment.DeleteEnrollmentHandlerFunc(func(params enrollment.DeleteEnrollmentParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EnrollmentDetailEnrollmentHandler = enrollment.DetailEnrollmentHandlerFunc(func(params enrollment.DetailEnrollmentParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EnrollmentDetailEnrollmentHandler = enrollment.DetailEnrollmentHandlerFunc(func(params enrollment.DetailEnrollmentParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.EnrollmentListEnrollmentsHandler = enrollment.ListEnrollmentsHandlerFunc(func(params enrollment.ListEnrollmentsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.EnrollmentListEnrollmentsHandler = enrollment.ListEnrollmentsHandlerFunc(func(params enrollment.ListEnrollmentsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
Copyright NetFoundry, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package routes
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/model"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/fabric/controller/models"
|
||||
)
|
||||
|
||||
const EntityNameGeoRegion = "geo-regions"
|
||||
|
||||
var GeoRegionLinkFactory = NewBasicLinkFactory(EntityNameGeoRegion)
|
||||
|
||||
func MapGeoRegionToRestEntity(_ *env.AppEnv, _ *response.RequestContext, e models.Entity) (interface{}, error) {
|
||||
geoRegion, ok := e.(*model.GeoRegion)
|
||||
|
||||
if !ok {
|
||||
err := fmt.Errorf("entity is not a GeoRegion \"%s\"", e.GetId())
|
||||
log := pfxlog.Logger()
|
||||
log.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
restModel, err := MapGeoRegionToRestModel(geoRegion)
|
||||
|
||||
if err != nil {
|
||||
err := fmt.Errorf("could not convert to API entity \"%s\": %s", e.GetId(), err)
|
||||
log := pfxlog.Logger()
|
||||
log.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
return restModel, nil
|
||||
}
|
||||
|
||||
func MapGeoRegionToRestModel(geoRegion *model.GeoRegion) (*rest_model.GeoRegionDetail, error) {
|
||||
ret := &rest_model.GeoRegionDetail{
|
||||
BaseEntity: BaseEntityToRestModel(geoRegion, GeoRegionLinkFactory),
|
||||
Name: &geoRegion.Name,
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
Copyright NetFoundry, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/geo_region"
|
||||
)
|
||||
|
||||
func init() {
|
||||
r := NewGeoRegionRouter()
|
||||
env.AddRouter(r)
|
||||
}
|
||||
|
||||
type GeoRegionRouter struct {
|
||||
BasePath string
|
||||
}
|
||||
|
||||
func NewGeoRegionRouter() *GeoRegionRouter {
|
||||
return &GeoRegionRouter{
|
||||
BasePath: "/" + EntityNameGeoRegion,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *GeoRegionRouter) Register(ae *env.AppEnv) {
|
||||
|
||||
ae.Api.GeoRegionDetailGeoRegionHandler = geo_region.DetailGeoRegionHandlerFunc(func(params geo_region.DetailGeoRegionParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.GeoRegionListGeoRegionsHandler = geo_region.ListGeoRegionsHandlerFunc(func(params geo_region.ListGeoRegionsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
func (r *GeoRegionRouter) List(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
ListWithHandler(ae, rc, ae.Handlers.GeoRegion, MapGeoRegionToRestEntity)
|
||||
}
|
||||
|
||||
func (r *GeoRegionRouter) Detail(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
DetailWithHandler(ae, rc, ae.Handlers.GeoRegion, MapGeoRegionToRestEntity)
|
||||
}
|
||||
@@ -61,8 +61,12 @@ func (factory *IdentityLinkFactoryImpl) Links(entity models.Entity) rest_model.L
|
||||
return links
|
||||
}
|
||||
|
||||
func getDefaultHostingCost(v rest_model.TerminatorCost) uint16 {
|
||||
return uint16(v)
|
||||
func getDefaultHostingCost(v *rest_model.TerminatorCost) uint16 {
|
||||
if v == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
return uint16(*v)
|
||||
}
|
||||
|
||||
func getServiceHostingPrecedences(v rest_model.TerminatorPrecedenceMap) map[string]ziti.Precedence {
|
||||
@@ -81,18 +85,19 @@ func getRestServiceHostingPrecedences(v map[string]ziti.Precedence) rest_model.T
|
||||
return result
|
||||
}
|
||||
|
||||
func getServiceHostingCosts(v rest_model.TerminatorCostMap) map[string]uint16 {
|
||||
func getServiceHostingCosts(costMap rest_model.TerminatorCostMap) map[string]uint16 {
|
||||
result := map[string]uint16{}
|
||||
for k, v := range v {
|
||||
result[k] = uint16(v)
|
||||
for key, cost := range costMap {
|
||||
result[key] = uint16(*cost)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func getRestServiceHostingCosts(v map[string]uint16) rest_model.TerminatorCostMap {
|
||||
func getRestServiceHostingCosts(costMap map[string]uint16) rest_model.TerminatorCostMap {
|
||||
result := rest_model.TerminatorCostMap{}
|
||||
for k, v := range v {
|
||||
result[k] = rest_model.TerminatorCost(v)
|
||||
for key, cost := range costMap {
|
||||
val := rest_model.TerminatorCost(cost)
|
||||
result[key] = &val
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -224,6 +229,8 @@ func MapIdentityToRestModel(ae *env.AppEnv, identity *model.Identity) (*rest_mod
|
||||
pfxlog.Logger().Errorf("error attempting to determine identity id's [%s] API session existence: %v", identity.Id, err)
|
||||
}
|
||||
|
||||
cost := rest_model.TerminatorCost(identity.DefaultHostingCost)
|
||||
|
||||
ret := &rest_model.IdentityDetail{
|
||||
BaseEntity: BaseEntityToRestModel(identity, IdentityLinkFactory),
|
||||
IsAdmin: &identity.IsAdmin,
|
||||
@@ -235,7 +242,7 @@ func MapIdentityToRestModel(ae *env.AppEnv, identity *model.Identity) (*rest_mod
|
||||
HasEdgeRouterConnection: &identity.HasHeartbeat,
|
||||
HasAPISession: &hasApiSession,
|
||||
DefaultHostingPrecedence: rest_model.TerminatorPrecedence(identity.DefaultHostingPrecedence.String()),
|
||||
DefaultHostingCost: rest_model.TerminatorCost(identity.DefaultHostingCost),
|
||||
DefaultHostingCost: &cost,
|
||||
ServiceHostingPrecedences: getRestServiceHostingPrecedences(identity.ServiceHostingPrecedences),
|
||||
ServiceHostingCosts: getRestServiceHostingCosts(identity.ServiceHostingCosts),
|
||||
IsMfaEnabled: &isMfaEnabled,
|
||||
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/model"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/identity"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/identity"
|
||||
"github.com/openziti/fabric/controller/models"
|
||||
"github.com/openziti/foundation/storage/ast"
|
||||
"github.com/openziti/foundation/storage/boltz"
|
||||
@@ -49,83 +49,83 @@ func NewIdentityRouter() *IdentityRouter {
|
||||
func (r *IdentityRouter) Register(ae *env.AppEnv) {
|
||||
|
||||
//identity crud
|
||||
ae.Api.IdentityDeleteIdentityHandler = identity.DeleteIdentityHandlerFunc(func(params identity.DeleteIdentityParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityDeleteIdentityHandler = identity.DeleteIdentityHandlerFunc(func(params identity.DeleteIdentityParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.IdentityDetailIdentityHandler = identity.DetailIdentityHandlerFunc(func(params identity.DetailIdentityParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityDetailIdentityHandler = identity.DetailIdentityHandlerFunc(func(params identity.DetailIdentityParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.IdentityListIdentitiesHandler = identity.ListIdentitiesHandlerFunc(func(params identity.ListIdentitiesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityListIdentitiesHandler = identity.ListIdentitiesHandlerFunc(func(params identity.ListIdentitiesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.IdentityUpdateIdentityHandler = identity.UpdateIdentityHandlerFunc(func(params identity.UpdateIdentityParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityUpdateIdentityHandler = identity.UpdateIdentityHandlerFunc(func(params identity.UpdateIdentityParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.IdentityCreateIdentityHandler = identity.CreateIdentityHandlerFunc(func(params identity.CreateIdentityParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityCreateIdentityHandler = identity.CreateIdentityHandlerFunc(func(params identity.CreateIdentityParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.IdentityPatchIdentityHandler = identity.PatchIdentityHandlerFunc(func(params identity.PatchIdentityParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityPatchIdentityHandler = identity.PatchIdentityHandlerFunc(func(params identity.PatchIdentityParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
// edge router policies list
|
||||
ae.Api.IdentityListIdentitysEdgeRouterPoliciesHandler = identity.ListIdentitysEdgeRouterPoliciesHandlerFunc(func(params identity.ListIdentitysEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityListIdentitysEdgeRouterPoliciesHandler = identity.ListIdentitysEdgeRouterPoliciesHandlerFunc(func(params identity.ListIdentitysEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listEdgeRouterPolicies, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
// edge routers list
|
||||
ae.Api.IdentityListIdentityEdgeRoutersHandler = identity.ListIdentityEdgeRoutersHandlerFunc(func(params identity.ListIdentityEdgeRoutersParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityListIdentityEdgeRoutersHandler = identity.ListIdentityEdgeRoutersHandlerFunc(func(params identity.ListIdentityEdgeRoutersParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listEdgeRouters, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
// service policies list
|
||||
ae.Api.IdentityListIdentityServicePoliciesHandler = identity.ListIdentityServicePoliciesHandlerFunc(func(params identity.ListIdentityServicePoliciesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityListIdentityServicePoliciesHandler = identity.ListIdentityServicePoliciesHandlerFunc(func(params identity.ListIdentityServicePoliciesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listServicePolicies, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
// service list
|
||||
ae.Api.IdentityListIdentityServicesHandler = identity.ListIdentityServicesHandlerFunc(func(params identity.ListIdentityServicesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityListIdentityServicesHandler = identity.ListIdentityServicesHandlerFunc(func(params identity.ListIdentityServicesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listServices, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
// service configs crud
|
||||
ae.Api.IdentityListIdentitysServiceConfigsHandler = identity.ListIdentitysServiceConfigsHandlerFunc(func(params identity.ListIdentitysServiceConfigsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityListIdentitysServiceConfigsHandler = identity.ListIdentitysServiceConfigsHandlerFunc(func(params identity.ListIdentitysServiceConfigsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listServiceConfigs, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.IdentityAssociateIdentitysServiceConfigsHandler = identity.AssociateIdentitysServiceConfigsHandlerFunc(func(params identity.AssociateIdentitysServiceConfigsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityAssociateIdentitysServiceConfigsHandler = identity.AssociateIdentitysServiceConfigsHandlerFunc(func(params identity.AssociateIdentitysServiceConfigsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.assignServiceConfigs(ae, rc, params)
|
||||
}, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.IdentityDisassociateIdentitysServiceConfigsHandler = identity.DisassociateIdentitysServiceConfigsHandlerFunc(func(params identity.DisassociateIdentitysServiceConfigsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityDisassociateIdentitysServiceConfigsHandler = identity.DisassociateIdentitysServiceConfigsHandlerFunc(func(params identity.DisassociateIdentitysServiceConfigsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.removeServiceConfigs(ae, rc, params)
|
||||
}, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
// policy advice URL
|
||||
ae.Api.IdentityGetIdentityPolicyAdviceHandler = identity.GetIdentityPolicyAdviceHandlerFunc(func(params identity.GetIdentityPolicyAdviceParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityGetIdentityPolicyAdviceHandler = identity.GetIdentityPolicyAdviceHandlerFunc(func(params identity.GetIdentityPolicyAdviceParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.getPolicyAdvice, params.HTTPRequest, params.ID, params.ServiceID, permissions.IsAdmin())
|
||||
})
|
||||
|
||||
// posture data
|
||||
ae.Api.IdentityGetIdentityPostureDataHandler = identity.GetIdentityPostureDataHandlerFunc(func(params identity.GetIdentityPostureDataParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityGetIdentityPostureDataHandler = identity.GetIdentityPostureDataHandlerFunc(func(params identity.GetIdentityPostureDataParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.getPostureData, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.IdentityGetIdentityFailedServiceRequestsHandler = identity.GetIdentityFailedServiceRequestsHandlerFunc(func(params identity.GetIdentityFailedServiceRequestsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityGetIdentityFailedServiceRequestsHandler = identity.GetIdentityFailedServiceRequestsHandlerFunc(func(params identity.GetIdentityFailedServiceRequestsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.getPostureDataFailedServiceRequests, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
// mfa
|
||||
ae.Api.IdentityRemoveIdentityMfaHandler = identity.RemoveIdentityMfaHandlerFunc(func(params identity.RemoveIdentityMfaParams, i interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityRemoveIdentityMfaHandler = identity.RemoveIdentityMfaHandlerFunc(func(params identity.RemoveIdentityMfaParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.removeMfa, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
@@ -163,7 +163,7 @@ func getIdentityTypeId(ae *env.AppEnv, identityType rest_model.IdentityType) str
|
||||
|
||||
func (r *IdentityRouter) Create(ae *env.AppEnv, rc *response.RequestContext, params identity.CreateIdentityParams) {
|
||||
Create(rc, rc, IdentityLinkFactory, func() (string, error) {
|
||||
identityModel, enrollments := MapCreateIdentityToModel(params.Identity, getIdentityTypeId(ae, params.Identity.Type))
|
||||
identityModel, enrollments := MapCreateIdentityToModel(params.Identity, getIdentityTypeId(ae, *params.Identity.Type))
|
||||
identityId, _, err := ae.Handlers.Identity.CreateWithEnrollments(identityModel, enrollments)
|
||||
return identityId, err
|
||||
})
|
||||
@@ -175,7 +175,7 @@ func (r *IdentityRouter) Delete(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
|
||||
func (r *IdentityRouter) Update(ae *env.AppEnv, rc *response.RequestContext, params identity.UpdateIdentityParams) {
|
||||
Update(rc, func(id string) error {
|
||||
return ae.Handlers.Identity.Update(MapUpdateIdentityToModel(params.ID, params.Identity, getIdentityTypeId(ae, params.Identity.Type)))
|
||||
return ae.Handlers.Identity.Update(MapUpdateIdentityToModel(params.ID, params.Identity, getIdentityTypeId(ae, *params.Identity.Type)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/identity"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/identity"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,11 +41,11 @@ func NewIdentityTypeRouter() *IdentityTypeRouter {
|
||||
|
||||
func (r *IdentityTypeRouter) Register(ae *env.AppEnv) {
|
||||
|
||||
ae.Api.IdentityDetailIdentityTypeHandler = identity.DetailIdentityTypeHandlerFunc(func(params identity.DetailIdentityTypeParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityDetailIdentityTypeHandler = identity.DetailIdentityTypeHandlerFunc(func(params identity.DetailIdentityTypeParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.IdentityListIdentityTypesHandler = identity.ListIdentityTypesHandlerFunc(func(params identity.ListIdentityTypesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.IdentityListIdentityTypesHandler = identity.ListIdentityTypesHandlerFunc(func(params identity.ListIdentityTypesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ func MapCreatePostureCheckToModel(postureCheck rest_model.PostureCheckCreate) *m
|
||||
|
||||
for _, os := range apiSubType.OperatingSystems {
|
||||
subType.OperatingSystems = append(subType.OperatingSystems, model.OperatingSystem{
|
||||
OsType: string(os.Type),
|
||||
OsType: string(*os.Type),
|
||||
OsVersions: os.Versions,
|
||||
})
|
||||
}
|
||||
@@ -83,7 +83,7 @@ func MapCreatePostureCheckToModel(postureCheck rest_model.PostureCheckCreate) *m
|
||||
}
|
||||
case *rest_model.PostureCheckProcessCreate:
|
||||
ret.SubType = &model.PostureCheckProcess{
|
||||
OsType: string(apiSubType.Process.OsType),
|
||||
OsType: string(*apiSubType.Process.OsType),
|
||||
Path: *apiSubType.Process.Path,
|
||||
Hashes: apiSubType.Process.Hashes,
|
||||
Fingerprint: apiSubType.Process.SignerFingerprint,
|
||||
@@ -93,13 +93,13 @@ func MapCreatePostureCheckToModel(postureCheck rest_model.PostureCheckCreate) *m
|
||||
case *rest_model.PostureCheckProcessMultiCreate:
|
||||
apiCheck := postureCheck.(*rest_model.PostureCheckProcessMultiCreate)
|
||||
modelCheck := &model.PostureCheckProcessMulti{
|
||||
Semantic: string(apiCheck.Semantic),
|
||||
Semantic: string(*apiCheck.Semantic),
|
||||
}
|
||||
|
||||
for _, process := range apiCheck.Processes {
|
||||
newProc := &model.ProcessMulti{
|
||||
Hashes: process.Hashes,
|
||||
OsType: string(process.OsType),
|
||||
OsType: string(*process.OsType),
|
||||
Path: *process.Path,
|
||||
SignerFingerprints: process.SignerFingerprints,
|
||||
}
|
||||
@@ -138,7 +138,7 @@ func MapUpdatePostureCheckToModel(id string, postureCheck rest_model.PostureChec
|
||||
case *rest_model.PostureCheckProcessUpdate:
|
||||
check := postureCheck.(*rest_model.PostureCheckProcessUpdate)
|
||||
ret.SubType = &model.PostureCheckProcess{
|
||||
OsType: string(check.Process.OsType),
|
||||
OsType: string(*check.Process.OsType),
|
||||
Path: stringz.OrEmpty(check.Process.Path),
|
||||
Hashes: check.Process.Hashes,
|
||||
Fingerprint: check.Process.SignerFingerprint,
|
||||
@@ -150,7 +150,7 @@ func MapUpdatePostureCheckToModel(id string, postureCheck rest_model.PostureChec
|
||||
|
||||
for _, restOs := range check.OperatingSystems {
|
||||
modelOs := model.OperatingSystem{
|
||||
OsType: string(restOs.Type),
|
||||
OsType: string(*restOs.Type),
|
||||
OsVersions: restOs.Versions,
|
||||
}
|
||||
osCheck.OperatingSystems = append(osCheck.OperatingSystems, modelOs)
|
||||
@@ -160,13 +160,13 @@ func MapUpdatePostureCheckToModel(id string, postureCheck rest_model.PostureChec
|
||||
case *rest_model.PostureCheckProcessMultiUpdate:
|
||||
apiCheck := postureCheck.(*rest_model.PostureCheckProcessMultiUpdate)
|
||||
modelCheck := &model.PostureCheckProcessMulti{
|
||||
Semantic: string(apiCheck.Semantic),
|
||||
Semantic: string(*apiCheck.Semantic),
|
||||
}
|
||||
|
||||
for _, process := range apiCheck.Processes {
|
||||
newProc := &model.ProcessMulti{
|
||||
Hashes: process.Hashes,
|
||||
OsType: string(process.OsType),
|
||||
OsType: string(*process.OsType),
|
||||
Path: *process.Path,
|
||||
SignerFingerprints: process.SignerFingerprints,
|
||||
}
|
||||
@@ -213,7 +213,7 @@ func MapPatchPostureCheckToModel(id string, postureCheck rest_model.PostureCheck
|
||||
ret.SubType = subType
|
||||
|
||||
if check.Process != nil {
|
||||
subType.OsType = string(check.Process.OsType)
|
||||
subType.OsType = string(*check.Process.OsType)
|
||||
subType.Path = stringz.OrEmpty(check.Process.Path)
|
||||
subType.Hashes = check.Process.Hashes
|
||||
subType.Fingerprint = check.Process.SignerFingerprint
|
||||
@@ -227,7 +227,7 @@ func MapPatchPostureCheckToModel(id string, postureCheck rest_model.PostureCheck
|
||||
|
||||
for _, restOs := range check.OperatingSystems {
|
||||
modelOs := model.OperatingSystem{
|
||||
OsType: string(restOs.Type),
|
||||
OsType: string(*restOs.Type),
|
||||
OsVersions: restOs.Versions,
|
||||
}
|
||||
osCheck.OperatingSystems = append(osCheck.OperatingSystems, modelOs)
|
||||
@@ -246,7 +246,7 @@ func MapPatchPostureCheckToModel(id string, postureCheck rest_model.PostureCheck
|
||||
for _, process := range apiCheck.Processes {
|
||||
newProc := &model.ProcessMulti{
|
||||
Hashes: process.Hashes,
|
||||
OsType: string(process.OsType),
|
||||
OsType: string(*process.OsType),
|
||||
Path: *process.Path,
|
||||
SignerFingerprints: process.SignerFingerprints,
|
||||
}
|
||||
@@ -307,8 +307,9 @@ func MapPostureCheckToRestModel(i *model.PostureCheck) (rest_model.PostureCheckD
|
||||
osArray := []*rest_model.OperatingSystem{}
|
||||
|
||||
for _, osMatch := range subType.OperatingSystems {
|
||||
osType := rest_model.OsType(osMatch.OsType)
|
||||
osArray = append(osArray, &rest_model.OperatingSystem{
|
||||
Type: rest_model.OsType(osMatch.OsType),
|
||||
Type: &osType,
|
||||
Versions: osMatch.OsVersions,
|
||||
})
|
||||
}
|
||||
@@ -320,9 +321,11 @@ func MapPostureCheckToRestModel(i *model.PostureCheck) (rest_model.PostureCheckD
|
||||
setBaseEntityDetailsOnPostureCheck(ret, i)
|
||||
|
||||
case *model.PostureCheckProcess:
|
||||
osType := rest_model.OsType(subType.OsType)
|
||||
|
||||
processMatch := &rest_model.Process{
|
||||
Hashes: subType.Hashes,
|
||||
OsType: rest_model.OsType(subType.OsType),
|
||||
OsType: &osType,
|
||||
Path: &subType.Path,
|
||||
SignerFingerprint: subType.Fingerprint,
|
||||
}
|
||||
@@ -346,15 +349,17 @@ func MapPostureCheckToRestModel(i *model.PostureCheck) (rest_model.PostureCheckD
|
||||
ret = &rest_model.PostureCheckMfaDetail{}
|
||||
setBaseEntityDetailsOnPostureCheck(ret, i)
|
||||
case *model.PostureCheckProcessMulti:
|
||||
semantic := rest_model.Semantic(subType.Semantic)
|
||||
detail := &rest_model.PostureCheckProcessMultiDetail{
|
||||
Processes: []*rest_model.ProcessMulti{},
|
||||
Semantic: rest_model.Semantic(subType.Semantic),
|
||||
Semantic: &semantic,
|
||||
}
|
||||
|
||||
for _, process := range subType.Processes {
|
||||
osType := rest_model.OsType(process.OsType)
|
||||
newProc := &rest_model.ProcessMulti{
|
||||
Hashes: process.Hashes,
|
||||
OsType: rest_model.OsType(process.OsType),
|
||||
OsType: &osType,
|
||||
Path: &process.Path,
|
||||
SignerFingerprints: process.SignerFingerprints,
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/persistence"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/posture_checks"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/posture_checks"
|
||||
"github.com/openziti/fabric/controller/models"
|
||||
)
|
||||
|
||||
@@ -42,27 +42,27 @@ func NewPostureCheckRouter() *PostureCheckRouter {
|
||||
}
|
||||
|
||||
func (r *PostureCheckRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.PostureChecksDeletePostureCheckHandler = posture_checks.DeletePostureCheckHandlerFunc(func(params posture_checks.DeletePostureCheckParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.PostureChecksDeletePostureCheckHandler = posture_checks.DeletePostureCheckHandlerFunc(func(params posture_checks.DeletePostureCheckParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.PostureChecksDetailPostureCheckHandler = posture_checks.DetailPostureCheckHandlerFunc(func(params posture_checks.DetailPostureCheckParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.PostureChecksDetailPostureCheckHandler = posture_checks.DetailPostureCheckHandlerFunc(func(params posture_checks.DetailPostureCheckParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.PostureChecksListPostureChecksHandler = posture_checks.ListPostureChecksHandlerFunc(func(params posture_checks.ListPostureChecksParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.PostureChecksListPostureChecksHandler = posture_checks.ListPostureChecksHandlerFunc(func(params posture_checks.ListPostureChecksParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.PostureChecksUpdatePostureCheckHandler = posture_checks.UpdatePostureCheckHandlerFunc(func(params posture_checks.UpdatePostureCheckParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.PostureChecksUpdatePostureCheckHandler = posture_checks.UpdatePostureCheckHandlerFunc(func(params posture_checks.UpdatePostureCheckParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.PostureChecksCreatePostureCheckHandler = posture_checks.CreatePostureCheckHandlerFunc(func(params posture_checks.CreatePostureCheckParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.PostureChecksCreatePostureCheckHandler = posture_checks.CreatePostureCheckHandlerFunc(func(params posture_checks.CreatePostureCheckParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.PostureChecksPatchPostureCheckHandler = posture_checks.PatchPostureCheckHandlerFunc(func(params posture_checks.PatchPostureCheckParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.PostureChecksPatchPostureCheckHandler = posture_checks.PatchPostureCheckHandlerFunc(func(params posture_checks.PatchPostureCheckParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -50,9 +50,10 @@ func MapPostureCheckTypeToRestModel(postureCheckType *model.PostureCheckType) *r
|
||||
operatingSystems := []*rest_model.OperatingSystem{}
|
||||
|
||||
for _, os := range postureCheckType.OperatingSystems {
|
||||
osType := rest_model.OsType(os.OsType)
|
||||
|
||||
newOs := &rest_model.OperatingSystem{
|
||||
Type: rest_model.OsType(os.OsType),
|
||||
Type: &osType,
|
||||
Versions: os.OsVersions,
|
||||
}
|
||||
operatingSystems = append(operatingSystems, newOs)
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/posture_checks"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/posture_checks"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,11 +41,11 @@ func NewPostureCheckTypeRouter() *PostureCheckTypeRouter {
|
||||
|
||||
func (r *PostureCheckTypeRouter) Register(ae *env.AppEnv) {
|
||||
|
||||
ae.Api.PostureChecksDetailPostureCheckTypeHandler = posture_checks.DetailPostureCheckTypeHandlerFunc(func(params posture_checks.DetailPostureCheckTypeParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.PostureChecksDetailPostureCheckTypeHandler = posture_checks.DetailPostureCheckTypeHandlerFunc(func(params posture_checks.DetailPostureCheckTypeParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.PostureChecksListPostureCheckTypesHandler = posture_checks.ListPostureCheckTypesHandlerFunc(func(params posture_checks.ListPostureCheckTypesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.PostureChecksListPostureCheckTypesHandler = posture_checks.ListPostureCheckTypesHandlerFunc(func(params posture_checks.ListPostureCheckTypesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func MapPostureDataToRestModel(ae *env.AppEnv, postureData *model.PostureData) *rest_model.PostureData {
|
||||
func MapPostureDataToRestModel(_ *env.AppEnv, postureData *model.PostureData) *rest_model.PostureData {
|
||||
ret := &rest_model.PostureData{
|
||||
Domain: MapPostureDataDomainToRestModel(&postureData.Domain),
|
||||
Mac: MapPostureDataMacToRestModel(&postureData.Mac),
|
||||
@@ -147,9 +147,10 @@ func MapPostureCheckFailureProcessToRestModel(failure *model.PostureCheckFailure
|
||||
ret.ActualValue.SignerFingerprints = val.ActualValue.SignerFingerprints
|
||||
ret.ActualValue.IsRunning = &val.ActualValue.IsRunning
|
||||
|
||||
osType := rest_model.OsType(val.ExpectedValue.OsType)
|
||||
ret.ExpectedValue.Hashes = val.ExpectedValue.Hashes
|
||||
ret.ExpectedValue.Path = &val.ExpectedValue.Path
|
||||
ret.ExpectedValue.OsType = rest_model.OsType(val.ExpectedValue.OsType)
|
||||
ret.ExpectedValue.OsType = &osType
|
||||
ret.ExpectedValue.SignerFingerprint = val.ExpectedValue.Fingerprint
|
||||
} else {
|
||||
pfxlog.Logger().Errorf("could not convert failure values of %T for posture check %s, expected process", failure.PostureCheckFailureValues, failure.PostureCheckId)
|
||||
@@ -169,7 +170,8 @@ func MapPostureCheckFailureProcessMultiToRestModel(failure *model.PostureCheckFa
|
||||
restResult.SetPostureCheckName(&failure.PostureCheckName)
|
||||
|
||||
if val, ok := failure.PostureCheckFailureValues.(*model.PostureCheckFailureValuesProcessMulti); ok {
|
||||
restResult.Semantic = rest_model.Semantic(val.ExpectedValue.Semantic)
|
||||
semantic := rest_model.Semantic(val.ExpectedValue.Semantic)
|
||||
restResult.Semantic = &semantic
|
||||
|
||||
for _, valActual := range val.ActualValue {
|
||||
restActual := &rest_model.PostureCheckFailureProcessActual{
|
||||
@@ -183,9 +185,10 @@ func MapPostureCheckFailureProcessMultiToRestModel(failure *model.PostureCheckFa
|
||||
}
|
||||
|
||||
for _, valExpected := range val.ExpectedValue.Processes {
|
||||
osType := rest_model.OsType(valExpected.OsType)
|
||||
restExpected := &rest_model.ProcessMulti{
|
||||
Hashes: valExpected.Hashes,
|
||||
OsType: rest_model.OsType(valExpected.OsType),
|
||||
OsType: &osType,
|
||||
Path: &valExpected.Path,
|
||||
SignerFingerprints: valExpected.SignerFingerprints,
|
||||
}
|
||||
@@ -253,8 +256,10 @@ func MapPostureCheckFailureOsToRestModel(failure *model.PostureCheckFailure) *re
|
||||
ret.ExpectedValue = []*rest_model.OperatingSystem{}
|
||||
|
||||
for _, os := range val.ExpectedValue {
|
||||
osType := rest_model.OsType(os.OsType)
|
||||
|
||||
newOs := &rest_model.OperatingSystem{
|
||||
Type: rest_model.OsType(os.OsType),
|
||||
Type: &osType,
|
||||
Versions: os.OsVersions,
|
||||
}
|
||||
ret.ExpectedValue = append(ret.ExpectedValue, newOs)
|
||||
@@ -285,11 +290,11 @@ func MapPostureCheckFailureMfaToRestModel(failure *model.PostureCheckFailure) *r
|
||||
return ret
|
||||
}
|
||||
|
||||
func MapPostureDataFailedSessionRequestToRestModel(modelFailedSessionRequests []*model.PostureSessionRequestFailure) []*rest_model.FailedSessionRequest {
|
||||
ret := []*rest_model.FailedSessionRequest{}
|
||||
func MapPostureDataFailedSessionRequestToRestModel(modelFailedSessionRequests []*model.PostureSessionRequestFailure) []*rest_model.FailedServiceRequest {
|
||||
ret := []*rest_model.FailedServiceRequest{}
|
||||
|
||||
for _, modelFailedSessionRequest := range modelFailedSessionRequests {
|
||||
failedSessionRequest := &rest_model.FailedSessionRequest{
|
||||
failedSessionRequest := &rest_model.FailedServiceRequest{
|
||||
APISessionID: modelFailedSessionRequest.ApiSessionId,
|
||||
PolicyFailures: []*rest_model.PolicyFailure{},
|
||||
ServiceID: modelFailedSessionRequest.ServiceId,
|
||||
|
||||
@@ -16,12 +16,6 @@
|
||||
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
const (
|
||||
EntityNamePostureResponse = "posture-response"
|
||||
EntityNamePostureData = "posture-data"
|
||||
@@ -30,6 +24,3 @@ const (
|
||||
|
||||
var PostureResponseLinkFactory = NewBasicLinkFactory(EntityNamePostureResponse)
|
||||
|
||||
func MapCreatePostureResponseToModel(ae *env.AppEnv, rc *response.RequestContext, postureResponse rest_model.PostureResponseCreate) {
|
||||
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ import (
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/model"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_client_api_server/operations/posture_checks"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/posture_checks"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -43,11 +43,11 @@ func NewPostureResponseRouter() *PostureResponseRouter {
|
||||
}
|
||||
|
||||
func (r *PostureResponseRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.PostureChecksCreatePostureResponseHandler = posture_checks.CreatePostureResponseHandlerFunc(func(params posture_checks.CreatePostureResponseParams, _ interface{}) middleware.Responder {
|
||||
ae.ClientApi.PostureChecksCreatePostureResponseHandler = posture_checks.CreatePostureResponseHandlerFunc(func(params posture_checks.CreatePostureResponseParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.PostureChecksCreatePostureResponseBulkHandler = posture_checks.CreatePostureResponseBulkHandlerFunc(func(params posture_checks.CreatePostureResponseBulkParams, _ interface{}) middleware.Responder {
|
||||
ae.ClientApi.PostureChecksCreatePostureResponseBulkHandler = posture_checks.CreatePostureResponseBulkHandlerFunc(func(params posture_checks.CreatePostureResponseBulkParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.CreateBulk(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
}
|
||||
@@ -120,9 +120,9 @@ func (r *PostureResponseRouter) handlePostureResponse(ae *env.AppEnv, rc *respon
|
||||
}
|
||||
|
||||
subType := &model.PostureResponseProcess{
|
||||
Path: *apiPostureResponse.Path,
|
||||
IsRunning: *apiPostureResponse.IsRunning,
|
||||
BinaryHash: *apiPostureResponse.Hash,
|
||||
Path: apiPostureResponse.Path,
|
||||
IsRunning: apiPostureResponse.IsRunning,
|
||||
BinaryHash: apiPostureResponse.Hash,
|
||||
SignerFingerprints: apiPostureResponse.SignerFingerprints,
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_client_api_server/operations/informational"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/informational"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,7 +41,7 @@ func NewProtocolRouter() *ProtocolRouter {
|
||||
}
|
||||
|
||||
func (router *ProtocolRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.InformationalListProtocolsHandler = informational.ListProtocolsHandlerFunc(func(params informational.ListProtocolsParams) middleware.Responder {
|
||||
ae.ClientApi.InformationalListProtocolsHandler = informational.ListProtocolsHandlerFunc(func(params informational.ListProtocolsParams) middleware.Responder {
|
||||
return ae.IsAllowed(router.List, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -26,12 +26,9 @@ import (
|
||||
|
||||
const (
|
||||
LimitMax = 500
|
||||
OffsetMax = 100000
|
||||
LimitDefault = 10
|
||||
OffsetDefault = 0
|
||||
)
|
||||
|
||||
// Represents external query options, which limits some query options (i.e. return all vs max limit). PublicQueryOptions
|
||||
// PublicQueryOptions represents external query options, which limits some query options (i.e. return all vs max limit). PublicQueryOptions
|
||||
// can be used internally as long as the public option limitations are fitting.
|
||||
type PublicQueryOptions struct {
|
||||
Predicate string
|
||||
|
||||
@@ -21,8 +21,8 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/role_attributes"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/role_attributes"
|
||||
"github.com/openziti/fabric/controller/models"
|
||||
)
|
||||
|
||||
@@ -38,15 +38,15 @@ func NewRoleAttributesRouter() *RoleAttributesRouter {
|
||||
}
|
||||
|
||||
func (r *RoleAttributesRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.RoleAttributesListEdgeRouterRoleAttributesHandler = role_attributes.ListEdgeRouterRoleAttributesHandlerFunc(func(params role_attributes.ListEdgeRouterRoleAttributesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.RoleAttributesListEdgeRouterRoleAttributesHandler = role_attributes.ListEdgeRouterRoleAttributesHandlerFunc(func(params role_attributes.ListEdgeRouterRoleAttributesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listEdgeRouterRoleAttributes, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.RoleAttributesListIdentityRoleAttributesHandler = role_attributes.ListIdentityRoleAttributesHandlerFunc(func(params role_attributes.ListIdentityRoleAttributesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.RoleAttributesListIdentityRoleAttributesHandler = role_attributes.ListIdentityRoleAttributesHandlerFunc(func(params role_attributes.ListIdentityRoleAttributesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listIdentityRoleAttributes, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.RoleAttributesListServiceRoleAttributesHandler = role_attributes.ListServiceRoleAttributesHandlerFunc(func(params role_attributes.ListServiceRoleAttributesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.RoleAttributesListServiceRoleAttributesHandler = role_attributes.ListServiceRoleAttributesHandlerFunc(func(params role_attributes.ListServiceRoleAttributesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listServiceRoleAttributes, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
+5
-5
@@ -16,7 +16,7 @@ const EntityNameTransitRouter = "transit-routers"
|
||||
|
||||
var TransitRouterLinkFactory = NewBasicLinkFactory(EntityNameTransitRouter)
|
||||
|
||||
func MapCreateTransitRouterToModel(router *rest_model.TransitRouterCreate) *model.TransitRouter {
|
||||
func MapCreateRouterToModel(router *rest_model.RouterCreate) *model.TransitRouter {
|
||||
ret := &model.TransitRouter{
|
||||
BaseEntity: models.BaseEntity{},
|
||||
Name: stringz.OrEmpty(router.Name),
|
||||
@@ -25,7 +25,7 @@ func MapCreateTransitRouterToModel(router *rest_model.TransitRouterCreate) *mode
|
||||
return ret
|
||||
}
|
||||
|
||||
func MapUpdateTransitRouterToModel(id string, router *rest_model.TransitRouterUpdate) *model.TransitRouter {
|
||||
func MapUpdateTransitRouterToModel(id string, router *rest_model.RouterUpdate) *model.TransitRouter {
|
||||
ret := &model.TransitRouter{
|
||||
BaseEntity: models.BaseEntity{
|
||||
Tags: router.Tags,
|
||||
@@ -37,7 +37,7 @@ func MapUpdateTransitRouterToModel(id string, router *rest_model.TransitRouterUp
|
||||
return ret
|
||||
}
|
||||
|
||||
func MapPatchTransitRouterToModel(id string, router *rest_model.TransitRouterPatch) *model.TransitRouter {
|
||||
func MapPatchTransitRouterToModel(id string, router *rest_model.RouterPatch) *model.TransitRouter {
|
||||
ret := &model.TransitRouter{
|
||||
BaseEntity: models.BaseEntity{
|
||||
Tags: router.Tags,
|
||||
@@ -70,9 +70,9 @@ func MapTransitRouterToRestEntity(ae *env.AppEnv, _ *response.RequestContext, e
|
||||
return restModel, nil
|
||||
}
|
||||
|
||||
func MapTransitRouterToRestModel(ae *env.AppEnv, router *model.TransitRouter) (*rest_model.TransitRouterDetail, error) {
|
||||
func MapTransitRouterToRestModel(ae *env.AppEnv, router *model.TransitRouter) (*rest_model.RouterDetail, error) {
|
||||
isConnected := ae.GetHandlers().Router.IsConnected(router.GetId())
|
||||
ret := &rest_model.TransitRouterDetail{
|
||||
ret := &rest_model.RouterDetail{
|
||||
BaseEntity: BaseEntityToRestModel(router, TransitRouterLinkFactory),
|
||||
Fingerprint: router.Fingerprint,
|
||||
IsOnline: &isConnected,
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
Copyright NetFoundry, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/router"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
r := NewTransitRouterRouter()
|
||||
env.AddRouter(r)
|
||||
}
|
||||
|
||||
type TransitRouterRouter struct {
|
||||
BasePath string
|
||||
}
|
||||
|
||||
func NewTransitRouterRouter() *TransitRouterRouter {
|
||||
return &TransitRouterRouter{
|
||||
BasePath: "/" + EntityNameTransitRouter,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Register(ae *env.AppEnv) {
|
||||
//Router
|
||||
ae.ManagementApi.RouterDeleteRouterHandler = router.DeleteRouterHandlerFunc(func(params router.DeleteRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.ManagementApi.RouterDetailRouterHandler = router.DetailRouterHandlerFunc(func(params router.DetailRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.ManagementApi.RouterListRoutersHandler = router.ListRoutersHandlerFunc(func(params router.ListRoutersParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.ManagementApi.RouterUpdateRouterHandler = router.UpdateRouterHandlerFunc(func(params router.UpdateRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params.ID, params.Router) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.ManagementApi.RouterCreateRouterHandler = router.CreateRouterHandlerFunc(func(params router.CreateRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params.Router) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.ManagementApi.RouterPatchRouterHandler = router.PatchRouterHandlerFunc(func(params router.PatchRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params.ID, params.Router) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
|
||||
//Transit Router (deprecated)
|
||||
ae.ManagementApi.RouterDeleteTransitRouterHandler = router.DeleteTransitRouterHandlerFunc(func(params router.DeleteTransitRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.ManagementApi.RouterDetailTransitRouterHandler = router.DetailTransitRouterHandlerFunc(func(params router.DetailTransitRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.ManagementApi.RouterListTransitRoutersHandler = router.ListTransitRoutersHandlerFunc(func(params router.ListTransitRoutersParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.ManagementApi.RouterUpdateTransitRouterHandler = router.UpdateTransitRouterHandlerFunc(func(params router.UpdateTransitRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params.ID, params.Router) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.ManagementApi.RouterCreateTransitRouterHandler = router.CreateTransitRouterHandlerFunc(func(params router.CreateTransitRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params.Router) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.ManagementApi.RouterPatchTransitRouterHandler = router.PatchTransitRouterHandlerFunc(func(params router.PatchTransitRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params.ID, params.Router) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) List(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
ListWithHandler(ae, rc, ae.Handlers.TransitRouter, MapTransitRouterToRestEntity)
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Detail(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
DetailWithHandler(ae, rc, ae.Handlers.TransitRouter, MapTransitRouterToRestEntity)
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Create(ae *env.AppEnv, rc *response.RequestContext, router *rest_model.RouterCreate) {
|
||||
Create(rc, rc, TransitRouterLinkFactory, func() (string, error) {
|
||||
return ae.Handlers.TransitRouter.Create(MapCreateRouterToModel(router))
|
||||
})
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Delete(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
DeleteWithHandler(rc, ae.Handlers.TransitRouter)
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Update(ae *env.AppEnv, rc *response.RequestContext, routerId string, router *rest_model.RouterUpdate) {
|
||||
Update(rc, func(id string) error {
|
||||
return ae.Handlers.TransitRouter.Update(MapUpdateTransitRouterToModel(routerId, router), false)
|
||||
})
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Patch(ae *env.AppEnv, rc *response.RequestContext, routerId string, router *rest_model.RouterPatch) {
|
||||
Patch(rc, func(id string, fields JsonFields) error {
|
||||
return ae.Handlers.TransitRouter.Patch(MapPatchTransitRouterToModel(routerId, router), fields.ConcatNestedNames().FilterMaps("tags"), false)
|
||||
})
|
||||
}
|
||||
@@ -209,13 +209,14 @@ func MapServiceToRestModel(ae *env.AppEnv, rc *response.RequestContext, service
|
||||
|
||||
func PostureCheckToQueries(check *model.PostureCheck) *rest_model.PostureQuery {
|
||||
isPassing := false
|
||||
queryType := rest_model.PostureCheckType(check.TypeId)
|
||||
ret := &rest_model.PostureQuery{
|
||||
BaseEntity: BaseEntityToRestModel(check, PostureCheckLinkFactory),
|
||||
IsPassing: &isPassing,
|
||||
QueryType: rest_model.PostureCheckType(check.TypeId),
|
||||
QueryType: &queryType,
|
||||
}
|
||||
|
||||
switch ret.QueryType {
|
||||
switch *ret.QueryType {
|
||||
case rest_model.PostureCheckTypePROCESS:
|
||||
processCheck := check.SubType.(*model.PostureCheckProcess)
|
||||
ret.Process = &rest_model.PostureQueryProcess{
|
||||
|
||||
@@ -114,14 +114,16 @@ func MapServiceEdgeRouterPolicyToRestEntity(ae *env.AppEnv, _ *response.RequestC
|
||||
}
|
||||
|
||||
func MapServiceEdgeRouterPolicyToRestModel(ae *env.AppEnv, policy *model.ServiceEdgeRouterPolicy) (*rest_model.ServiceEdgeRouterPolicyDetail, error) {
|
||||
semantic := rest_model.Semantic(policy.Semantic)
|
||||
|
||||
ret := &rest_model.ServiceEdgeRouterPolicyDetail{
|
||||
BaseEntity: BaseEntityToRestModel(policy, ServiceEdgeRouterPolicyLinkFactory),
|
||||
EdgeRouterRoles: policy.EdgeRouterRoles,
|
||||
BaseEntity: BaseEntityToRestModel(policy, ServiceEdgeRouterPolicyLinkFactory),
|
||||
EdgeRouterRoles: policy.EdgeRouterRoles,
|
||||
EdgeRouterRolesDisplay: GetNamedEdgeRouterRoles(ae.GetHandlers().EdgeRouter, policy.EdgeRouterRoles),
|
||||
Name: &policy.Name,
|
||||
Semantic: rest_model.Semantic(policy.Semantic),
|
||||
ServiceRoles: policy.ServiceRoles,
|
||||
ServiceRolesDisplay: GetNamedServiceRoles(ae.GetHandlers().EdgeService, policy.ServiceRoles),
|
||||
Name: &policy.Name,
|
||||
Semantic: &semantic,
|
||||
ServiceRoles: policy.ServiceRoles,
|
||||
ServiceRolesDisplay: GetNamedServiceRoles(ae.GetHandlers().EdgeService, policy.ServiceRoles),
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/service_edge_router_policy"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/service_edge_router_policy"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,36 +41,36 @@ func NewServiceEdgeRouterPolicyRouter() *ServiceEdgeRouterPolicyRouter {
|
||||
|
||||
func (r *ServiceEdgeRouterPolicyRouter) Register(ae *env.AppEnv) {
|
||||
// CRUD
|
||||
ae.Api.ServiceEdgeRouterPolicyDeleteServiceEdgeRouterPolicyHandler = service_edge_router_policy.DeleteServiceEdgeRouterPolicyHandlerFunc(func(params service_edge_router_policy.DeleteServiceEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceEdgeRouterPolicyDeleteServiceEdgeRouterPolicyHandler = service_edge_router_policy.DeleteServiceEdgeRouterPolicyHandlerFunc(func(params service_edge_router_policy.DeleteServiceEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceEdgeRouterPolicyDetailServiceEdgeRouterPolicyHandler = service_edge_router_policy.DetailServiceEdgeRouterPolicyHandlerFunc(func(params service_edge_router_policy.DetailServiceEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceEdgeRouterPolicyDetailServiceEdgeRouterPolicyHandler = service_edge_router_policy.DetailServiceEdgeRouterPolicyHandlerFunc(func(params service_edge_router_policy.DetailServiceEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceEdgeRouterPolicyListServiceEdgeRouterPoliciesHandler = service_edge_router_policy.ListServiceEdgeRouterPoliciesHandlerFunc(func(params service_edge_router_policy.ListServiceEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceEdgeRouterPolicyListServiceEdgeRouterPoliciesHandler = service_edge_router_policy.ListServiceEdgeRouterPoliciesHandlerFunc(func(params service_edge_router_policy.ListServiceEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceEdgeRouterPolicyUpdateServiceEdgeRouterPolicyHandler = service_edge_router_policy.UpdateServiceEdgeRouterPolicyHandlerFunc(func(params service_edge_router_policy.UpdateServiceEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceEdgeRouterPolicyUpdateServiceEdgeRouterPolicyHandler = service_edge_router_policy.UpdateServiceEdgeRouterPolicyHandlerFunc(func(params service_edge_router_policy.UpdateServiceEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceEdgeRouterPolicyCreateServiceEdgeRouterPolicyHandler = service_edge_router_policy.CreateServiceEdgeRouterPolicyHandlerFunc(func(params service_edge_router_policy.CreateServiceEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceEdgeRouterPolicyCreateServiceEdgeRouterPolicyHandler = service_edge_router_policy.CreateServiceEdgeRouterPolicyHandlerFunc(func(params service_edge_router_policy.CreateServiceEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceEdgeRouterPolicyPatchServiceEdgeRouterPolicyHandler = service_edge_router_policy.PatchServiceEdgeRouterPolicyHandlerFunc(func(params service_edge_router_policy.PatchServiceEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceEdgeRouterPolicyPatchServiceEdgeRouterPolicyHandler = service_edge_router_policy.PatchServiceEdgeRouterPolicyHandlerFunc(func(params service_edge_router_policy.PatchServiceEdgeRouterPolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
//Additional Lists
|
||||
ae.Api.ServiceEdgeRouterPolicyListServiceEdgeRouterPolicyEdgeRoutersHandler = service_edge_router_policy.ListServiceEdgeRouterPolicyEdgeRoutersHandlerFunc(func(params service_edge_router_policy.ListServiceEdgeRouterPolicyEdgeRoutersParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceEdgeRouterPolicyListServiceEdgeRouterPolicyEdgeRoutersHandler = service_edge_router_policy.ListServiceEdgeRouterPolicyEdgeRoutersHandlerFunc(func(params service_edge_router_policy.ListServiceEdgeRouterPolicyEdgeRoutersParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.ListEdgeRouters, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceEdgeRouterPolicyListServiceEdgeRouterPolicyServicesHandler = service_edge_router_policy.ListServiceEdgeRouterPolicyServicesHandlerFunc(func(params service_edge_router_policy.ListServiceEdgeRouterPolicyServicesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceEdgeRouterPolicyListServiceEdgeRouterPolicyServicesHandler = service_edge_router_policy.ListServiceEdgeRouterPolicyServicesHandlerFunc(func(params service_edge_router_policy.ListServiceEdgeRouterPolicyServicesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.ListServices, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ func MapCreateServicePolicyToModel(policy *rest_model.ServicePolicyCreate) *mode
|
||||
Tags: policy.Tags,
|
||||
},
|
||||
Name: stringz.OrEmpty(policy.Name),
|
||||
PolicyType: string(policy.Type),
|
||||
PolicyType: string(*policy.Type),
|
||||
Semantic: string(policy.Semantic),
|
||||
ServiceRoles: policy.ServiceRoles,
|
||||
IdentityRoles: policy.IdentityRoles,
|
||||
@@ -73,7 +73,7 @@ func MapUpdateServicePolicyToModel(id string, policy *rest_model.ServicePolicyUp
|
||||
Id: id,
|
||||
},
|
||||
Name: stringz.OrEmpty(policy.Name),
|
||||
PolicyType: string(policy.Type),
|
||||
PolicyType: string(*policy.Type),
|
||||
Semantic: string(policy.Semantic),
|
||||
ServiceRoles: policy.ServiceRoles,
|
||||
IdentityRoles: policy.IdentityRoles,
|
||||
@@ -122,15 +122,18 @@ func MapServicePolicyToRestEntity(ae *env.AppEnv, _ *response.RequestContext, e
|
||||
}
|
||||
|
||||
func MapServicePolicyToRestModel(ae *env.AppEnv, policy *model.ServicePolicy) (*rest_model.ServicePolicyDetail, error) {
|
||||
semantic := rest_model.Semantic(policy.Semantic)
|
||||
dialBindType := rest_model.DialBind(policy.PolicyType)
|
||||
|
||||
ret := &rest_model.ServicePolicyDetail{
|
||||
BaseEntity: BaseEntityToRestModel(policy, ServicePolicyLinkFactory),
|
||||
IdentityRoles: policy.IdentityRoles,
|
||||
IdentityRolesDisplay: GetNamedIdentityRoles(ae.GetHandlers().Identity, policy.IdentityRoles),
|
||||
Name: &policy.Name,
|
||||
Semantic: rest_model.Semantic(policy.Semantic),
|
||||
Semantic: &semantic,
|
||||
ServiceRoles: policy.ServiceRoles,
|
||||
ServiceRolesDisplay: GetNamedServiceRoles(ae.GetHandlers().EdgeService, policy.ServiceRoles),
|
||||
Type: rest_model.DialBind(policy.PolicyType),
|
||||
Type: &dialBindType,
|
||||
PostureCheckRoles: policy.PostureCheckRoles,
|
||||
PostureCheckRolesDisplay: GetNamedPostureCheckRoles(ae.GetHandlers().PostureCheck, policy.PostureCheckRoles),
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/service_policy"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/service_policy"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,40 +41,40 @@ func NewServicePolicyRouter() *ServicePolicyRouter {
|
||||
|
||||
func (r *ServicePolicyRouter) Register(ae *env.AppEnv) {
|
||||
//CRUD
|
||||
ae.Api.ServicePolicyDeleteServicePolicyHandler = service_policy.DeleteServicePolicyHandlerFunc(func(params service_policy.DeleteServicePolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServicePolicyDeleteServicePolicyHandler = service_policy.DeleteServicePolicyHandlerFunc(func(params service_policy.DeleteServicePolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServicePolicyDetailServicePolicyHandler = service_policy.DetailServicePolicyHandlerFunc(func(params service_policy.DetailServicePolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServicePolicyDetailServicePolicyHandler = service_policy.DetailServicePolicyHandlerFunc(func(params service_policy.DetailServicePolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServicePolicyListServicePoliciesHandler = service_policy.ListServicePoliciesHandlerFunc(func(params service_policy.ListServicePoliciesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServicePolicyListServicePoliciesHandler = service_policy.ListServicePoliciesHandlerFunc(func(params service_policy.ListServicePoliciesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServicePolicyUpdateServicePolicyHandler = service_policy.UpdateServicePolicyHandlerFunc(func(params service_policy.UpdateServicePolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServicePolicyUpdateServicePolicyHandler = service_policy.UpdateServicePolicyHandlerFunc(func(params service_policy.UpdateServicePolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServicePolicyCreateServicePolicyHandler = service_policy.CreateServicePolicyHandlerFunc(func(params service_policy.CreateServicePolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServicePolicyCreateServicePolicyHandler = service_policy.CreateServicePolicyHandlerFunc(func(params service_policy.CreateServicePolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServicePolicyPatchServicePolicyHandler = service_policy.PatchServicePolicyHandlerFunc(func(params service_policy.PatchServicePolicyParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServicePolicyPatchServicePolicyHandler = service_policy.PatchServicePolicyHandlerFunc(func(params service_policy.PatchServicePolicyParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
//Additional Lists
|
||||
ae.Api.ServicePolicyListServicePolicyServicesHandler = service_policy.ListServicePolicyServicesHandlerFunc(func(params service_policy.ListServicePolicyServicesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServicePolicyListServicePolicyServicesHandler = service_policy.ListServicePolicyServicesHandlerFunc(func(params service_policy.ListServicePolicyServicesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.ListServices, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServicePolicyListServicePolicyIdentitiesHandler = service_policy.ListServicePolicyIdentitiesHandlerFunc(func(params service_policy.ListServicePolicyIdentitiesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServicePolicyListServicePolicyIdentitiesHandler = service_policy.ListServicePolicyIdentitiesHandlerFunc(func(params service_policy.ListServicePolicyIdentitiesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.ListIdentities, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServicePolicyListServicePolicyPostureChecksHandler = service_policy.ListServicePolicyPostureChecksHandlerFunc(func(params service_policy.ListServicePolicyPostureChecksParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServicePolicyListServicePolicyPostureChecksHandler = service_policy.ListServicePolicyPostureChecksHandlerFunc(func(params service_policy.ListServicePolicyPostureChecksParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.ListPostureChecks, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/edge/rest_server/operations/service"
|
||||
clientService "github.com/openziti/edge/rest_client_api_server/operations/service"
|
||||
managementService "github.com/openziti/edge/rest_management_api_server/operations/service"
|
||||
"github.com/openziti/fabric/controller/models"
|
||||
"github.com/openziti/foundation/metrics"
|
||||
"github.com/openziti/foundation/storage/boltz"
|
||||
@@ -52,70 +53,82 @@ func NewServiceRouter() *ServiceRouter {
|
||||
func (r *ServiceRouter) Register(ae *env.AppEnv) {
|
||||
r.listTimer = ae.GetHostController().GetNetwork().GetMetricsRegistry().Timer("services.list")
|
||||
|
||||
ae.Api.ServiceDeleteServiceHandler = service.DeleteServiceHandlerFunc(func(params service.DeleteServiceParams, _ interface{}) middleware.Responder {
|
||||
//Client
|
||||
ae.ClientApi.ServiceListServicesHandler = clientService.ListServicesHandlerFunc(func(params clientService.ListServicesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.ListClientServices, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ClientApi.ServiceDetailServiceHandler = clientService.DetailServiceHandlerFunc(func(params clientService.DetailServiceParams, _ interface{}) middleware.Responder {
|
||||
//r.Detail limits by identity
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ClientApi.ServiceListServiceTerminatorsHandler = clientService.ListServiceTerminatorsHandlerFunc(func(params clientService.ListServiceTerminatorsParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listClientTerminators, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
//Management
|
||||
ae.ManagementApi.ServiceDeleteServiceHandler = managementService.DeleteServiceHandlerFunc(func(params managementService.DeleteServiceParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceDetailServiceHandler = service.DetailServiceHandlerFunc(func(params service.DetailServiceParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated()) //filter restricted
|
||||
ae.ManagementApi.ServiceDetailServiceHandler = managementService.DetailServiceHandlerFunc(func(params managementService.DetailServiceParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceListServicesHandler = service.ListServicesHandlerFunc(func(params service.ListServicesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAuthenticated()) //filter restricted
|
||||
ae.ManagementApi.ServiceListServicesHandler = managementService.ListServicesHandlerFunc(func(params managementService.ListServicesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.ListManagementServices, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceUpdateServiceHandler = service.UpdateServiceHandlerFunc(func(params service.UpdateServiceParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceUpdateServiceHandler = managementService.UpdateServiceHandlerFunc(func(params managementService.UpdateServiceParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceCreateServiceHandler = service.CreateServiceHandlerFunc(func(params service.CreateServiceParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceCreateServiceHandler = managementService.CreateServiceHandlerFunc(func(params managementService.CreateServiceParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServicePatchServiceHandler = service.PatchServiceHandlerFunc(func(params service.PatchServiceParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServicePatchServiceHandler = managementService.PatchServiceHandlerFunc(func(params managementService.PatchServiceParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceListServiceServiceEdgeRouterPoliciesHandler = service.ListServiceServiceEdgeRouterPoliciesHandlerFunc(func(params service.ListServiceServiceEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceListServiceServiceEdgeRouterPoliciesHandler = managementService.ListServiceServiceEdgeRouterPoliciesHandlerFunc(func(params managementService.ListServiceServiceEdgeRouterPoliciesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listServiceEdgeRouterPolicies, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceListServiceEdgeRoutersHandler = service.ListServiceEdgeRoutersHandlerFunc(func(params service.ListServiceEdgeRoutersParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceListServiceEdgeRoutersHandler = managementService.ListServiceEdgeRoutersHandlerFunc(func(params managementService.ListServiceEdgeRoutersParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listEdgeRouters, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceListServiceServicePoliciesHandler = service.ListServiceServicePoliciesHandlerFunc(func(params service.ListServiceServicePoliciesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceListServiceServicePoliciesHandler = managementService.ListServiceServicePoliciesHandlerFunc(func(params managementService.ListServiceServicePoliciesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listServicePolicies, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceListServiceIdentitiesHandler = service.ListServiceIdentitiesHandlerFunc(func(params service.ListServiceIdentitiesParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceListServiceIdentitiesHandler = managementService.ListServiceIdentitiesHandlerFunc(func(params managementService.ListServiceIdentitiesParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listIdentities, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceListServiceConfigHandler = service.ListServiceConfigHandlerFunc(func(params service.ListServiceConfigParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.ServiceListServiceConfigHandler = managementService.ListServiceConfigHandlerFunc(func(params managementService.ListServiceConfigParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listConfigs, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.ServiceListServiceTerminatorsHandler = service.ListServiceTerminatorsHandlerFunc(func(params service.ListServiceTerminatorsParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listTerminators, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
ae.ManagementApi.ServiceListServiceTerminatorsHandler = managementService.ListServiceTerminatorsHandlerFunc(func(params managementService.ListServiceTerminatorsParams, i interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.listManagementTerminators, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
func (r *ServiceRouter) List(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
start := time.Now()
|
||||
// ListWithHandler won't do search limiting by logged in user
|
||||
func (r *ServiceRouter) ListManagementServices(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
//always admin
|
||||
List(rc, func(rc *response.RequestContext, queryOptions *PublicQueryOptions) (*QueryResult, error) {
|
||||
identity := rc.Identity
|
||||
if rc.Identity.IsAdmin {
|
||||
if asId := rc.Request.URL.Query().Get("asIdentity"); asId != "" {
|
||||
var err error
|
||||
identity, err = ae.Handlers.Identity.ReadOneByQuery(fmt.Sprintf(`id = "%v" or name = "%v"`, asId, asId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if identity == nil {
|
||||
return nil, boltz.NewNotFoundError("identity", "id or name", asId)
|
||||
}
|
||||
if asId := rc.Request.URL.Query().Get("asIdentity"); asId != "" {
|
||||
var err error
|
||||
identity, err = ae.Handlers.Identity.ReadOneByQuery(fmt.Sprintf(`id = "%v" or name = "%v"`, asId, asId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if identity == nil {
|
||||
return nil, boltz.NewNotFoundError("identity", "id or name", asId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +148,8 @@ func (r *ServiceRouter) List(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
|
||||
var apiEntities []interface{}
|
||||
var qmd *models.QueryMetaData
|
||||
if rc.Identity.IsAdmin && len(roleFilters) > 0 {
|
||||
|
||||
if len(roleFilters) > 0 {
|
||||
cursorProvider, err := ae.GetStores().EdgeService.GetRoleAttributesCursorProvider(roleFilters, roleSemantic)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -164,6 +178,40 @@ func (r *ServiceRouter) List(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
}
|
||||
qmd = &result.QueryMetaData
|
||||
}
|
||||
|
||||
|
||||
return NewQueryResult(apiEntities, qmd), nil
|
||||
})
|
||||
}
|
||||
|
||||
func (r *ServiceRouter) ListClientServices(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
//never in an admin capacity
|
||||
start := time.Now()
|
||||
// ListWithHandler won't do search limiting by logged in user
|
||||
List(rc, func(rc *response.RequestContext, queryOptions *PublicQueryOptions) (*QueryResult, error) {
|
||||
|
||||
// allow overriding config types
|
||||
configTypes := rc.ApiSession.ConfigTypes
|
||||
if requestedConfigTypes := rc.Request.URL.Query().Get("configTypes"); requestedConfigTypes != "" {
|
||||
configTypes = ae.Handlers.ConfigType.MapConfigTypeNamesToIds(strings.Split(requestedConfigTypes, ","), rc.Identity.Id)
|
||||
}
|
||||
|
||||
query, err := queryOptions.getFullQuery(ae.Handlers.EdgeService.GetStore())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result, err := ae.Handlers.EdgeService.PublicQueryForIdentity(rc.Identity, configTypes, query)
|
||||
if err != nil {
|
||||
pfxlog.Logger().Errorf("error executing list query: %+v", err)
|
||||
return nil, err
|
||||
}
|
||||
apiEntities, err := MapServicesToRestEntity(ae, rc, result.Services)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qmd := &result.QueryMetaData
|
||||
|
||||
return NewQueryResult(apiEntities, qmd), nil
|
||||
})
|
||||
r.listTimer.UpdateSince(start)
|
||||
@@ -180,7 +228,7 @@ func (r *ServiceRouter) Detail(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
})
|
||||
}
|
||||
|
||||
func (r *ServiceRouter) Create(ae *env.AppEnv, rc *response.RequestContext, params service.CreateServiceParams) {
|
||||
func (r *ServiceRouter) Create(ae *env.AppEnv, rc *response.RequestContext, params managementService.CreateServiceParams) {
|
||||
Create(rc, rc, ServiceLinkFactory, func() (string, error) {
|
||||
return ae.Handlers.EdgeService.Create(MapCreateServiceToModel(params.Service))
|
||||
})
|
||||
@@ -190,13 +238,13 @@ func (r *ServiceRouter) Delete(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
DeleteWithHandler(rc, ae.Handlers.EdgeService)
|
||||
}
|
||||
|
||||
func (r *ServiceRouter) Update(ae *env.AppEnv, rc *response.RequestContext, params service.UpdateServiceParams) {
|
||||
func (r *ServiceRouter) Update(ae *env.AppEnv, rc *response.RequestContext, params managementService.UpdateServiceParams) {
|
||||
Update(rc, func(id string) error {
|
||||
return ae.Handlers.EdgeService.Update(MapUpdateServiceToModel(params.ID, params.Service))
|
||||
})
|
||||
}
|
||||
|
||||
func (r *ServiceRouter) Patch(ae *env.AppEnv, rc *response.RequestContext, params service.PatchServiceParams) {
|
||||
func (r *ServiceRouter) Patch(ae *env.AppEnv, rc *response.RequestContext, params managementService.PatchServiceParams) {
|
||||
Patch(rc, func(id string, fields JsonFields) error {
|
||||
return ae.Handlers.EdgeService.Patch(MapPatchServiceToModel(params.ID, params.Service), fields.ConcatNestedNames().FilterMaps("tags"))
|
||||
})
|
||||
@@ -214,37 +262,35 @@ func (r *ServiceRouter) listConfigs(ae *env.AppEnv, rc *response.RequestContext)
|
||||
r.listAssociations(ae, rc, ae.Handlers.Config, MapConfigToRestEntity)
|
||||
}
|
||||
|
||||
func (r *ServiceRouter) listTerminators(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
if rc.Identity.IsAdmin {
|
||||
r.listAssociations(ae, rc, ae.Handlers.Terminator, MapTerminatorToRestEntity)
|
||||
return
|
||||
} else {
|
||||
serviceId, err := rc.GetEntityId()
|
||||
func (r *ServiceRouter) listManagementTerminators(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
r.listAssociations(ae, rc, ae.Handlers.Terminator, MapTerminatorToRestEntity)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
rc.RespondWithError(err)
|
||||
return
|
||||
}
|
||||
func (r *ServiceRouter) listClientTerminators(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
serviceId, err := rc.GetEntityId()
|
||||
|
||||
svc, err := ae.Handlers.EdgeService.ReadForIdentity(serviceId, rc.Identity.Id, nil)
|
||||
|
||||
if err != nil {
|
||||
if boltz.IsErrNotFoundErr(err) {
|
||||
rc.RespondWithNotFound()
|
||||
} else {
|
||||
rc.RespondWithError(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if svc == nil {
|
||||
rc.RespondWithNotFound()
|
||||
return
|
||||
}
|
||||
|
||||
r.listAssociations(ae, rc, ae.Handlers.Terminator, MapLimitedTerminatorToRestEntity)
|
||||
if err != nil {
|
||||
rc.RespondWithError(err)
|
||||
return
|
||||
}
|
||||
|
||||
svc, err := ae.Handlers.EdgeService.ReadForIdentity(serviceId, rc.Identity.Id, nil)
|
||||
|
||||
if err != nil {
|
||||
if boltz.IsErrNotFoundErr(err) {
|
||||
rc.RespondWithNotFound()
|
||||
} else {
|
||||
rc.RespondWithError(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if svc == nil {
|
||||
rc.RespondWithNotFound()
|
||||
return
|
||||
}
|
||||
|
||||
r.listAssociations(ae, rc, ae.Handlers.Terminator, MapClientTerminatorToRestEntity)
|
||||
}
|
||||
|
||||
func (r *ServiceRouter) listAssociations(ae *env.AppEnv, rc *response.RequestContext, associationLoader models.EntityRetriever, mapper ModelToApiMapper) {
|
||||
|
||||
@@ -100,6 +100,8 @@ func MapSessionToRestModel(ae *env.AppEnv, sessionModel *model.Session) (*rest_m
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dialBindType := rest_model.DialBind(sessionModel.Type)
|
||||
|
||||
ret := &rest_model.SessionDetail{
|
||||
BaseEntity: BaseEntityToRestModel(sessionModel, SessionLinkFactory),
|
||||
APISession: ToEntityRef("", apiSession, ApiSessionLinkFactory),
|
||||
@@ -107,7 +109,7 @@ func MapSessionToRestModel(ae *env.AppEnv, sessionModel *model.Session) (*rest_m
|
||||
Service: ToEntityRef(service.Name, service, ServiceLinkFactory),
|
||||
ServiceID: &service.Id,
|
||||
EdgeRouters: edgeRouters,
|
||||
Type: rest_model.DialBind(sessionModel.Type),
|
||||
Type: &dialBindType,
|
||||
Token: &sessionModel.Token,
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ type SessionRequestResponder struct {
|
||||
ae *env.AppEnv
|
||||
}
|
||||
|
||||
func (nsr *SessionRequestResponder) RespondWithCreatedId(id string, link rest_model.Link) {
|
||||
func (nsr *SessionRequestResponder) RespondWithCreatedId(id string, _ rest_model.Link) {
|
||||
modelSession, err := nsr.ae.GetHandlers().Session.Read(id)
|
||||
if err != nil {
|
||||
nsr.RespondWithError(err)
|
||||
|
||||
@@ -21,8 +21,10 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_client_api_server/operations/session"
|
||||
clientSession "github.com/openziti/edge/rest_client_api_server/operations/session"
|
||||
managementSession "github.com/openziti/edge/rest_management_api_server/operations/session"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/session"
|
||||
"github.com/openziti/foundation/metrics"
|
||||
"time"
|
||||
)
|
||||
@@ -46,25 +48,41 @@ func NewSessionRouter() *SessionRouter {
|
||||
|
||||
func (r *SessionRouter) Register(ae *env.AppEnv) {
|
||||
r.createTimer = ae.GetHostController().GetNetwork().GetMetricsRegistry().Timer("session.create")
|
||||
ae.Api.SessionDeleteSessionHandler = session.DeleteSessionHandlerFunc(func(params session.DeleteSessionParams, _ interface{}) middleware.Responder {
|
||||
|
||||
//Management
|
||||
ae.ManagementApi.SessionDeleteSessionHandler = managementSession.DeleteSessionHandlerFunc(func(params managementSession.DeleteSessionParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.SessionDetailSessionHandler = session.DetailSessionHandlerFunc(func(params session.DetailSessionParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.SessionDetailSessionHandler = managementSession.DetailSessionHandlerFunc(func(params managementSession.DetailSessionParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.SessionListSessionsHandler = session.ListSessionsHandlerFunc(func(params session.ListSessionsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.SessionListSessionsHandler = managementSession.ListSessionsHandlerFunc(func(params managementSession.ListSessionsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.SessionCreateSessionHandler = session.CreateSessionHandlerFunc(func(params session.CreateSessionParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.SessionDetailSessionRoutePathHandler = managementSession.DetailSessionRoutePathHandlerFunc(func(params managementSession.DetailSessionRoutePathParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.DetailRoutePath(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
//Client
|
||||
ae.ClientApi.SessionDeleteSessionHandler = clientSession.DeleteSessionHandlerFunc(func(params clientSession.DeleteSessionParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ClientApi.SessionDetailSessionHandler = clientSession.DetailSessionHandlerFunc(func(params clientSession.DetailSessionParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ClientApi.SessionListSessionsHandler = clientSession.ListSessionsHandlerFunc(func(params clientSession.ListSessionsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.ClientApi.SessionCreateSessionHandler = clientSession.CreateSessionHandlerFunc(func(params clientSession.CreateSessionParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
|
||||
ae.Api.SessionDetailSessionRoutePathHandler = session.DetailSessionRoutePathHandlerFunc(func(params session.DetailSessionRoutePathParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.DetailRoutePath(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAuthenticated())
|
||||
})
|
||||
}
|
||||
|
||||
func (r *SessionRouter) List(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
@@ -113,7 +131,7 @@ func (r *SessionRouter) Create(ae *env.AppEnv, rc *response.RequestContext, para
|
||||
r.createTimer.UpdateSince(start)
|
||||
}
|
||||
|
||||
func (r *SessionRouter) DetailRoutePath(ae *env.AppEnv, rc *response.RequestContext, params session.DetailSessionRoutePathParams) {
|
||||
func (r *SessionRouter) DetailRoutePath(ae *env.AppEnv, rc *response.RequestContext, params managementSession.DetailSessionRoutePathParams) {
|
||||
path := []string{} //must be non null
|
||||
|
||||
for _, fabricSession := range ae.HostController.GetNetwork().GetAllSessions() {
|
||||
|
||||
@@ -25,9 +25,11 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_client_api_server"
|
||||
clientInformational "github.com/openziti/edge/rest_client_api_server/operations/informational"
|
||||
"github.com/openziti/edge/rest_management_api_server"
|
||||
managementInformational "github.com/openziti/edge/rest_management_api_server/operations/informational"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server"
|
||||
"github.com/openziti/edge/rest_server/operations/informational"
|
||||
"github.com/openziti/fabric/controller/models"
|
||||
"time"
|
||||
)
|
||||
@@ -59,7 +61,8 @@ type Spec struct {
|
||||
body map[string]interface{}
|
||||
}
|
||||
|
||||
var swaggerSpec *Spec
|
||||
var clientSpec *Spec
|
||||
var managementSpec *Spec
|
||||
var specs []*Spec
|
||||
|
||||
func init() {
|
||||
@@ -72,22 +75,38 @@ func init() {
|
||||
pfxlog.Logger().WithError(err).Warn("could not parse build info date for swagger spec")
|
||||
}
|
||||
}
|
||||
swaggerSpec = &Spec{
|
||||
|
||||
clientSpec = &Spec{
|
||||
BaseEntity: models.BaseEntity{
|
||||
Id: "swagger",
|
||||
Id: "edge-client",
|
||||
CreatedAt: date,
|
||||
UpdatedAt: date,
|
||||
Tags: map[string]interface{}{},
|
||||
},
|
||||
name: "swagger",
|
||||
name: "edge-client",
|
||||
}
|
||||
|
||||
err := json.Unmarshal(rest_server.SwaggerJSON, &swaggerSpec.body)
|
||||
managementSpec = &Spec{
|
||||
BaseEntity: models.BaseEntity{
|
||||
Id: "edge-management",
|
||||
CreatedAt: date,
|
||||
UpdatedAt: date,
|
||||
Tags: map[string]interface{}{},
|
||||
},
|
||||
name: "edge-management",
|
||||
}
|
||||
|
||||
err := json.Unmarshal(rest_client_api_server.SwaggerJSON, &clientSpec.body)
|
||||
if err != nil {
|
||||
pfxlog.Logger().WithError(err).Panic("could not parse rest server JSON spec")
|
||||
pfxlog.Logger().WithError(err).Panic("could not parse edge client server JSON spec")
|
||||
}
|
||||
|
||||
specs = append(specs, swaggerSpec)
|
||||
err = json.Unmarshal(rest_management_api_server.SwaggerJSON, &managementSpec.body)
|
||||
if err != nil {
|
||||
pfxlog.Logger().WithError(err).Panic("could not parse edge management server JSON spec")
|
||||
}
|
||||
|
||||
specs = append(specs, clientSpec, managementSpec)
|
||||
|
||||
r := NewSpecRouter()
|
||||
env.AddRouter(r)
|
||||
@@ -104,24 +123,38 @@ func NewSpecRouter() *SpecRouter {
|
||||
}
|
||||
|
||||
func (r *SpecRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.InformationalListSpecsHandler = informational.ListSpecsHandlerFunc(func(params informational.ListSpecsParams) middleware.Responder {
|
||||
//Client
|
||||
ae.ClientApi.InformationalListSpecsHandler = clientInformational.ListSpecsHandlerFunc(func(params clientInformational.ListSpecsParams) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.Api.InformationalDetailSpecHandler = informational.DetailSpecHandlerFunc(func(params informational.DetailSpecParams) middleware.Responder {
|
||||
ae.ClientApi.InformationalDetailSpecHandler = clientInformational.DetailSpecHandlerFunc(func(params clientInformational.DetailSpecParams) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.Api.InformationalDetailSpecBodyHandler = informational.DetailSpecBodyHandlerFunc(func(params informational.DetailSpecBodyParams) middleware.Responder {
|
||||
ae.ClientApi.InformationalDetailSpecBodyHandler = clientInformational.DetailSpecBodyHandlerFunc(func(params clientInformational.DetailSpecBodyParams) middleware.Responder {
|
||||
return ae.IsAllowed(r.DetailBody, params.HTTPRequest, params.ID, "", permissions.Always())
|
||||
})
|
||||
|
||||
//Management
|
||||
ae.ManagementApi.InformationalListSpecsHandler = managementInformational.ListSpecsHandlerFunc(func(params managementInformational.ListSpecsParams) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.ManagementApi.InformationalDetailSpecHandler = managementInformational.DetailSpecHandlerFunc(func(params managementInformational.DetailSpecParams) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.ManagementApi.InformationalDetailSpecBodyHandler = managementInformational.DetailSpecBodyHandlerFunc(func(params managementInformational.DetailSpecBodyParams) middleware.Responder {
|
||||
return ae.IsAllowed(r.DetailBody, params.HTTPRequest, params.ID, "", permissions.Always())
|
||||
})
|
||||
}
|
||||
|
||||
func (r *SpecRouter) List(_ *env.AppEnv, rc *response.RequestContext) {
|
||||
data := rest_model.SpecList{
|
||||
mapSpecToRestModel(swaggerSpec),
|
||||
mapSpecToRestModel(clientSpec),
|
||||
}
|
||||
|
||||
|
||||
rc.RespondWithOk(data, &rest_model.Meta{})
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ import (
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/persistence"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/informational"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/informational"
|
||||
"go.etcd.io/bbolt"
|
||||
|
||||
"reflect"
|
||||
@@ -45,7 +45,7 @@ func NewSummaryRouter() *SummaryRouter {
|
||||
}
|
||||
|
||||
func (r *SummaryRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.InformationalListSummaryHandler = informational.ListSummaryHandlerFunc(func(params informational.ListSummaryParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.InformationalListSummaryHandler = informational.ListSummaryHandlerFunc(func(params informational.ListSummaryParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
|
||||
@@ -44,7 +44,11 @@ func MapCreateTerminatorToModel(terminator *rest_model.TerminatorCreate) *networ
|
||||
Identity: terminator.Identity,
|
||||
IdentitySecret: terminator.IdentitySecret,
|
||||
Precedence: xt.GetPrecedenceForName(string(terminator.Precedence)),
|
||||
Cost: uint16(terminator.Cost),
|
||||
Cost: 0,
|
||||
}
|
||||
|
||||
if terminator.Cost != nil {
|
||||
ret.Cost = uint16(*terminator.Cost)
|
||||
}
|
||||
|
||||
return ret
|
||||
@@ -61,7 +65,7 @@ func MapUpdateTerminatorToModel(id string, terminator *rest_model.TerminatorUpda
|
||||
Binding: stringz.OrEmpty(terminator.Binding),
|
||||
Address: stringz.OrEmpty(terminator.Address),
|
||||
Precedence: xt.GetPrecedenceForName(string(terminator.Precedence)),
|
||||
Cost: uint16(terminator.Cost),
|
||||
Cost: uint16(*terminator.Cost),
|
||||
}
|
||||
return ret
|
||||
}
|
||||
@@ -77,7 +81,7 @@ func MapPatchTerminatorToModel(id string, terminator *rest_model.TerminatorPatch
|
||||
Binding: terminator.Binding,
|
||||
Address: terminator.Address,
|
||||
Precedence: xt.GetPrecedenceForName(string(terminator.Precedence)),
|
||||
Cost: uint16(terminator.Cost),
|
||||
Cost: uint16(*terminator.Cost),
|
||||
}
|
||||
return ret
|
||||
}
|
||||
@@ -115,6 +119,9 @@ func MapTerminatorToRestModel(ae *env.AppEnv, terminator *network.Terminator) (*
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cost := rest_model.TerminatorCost(int64(terminator.Cost))
|
||||
dynamicCost := rest_model.TerminatorCost(xt.GlobalCosts().GetDynamicCost(terminator.Id))
|
||||
|
||||
ret := &rest_model.TerminatorDetail{
|
||||
BaseEntity: BaseEntityToRestModel(terminator, TerminatorLinkFactory),
|
||||
ServiceID: &terminator.Service,
|
||||
@@ -124,23 +131,26 @@ func MapTerminatorToRestModel(ae *env.AppEnv, terminator *network.Terminator) (*
|
||||
Binding: &terminator.Binding,
|
||||
Address: &terminator.Address,
|
||||
Identity: &terminator.Identity,
|
||||
Cost: rest_model.TerminatorCost(int64(terminator.Cost)),
|
||||
DynamicCost: rest_model.TerminatorCost(xt.GlobalCosts().GetDynamicCost(terminator.Id)),
|
||||
Cost: &cost,
|
||||
DynamicCost: &dynamicCost,
|
||||
}
|
||||
|
||||
precedence := terminator.Precedence
|
||||
|
||||
resultPrecedence := rest_model.TerminatorPrecedenceDefault
|
||||
|
||||
if precedence.IsRequired() {
|
||||
ret.Precedence = "required"
|
||||
resultPrecedence = rest_model.TerminatorPrecedenceRequired
|
||||
} else if precedence.IsFailed() {
|
||||
ret.Precedence = "failed"
|
||||
} else {
|
||||
ret.Precedence = "default"
|
||||
resultPrecedence = rest_model.TerminatorPrecedenceFailed
|
||||
}
|
||||
|
||||
ret.Precedence = &resultPrecedence
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func MapLimitedTerminatorToRestEntity(ae *env.AppEnv, _ *response.RequestContext, e models.Entity) (interface{}, error) {
|
||||
func MapClientTerminatorToRestEntity(ae *env.AppEnv, _ *response.RequestContext, e models.Entity) (interface{}, error) {
|
||||
terminator, ok := e.(*network.Terminator)
|
||||
|
||||
if !ok {
|
||||
@@ -161,13 +171,13 @@ func MapLimitedTerminatorToRestEntity(ae *env.AppEnv, _ *response.RequestContext
|
||||
return restModel, nil
|
||||
}
|
||||
|
||||
func MapLimitedTerminatorToRestModel(ae *env.AppEnv, terminator *network.Terminator) (*rest_model.TerminatorDetailLimited, error) {
|
||||
func MapLimitedTerminatorToRestModel(ae *env.AppEnv, terminator *network.Terminator) (*rest_model.TerminatorClientDetail, error) {
|
||||
service, err := ae.Handlers.EdgeService.Read(terminator.Service)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ret := &rest_model.TerminatorDetailLimited{
|
||||
ret := &rest_model.TerminatorClientDetail{
|
||||
BaseEntity: BaseEntityToRestModel(terminator, TerminatorLinkFactory),
|
||||
ServiceID: &terminator.Service,
|
||||
Service: ToEntityRef(service.Name, service, ServiceLinkFactory),
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/terminator"
|
||||
"github.com/openziti/edge/rest_management_api_server/operations/terminator"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -40,27 +40,27 @@ func NewTerminatorRouter() *TerminatorRouter {
|
||||
}
|
||||
|
||||
func (r *TerminatorRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.TerminatorDeleteTerminatorHandler = terminator.DeleteTerminatorHandlerFunc(func(params terminator.DeleteTerminatorParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.TerminatorDeleteTerminatorHandler = terminator.DeleteTerminatorHandlerFunc(func(params terminator.DeleteTerminatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.TerminatorDetailTerminatorHandler = terminator.DetailTerminatorHandlerFunc(func(params terminator.DetailTerminatorParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.TerminatorDetailTerminatorHandler = terminator.DetailTerminatorHandlerFunc(func(params terminator.DetailTerminatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.TerminatorListTerminatorsHandler = terminator.ListTerminatorsHandlerFunc(func(params terminator.ListTerminatorsParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.TerminatorListTerminatorsHandler = terminator.ListTerminatorsHandlerFunc(func(params terminator.ListTerminatorsParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.TerminatorUpdateTerminatorHandler = terminator.UpdateTerminatorHandlerFunc(func(params terminator.UpdateTerminatorParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.TerminatorUpdateTerminatorHandler = terminator.UpdateTerminatorHandlerFunc(func(params terminator.UpdateTerminatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.TerminatorCreateTerminatorHandler = terminator.CreateTerminatorHandlerFunc(func(params terminator.CreateTerminatorParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.TerminatorCreateTerminatorHandler = terminator.CreateTerminatorHandlerFunc(func(params terminator.CreateTerminatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.TerminatorPatchTerminatorHandler = terminator.PatchTerminatorHandlerFunc(func(params terminator.PatchTerminatorParams, _ interface{}) middleware.Responder {
|
||||
ae.ManagementApi.TerminatorPatchTerminatorHandler = terminator.PatchTerminatorHandlerFunc(func(params terminator.PatchTerminatorParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
Copyright NetFoundry, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
"github.com/openziti/edge/rest_server/operations/transit_router"
|
||||
)
|
||||
|
||||
func init() {
|
||||
r := NewTransitRouterRouter()
|
||||
env.AddRouter(r)
|
||||
}
|
||||
|
||||
type TransitRouterRouter struct {
|
||||
BasePath string
|
||||
}
|
||||
|
||||
func NewTransitRouterRouter() *TransitRouterRouter {
|
||||
return &TransitRouterRouter{
|
||||
BasePath: "/" + EntityNameTransitRouter,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.TransitRouterDeleteTransitRouterHandler = transit_router.DeleteTransitRouterHandlerFunc(func(params transit_router.DeleteTransitRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Delete, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.TransitRouterDetailTransitRouterHandler = transit_router.DetailTransitRouterHandlerFunc(func(params transit_router.DetailTransitRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.Detail, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.TransitRouterListTransitRoutersHandler = transit_router.ListTransitRoutersHandlerFunc(func(params transit_router.ListTransitRoutersParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(r.List, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.TransitRouterUpdateTransitRouterHandler = transit_router.UpdateTransitRouterHandlerFunc(func(params transit_router.UpdateTransitRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Update(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.TransitRouterCreateTransitRouterHandler = transit_router.CreateTransitRouterHandlerFunc(func(params transit_router.CreateTransitRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Create(ae, rc, params) }, params.HTTPRequest, "", "", permissions.IsAdmin())
|
||||
})
|
||||
|
||||
ae.Api.TransitRouterPatchTransitRouterHandler = transit_router.PatchTransitRouterHandlerFunc(func(params transit_router.PatchTransitRouterParams, _ interface{}) middleware.Responder {
|
||||
return ae.IsAllowed(func(ae *env.AppEnv, rc *response.RequestContext) { r.Patch(ae, rc, params) }, params.HTTPRequest, params.ID, "", permissions.IsAdmin())
|
||||
})
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) List(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
ListWithHandler(ae, rc, ae.Handlers.TransitRouter, MapTransitRouterToRestEntity)
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Detail(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
DetailWithHandler(ae, rc, ae.Handlers.TransitRouter, MapTransitRouterToRestEntity)
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Create(ae *env.AppEnv, rc *response.RequestContext, params transit_router.CreateTransitRouterParams) {
|
||||
Create(rc, rc, TransitRouterLinkFactory, func() (string, error) {
|
||||
return ae.Handlers.TransitRouter.Create(MapCreateTransitRouterToModel(params.Router))
|
||||
})
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Delete(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
DeleteWithHandler(rc, ae.Handlers.TransitRouter)
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Update(ae *env.AppEnv, rc *response.RequestContext, params transit_router.UpdateTransitRouterParams) {
|
||||
Update(rc, func(id string) error {
|
||||
return ae.Handlers.TransitRouter.Update(MapUpdateTransitRouterToModel(params.ID, params.Router), false)
|
||||
})
|
||||
}
|
||||
|
||||
func (r *TransitRouterRouter) Patch(ae *env.AppEnv, rc *response.RequestContext, params transit_router.PatchTransitRouterParams) {
|
||||
Patch(rc, func(id string, fields JsonFields) error {
|
||||
return ae.Handlers.TransitRouter.Patch(MapPatchTransitRouterToModel(params.ID, params.Router), fields.ConcatNestedNames().FilterMaps("tags"), false)
|
||||
})
|
||||
}
|
||||
@@ -23,8 +23,9 @@ import (
|
||||
"github.com/openziti/edge/controller/env"
|
||||
"github.com/openziti/edge/controller/internal/permissions"
|
||||
"github.com/openziti/edge/controller/response"
|
||||
clientInformational "github.com/openziti/edge/rest_client_api_server/operations/informational"
|
||||
managementInformational "github.com/openziti/edge/rest_management_api_server/operations/informational"
|
||||
"github.com/openziti/edge/rest_model"
|
||||
"github.com/openziti/edge/rest_server/operations/informational"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
@@ -44,11 +45,19 @@ func NewVersionRouter() *VersionRouter {
|
||||
}
|
||||
|
||||
func (ir *VersionRouter) Register(ae *env.AppEnv) {
|
||||
ae.Api.InformationalListVersionHandler = informational.ListVersionHandlerFunc(func(params informational.ListVersionParams) middleware.Responder {
|
||||
ae.ClientApi.InformationalListVersionHandler = clientInformational.ListVersionHandlerFunc(func(params clientInformational.ListVersionParams) middleware.Responder {
|
||||
return ae.IsAllowed(ir.List, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.Api.InformationalListRootHandler = informational.ListRootHandlerFunc(func(params informational.ListRootParams) middleware.Responder {
|
||||
ae.ClientApi.InformationalListRootHandler = clientInformational.ListRootHandlerFunc(func(params clientInformational.ListRootParams) middleware.Responder {
|
||||
return ae.IsAllowed(ir.List, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.ManagementApi.InformationalListVersionHandler = managementInformational.ListVersionHandlerFunc(func(params managementInformational.ListVersionParams) middleware.Responder {
|
||||
return ae.IsAllowed(ir.List, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
|
||||
ae.ManagementApi.InformationalListRootHandler = managementInformational.ListRootHandlerFunc(func(params managementInformational.ListRootParams) middleware.Responder {
|
||||
return ae.IsAllowed(ir.List, params.HTTPRequest, "", "", permissions.Always())
|
||||
})
|
||||
}
|
||||
@@ -61,7 +70,7 @@ func (ir *VersionRouter) List(_ *env.AppEnv, rc *response.RequestContext) {
|
||||
RuntimeVersion: runtime.Version(),
|
||||
Version: buildInfo.Version(),
|
||||
APIVersions: map[string]map[string]rest_model.APIVersion{
|
||||
"edge": {controller.RestApiV1: mapApiVersionToRestModel(controller.RestApiBaseUrlV1)},
|
||||
"edge": {controller.RestApiV1: mapApiVersionToRestModel(controller.LegacyClientRestApiBaseUrlV1)},
|
||||
},
|
||||
}
|
||||
rc.RespondWithOk(data, &rest_model.Meta{})
|
||||
|
||||
@@ -26,7 +26,8 @@ import (
|
||||
sync2 "github.com/openziti/edge/controller/sync_strats"
|
||||
"github.com/openziti/edge/controller/timeout"
|
||||
"github.com/openziti/edge/pb/edge_ctrl_pb"
|
||||
"github.com/openziti/edge/rest_server"
|
||||
"github.com/openziti/edge/rest_client_api_server"
|
||||
"github.com/openziti/edge/rest_management_api_server"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -270,8 +271,29 @@ func (c *Controller) Run() {
|
||||
http.MethodDelete}),
|
||||
handlers.AllowCredentials(),
|
||||
}
|
||||
c.AppEnv.Api.Context()
|
||||
apiHandler := c.AppEnv.Api.Serve(func(handler http.Handler) http.Handler {
|
||||
c.AppEnv.ManagementApi.Context()
|
||||
c.AppEnv.ClientApi.Context()
|
||||
|
||||
clientApiHandler := c.AppEnv.ClientApi.Serve(func(handler http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
rc := c.AppEnv.CreateRequestContext(rw, r)
|
||||
|
||||
env.AddRequestContextToHttpContext(r, rc)
|
||||
|
||||
err := c.AppEnv.FillRequestContext(rc)
|
||||
if err != nil {
|
||||
rc.RespondWithError(err)
|
||||
return
|
||||
}
|
||||
|
||||
//after request context is filled so that api session is present for session expiration headers
|
||||
response.AddHeaders(rc)
|
||||
|
||||
handler.ServeHTTP(rw, r)
|
||||
})
|
||||
})
|
||||
|
||||
managementApiHandler := c.AppEnv.ManagementApi.Serve(func(handler http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
rc := c.AppEnv.CreateRequestContext(rw, r)
|
||||
|
||||
@@ -292,19 +314,40 @@ func (c *Controller) Run() {
|
||||
|
||||
handler := http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
|
||||
writer.Header().Set(ZitiInstanceId, c.AppEnv.InstanceId)
|
||||
//if not edge prefix, translate to "/edge/v<latest>"
|
||||
if !strings.HasPrefix(request.URL.Path, controller.RestApiBase) {
|
||||
request.URL.Path = controller.RestApiBaseUrlLatest + request.URL.Path
|
||||
|
||||
//if not /edge prefix, translate to "/edge/client/v<latest>"
|
||||
if !strings.HasPrefix(request.URL.Path, controller.RestApiRootPath) {
|
||||
request.URL.Path = controller.ClientRestApiBaseUrlLatest + request.URL.Path
|
||||
}
|
||||
|
||||
if request.URL.Path == controller.RestApiSpecUrl {
|
||||
//translate /edge/v1 to /edge/client/v1
|
||||
request.URL.Path = strings.Replace(request.URL.Path, controller.LegacyClientRestApiBaseUrlV1, controller.ClientRestApiBaseUrlLatest, 1)
|
||||
|
||||
if request.URL.Path == controller.ClientRestApiSpecUrl {
|
||||
writer.Header().Set("content-type", "application/json")
|
||||
writer.WriteHeader(http.StatusOK)
|
||||
_, _ = writer.Write(rest_server.SwaggerJSON)
|
||||
_, _ = writer.Write(rest_client_api_server.SwaggerJSON)
|
||||
return
|
||||
}
|
||||
//let the OpenApi http router take over
|
||||
apiHandler.ServeHTTP(writer, request)
|
||||
|
||||
if request.URL.Path == controller.ManagementRestApiSpecUrl {
|
||||
writer.Header().Set("content-type", "application/json")
|
||||
writer.WriteHeader(http.StatusOK)
|
||||
_, _ = writer.Write(rest_management_api_server.SwaggerJSON)
|
||||
return
|
||||
}
|
||||
|
||||
if strings.HasPrefix(request.URL.Path, controller.ManagementRestApiBaseUrlLatest) {
|
||||
managementApiHandler.ServeHTTP(writer, request)
|
||||
return
|
||||
}
|
||||
|
||||
if strings.HasPrefix(request.URL.Path, controller.ClientRestApiBase) {
|
||||
clientApiHandler.ServeHTTP(writer, request)
|
||||
return
|
||||
}
|
||||
|
||||
pfxlog.Logger().Debugf("unhandled request URL: %s", request.URL.Path)
|
||||
})
|
||||
|
||||
timeoutHandler := timeout.TimeoutHandler(handler, 10*time.Second, apierror.NewTimeoutError())
|
||||
|
||||
+15
-5
@@ -17,10 +17,20 @@
|
||||
package controller
|
||||
|
||||
const (
|
||||
RestApiBase = "/edge/"
|
||||
RestApiV1 = "/v1"
|
||||
|
||||
RestApiRootPath = "/edge"
|
||||
ClientRestApiBase = "/edge/client"
|
||||
ManagementRestApiBase = "/edge/management"
|
||||
|
||||
LegacyClientRestApiBaseUrlV1 = RestApiRootPath + RestApiV1
|
||||
ClientRestApiBaseUrlV1 = ClientRestApiBase + RestApiV1
|
||||
ManagementRestApiBaseUrlV1 = ManagementRestApiBase + RestApiV1
|
||||
|
||||
ClientRestApiBaseUrlLatest = ClientRestApiBaseUrlV1
|
||||
ManagementRestApiBaseUrlLatest = ManagementRestApiBaseUrlV1
|
||||
|
||||
ClientRestApiSpecUrl = ClientRestApiBaseUrlLatest + "/swagger.json"
|
||||
ManagementRestApiSpecUrl = ManagementRestApiBaseUrlLatest + "/swagger.json"
|
||||
|
||||
RestApiV1 = "v1"
|
||||
RestApiBaseUrlV1 = "/edge/" + RestApiV1
|
||||
RestApiBaseUrlLatest = RestApiBaseUrlV1
|
||||
RestApiSpecUrl = RestApiBaseUrlLatest + "/swagger.json"
|
||||
)
|
||||
|
||||
@@ -42,7 +42,7 @@ require (
|
||||
github.com/netfoundry/secretstream v0.1.2
|
||||
github.com/openziti/fabric v0.16.59
|
||||
github.com/openziti/foundation v0.15.50
|
||||
github.com/openziti/sdk-golang v0.15.45
|
||||
github.com/openziti/sdk-golang v0.15.47
|
||||
github.com/orcaman/concurrent-map v0.0.0-20210106121528-16402b402231
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
|
||||
|
||||
@@ -491,8 +491,8 @@ github.com/openziti/fabric v0.16.59 h1:PQlCooOM0sK9Afo0EwuBJlNphASwfTPKAde8LlxAy
|
||||
github.com/openziti/fabric v0.16.59/go.mod h1:xro2eGr6ilDmz8qZ0sp7KjHMl0KU4l9aOBydGF/tg9E=
|
||||
github.com/openziti/foundation v0.15.50 h1:xvID5CAXNLAb0h9nOXCQr4PlcxlPpnPOnNDoEeyl424=
|
||||
github.com/openziti/foundation v0.15.50/go.mod h1:NnSBTp9ZkcYsv6nYxZR0/NzoHfkIo6tjpBHDvBsPFqw=
|
||||
github.com/openziti/sdk-golang v0.15.45 h1:SaO4puquArrZp+gk0Ub41j8VO40pUH0cwYyyvJXCo6k=
|
||||
github.com/openziti/sdk-golang v0.15.45/go.mod h1:T68tkxqOwwcZhzfRjxSK26xe0eWsQ3VeLqi3cLCzQ0M=
|
||||
github.com/openziti/sdk-golang v0.15.47 h1:6/VUergS4cWcmz4xAn45Q/aTC99steFWsLs3TLdk2Rk=
|
||||
github.com/openziti/sdk-golang v0.15.47/go.mod h1:T68tkxqOwwcZhzfRjxSK26xe0eWsQ3VeLqi3cLCzQ0M=
|
||||
github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
github.com/orcaman/concurrent-map v0.0.0-20210106121528-16402b402231 h1:fa50YL1pzKW+1SsBnJDOHppJN9stOEwS+CRWyUtyYGU=
|
||||
github.com/orcaman/concurrent-map v0.0.0-20210106121528-16402b402231/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
//
|
||||
// Copyright NetFoundry, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// __ __ _
|
||||
// \ \ / / (_)
|
||||
// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _
|
||||
// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` |
|
||||
// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it.
|
||||
// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, |
|
||||
// __/ |
|
||||
// |___/
|
||||
|
||||
package geo_region
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDetailGeoRegionParams creates a new DetailGeoRegionParams object
|
||||
// with the default values initialized.
|
||||
func NewDetailGeoRegionParams() *DetailGeoRegionParams {
|
||||
var ()
|
||||
return &DetailGeoRegionParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailGeoRegionParamsWithTimeout creates a new DetailGeoRegionParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewDetailGeoRegionParamsWithTimeout(timeout time.Duration) *DetailGeoRegionParams {
|
||||
var ()
|
||||
return &DetailGeoRegionParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailGeoRegionParamsWithContext creates a new DetailGeoRegionParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewDetailGeoRegionParamsWithContext(ctx context.Context) *DetailGeoRegionParams {
|
||||
var ()
|
||||
return &DetailGeoRegionParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailGeoRegionParamsWithHTTPClient creates a new DetailGeoRegionParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewDetailGeoRegionParamsWithHTTPClient(client *http.Client) *DetailGeoRegionParams {
|
||||
var ()
|
||||
return &DetailGeoRegionParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*DetailGeoRegionParams contains all the parameters to send to the API endpoint
|
||||
for the detail geo region operation typically these are written to a http.Request
|
||||
*/
|
||||
type DetailGeoRegionParams struct {
|
||||
|
||||
/*ID
|
||||
The id of the requested resource
|
||||
|
||||
*/
|
||||
ID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the detail geo region params
|
||||
func (o *DetailGeoRegionParams) WithTimeout(timeout time.Duration) *DetailGeoRegionParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the detail geo region params
|
||||
func (o *DetailGeoRegionParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the detail geo region params
|
||||
func (o *DetailGeoRegionParams) WithContext(ctx context.Context) *DetailGeoRegionParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the detail geo region params
|
||||
func (o *DetailGeoRegionParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the detail geo region params
|
||||
func (o *DetailGeoRegionParams) WithHTTPClient(client *http.Client) *DetailGeoRegionParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the detail geo region params
|
||||
func (o *DetailGeoRegionParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithID adds the id to the detail geo region params
|
||||
func (o *DetailGeoRegionParams) WithID(id string) *DetailGeoRegionParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the detail geo region params
|
||||
func (o *DetailGeoRegionParams) SetID(id string) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *DetailGeoRegionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", o.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
//
|
||||
// Copyright NetFoundry, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// __ __ _
|
||||
// \ \ / / (_)
|
||||
// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _
|
||||
// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` |
|
||||
// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it.
|
||||
// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, |
|
||||
// __/ |
|
||||
// |___/
|
||||
|
||||
package geo_region
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
// DetailGeoRegionReader is a Reader for the DetailGeoRegion structure.
|
||||
type DetailGeoRegionReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *DetailGeoRegionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewDetailGeoRegionOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 401:
|
||||
result := NewDetailGeoRegionUnauthorized()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 404:
|
||||
result := NewDetailGeoRegionNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailGeoRegionOK creates a DetailGeoRegionOK with default headers values
|
||||
func NewDetailGeoRegionOK() *DetailGeoRegionOK {
|
||||
return &DetailGeoRegionOK{}
|
||||
}
|
||||
|
||||
/*DetailGeoRegionOK handles this case with default header values.
|
||||
|
||||
A single geo-region
|
||||
*/
|
||||
type DetailGeoRegionOK struct {
|
||||
Payload *rest_model.DetailGeoRegionEnvelope
|
||||
}
|
||||
|
||||
func (o *DetailGeoRegionOK) Error() string {
|
||||
return fmt.Sprintf("[GET /geo-regions/{id}][%d] detailGeoRegionOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailGeoRegionOK) GetPayload() *rest_model.DetailGeoRegionEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *DetailGeoRegionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(rest_model.DetailGeoRegionEnvelope)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewDetailGeoRegionUnauthorized creates a DetailGeoRegionUnauthorized with default headers values
|
||||
func NewDetailGeoRegionUnauthorized() *DetailGeoRegionUnauthorized {
|
||||
return &DetailGeoRegionUnauthorized{}
|
||||
}
|
||||
|
||||
/*DetailGeoRegionUnauthorized handles this case with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
type DetailGeoRegionUnauthorized struct {
|
||||
Payload *rest_model.APIErrorEnvelope
|
||||
}
|
||||
|
||||
func (o *DetailGeoRegionUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /geo-regions/{id}][%d] detailGeoRegionUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailGeoRegionUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *DetailGeoRegionUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(rest_model.APIErrorEnvelope)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewDetailGeoRegionNotFound creates a DetailGeoRegionNotFound with default headers values
|
||||
func NewDetailGeoRegionNotFound() *DetailGeoRegionNotFound {
|
||||
return &DetailGeoRegionNotFound{}
|
||||
}
|
||||
|
||||
/*DetailGeoRegionNotFound handles this case with default header values.
|
||||
|
||||
The requested resource does not exist
|
||||
*/
|
||||
type DetailGeoRegionNotFound struct {
|
||||
Payload *rest_model.APIErrorEnvelope
|
||||
}
|
||||
|
||||
func (o *DetailGeoRegionNotFound) Error() string {
|
||||
return fmt.Sprintf("[GET /geo-regions/{id}][%d] detailGeoRegionNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailGeoRegionNotFound) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *DetailGeoRegionNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(rest_model.APIErrorEnvelope)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
//
|
||||
// Copyright NetFoundry, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// __ __ _
|
||||
// \ \ / / (_)
|
||||
// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _
|
||||
// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` |
|
||||
// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it.
|
||||
// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, |
|
||||
// __/ |
|
||||
// |___/
|
||||
|
||||
package geo_region
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewListGeoRegionsParams creates a new ListGeoRegionsParams object
|
||||
// with the default values initialized.
|
||||
func NewListGeoRegionsParams() *ListGeoRegionsParams {
|
||||
var ()
|
||||
return &ListGeoRegionsParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListGeoRegionsParamsWithTimeout creates a new ListGeoRegionsParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewListGeoRegionsParamsWithTimeout(timeout time.Duration) *ListGeoRegionsParams {
|
||||
var ()
|
||||
return &ListGeoRegionsParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListGeoRegionsParamsWithContext creates a new ListGeoRegionsParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewListGeoRegionsParamsWithContext(ctx context.Context) *ListGeoRegionsParams {
|
||||
var ()
|
||||
return &ListGeoRegionsParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListGeoRegionsParamsWithHTTPClient creates a new ListGeoRegionsParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewListGeoRegionsParamsWithHTTPClient(client *http.Client) *ListGeoRegionsParams {
|
||||
var ()
|
||||
return &ListGeoRegionsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*ListGeoRegionsParams contains all the parameters to send to the API endpoint
|
||||
for the list geo regions operation typically these are written to a http.Request
|
||||
*/
|
||||
type ListGeoRegionsParams struct {
|
||||
|
||||
/*Filter*/
|
||||
Filter *string
|
||||
/*Limit*/
|
||||
Limit *int64
|
||||
/*Offset*/
|
||||
Offset *int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) WithTimeout(timeout time.Duration) *ListGeoRegionsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) WithContext(ctx context.Context) *ListGeoRegionsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) WithHTTPClient(client *http.Client) *ListGeoRegionsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithFilter adds the filter to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) WithFilter(filter *string) *ListGeoRegionsParams {
|
||||
o.SetFilter(filter)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetFilter adds the filter to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) SetFilter(filter *string) {
|
||||
o.Filter = filter
|
||||
}
|
||||
|
||||
// WithLimit adds the limit to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) WithLimit(limit *int64) *ListGeoRegionsParams {
|
||||
o.SetLimit(limit)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetLimit adds the limit to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) SetLimit(limit *int64) {
|
||||
o.Limit = limit
|
||||
}
|
||||
|
||||
// WithOffset adds the offset to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) WithOffset(offset *int64) *ListGeoRegionsParams {
|
||||
o.SetOffset(offset)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOffset adds the offset to the list geo regions params
|
||||
func (o *ListGeoRegionsParams) SetOffset(offset *int64) {
|
||||
o.Offset = offset
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListGeoRegionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Filter != nil {
|
||||
|
||||
// query param filter
|
||||
var qrFilter string
|
||||
if o.Filter != nil {
|
||||
qrFilter = *o.Filter
|
||||
}
|
||||
qFilter := qrFilter
|
||||
if qFilter != "" {
|
||||
if err := r.SetQueryParam("filter", qFilter); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Limit != nil {
|
||||
|
||||
// query param limit
|
||||
var qrLimit int64
|
||||
if o.Limit != nil {
|
||||
qrLimit = *o.Limit
|
||||
}
|
||||
qLimit := swag.FormatInt64(qrLimit)
|
||||
if qLimit != "" {
|
||||
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Offset != nil {
|
||||
|
||||
// query param offset
|
||||
var qrOffset int64
|
||||
if o.Offset != nil {
|
||||
qrOffset = *o.Offset
|
||||
}
|
||||
qOffset := swag.FormatInt64(qrOffset)
|
||||
if qOffset != "" {
|
||||
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,295 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
//
|
||||
// Copyright NetFoundry, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// __ __ _
|
||||
// \ \ / / (_)
|
||||
// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _
|
||||
// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` |
|
||||
// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it.
|
||||
// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, |
|
||||
// __/ |
|
||||
// |___/
|
||||
|
||||
package transit_router
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new transit router API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for transit router API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
CreateTransitRouter(params *CreateTransitRouterParams, authInfo runtime.ClientAuthInfoWriter) (*CreateTransitRouterCreated, error)
|
||||
|
||||
DeleteTransitRouter(params *DeleteTransitRouterParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteTransitRouterOK, error)
|
||||
|
||||
DetailTransitRouter(params *DetailTransitRouterParams, authInfo runtime.ClientAuthInfoWriter) (*DetailTransitRouterOK, error)
|
||||
|
||||
ListTransitRouters(params *ListTransitRoutersParams, authInfo runtime.ClientAuthInfoWriter) (*ListTransitRoutersOK, error)
|
||||
|
||||
PatchTransitRouter(params *PatchTransitRouterParams, authInfo runtime.ClientAuthInfoWriter) (*PatchTransitRouterOK, error)
|
||||
|
||||
UpdateTransitRouter(params *UpdateTransitRouterParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateTransitRouterOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
CreateTransitRouter creates a transit router resource
|
||||
|
||||
Create a transit router resource. Requires admin access.
|
||||
*/
|
||||
func (a *Client) CreateTransitRouter(params *CreateTransitRouterParams, authInfo runtime.ClientAuthInfoWriter) (*CreateTransitRouterCreated, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewCreateTransitRouterParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "createTransitRouter",
|
||||
Method: "POST",
|
||||
PathPattern: "/transit-routers",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"https"},
|
||||
Params: params,
|
||||
Reader: &CreateTransitRouterReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*CreateTransitRouterCreated)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for createTransitRouter: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteTransitRouter deletes a transit router
|
||||
|
||||
Delete a transit router by id. Requires admin access.
|
||||
*/
|
||||
func (a *Client) DeleteTransitRouter(params *DeleteTransitRouterParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteTransitRouterOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteTransitRouterParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "deleteTransitRouter",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/transit-routers/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"https"},
|
||||
Params: params,
|
||||
Reader: &DeleteTransitRouterReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*DeleteTransitRouterOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for deleteTransitRouter: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
DetailTransitRouter retrieves a single transit router
|
||||
|
||||
Retrieves a single transit router by id. Requires admin access.
|
||||
*/
|
||||
func (a *Client) DetailTransitRouter(params *DetailTransitRouterParams, authInfo runtime.ClientAuthInfoWriter) (*DetailTransitRouterOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDetailTransitRouterParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "detailTransitRouter",
|
||||
Method: "GET",
|
||||
PathPattern: "/transit-routers/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"https"},
|
||||
Params: params,
|
||||
Reader: &DetailTransitRouterReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*DetailTransitRouterOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for detailTransitRouter: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
ListTransitRouters lists transit routers
|
||||
|
||||
Retrieves a list of transit router resources; supports filtering, sorting, and pagination. Requires admin access.
|
||||
|
||||
*/
|
||||
func (a *Client) ListTransitRouters(params *ListTransitRoutersParams, authInfo runtime.ClientAuthInfoWriter) (*ListTransitRoutersOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListTransitRoutersParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "listTransitRouters",
|
||||
Method: "GET",
|
||||
PathPattern: "/transit-routers",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"https"},
|
||||
Params: params,
|
||||
Reader: &ListTransitRoutersReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListTransitRoutersOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for listTransitRouters: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
PatchTransitRouter updates the supplied fields on a transit router
|
||||
|
||||
Update the supplied fields on a transit router. Requires admin access.
|
||||
*/
|
||||
func (a *Client) PatchTransitRouter(params *PatchTransitRouterParams, authInfo runtime.ClientAuthInfoWriter) (*PatchTransitRouterOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewPatchTransitRouterParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "patchTransitRouter",
|
||||
Method: "PATCH",
|
||||
PathPattern: "/transit-routers/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"https"},
|
||||
Params: params,
|
||||
Reader: &PatchTransitRouterReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*PatchTransitRouterOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for patchTransitRouter: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateTransitRouter updates all fields on a transit router
|
||||
|
||||
Update all fields on a transit router by id. Requires admin access.
|
||||
*/
|
||||
func (a *Client) UpdateTransitRouter(params *UpdateTransitRouterParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateTransitRouterOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUpdateTransitRouterParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "updateTransitRouter",
|
||||
Method: "PUT",
|
||||
PathPattern: "/transit-routers/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"https"},
|
||||
Params: params,
|
||||
Reader: &UpdateTransitRouterReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*UpdateTransitRouterOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for updateTransitRouter: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
+30
-17
@@ -42,53 +42,52 @@ import (
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
// NewAuthenticateMfaParams creates a new AuthenticateMfaParams object
|
||||
// with the default values initialized.
|
||||
// NewAuthenticateMfaParams creates a new AuthenticateMfaParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAuthenticateMfaParams() *AuthenticateMfaParams {
|
||||
var ()
|
||||
return &AuthenticateMfaParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAuthenticateMfaParamsWithTimeout creates a new AuthenticateMfaParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAuthenticateMfaParamsWithTimeout(timeout time.Duration) *AuthenticateMfaParams {
|
||||
var ()
|
||||
return &AuthenticateMfaParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAuthenticateMfaParamsWithContext creates a new AuthenticateMfaParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewAuthenticateMfaParamsWithContext(ctx context.Context) *AuthenticateMfaParams {
|
||||
var ()
|
||||
return &AuthenticateMfaParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAuthenticateMfaParamsWithHTTPClient creates a new AuthenticateMfaParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAuthenticateMfaParamsWithHTTPClient(client *http.Client) *AuthenticateMfaParams {
|
||||
var ()
|
||||
return &AuthenticateMfaParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*AuthenticateMfaParams contains all the parameters to send to the API endpoint
|
||||
for the authenticate mfa operation typically these are written to a http.Request
|
||||
/* AuthenticateMfaParams contains all the parameters to send to the API endpoint
|
||||
for the authenticate mfa operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AuthenticateMfaParams struct {
|
||||
|
||||
/*MfaAuth
|
||||
An MFA validation request
|
||||
/* MfaAuth.
|
||||
|
||||
An MFA validation request
|
||||
*/
|
||||
MfaAuth *rest_model.MfaCode
|
||||
|
||||
@@ -97,6 +96,21 @@ type AuthenticateMfaParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the authenticate mfa params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AuthenticateMfaParams) WithDefaults() *AuthenticateMfaParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the authenticate mfa params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AuthenticateMfaParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the authenticate mfa params
|
||||
func (o *AuthenticateMfaParams) WithTimeout(timeout time.Duration) *AuthenticateMfaParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -148,7 +162,6 @@ func (o *AuthenticateMfaParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.MfaAuth != nil {
|
||||
if err := r.SetBodyParam(o.MfaAuth); err != nil {
|
||||
return err
|
||||
+2
-5
@@ -59,7 +59,6 @@ func (o *AuthenticateMfaReader) ReadResponse(response runtime.ClientResponse, co
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -70,7 +69,7 @@ func NewAuthenticateMfaOK() *AuthenticateMfaOK {
|
||||
return &AuthenticateMfaOK{}
|
||||
}
|
||||
|
||||
/*AuthenticateMfaOK handles this case with default header values.
|
||||
/* AuthenticateMfaOK describes a response with status code 200, with default header values.
|
||||
|
||||
Base empty response
|
||||
*/
|
||||
@@ -81,7 +80,6 @@ type AuthenticateMfaOK struct {
|
||||
func (o *AuthenticateMfaOK) Error() string {
|
||||
return fmt.Sprintf("[POST /authenticate/mfa][%d] authenticateMfaOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *AuthenticateMfaOK) GetPayload() *rest_model.Empty {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -103,7 +101,7 @@ func NewAuthenticateMfaUnauthorized() *AuthenticateMfaUnauthorized {
|
||||
return &AuthenticateMfaUnauthorized{}
|
||||
}
|
||||
|
||||
/*AuthenticateMfaUnauthorized handles this case with default header values.
|
||||
/* AuthenticateMfaUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
Base empty response
|
||||
*/
|
||||
@@ -114,7 +112,6 @@ type AuthenticateMfaUnauthorized struct {
|
||||
func (o *AuthenticateMfaUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[POST /authenticate/mfa][%d] authenticateMfaUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *AuthenticateMfaUnauthorized) GetPayload() *rest_model.Empty {
|
||||
return o.Payload
|
||||
}
|
||||
+32
-17
@@ -42,53 +42,53 @@ import (
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
// NewAuthenticateParams creates a new AuthenticateParams object
|
||||
// with the default values initialized.
|
||||
// NewAuthenticateParams creates a new AuthenticateParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAuthenticateParams() *AuthenticateParams {
|
||||
var ()
|
||||
return &AuthenticateParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAuthenticateParamsWithTimeout creates a new AuthenticateParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAuthenticateParamsWithTimeout(timeout time.Duration) *AuthenticateParams {
|
||||
var ()
|
||||
return &AuthenticateParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAuthenticateParamsWithContext creates a new AuthenticateParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewAuthenticateParamsWithContext(ctx context.Context) *AuthenticateParams {
|
||||
var ()
|
||||
return &AuthenticateParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAuthenticateParamsWithHTTPClient creates a new AuthenticateParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAuthenticateParamsWithHTTPClient(client *http.Client) *AuthenticateParams {
|
||||
var ()
|
||||
return &AuthenticateParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*AuthenticateParams contains all the parameters to send to the API endpoint
|
||||
for the authenticate operation typically these are written to a http.Request
|
||||
/* AuthenticateParams contains all the parameters to send to the API endpoint
|
||||
for the authenticate operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AuthenticateParams struct {
|
||||
|
||||
/*Auth*/
|
||||
// Auth.
|
||||
Auth *rest_model.Authenticate
|
||||
/*Method*/
|
||||
|
||||
// Method.
|
||||
Method string
|
||||
|
||||
timeout time.Duration
|
||||
@@ -96,6 +96,21 @@ type AuthenticateParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the authenticate params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AuthenticateParams) WithDefaults() *AuthenticateParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the authenticate params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AuthenticateParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the authenticate params
|
||||
func (o *AuthenticateParams) WithTimeout(timeout time.Duration) *AuthenticateParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -158,7 +173,6 @@ func (o *AuthenticateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Auth != nil {
|
||||
if err := r.SetBodyParam(o.Auth); err != nil {
|
||||
return err
|
||||
@@ -169,6 +183,7 @@ func (o *AuthenticateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
|
||||
qrMethod := o.Method
|
||||
qMethod := qrMethod
|
||||
if qMethod != "" {
|
||||
|
||||
if err := r.SetQueryParam("method", qMethod); err != nil {
|
||||
return err
|
||||
}
|
||||
+3
-7
@@ -65,7 +65,6 @@ func (o *AuthenticateReader) ReadResponse(response runtime.ClientResponse, consu
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -76,7 +75,7 @@ func NewAuthenticateOK() *AuthenticateOK {
|
||||
return &AuthenticateOK{}
|
||||
}
|
||||
|
||||
/*AuthenticateOK handles this case with default header values.
|
||||
/* AuthenticateOK describes a response with status code 200, with default header values.
|
||||
|
||||
The API session associated with the session used to issue the request
|
||||
*/
|
||||
@@ -87,7 +86,6 @@ type AuthenticateOK struct {
|
||||
func (o *AuthenticateOK) Error() string {
|
||||
return fmt.Sprintf("[POST /authenticate][%d] authenticateOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *AuthenticateOK) GetPayload() *rest_model.CurrentAPISessionDetailEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -109,7 +107,7 @@ func NewAuthenticateBadRequest() *AuthenticateBadRequest {
|
||||
return &AuthenticateBadRequest{}
|
||||
}
|
||||
|
||||
/*AuthenticateBadRequest handles this case with default header values.
|
||||
/* AuthenticateBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information
|
||||
*/
|
||||
@@ -120,7 +118,6 @@ type AuthenticateBadRequest struct {
|
||||
func (o *AuthenticateBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /authenticate][%d] authenticateBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *AuthenticateBadRequest) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -142,7 +139,7 @@ func NewAuthenticateForbidden() *AuthenticateForbidden {
|
||||
return &AuthenticateForbidden{}
|
||||
}
|
||||
|
||||
/*AuthenticateForbidden handles this case with default header values.
|
||||
/* AuthenticateForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
The authentication request could not be processed as the credentials are invalid
|
||||
*/
|
||||
@@ -153,7 +150,6 @@ type AuthenticateForbidden struct {
|
||||
func (o *AuthenticateForbidden) Error() string {
|
||||
return fmt.Sprintf("[POST /authenticate][%d] authenticateForbidden %+v", 403, o.Payload)
|
||||
}
|
||||
|
||||
func (o *AuthenticateForbidden) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+21
-10
@@ -49,11 +49,14 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
Authenticate(params *AuthenticateParams) (*AuthenticateOK, error)
|
||||
Authenticate(params *AuthenticateParams, opts ...ClientOption) (*AuthenticateOK, error)
|
||||
|
||||
AuthenticateMfa(params *AuthenticateMfaParams, authInfo runtime.ClientAuthInfoWriter) (*AuthenticateMfaOK, error)
|
||||
AuthenticateMfa(params *AuthenticateMfaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AuthenticateMfaOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
@@ -64,13 +67,12 @@ type ClientService interface {
|
||||
Allows authentication Methods include "password" and "cert"
|
||||
|
||||
*/
|
||||
func (a *Client) Authenticate(params *AuthenticateParams) (*AuthenticateOK, error) {
|
||||
func (a *Client) Authenticate(params *AuthenticateParams, opts ...ClientOption) (*AuthenticateOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewAuthenticateParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "authenticate",
|
||||
Method: "POST",
|
||||
PathPattern: "/authenticate",
|
||||
@@ -81,7 +83,12 @@ func (a *Client) Authenticate(params *AuthenticateParams) (*AuthenticateOK, erro
|
||||
Reader: &AuthenticateReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -100,13 +107,12 @@ func (a *Client) Authenticate(params *AuthenticateParams) (*AuthenticateOK, erro
|
||||
|
||||
Completes MFA authentication by submitting a MFA time based one time token or backup code.
|
||||
*/
|
||||
func (a *Client) AuthenticateMfa(params *AuthenticateMfaParams, authInfo runtime.ClientAuthInfoWriter) (*AuthenticateMfaOK, error) {
|
||||
func (a *Client) AuthenticateMfa(params *AuthenticateMfaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AuthenticateMfaOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewAuthenticateMfaParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "authenticateMfa",
|
||||
Method: "POST",
|
||||
PathPattern: "/authenticate/mfa",
|
||||
@@ -118,7 +124,12 @@ func (a *Client) AuthenticateMfa(params *AuthenticateMfaParams, authInfo runtime
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
+30
-17
@@ -42,53 +42,52 @@ import (
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
// NewCreateCurrentAPISessionCertificateParams creates a new CreateCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized.
|
||||
// NewCreateCurrentAPISessionCertificateParams creates a new CreateCurrentAPISessionCertificateParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewCreateCurrentAPISessionCertificateParams() *CreateCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &CreateCurrentAPISessionCertificateParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateCurrentAPISessionCertificateParamsWithTimeout creates a new CreateCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewCreateCurrentAPISessionCertificateParamsWithTimeout(timeout time.Duration) *CreateCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &CreateCurrentAPISessionCertificateParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateCurrentAPISessionCertificateParamsWithContext creates a new CreateCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewCreateCurrentAPISessionCertificateParamsWithContext(ctx context.Context) *CreateCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &CreateCurrentAPISessionCertificateParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateCurrentAPISessionCertificateParamsWithHTTPClient creates a new CreateCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewCreateCurrentAPISessionCertificateParamsWithHTTPClient(client *http.Client) *CreateCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &CreateCurrentAPISessionCertificateParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*CreateCurrentAPISessionCertificateParams contains all the parameters to send to the API endpoint
|
||||
for the create current Api session certificate operation typically these are written to a http.Request
|
||||
/* CreateCurrentAPISessionCertificateParams contains all the parameters to send to the API endpoint
|
||||
for the create current Api session certificate operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type CreateCurrentAPISessionCertificateParams struct {
|
||||
|
||||
/*SessionCertificate
|
||||
The payload describing the CSR used to create a session certificate
|
||||
/* SessionCertificate.
|
||||
|
||||
The payload describing the CSR used to create a session certificate
|
||||
*/
|
||||
SessionCertificate *rest_model.CurrentAPISessionCertificateCreate
|
||||
|
||||
@@ -97,6 +96,21 @@ type CreateCurrentAPISessionCertificateParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the create current Api session certificate params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateCurrentAPISessionCertificateParams) WithDefaults() *CreateCurrentAPISessionCertificateParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the create current Api session certificate params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateCurrentAPISessionCertificateParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the create current Api session certificate params
|
||||
func (o *CreateCurrentAPISessionCertificateParams) WithTimeout(timeout time.Duration) *CreateCurrentAPISessionCertificateParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -148,7 +162,6 @@ func (o *CreateCurrentAPISessionCertificateParams) WriteToRequest(r runtime.Clie
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.SessionCertificate != nil {
|
||||
if err := r.SetBodyParam(o.SessionCertificate); err != nil {
|
||||
return err
|
||||
+3
-7
@@ -65,7 +65,6 @@ func (o *CreateCurrentAPISessionCertificateReader) ReadResponse(response runtime
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -76,7 +75,7 @@ func NewCreateCurrentAPISessionCertificateCreated() *CreateCurrentAPISessionCert
|
||||
return &CreateCurrentAPISessionCertificateCreated{}
|
||||
}
|
||||
|
||||
/*CreateCurrentAPISessionCertificateCreated handles this case with default header values.
|
||||
/* CreateCurrentAPISessionCertificateCreated describes a response with status code 201, with default header values.
|
||||
|
||||
A response of a create API Session certificate
|
||||
*/
|
||||
@@ -87,7 +86,6 @@ type CreateCurrentAPISessionCertificateCreated struct {
|
||||
func (o *CreateCurrentAPISessionCertificateCreated) Error() string {
|
||||
return fmt.Sprintf("[POST /current-api-session/certificates][%d] createCurrentApiSessionCertificateCreated %+v", 201, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateCurrentAPISessionCertificateCreated) GetPayload() *rest_model.CreateCurrentAPISessionCertificateEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -109,7 +107,7 @@ func NewCreateCurrentAPISessionCertificateBadRequest() *CreateCurrentAPISessionC
|
||||
return &CreateCurrentAPISessionCertificateBadRequest{}
|
||||
}
|
||||
|
||||
/*CreateCurrentAPISessionCertificateBadRequest handles this case with default header values.
|
||||
/* CreateCurrentAPISessionCertificateBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information
|
||||
*/
|
||||
@@ -120,7 +118,6 @@ type CreateCurrentAPISessionCertificateBadRequest struct {
|
||||
func (o *CreateCurrentAPISessionCertificateBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /current-api-session/certificates][%d] createCurrentApiSessionCertificateBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateCurrentAPISessionCertificateBadRequest) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -142,7 +139,7 @@ func NewCreateCurrentAPISessionCertificateUnauthorized() *CreateCurrentAPISessio
|
||||
return &CreateCurrentAPISessionCertificateUnauthorized{}
|
||||
}
|
||||
|
||||
/*CreateCurrentAPISessionCertificateUnauthorized handles this case with default header values.
|
||||
/* CreateCurrentAPISessionCertificateUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -153,7 +150,6 @@ type CreateCurrentAPISessionCertificateUnauthorized struct {
|
||||
func (o *CreateCurrentAPISessionCertificateUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[POST /current-api-session/certificates][%d] createCurrentApiSessionCertificateUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateCurrentAPISessionCertificateUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+102
-55
@@ -49,29 +49,32 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
DeleteCurrentAPISession(params *DeleteCurrentAPISessionParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCurrentAPISessionOK, error)
|
||||
DeleteCurrentAPISession(params *DeleteCurrentAPISessionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCurrentAPISessionOK, error)
|
||||
|
||||
CreateCurrentAPISessionCertificate(params *CreateCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCurrentAPISessionCertificateCreated, error)
|
||||
CreateCurrentAPISessionCertificate(params *CreateCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateCurrentAPISessionCertificateCreated, error)
|
||||
|
||||
DeleteCurrentAPISessionCertificate(params *DeleteCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCurrentAPISessionCertificateOK, error)
|
||||
DeleteCurrentAPISessionCertificate(params *DeleteCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCurrentAPISessionCertificateOK, error)
|
||||
|
||||
DetailCurrentAPISessionCertificate(params *DetailCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*DetailCurrentAPISessionCertificateOK, error)
|
||||
DetailCurrentAPISessionCertificate(params *DetailCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailCurrentAPISessionCertificateOK, error)
|
||||
|
||||
DetailCurrentIdentityAuthenticator(params *DetailCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter) (*DetailCurrentIdentityAuthenticatorOK, error)
|
||||
DetailCurrentIdentityAuthenticator(params *DetailCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailCurrentIdentityAuthenticatorOK, error)
|
||||
|
||||
GetCurrentAPISession(params *GetCurrentAPISessionParams, authInfo runtime.ClientAuthInfoWriter) (*GetCurrentAPISessionOK, error)
|
||||
GetCurrentAPISession(params *GetCurrentAPISessionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCurrentAPISessionOK, error)
|
||||
|
||||
ListCurrentAPISessionCertificates(params *ListCurrentAPISessionCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*ListCurrentAPISessionCertificatesOK, error)
|
||||
ListCurrentAPISessionCertificates(params *ListCurrentAPISessionCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCurrentAPISessionCertificatesOK, error)
|
||||
|
||||
ListCurrentIdentityAuthenticators(params *ListCurrentIdentityAuthenticatorsParams, authInfo runtime.ClientAuthInfoWriter) (*ListCurrentIdentityAuthenticatorsOK, error)
|
||||
ListCurrentIdentityAuthenticators(params *ListCurrentIdentityAuthenticatorsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCurrentIdentityAuthenticatorsOK, error)
|
||||
|
||||
ListServiceUpdates(params *ListServiceUpdatesParams, authInfo runtime.ClientAuthInfoWriter) (*ListServiceUpdatesOK, error)
|
||||
ListServiceUpdates(params *ListServiceUpdatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListServiceUpdatesOK, error)
|
||||
|
||||
PatchCurrentIdentityAuthenticator(params *PatchCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter) (*PatchCurrentIdentityAuthenticatorOK, error)
|
||||
PatchCurrentIdentityAuthenticator(params *PatchCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchCurrentIdentityAuthenticatorOK, error)
|
||||
|
||||
UpdateCurrentIdentityAuthenticator(params *UpdateCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateCurrentIdentityAuthenticatorOK, error)
|
||||
UpdateCurrentIdentityAuthenticator(params *UpdateCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCurrentIdentityAuthenticatorOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
@@ -81,13 +84,12 @@ type ClientService interface {
|
||||
|
||||
Terminates the current API session
|
||||
*/
|
||||
func (a *Client) DeleteCurrentAPISession(params *DeleteCurrentAPISessionParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCurrentAPISessionOK, error) {
|
||||
func (a *Client) DeleteCurrentAPISession(params *DeleteCurrentAPISessionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCurrentAPISessionOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteCurrentAPISessionParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "DeleteCurrentAPISession",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/current-api-session",
|
||||
@@ -99,7 +101,12 @@ func (a *Client) DeleteCurrentAPISession(params *DeleteCurrentAPISessionParams,
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -118,13 +125,12 @@ func (a *Client) DeleteCurrentAPISession(params *DeleteCurrentAPISessionParams,
|
||||
|
||||
Creates an ephemeral certificate for the current API Session. This endpoint expects a PEM encoded CSRs to be provided for fulfillment as a property of a JSON payload. It is up to the client to manage the private key backing the CSR request.
|
||||
*/
|
||||
func (a *Client) CreateCurrentAPISessionCertificate(params *CreateCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCurrentAPISessionCertificateCreated, error) {
|
||||
func (a *Client) CreateCurrentAPISessionCertificate(params *CreateCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateCurrentAPISessionCertificateCreated, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewCreateCurrentAPISessionCertificateParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "createCurrentApiSessionCertificate",
|
||||
Method: "POST",
|
||||
PathPattern: "/current-api-session/certificates",
|
||||
@@ -136,7 +142,12 @@ func (a *Client) CreateCurrentAPISessionCertificate(params *CreateCurrentAPISess
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -156,13 +167,12 @@ func (a *Client) CreateCurrentAPISessionCertificate(params *CreateCurrentAPISess
|
||||
Delete an ephemeral certificateby id
|
||||
|
||||
*/
|
||||
func (a *Client) DeleteCurrentAPISessionCertificate(params *DeleteCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCurrentAPISessionCertificateOK, error) {
|
||||
func (a *Client) DeleteCurrentAPISessionCertificate(params *DeleteCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCurrentAPISessionCertificateOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteCurrentAPISessionCertificateParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "deleteCurrentApiSessionCertificate",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/current-api-session/certificates/{id}",
|
||||
@@ -174,7 +184,12 @@ func (a *Client) DeleteCurrentAPISessionCertificate(params *DeleteCurrentAPISess
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -193,13 +208,12 @@ func (a *Client) DeleteCurrentAPISessionCertificate(params *DeleteCurrentAPISess
|
||||
|
||||
Retrieves a single ephemeral certificate by id
|
||||
*/
|
||||
func (a *Client) DetailCurrentAPISessionCertificate(params *DetailCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*DetailCurrentAPISessionCertificateOK, error) {
|
||||
func (a *Client) DetailCurrentAPISessionCertificate(params *DetailCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailCurrentAPISessionCertificateOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDetailCurrentAPISessionCertificateParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "detailCurrentApiSessionCertificate",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-api-session/certificates/{id}",
|
||||
@@ -211,7 +225,12 @@ func (a *Client) DetailCurrentAPISessionCertificate(params *DetailCurrentAPISess
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -230,13 +249,12 @@ func (a *Client) DetailCurrentAPISessionCertificate(params *DetailCurrentAPISess
|
||||
|
||||
Retrieves a single authenticator by id. Will only show authenticators assigned to the API session's identity.
|
||||
*/
|
||||
func (a *Client) DetailCurrentIdentityAuthenticator(params *DetailCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter) (*DetailCurrentIdentityAuthenticatorOK, error) {
|
||||
func (a *Client) DetailCurrentIdentityAuthenticator(params *DetailCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailCurrentIdentityAuthenticatorOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDetailCurrentIdentityAuthenticatorParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "detailCurrentIdentityAuthenticator",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-identity/authenticators/{id}",
|
||||
@@ -248,7 +266,12 @@ func (a *Client) DetailCurrentIdentityAuthenticator(params *DetailCurrentIdentit
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -267,13 +290,12 @@ func (a *Client) DetailCurrentIdentityAuthenticator(params *DetailCurrentIdentit
|
||||
|
||||
Retrieves the API session that was used to issue the current request
|
||||
*/
|
||||
func (a *Client) GetCurrentAPISession(params *GetCurrentAPISessionParams, authInfo runtime.ClientAuthInfoWriter) (*GetCurrentAPISessionOK, error) {
|
||||
func (a *Client) GetCurrentAPISession(params *GetCurrentAPISessionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCurrentAPISessionOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetCurrentAPISessionParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "getCurrentAPISession",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-api-session",
|
||||
@@ -285,7 +307,12 @@ func (a *Client) GetCurrentAPISession(params *GetCurrentAPISessionParams, authIn
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -304,13 +331,12 @@ func (a *Client) GetCurrentAPISession(params *GetCurrentAPISessionParams, authIn
|
||||
|
||||
Retrieves a list of certificate resources for the current API session; supports filtering, sorting, and pagination
|
||||
*/
|
||||
func (a *Client) ListCurrentAPISessionCertificates(params *ListCurrentAPISessionCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*ListCurrentAPISessionCertificatesOK, error) {
|
||||
func (a *Client) ListCurrentAPISessionCertificates(params *ListCurrentAPISessionCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCurrentAPISessionCertificatesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListCurrentAPISessionCertificatesParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "listCurrentApiSessionCertificates",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-api-session/certificates",
|
||||
@@ -322,7 +348,12 @@ func (a *Client) ListCurrentAPISessionCertificates(params *ListCurrentAPISession
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -341,13 +372,12 @@ func (a *Client) ListCurrentAPISessionCertificates(params *ListCurrentAPISession
|
||||
|
||||
Retrieves a list of authenticators assigned to the current API session's identity; supports filtering, sorting, and pagination.
|
||||
*/
|
||||
func (a *Client) ListCurrentIdentityAuthenticators(params *ListCurrentIdentityAuthenticatorsParams, authInfo runtime.ClientAuthInfoWriter) (*ListCurrentIdentityAuthenticatorsOK, error) {
|
||||
func (a *Client) ListCurrentIdentityAuthenticators(params *ListCurrentIdentityAuthenticatorsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCurrentIdentityAuthenticatorsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListCurrentIdentityAuthenticatorsParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "listCurrentIdentityAuthenticators",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-identity/authenticators",
|
||||
@@ -359,7 +389,12 @@ func (a *Client) ListCurrentIdentityAuthenticators(params *ListCurrentIdentityAu
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -380,13 +415,12 @@ func (a *Client) ListCurrentIdentityAuthenticators(params *ListCurrentIdentityAu
|
||||
service refreshes.
|
||||
|
||||
*/
|
||||
func (a *Client) ListServiceUpdates(params *ListServiceUpdatesParams, authInfo runtime.ClientAuthInfoWriter) (*ListServiceUpdatesOK, error) {
|
||||
func (a *Client) ListServiceUpdates(params *ListServiceUpdatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListServiceUpdatesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListServiceUpdatesParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "listServiceUpdates",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-api-session/service-updates",
|
||||
@@ -398,7 +432,12 @@ func (a *Client) ListServiceUpdates(params *ListServiceUpdatesParams, authInfo r
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -419,13 +458,12 @@ func (a *Client) ListServiceUpdates(params *ListServiceUpdatesParams, authInfo r
|
||||
session's identity.
|
||||
|
||||
*/
|
||||
func (a *Client) PatchCurrentIdentityAuthenticator(params *PatchCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter) (*PatchCurrentIdentityAuthenticatorOK, error) {
|
||||
func (a *Client) PatchCurrentIdentityAuthenticator(params *PatchCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchCurrentIdentityAuthenticatorOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewPatchCurrentIdentityAuthenticatorParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "patchCurrentIdentityAuthenticator",
|
||||
Method: "PATCH",
|
||||
PathPattern: "/current-identity/authenticators/{id}",
|
||||
@@ -437,7 +475,12 @@ func (a *Client) PatchCurrentIdentityAuthenticator(params *PatchCurrentIdentityA
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -458,13 +501,12 @@ func (a *Client) PatchCurrentIdentityAuthenticator(params *PatchCurrentIdentityA
|
||||
identity.
|
||||
|
||||
*/
|
||||
func (a *Client) UpdateCurrentIdentityAuthenticator(params *UpdateCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateCurrentIdentityAuthenticatorOK, error) {
|
||||
func (a *Client) UpdateCurrentIdentityAuthenticator(params *UpdateCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCurrentIdentityAuthenticatorOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUpdateCurrentIdentityAuthenticatorParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "updateCurrentIdentityAuthenticator",
|
||||
Method: "PUT",
|
||||
PathPattern: "/current-identity/authenticators/{id}",
|
||||
@@ -476,7 +518,12 @@ func (a *Client) UpdateCurrentIdentityAuthenticator(params *UpdateCurrentIdentit
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
+30
-16
@@ -40,53 +40,52 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeleteCurrentAPISessionCertificateParams creates a new DeleteCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized.
|
||||
// NewDeleteCurrentAPISessionCertificateParams creates a new DeleteCurrentAPISessionCertificateParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeleteCurrentAPISessionCertificateParams() *DeleteCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &DeleteCurrentAPISessionCertificateParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteCurrentAPISessionCertificateParamsWithTimeout creates a new DeleteCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteCurrentAPISessionCertificateParamsWithTimeout(timeout time.Duration) *DeleteCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &DeleteCurrentAPISessionCertificateParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteCurrentAPISessionCertificateParamsWithContext creates a new DeleteCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteCurrentAPISessionCertificateParamsWithContext(ctx context.Context) *DeleteCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &DeleteCurrentAPISessionCertificateParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteCurrentAPISessionCertificateParamsWithHTTPClient creates a new DeleteCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteCurrentAPISessionCertificateParamsWithHTTPClient(client *http.Client) *DeleteCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &DeleteCurrentAPISessionCertificateParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*DeleteCurrentAPISessionCertificateParams contains all the parameters to send to the API endpoint
|
||||
for the delete current Api session certificate operation typically these are written to a http.Request
|
||||
/* DeleteCurrentAPISessionCertificateParams contains all the parameters to send to the API endpoint
|
||||
for the delete current Api session certificate operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteCurrentAPISessionCertificateParams struct {
|
||||
|
||||
/*ID
|
||||
The id of the requested resource
|
||||
/* ID.
|
||||
|
||||
The id of the requested resource
|
||||
*/
|
||||
ID string
|
||||
|
||||
@@ -95,6 +94,21 @@ type DeleteCurrentAPISessionCertificateParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete current Api session certificate params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteCurrentAPISessionCertificateParams) WithDefaults() *DeleteCurrentAPISessionCertificateParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete current Api session certificate params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteCurrentAPISessionCertificateParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete current Api session certificate params
|
||||
func (o *DeleteCurrentAPISessionCertificateParams) WithTimeout(timeout time.Duration) *DeleteCurrentAPISessionCertificateParams {
|
||||
o.SetTimeout(timeout)
|
||||
+3
-7
@@ -65,7 +65,6 @@ func (o *DeleteCurrentAPISessionCertificateReader) ReadResponse(response runtime
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -76,7 +75,7 @@ func NewDeleteCurrentAPISessionCertificateOK() *DeleteCurrentAPISessionCertifica
|
||||
return &DeleteCurrentAPISessionCertificateOK{}
|
||||
}
|
||||
|
||||
/*DeleteCurrentAPISessionCertificateOK handles this case with default header values.
|
||||
/* DeleteCurrentAPISessionCertificateOK describes a response with status code 200, with default header values.
|
||||
|
||||
The delete request was successful and the resource has been removed
|
||||
*/
|
||||
@@ -87,7 +86,6 @@ type DeleteCurrentAPISessionCertificateOK struct {
|
||||
func (o *DeleteCurrentAPISessionCertificateOK) Error() string {
|
||||
return fmt.Sprintf("[DELETE /current-api-session/certificates/{id}][%d] deleteCurrentApiSessionCertificateOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteCurrentAPISessionCertificateOK) GetPayload() *rest_model.Empty {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -109,7 +107,7 @@ func NewDeleteCurrentAPISessionCertificateBadRequest() *DeleteCurrentAPISessionC
|
||||
return &DeleteCurrentAPISessionCertificateBadRequest{}
|
||||
}
|
||||
|
||||
/*DeleteCurrentAPISessionCertificateBadRequest handles this case with default header values.
|
||||
/* DeleteCurrentAPISessionCertificateBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information
|
||||
*/
|
||||
@@ -120,7 +118,6 @@ type DeleteCurrentAPISessionCertificateBadRequest struct {
|
||||
func (o *DeleteCurrentAPISessionCertificateBadRequest) Error() string {
|
||||
return fmt.Sprintf("[DELETE /current-api-session/certificates/{id}][%d] deleteCurrentApiSessionCertificateBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteCurrentAPISessionCertificateBadRequest) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -142,7 +139,7 @@ func NewDeleteCurrentAPISessionCertificateUnauthorized() *DeleteCurrentAPISessio
|
||||
return &DeleteCurrentAPISessionCertificateUnauthorized{}
|
||||
}
|
||||
|
||||
/*DeleteCurrentAPISessionCertificateUnauthorized handles this case with default header values.
|
||||
/* DeleteCurrentAPISessionCertificateUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -153,7 +150,6 @@ type DeleteCurrentAPISessionCertificateUnauthorized struct {
|
||||
func (o *DeleteCurrentAPISessionCertificateUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[DELETE /current-api-session/certificates/{id}][%d] deleteCurrentApiSessionCertificateUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteCurrentAPISessionCertificateUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+28
-14
@@ -40,47 +40,46 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeleteCurrentAPISessionParams creates a new DeleteCurrentAPISessionParams object
|
||||
// with the default values initialized.
|
||||
// NewDeleteCurrentAPISessionParams creates a new DeleteCurrentAPISessionParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeleteCurrentAPISessionParams() *DeleteCurrentAPISessionParams {
|
||||
|
||||
return &DeleteCurrentAPISessionParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteCurrentAPISessionParamsWithTimeout creates a new DeleteCurrentAPISessionParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteCurrentAPISessionParamsWithTimeout(timeout time.Duration) *DeleteCurrentAPISessionParams {
|
||||
|
||||
return &DeleteCurrentAPISessionParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteCurrentAPISessionParamsWithContext creates a new DeleteCurrentAPISessionParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteCurrentAPISessionParamsWithContext(ctx context.Context) *DeleteCurrentAPISessionParams {
|
||||
|
||||
return &DeleteCurrentAPISessionParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteCurrentAPISessionParamsWithHTTPClient creates a new DeleteCurrentAPISessionParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteCurrentAPISessionParamsWithHTTPClient(client *http.Client) *DeleteCurrentAPISessionParams {
|
||||
|
||||
return &DeleteCurrentAPISessionParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*DeleteCurrentAPISessionParams contains all the parameters to send to the API endpoint
|
||||
for the delete current API session operation typically these are written to a http.Request
|
||||
/* DeleteCurrentAPISessionParams contains all the parameters to send to the API endpoint
|
||||
for the delete current API session operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteCurrentAPISessionParams struct {
|
||||
timeout time.Duration
|
||||
@@ -88,6 +87,21 @@ type DeleteCurrentAPISessionParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete current API session params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteCurrentAPISessionParams) WithDefaults() *DeleteCurrentAPISessionParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete current API session params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteCurrentAPISessionParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete current API session params
|
||||
func (o *DeleteCurrentAPISessionParams) WithTimeout(timeout time.Duration) *DeleteCurrentAPISessionParams {
|
||||
o.SetTimeout(timeout)
|
||||
+2
-5
@@ -59,7 +59,6 @@ func (o *DeleteCurrentAPISessionReader) ReadResponse(response runtime.ClientResp
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -70,7 +69,7 @@ func NewDeleteCurrentAPISessionOK() *DeleteCurrentAPISessionOK {
|
||||
return &DeleteCurrentAPISessionOK{}
|
||||
}
|
||||
|
||||
/*DeleteCurrentAPISessionOK handles this case with default header values.
|
||||
/* DeleteCurrentAPISessionOK describes a response with status code 200, with default header values.
|
||||
|
||||
Base empty response
|
||||
*/
|
||||
@@ -81,7 +80,6 @@ type DeleteCurrentAPISessionOK struct {
|
||||
func (o *DeleteCurrentAPISessionOK) Error() string {
|
||||
return fmt.Sprintf("[DELETE /current-api-session][%d] deleteCurrentApiSessionOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteCurrentAPISessionOK) GetPayload() *rest_model.Empty {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -103,7 +101,7 @@ func NewDeleteCurrentAPISessionUnauthorized() *DeleteCurrentAPISessionUnauthoriz
|
||||
return &DeleteCurrentAPISessionUnauthorized{}
|
||||
}
|
||||
|
||||
/*DeleteCurrentAPISessionUnauthorized handles this case with default header values.
|
||||
/* DeleteCurrentAPISessionUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -114,7 +112,6 @@ type DeleteCurrentAPISessionUnauthorized struct {
|
||||
func (o *DeleteCurrentAPISessionUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[DELETE /current-api-session][%d] deleteCurrentApiSessionUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteCurrentAPISessionUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+30
-16
@@ -40,53 +40,52 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDetailCurrentAPISessionCertificateParams creates a new DetailCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized.
|
||||
// NewDetailCurrentAPISessionCertificateParams creates a new DetailCurrentAPISessionCertificateParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDetailCurrentAPISessionCertificateParams() *DetailCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &DetailCurrentAPISessionCertificateParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailCurrentAPISessionCertificateParamsWithTimeout creates a new DetailCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDetailCurrentAPISessionCertificateParamsWithTimeout(timeout time.Duration) *DetailCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &DetailCurrentAPISessionCertificateParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailCurrentAPISessionCertificateParamsWithContext creates a new DetailCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewDetailCurrentAPISessionCertificateParamsWithContext(ctx context.Context) *DetailCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &DetailCurrentAPISessionCertificateParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailCurrentAPISessionCertificateParamsWithHTTPClient creates a new DetailCurrentAPISessionCertificateParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDetailCurrentAPISessionCertificateParamsWithHTTPClient(client *http.Client) *DetailCurrentAPISessionCertificateParams {
|
||||
var ()
|
||||
return &DetailCurrentAPISessionCertificateParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*DetailCurrentAPISessionCertificateParams contains all the parameters to send to the API endpoint
|
||||
for the detail current Api session certificate operation typically these are written to a http.Request
|
||||
/* DetailCurrentAPISessionCertificateParams contains all the parameters to send to the API endpoint
|
||||
for the detail current Api session certificate operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DetailCurrentAPISessionCertificateParams struct {
|
||||
|
||||
/*ID
|
||||
The id of the requested resource
|
||||
/* ID.
|
||||
|
||||
The id of the requested resource
|
||||
*/
|
||||
ID string
|
||||
|
||||
@@ -95,6 +94,21 @@ type DetailCurrentAPISessionCertificateParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the detail current Api session certificate params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DetailCurrentAPISessionCertificateParams) WithDefaults() *DetailCurrentAPISessionCertificateParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the detail current Api session certificate params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DetailCurrentAPISessionCertificateParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the detail current Api session certificate params
|
||||
func (o *DetailCurrentAPISessionCertificateParams) WithTimeout(timeout time.Duration) *DetailCurrentAPISessionCertificateParams {
|
||||
o.SetTimeout(timeout)
|
||||
+3
-7
@@ -65,7 +65,6 @@ func (o *DetailCurrentAPISessionCertificateReader) ReadResponse(response runtime
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -76,7 +75,7 @@ func NewDetailCurrentAPISessionCertificateOK() *DetailCurrentAPISessionCertifica
|
||||
return &DetailCurrentAPISessionCertificateOK{}
|
||||
}
|
||||
|
||||
/*DetailCurrentAPISessionCertificateOK handles this case with default header values.
|
||||
/* DetailCurrentAPISessionCertificateOK describes a response with status code 200, with default header values.
|
||||
|
||||
A response containing a single API Session certificate
|
||||
*/
|
||||
@@ -87,7 +86,6 @@ type DetailCurrentAPISessionCertificateOK struct {
|
||||
func (o *DetailCurrentAPISessionCertificateOK) Error() string {
|
||||
return fmt.Sprintf("[GET /current-api-session/certificates/{id}][%d] detailCurrentApiSessionCertificateOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailCurrentAPISessionCertificateOK) GetPayload() *rest_model.DetailCurrentAPISessionCertificateEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -109,7 +107,7 @@ func NewDetailCurrentAPISessionCertificateUnauthorized() *DetailCurrentAPISessio
|
||||
return &DetailCurrentAPISessionCertificateUnauthorized{}
|
||||
}
|
||||
|
||||
/*DetailCurrentAPISessionCertificateUnauthorized handles this case with default header values.
|
||||
/* DetailCurrentAPISessionCertificateUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -120,7 +118,6 @@ type DetailCurrentAPISessionCertificateUnauthorized struct {
|
||||
func (o *DetailCurrentAPISessionCertificateUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /current-api-session/certificates/{id}][%d] detailCurrentApiSessionCertificateUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailCurrentAPISessionCertificateUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -142,7 +139,7 @@ func NewDetailCurrentAPISessionCertificateNotFound() *DetailCurrentAPISessionCer
|
||||
return &DetailCurrentAPISessionCertificateNotFound{}
|
||||
}
|
||||
|
||||
/*DetailCurrentAPISessionCertificateNotFound handles this case with default header values.
|
||||
/* DetailCurrentAPISessionCertificateNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
The requested resource does not exist
|
||||
*/
|
||||
@@ -153,7 +150,6 @@ type DetailCurrentAPISessionCertificateNotFound struct {
|
||||
func (o *DetailCurrentAPISessionCertificateNotFound) Error() string {
|
||||
return fmt.Sprintf("[GET /current-api-session/certificates/{id}][%d] detailCurrentApiSessionCertificateNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailCurrentAPISessionCertificateNotFound) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+30
-16
@@ -40,53 +40,52 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDetailCurrentIdentityAuthenticatorParams creates a new DetailCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized.
|
||||
// NewDetailCurrentIdentityAuthenticatorParams creates a new DetailCurrentIdentityAuthenticatorParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDetailCurrentIdentityAuthenticatorParams() *DetailCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &DetailCurrentIdentityAuthenticatorParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailCurrentIdentityAuthenticatorParamsWithTimeout creates a new DetailCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDetailCurrentIdentityAuthenticatorParamsWithTimeout(timeout time.Duration) *DetailCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &DetailCurrentIdentityAuthenticatorParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailCurrentIdentityAuthenticatorParamsWithContext creates a new DetailCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewDetailCurrentIdentityAuthenticatorParamsWithContext(ctx context.Context) *DetailCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &DetailCurrentIdentityAuthenticatorParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailCurrentIdentityAuthenticatorParamsWithHTTPClient creates a new DetailCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDetailCurrentIdentityAuthenticatorParamsWithHTTPClient(client *http.Client) *DetailCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &DetailCurrentIdentityAuthenticatorParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*DetailCurrentIdentityAuthenticatorParams contains all the parameters to send to the API endpoint
|
||||
for the detail current identity authenticator operation typically these are written to a http.Request
|
||||
/* DetailCurrentIdentityAuthenticatorParams contains all the parameters to send to the API endpoint
|
||||
for the detail current identity authenticator operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DetailCurrentIdentityAuthenticatorParams struct {
|
||||
|
||||
/*ID
|
||||
The id of the requested resource
|
||||
/* ID.
|
||||
|
||||
The id of the requested resource
|
||||
*/
|
||||
ID string
|
||||
|
||||
@@ -95,6 +94,21 @@ type DetailCurrentIdentityAuthenticatorParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the detail current identity authenticator params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DetailCurrentIdentityAuthenticatorParams) WithDefaults() *DetailCurrentIdentityAuthenticatorParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the detail current identity authenticator params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DetailCurrentIdentityAuthenticatorParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the detail current identity authenticator params
|
||||
func (o *DetailCurrentIdentityAuthenticatorParams) WithTimeout(timeout time.Duration) *DetailCurrentIdentityAuthenticatorParams {
|
||||
o.SetTimeout(timeout)
|
||||
+3
-7
@@ -65,7 +65,6 @@ func (o *DetailCurrentIdentityAuthenticatorReader) ReadResponse(response runtime
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -76,7 +75,7 @@ func NewDetailCurrentIdentityAuthenticatorOK() *DetailCurrentIdentityAuthenticat
|
||||
return &DetailCurrentIdentityAuthenticatorOK{}
|
||||
}
|
||||
|
||||
/*DetailCurrentIdentityAuthenticatorOK handles this case with default header values.
|
||||
/* DetailCurrentIdentityAuthenticatorOK describes a response with status code 200, with default header values.
|
||||
|
||||
A singular authenticator resource
|
||||
*/
|
||||
@@ -87,7 +86,6 @@ type DetailCurrentIdentityAuthenticatorOK struct {
|
||||
func (o *DetailCurrentIdentityAuthenticatorOK) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/authenticators/{id}][%d] detailCurrentIdentityAuthenticatorOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailCurrentIdentityAuthenticatorOK) GetPayload() *rest_model.DetailAuthenticatorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -109,7 +107,7 @@ func NewDetailCurrentIdentityAuthenticatorUnauthorized() *DetailCurrentIdentityA
|
||||
return &DetailCurrentIdentityAuthenticatorUnauthorized{}
|
||||
}
|
||||
|
||||
/*DetailCurrentIdentityAuthenticatorUnauthorized handles this case with default header values.
|
||||
/* DetailCurrentIdentityAuthenticatorUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -120,7 +118,6 @@ type DetailCurrentIdentityAuthenticatorUnauthorized struct {
|
||||
func (o *DetailCurrentIdentityAuthenticatorUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/authenticators/{id}][%d] detailCurrentIdentityAuthenticatorUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailCurrentIdentityAuthenticatorUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -142,7 +139,7 @@ func NewDetailCurrentIdentityAuthenticatorNotFound() *DetailCurrentIdentityAuthe
|
||||
return &DetailCurrentIdentityAuthenticatorNotFound{}
|
||||
}
|
||||
|
||||
/*DetailCurrentIdentityAuthenticatorNotFound handles this case with default header values.
|
||||
/* DetailCurrentIdentityAuthenticatorNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
The requested resource does not exist
|
||||
*/
|
||||
@@ -153,7 +150,6 @@ type DetailCurrentIdentityAuthenticatorNotFound struct {
|
||||
func (o *DetailCurrentIdentityAuthenticatorNotFound) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/authenticators/{id}][%d] detailCurrentIdentityAuthenticatorNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailCurrentIdentityAuthenticatorNotFound) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+28
-14
@@ -40,47 +40,46 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetCurrentAPISessionParams creates a new GetCurrentAPISessionParams object
|
||||
// with the default values initialized.
|
||||
// NewGetCurrentAPISessionParams creates a new GetCurrentAPISessionParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetCurrentAPISessionParams() *GetCurrentAPISessionParams {
|
||||
|
||||
return &GetCurrentAPISessionParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetCurrentAPISessionParamsWithTimeout creates a new GetCurrentAPISessionParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetCurrentAPISessionParamsWithTimeout(timeout time.Duration) *GetCurrentAPISessionParams {
|
||||
|
||||
return &GetCurrentAPISessionParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetCurrentAPISessionParamsWithContext creates a new GetCurrentAPISessionParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetCurrentAPISessionParamsWithContext(ctx context.Context) *GetCurrentAPISessionParams {
|
||||
|
||||
return &GetCurrentAPISessionParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetCurrentAPISessionParamsWithHTTPClient creates a new GetCurrentAPISessionParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetCurrentAPISessionParamsWithHTTPClient(client *http.Client) *GetCurrentAPISessionParams {
|
||||
|
||||
return &GetCurrentAPISessionParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*GetCurrentAPISessionParams contains all the parameters to send to the API endpoint
|
||||
for the get current API session operation typically these are written to a http.Request
|
||||
/* GetCurrentAPISessionParams contains all the parameters to send to the API endpoint
|
||||
for the get current API session operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetCurrentAPISessionParams struct {
|
||||
timeout time.Duration
|
||||
@@ -88,6 +87,21 @@ type GetCurrentAPISessionParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get current API session params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetCurrentAPISessionParams) WithDefaults() *GetCurrentAPISessionParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get current API session params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetCurrentAPISessionParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get current API session params
|
||||
func (o *GetCurrentAPISessionParams) WithTimeout(timeout time.Duration) *GetCurrentAPISessionParams {
|
||||
o.SetTimeout(timeout)
|
||||
+2
-5
@@ -59,7 +59,6 @@ func (o *GetCurrentAPISessionReader) ReadResponse(response runtime.ClientRespons
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -70,7 +69,7 @@ func NewGetCurrentAPISessionOK() *GetCurrentAPISessionOK {
|
||||
return &GetCurrentAPISessionOK{}
|
||||
}
|
||||
|
||||
/*GetCurrentAPISessionOK handles this case with default header values.
|
||||
/* GetCurrentAPISessionOK describes a response with status code 200, with default header values.
|
||||
|
||||
The API session associated with the session used to issue the request
|
||||
*/
|
||||
@@ -81,7 +80,6 @@ type GetCurrentAPISessionOK struct {
|
||||
func (o *GetCurrentAPISessionOK) Error() string {
|
||||
return fmt.Sprintf("[GET /current-api-session][%d] getCurrentApiSessionOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetCurrentAPISessionOK) GetPayload() *rest_model.CurrentAPISessionDetailEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -103,7 +101,7 @@ func NewGetCurrentAPISessionUnauthorized() *GetCurrentAPISessionUnauthorized {
|
||||
return &GetCurrentAPISessionUnauthorized{}
|
||||
}
|
||||
|
||||
/*GetCurrentAPISessionUnauthorized handles this case with default header values.
|
||||
/* GetCurrentAPISessionUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -114,7 +112,6 @@ type GetCurrentAPISessionUnauthorized struct {
|
||||
func (o *GetCurrentAPISessionUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /current-api-session][%d] getCurrentApiSessionUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetCurrentAPISessionUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+39
-20
@@ -41,55 +41,56 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewListCurrentAPISessionCertificatesParams creates a new ListCurrentAPISessionCertificatesParams object
|
||||
// with the default values initialized.
|
||||
// NewListCurrentAPISessionCertificatesParams creates a new ListCurrentAPISessionCertificatesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListCurrentAPISessionCertificatesParams() *ListCurrentAPISessionCertificatesParams {
|
||||
var ()
|
||||
return &ListCurrentAPISessionCertificatesParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListCurrentAPISessionCertificatesParamsWithTimeout creates a new ListCurrentAPISessionCertificatesParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListCurrentAPISessionCertificatesParamsWithTimeout(timeout time.Duration) *ListCurrentAPISessionCertificatesParams {
|
||||
var ()
|
||||
return &ListCurrentAPISessionCertificatesParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListCurrentAPISessionCertificatesParamsWithContext creates a new ListCurrentAPISessionCertificatesParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewListCurrentAPISessionCertificatesParamsWithContext(ctx context.Context) *ListCurrentAPISessionCertificatesParams {
|
||||
var ()
|
||||
return &ListCurrentAPISessionCertificatesParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListCurrentAPISessionCertificatesParamsWithHTTPClient creates a new ListCurrentAPISessionCertificatesParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListCurrentAPISessionCertificatesParamsWithHTTPClient(client *http.Client) *ListCurrentAPISessionCertificatesParams {
|
||||
var ()
|
||||
return &ListCurrentAPISessionCertificatesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*ListCurrentAPISessionCertificatesParams contains all the parameters to send to the API endpoint
|
||||
for the list current Api session certificates operation typically these are written to a http.Request
|
||||
/* ListCurrentAPISessionCertificatesParams contains all the parameters to send to the API endpoint
|
||||
for the list current Api session certificates operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListCurrentAPISessionCertificatesParams struct {
|
||||
|
||||
/*Filter*/
|
||||
// Filter.
|
||||
Filter *string
|
||||
/*Limit*/
|
||||
|
||||
// Limit.
|
||||
Limit *int64
|
||||
/*Offset*/
|
||||
|
||||
// Offset.
|
||||
Offset *int64
|
||||
|
||||
timeout time.Duration
|
||||
@@ -97,6 +98,21 @@ type ListCurrentAPISessionCertificatesParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list current Api session certificates params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListCurrentAPISessionCertificatesParams) WithDefaults() *ListCurrentAPISessionCertificatesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list current Api session certificates params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListCurrentAPISessionCertificatesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list current Api session certificates params
|
||||
func (o *ListCurrentAPISessionCertificatesParams) WithTimeout(timeout time.Duration) *ListCurrentAPISessionCertificatesParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -175,48 +191,51 @@ func (o *ListCurrentAPISessionCertificatesParams) WriteToRequest(r runtime.Clien
|
||||
|
||||
// query param filter
|
||||
var qrFilter string
|
||||
|
||||
if o.Filter != nil {
|
||||
qrFilter = *o.Filter
|
||||
}
|
||||
qFilter := qrFilter
|
||||
if qFilter != "" {
|
||||
|
||||
if err := r.SetQueryParam("filter", qFilter); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Limit != nil {
|
||||
|
||||
// query param limit
|
||||
var qrLimit int64
|
||||
|
||||
if o.Limit != nil {
|
||||
qrLimit = *o.Limit
|
||||
}
|
||||
qLimit := swag.FormatInt64(qrLimit)
|
||||
if qLimit != "" {
|
||||
|
||||
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Offset != nil {
|
||||
|
||||
// query param offset
|
||||
var qrOffset int64
|
||||
|
||||
if o.Offset != nil {
|
||||
qrOffset = *o.Offset
|
||||
}
|
||||
qOffset := swag.FormatInt64(qrOffset)
|
||||
if qOffset != "" {
|
||||
|
||||
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
+1
-3
@@ -53,7 +53,6 @@ func (o *ListCurrentAPISessionCertificatesReader) ReadResponse(response runtime.
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -64,7 +63,7 @@ func NewListCurrentAPISessionCertificatesOK() *ListCurrentAPISessionCertificates
|
||||
return &ListCurrentAPISessionCertificatesOK{}
|
||||
}
|
||||
|
||||
/*ListCurrentAPISessionCertificatesOK handles this case with default header values.
|
||||
/* ListCurrentAPISessionCertificatesOK describes a response with status code 200, with default header values.
|
||||
|
||||
A list of the current API Session's certificate
|
||||
*/
|
||||
@@ -75,7 +74,6 @@ type ListCurrentAPISessionCertificatesOK struct {
|
||||
func (o *ListCurrentAPISessionCertificatesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /current-api-session/certificates][%d] listCurrentApiSessionCertificatesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListCurrentAPISessionCertificatesOK) GetPayload() *rest_model.ListCurrentAPISessionCertificatesEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+39
-20
@@ -41,55 +41,56 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewListCurrentIdentityAuthenticatorsParams creates a new ListCurrentIdentityAuthenticatorsParams object
|
||||
// with the default values initialized.
|
||||
// NewListCurrentIdentityAuthenticatorsParams creates a new ListCurrentIdentityAuthenticatorsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListCurrentIdentityAuthenticatorsParams() *ListCurrentIdentityAuthenticatorsParams {
|
||||
var ()
|
||||
return &ListCurrentIdentityAuthenticatorsParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListCurrentIdentityAuthenticatorsParamsWithTimeout creates a new ListCurrentIdentityAuthenticatorsParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListCurrentIdentityAuthenticatorsParamsWithTimeout(timeout time.Duration) *ListCurrentIdentityAuthenticatorsParams {
|
||||
var ()
|
||||
return &ListCurrentIdentityAuthenticatorsParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListCurrentIdentityAuthenticatorsParamsWithContext creates a new ListCurrentIdentityAuthenticatorsParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewListCurrentIdentityAuthenticatorsParamsWithContext(ctx context.Context) *ListCurrentIdentityAuthenticatorsParams {
|
||||
var ()
|
||||
return &ListCurrentIdentityAuthenticatorsParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListCurrentIdentityAuthenticatorsParamsWithHTTPClient creates a new ListCurrentIdentityAuthenticatorsParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListCurrentIdentityAuthenticatorsParamsWithHTTPClient(client *http.Client) *ListCurrentIdentityAuthenticatorsParams {
|
||||
var ()
|
||||
return &ListCurrentIdentityAuthenticatorsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*ListCurrentIdentityAuthenticatorsParams contains all the parameters to send to the API endpoint
|
||||
for the list current identity authenticators operation typically these are written to a http.Request
|
||||
/* ListCurrentIdentityAuthenticatorsParams contains all the parameters to send to the API endpoint
|
||||
for the list current identity authenticators operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListCurrentIdentityAuthenticatorsParams struct {
|
||||
|
||||
/*Filter*/
|
||||
// Filter.
|
||||
Filter *string
|
||||
/*Limit*/
|
||||
|
||||
// Limit.
|
||||
Limit *int64
|
||||
/*Offset*/
|
||||
|
||||
// Offset.
|
||||
Offset *int64
|
||||
|
||||
timeout time.Duration
|
||||
@@ -97,6 +98,21 @@ type ListCurrentIdentityAuthenticatorsParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list current identity authenticators params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListCurrentIdentityAuthenticatorsParams) WithDefaults() *ListCurrentIdentityAuthenticatorsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list current identity authenticators params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListCurrentIdentityAuthenticatorsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list current identity authenticators params
|
||||
func (o *ListCurrentIdentityAuthenticatorsParams) WithTimeout(timeout time.Duration) *ListCurrentIdentityAuthenticatorsParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -175,48 +191,51 @@ func (o *ListCurrentIdentityAuthenticatorsParams) WriteToRequest(r runtime.Clien
|
||||
|
||||
// query param filter
|
||||
var qrFilter string
|
||||
|
||||
if o.Filter != nil {
|
||||
qrFilter = *o.Filter
|
||||
}
|
||||
qFilter := qrFilter
|
||||
if qFilter != "" {
|
||||
|
||||
if err := r.SetQueryParam("filter", qFilter); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Limit != nil {
|
||||
|
||||
// query param limit
|
||||
var qrLimit int64
|
||||
|
||||
if o.Limit != nil {
|
||||
qrLimit = *o.Limit
|
||||
}
|
||||
qLimit := swag.FormatInt64(qrLimit)
|
||||
if qLimit != "" {
|
||||
|
||||
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Offset != nil {
|
||||
|
||||
// query param offset
|
||||
var qrOffset int64
|
||||
|
||||
if o.Offset != nil {
|
||||
qrOffset = *o.Offset
|
||||
}
|
||||
qOffset := swag.FormatInt64(qrOffset)
|
||||
if qOffset != "" {
|
||||
|
||||
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
+2
-5
@@ -59,7 +59,6 @@ func (o *ListCurrentIdentityAuthenticatorsReader) ReadResponse(response runtime.
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -70,7 +69,7 @@ func NewListCurrentIdentityAuthenticatorsOK() *ListCurrentIdentityAuthenticators
|
||||
return &ListCurrentIdentityAuthenticatorsOK{}
|
||||
}
|
||||
|
||||
/*ListCurrentIdentityAuthenticatorsOK handles this case with default header values.
|
||||
/* ListCurrentIdentityAuthenticatorsOK describes a response with status code 200, with default header values.
|
||||
|
||||
A list of authenticators
|
||||
*/
|
||||
@@ -81,7 +80,6 @@ type ListCurrentIdentityAuthenticatorsOK struct {
|
||||
func (o *ListCurrentIdentityAuthenticatorsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/authenticators][%d] listCurrentIdentityAuthenticatorsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListCurrentIdentityAuthenticatorsOK) GetPayload() *rest_model.ListAuthenticatorsEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -103,7 +101,7 @@ func NewListCurrentIdentityAuthenticatorsUnauthorized() *ListCurrentIdentityAuth
|
||||
return &ListCurrentIdentityAuthenticatorsUnauthorized{}
|
||||
}
|
||||
|
||||
/*ListCurrentIdentityAuthenticatorsUnauthorized handles this case with default header values.
|
||||
/* ListCurrentIdentityAuthenticatorsUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -114,7 +112,6 @@ type ListCurrentIdentityAuthenticatorsUnauthorized struct {
|
||||
func (o *ListCurrentIdentityAuthenticatorsUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/authenticators][%d] listCurrentIdentityAuthenticatorsUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListCurrentIdentityAuthenticatorsUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+28
-14
@@ -40,47 +40,46 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListServiceUpdatesParams creates a new ListServiceUpdatesParams object
|
||||
// with the default values initialized.
|
||||
// NewListServiceUpdatesParams creates a new ListServiceUpdatesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListServiceUpdatesParams() *ListServiceUpdatesParams {
|
||||
|
||||
return &ListServiceUpdatesParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListServiceUpdatesParamsWithTimeout creates a new ListServiceUpdatesParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListServiceUpdatesParamsWithTimeout(timeout time.Duration) *ListServiceUpdatesParams {
|
||||
|
||||
return &ListServiceUpdatesParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListServiceUpdatesParamsWithContext creates a new ListServiceUpdatesParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewListServiceUpdatesParamsWithContext(ctx context.Context) *ListServiceUpdatesParams {
|
||||
|
||||
return &ListServiceUpdatesParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListServiceUpdatesParamsWithHTTPClient creates a new ListServiceUpdatesParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListServiceUpdatesParamsWithHTTPClient(client *http.Client) *ListServiceUpdatesParams {
|
||||
|
||||
return &ListServiceUpdatesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*ListServiceUpdatesParams contains all the parameters to send to the API endpoint
|
||||
for the list service updates operation typically these are written to a http.Request
|
||||
/* ListServiceUpdatesParams contains all the parameters to send to the API endpoint
|
||||
for the list service updates operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListServiceUpdatesParams struct {
|
||||
timeout time.Duration
|
||||
@@ -88,6 +87,21 @@ type ListServiceUpdatesParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list service updates params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListServiceUpdatesParams) WithDefaults() *ListServiceUpdatesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list service updates params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListServiceUpdatesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list service updates params
|
||||
func (o *ListServiceUpdatesParams) WithTimeout(timeout time.Duration) *ListServiceUpdatesParams {
|
||||
o.SetTimeout(timeout)
|
||||
+2
-5
@@ -59,7 +59,6 @@ func (o *ListServiceUpdatesReader) ReadResponse(response runtime.ClientResponse,
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -70,7 +69,7 @@ func NewListServiceUpdatesOK() *ListServiceUpdatesOK {
|
||||
return &ListServiceUpdatesOK{}
|
||||
}
|
||||
|
||||
/*ListServiceUpdatesOK handles this case with default header values.
|
||||
/* ListServiceUpdatesOK describes a response with status code 200, with default header values.
|
||||
|
||||
Data indicating necessary service updates
|
||||
*/
|
||||
@@ -81,7 +80,6 @@ type ListServiceUpdatesOK struct {
|
||||
func (o *ListServiceUpdatesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /current-api-session/service-updates][%d] listServiceUpdatesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListServiceUpdatesOK) GetPayload() *rest_model.ListCurrentAPISessionServiceUpdatesEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -103,7 +101,7 @@ func NewListServiceUpdatesUnauthorized() *ListServiceUpdatesUnauthorized {
|
||||
return &ListServiceUpdatesUnauthorized{}
|
||||
}
|
||||
|
||||
/*ListServiceUpdatesUnauthorized handles this case with default header values.
|
||||
/* ListServiceUpdatesUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -114,7 +112,6 @@ type ListServiceUpdatesUnauthorized struct {
|
||||
func (o *ListServiceUpdatesUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /current-api-session/service-updates][%d] listServiceUpdatesUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListServiceUpdatesUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+33
-19
@@ -42,58 +42,58 @@ import (
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
// NewPatchCurrentIdentityAuthenticatorParams creates a new PatchCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized.
|
||||
// NewPatchCurrentIdentityAuthenticatorParams creates a new PatchCurrentIdentityAuthenticatorParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewPatchCurrentIdentityAuthenticatorParams() *PatchCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &PatchCurrentIdentityAuthenticatorParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchCurrentIdentityAuthenticatorParamsWithTimeout creates a new PatchCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewPatchCurrentIdentityAuthenticatorParamsWithTimeout(timeout time.Duration) *PatchCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &PatchCurrentIdentityAuthenticatorParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchCurrentIdentityAuthenticatorParamsWithContext creates a new PatchCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewPatchCurrentIdentityAuthenticatorParamsWithContext(ctx context.Context) *PatchCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &PatchCurrentIdentityAuthenticatorParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchCurrentIdentityAuthenticatorParamsWithHTTPClient creates a new PatchCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewPatchCurrentIdentityAuthenticatorParamsWithHTTPClient(client *http.Client) *PatchCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &PatchCurrentIdentityAuthenticatorParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*PatchCurrentIdentityAuthenticatorParams contains all the parameters to send to the API endpoint
|
||||
for the patch current identity authenticator operation typically these are written to a http.Request
|
||||
/* PatchCurrentIdentityAuthenticatorParams contains all the parameters to send to the API endpoint
|
||||
for the patch current identity authenticator operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type PatchCurrentIdentityAuthenticatorParams struct {
|
||||
|
||||
/*Authenticator
|
||||
An authenticator patch object
|
||||
/* Authenticator.
|
||||
|
||||
An authenticator patch object
|
||||
*/
|
||||
Authenticator *rest_model.AuthenticatorPatchWithCurrent
|
||||
/*ID
|
||||
The id of the requested resource
|
||||
|
||||
/* ID.
|
||||
|
||||
The id of the requested resource
|
||||
*/
|
||||
ID string
|
||||
|
||||
@@ -102,6 +102,21 @@ type PatchCurrentIdentityAuthenticatorParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the patch current identity authenticator params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PatchCurrentIdentityAuthenticatorParams) WithDefaults() *PatchCurrentIdentityAuthenticatorParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the patch current identity authenticator params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PatchCurrentIdentityAuthenticatorParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the patch current identity authenticator params
|
||||
func (o *PatchCurrentIdentityAuthenticatorParams) WithTimeout(timeout time.Duration) *PatchCurrentIdentityAuthenticatorParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -164,7 +179,6 @@ func (o *PatchCurrentIdentityAuthenticatorParams) WriteToRequest(r runtime.Clien
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Authenticator != nil {
|
||||
if err := r.SetBodyParam(o.Authenticator); err != nil {
|
||||
return err
|
||||
+4
-9
@@ -71,7 +71,6 @@ func (o *PatchCurrentIdentityAuthenticatorReader) ReadResponse(response runtime.
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -82,7 +81,7 @@ func NewPatchCurrentIdentityAuthenticatorOK() *PatchCurrentIdentityAuthenticator
|
||||
return &PatchCurrentIdentityAuthenticatorOK{}
|
||||
}
|
||||
|
||||
/*PatchCurrentIdentityAuthenticatorOK handles this case with default header values.
|
||||
/* PatchCurrentIdentityAuthenticatorOK describes a response with status code 200, with default header values.
|
||||
|
||||
The patch request was successful and the resource has been altered
|
||||
*/
|
||||
@@ -93,7 +92,6 @@ type PatchCurrentIdentityAuthenticatorOK struct {
|
||||
func (o *PatchCurrentIdentityAuthenticatorOK) Error() string {
|
||||
return fmt.Sprintf("[PATCH /current-identity/authenticators/{id}][%d] patchCurrentIdentityAuthenticatorOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchCurrentIdentityAuthenticatorOK) GetPayload() *rest_model.Empty {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -115,7 +113,7 @@ func NewPatchCurrentIdentityAuthenticatorBadRequest() *PatchCurrentIdentityAuthe
|
||||
return &PatchCurrentIdentityAuthenticatorBadRequest{}
|
||||
}
|
||||
|
||||
/*PatchCurrentIdentityAuthenticatorBadRequest handles this case with default header values.
|
||||
/* PatchCurrentIdentityAuthenticatorBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information
|
||||
*/
|
||||
@@ -126,7 +124,6 @@ type PatchCurrentIdentityAuthenticatorBadRequest struct {
|
||||
func (o *PatchCurrentIdentityAuthenticatorBadRequest) Error() string {
|
||||
return fmt.Sprintf("[PATCH /current-identity/authenticators/{id}][%d] patchCurrentIdentityAuthenticatorBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchCurrentIdentityAuthenticatorBadRequest) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -148,7 +145,7 @@ func NewPatchCurrentIdentityAuthenticatorUnauthorized() *PatchCurrentIdentityAut
|
||||
return &PatchCurrentIdentityAuthenticatorUnauthorized{}
|
||||
}
|
||||
|
||||
/*PatchCurrentIdentityAuthenticatorUnauthorized handles this case with default header values.
|
||||
/* PatchCurrentIdentityAuthenticatorUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -159,7 +156,6 @@ type PatchCurrentIdentityAuthenticatorUnauthorized struct {
|
||||
func (o *PatchCurrentIdentityAuthenticatorUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[PATCH /current-identity/authenticators/{id}][%d] patchCurrentIdentityAuthenticatorUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchCurrentIdentityAuthenticatorUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -181,7 +177,7 @@ func NewPatchCurrentIdentityAuthenticatorNotFound() *PatchCurrentIdentityAuthent
|
||||
return &PatchCurrentIdentityAuthenticatorNotFound{}
|
||||
}
|
||||
|
||||
/*PatchCurrentIdentityAuthenticatorNotFound handles this case with default header values.
|
||||
/* PatchCurrentIdentityAuthenticatorNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
The requested resource does not exist
|
||||
*/
|
||||
@@ -192,7 +188,6 @@ type PatchCurrentIdentityAuthenticatorNotFound struct {
|
||||
func (o *PatchCurrentIdentityAuthenticatorNotFound) Error() string {
|
||||
return fmt.Sprintf("[PATCH /current-identity/authenticators/{id}][%d] patchCurrentIdentityAuthenticatorNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchCurrentIdentityAuthenticatorNotFound) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+33
-19
@@ -42,58 +42,58 @@ import (
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
// NewUpdateCurrentIdentityAuthenticatorParams creates a new UpdateCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized.
|
||||
// NewUpdateCurrentIdentityAuthenticatorParams creates a new UpdateCurrentIdentityAuthenticatorParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewUpdateCurrentIdentityAuthenticatorParams() *UpdateCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &UpdateCurrentIdentityAuthenticatorParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateCurrentIdentityAuthenticatorParamsWithTimeout creates a new UpdateCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUpdateCurrentIdentityAuthenticatorParamsWithTimeout(timeout time.Duration) *UpdateCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &UpdateCurrentIdentityAuthenticatorParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateCurrentIdentityAuthenticatorParamsWithContext creates a new UpdateCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewUpdateCurrentIdentityAuthenticatorParamsWithContext(ctx context.Context) *UpdateCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &UpdateCurrentIdentityAuthenticatorParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateCurrentIdentityAuthenticatorParamsWithHTTPClient creates a new UpdateCurrentIdentityAuthenticatorParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUpdateCurrentIdentityAuthenticatorParamsWithHTTPClient(client *http.Client) *UpdateCurrentIdentityAuthenticatorParams {
|
||||
var ()
|
||||
return &UpdateCurrentIdentityAuthenticatorParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*UpdateCurrentIdentityAuthenticatorParams contains all the parameters to send to the API endpoint
|
||||
for the update current identity authenticator operation typically these are written to a http.Request
|
||||
/* UpdateCurrentIdentityAuthenticatorParams contains all the parameters to send to the API endpoint
|
||||
for the update current identity authenticator operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UpdateCurrentIdentityAuthenticatorParams struct {
|
||||
|
||||
/*Authenticator
|
||||
An authenticator put object
|
||||
/* Authenticator.
|
||||
|
||||
An authenticator put object
|
||||
*/
|
||||
Authenticator *rest_model.AuthenticatorUpdateWithCurrent
|
||||
/*ID
|
||||
The id of the requested resource
|
||||
|
||||
/* ID.
|
||||
|
||||
The id of the requested resource
|
||||
*/
|
||||
ID string
|
||||
|
||||
@@ -102,6 +102,21 @@ type UpdateCurrentIdentityAuthenticatorParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the update current identity authenticator params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateCurrentIdentityAuthenticatorParams) WithDefaults() *UpdateCurrentIdentityAuthenticatorParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the update current identity authenticator params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateCurrentIdentityAuthenticatorParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the update current identity authenticator params
|
||||
func (o *UpdateCurrentIdentityAuthenticatorParams) WithTimeout(timeout time.Duration) *UpdateCurrentIdentityAuthenticatorParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -164,7 +179,6 @@ func (o *UpdateCurrentIdentityAuthenticatorParams) WriteToRequest(r runtime.Clie
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Authenticator != nil {
|
||||
if err := r.SetBodyParam(o.Authenticator); err != nil {
|
||||
return err
|
||||
+4
-9
@@ -71,7 +71,6 @@ func (o *UpdateCurrentIdentityAuthenticatorReader) ReadResponse(response runtime
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -82,7 +81,7 @@ func NewUpdateCurrentIdentityAuthenticatorOK() *UpdateCurrentIdentityAuthenticat
|
||||
return &UpdateCurrentIdentityAuthenticatorOK{}
|
||||
}
|
||||
|
||||
/*UpdateCurrentIdentityAuthenticatorOK handles this case with default header values.
|
||||
/* UpdateCurrentIdentityAuthenticatorOK describes a response with status code 200, with default header values.
|
||||
|
||||
The update request was successful and the resource has been altered
|
||||
*/
|
||||
@@ -93,7 +92,6 @@ type UpdateCurrentIdentityAuthenticatorOK struct {
|
||||
func (o *UpdateCurrentIdentityAuthenticatorOK) Error() string {
|
||||
return fmt.Sprintf("[PUT /current-identity/authenticators/{id}][%d] updateCurrentIdentityAuthenticatorOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateCurrentIdentityAuthenticatorOK) GetPayload() *rest_model.Empty {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -115,7 +113,7 @@ func NewUpdateCurrentIdentityAuthenticatorBadRequest() *UpdateCurrentIdentityAut
|
||||
return &UpdateCurrentIdentityAuthenticatorBadRequest{}
|
||||
}
|
||||
|
||||
/*UpdateCurrentIdentityAuthenticatorBadRequest handles this case with default header values.
|
||||
/* UpdateCurrentIdentityAuthenticatorBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information
|
||||
*/
|
||||
@@ -126,7 +124,6 @@ type UpdateCurrentIdentityAuthenticatorBadRequest struct {
|
||||
func (o *UpdateCurrentIdentityAuthenticatorBadRequest) Error() string {
|
||||
return fmt.Sprintf("[PUT /current-identity/authenticators/{id}][%d] updateCurrentIdentityAuthenticatorBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateCurrentIdentityAuthenticatorBadRequest) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -148,7 +145,7 @@ func NewUpdateCurrentIdentityAuthenticatorUnauthorized() *UpdateCurrentIdentityA
|
||||
return &UpdateCurrentIdentityAuthenticatorUnauthorized{}
|
||||
}
|
||||
|
||||
/*UpdateCurrentIdentityAuthenticatorUnauthorized handles this case with default header values.
|
||||
/* UpdateCurrentIdentityAuthenticatorUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -159,7 +156,6 @@ type UpdateCurrentIdentityAuthenticatorUnauthorized struct {
|
||||
func (o *UpdateCurrentIdentityAuthenticatorUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[PUT /current-identity/authenticators/{id}][%d] updateCurrentIdentityAuthenticatorUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateCurrentIdentityAuthenticatorUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -181,7 +177,7 @@ func NewUpdateCurrentIdentityAuthenticatorNotFound() *UpdateCurrentIdentityAuthe
|
||||
return &UpdateCurrentIdentityAuthenticatorNotFound{}
|
||||
}
|
||||
|
||||
/*UpdateCurrentIdentityAuthenticatorNotFound handles this case with default header values.
|
||||
/* UpdateCurrentIdentityAuthenticatorNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
The requested resource does not exist
|
||||
*/
|
||||
@@ -192,7 +188,6 @@ type UpdateCurrentIdentityAuthenticatorNotFound struct {
|
||||
func (o *UpdateCurrentIdentityAuthenticatorNotFound) Error() string {
|
||||
return fmt.Sprintf("[PUT /current-identity/authenticators/{id}][%d] updateCurrentIdentityAuthenticatorNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateCurrentIdentityAuthenticatorNotFound) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+30
-17
@@ -42,53 +42,52 @@ import (
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
// NewCreateMfaRecoveryCodesParams creates a new CreateMfaRecoveryCodesParams object
|
||||
// with the default values initialized.
|
||||
// NewCreateMfaRecoveryCodesParams creates a new CreateMfaRecoveryCodesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewCreateMfaRecoveryCodesParams() *CreateMfaRecoveryCodesParams {
|
||||
var ()
|
||||
return &CreateMfaRecoveryCodesParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateMfaRecoveryCodesParamsWithTimeout creates a new CreateMfaRecoveryCodesParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewCreateMfaRecoveryCodesParamsWithTimeout(timeout time.Duration) *CreateMfaRecoveryCodesParams {
|
||||
var ()
|
||||
return &CreateMfaRecoveryCodesParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateMfaRecoveryCodesParamsWithContext creates a new CreateMfaRecoveryCodesParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewCreateMfaRecoveryCodesParamsWithContext(ctx context.Context) *CreateMfaRecoveryCodesParams {
|
||||
var ()
|
||||
return &CreateMfaRecoveryCodesParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateMfaRecoveryCodesParamsWithHTTPClient creates a new CreateMfaRecoveryCodesParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewCreateMfaRecoveryCodesParamsWithHTTPClient(client *http.Client) *CreateMfaRecoveryCodesParams {
|
||||
var ()
|
||||
return &CreateMfaRecoveryCodesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*CreateMfaRecoveryCodesParams contains all the parameters to send to the API endpoint
|
||||
for the create mfa recovery codes operation typically these are written to a http.Request
|
||||
/* CreateMfaRecoveryCodesParams contains all the parameters to send to the API endpoint
|
||||
for the create mfa recovery codes operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type CreateMfaRecoveryCodesParams struct {
|
||||
|
||||
/*MfaValidation
|
||||
An MFA validation request
|
||||
/* MfaValidation.
|
||||
|
||||
An MFA validation request
|
||||
*/
|
||||
MfaValidation *rest_model.MfaCode
|
||||
|
||||
@@ -97,6 +96,21 @@ type CreateMfaRecoveryCodesParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the create mfa recovery codes params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateMfaRecoveryCodesParams) WithDefaults() *CreateMfaRecoveryCodesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the create mfa recovery codes params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateMfaRecoveryCodesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the create mfa recovery codes params
|
||||
func (o *CreateMfaRecoveryCodesParams) WithTimeout(timeout time.Duration) *CreateMfaRecoveryCodesParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -148,7 +162,6 @@ func (o *CreateMfaRecoveryCodesParams) WriteToRequest(r runtime.ClientRequest, r
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.MfaValidation != nil {
|
||||
if err := r.SetBodyParam(o.MfaValidation); err != nil {
|
||||
return err
|
||||
+3
-7
@@ -65,7 +65,6 @@ func (o *CreateMfaRecoveryCodesReader) ReadResponse(response runtime.ClientRespo
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -76,7 +75,7 @@ func NewCreateMfaRecoveryCodesOK() *CreateMfaRecoveryCodesOK {
|
||||
return &CreateMfaRecoveryCodesOK{}
|
||||
}
|
||||
|
||||
/*CreateMfaRecoveryCodesOK handles this case with default header values.
|
||||
/* CreateMfaRecoveryCodesOK describes a response with status code 200, with default header values.
|
||||
|
||||
The recovery codes of an MFA enrollment
|
||||
*/
|
||||
@@ -87,7 +86,6 @@ type CreateMfaRecoveryCodesOK struct {
|
||||
func (o *CreateMfaRecoveryCodesOK) Error() string {
|
||||
return fmt.Sprintf("[POST /current-identity/mfa/recovery-codes][%d] createMfaRecoveryCodesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateMfaRecoveryCodesOK) GetPayload() *rest_model.DetailMfaRecoveryCodesEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -109,7 +107,7 @@ func NewCreateMfaRecoveryCodesUnauthorized() *CreateMfaRecoveryCodesUnauthorized
|
||||
return &CreateMfaRecoveryCodesUnauthorized{}
|
||||
}
|
||||
|
||||
/*CreateMfaRecoveryCodesUnauthorized handles this case with default header values.
|
||||
/* CreateMfaRecoveryCodesUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -120,7 +118,6 @@ type CreateMfaRecoveryCodesUnauthorized struct {
|
||||
func (o *CreateMfaRecoveryCodesUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[POST /current-identity/mfa/recovery-codes][%d] createMfaRecoveryCodesUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateMfaRecoveryCodesUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -142,7 +139,7 @@ func NewCreateMfaRecoveryCodesNotFound() *CreateMfaRecoveryCodesNotFound {
|
||||
return &CreateMfaRecoveryCodesNotFound{}
|
||||
}
|
||||
|
||||
/*CreateMfaRecoveryCodesNotFound handles this case with default header values.
|
||||
/* CreateMfaRecoveryCodesNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
The requested resource does not exist
|
||||
*/
|
||||
@@ -153,7 +150,6 @@ type CreateMfaRecoveryCodesNotFound struct {
|
||||
func (o *CreateMfaRecoveryCodesNotFound) Error() string {
|
||||
return fmt.Sprintf("[POST /current-identity/mfa/recovery-codes][%d] createMfaRecoveryCodesNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateMfaRecoveryCodesNotFound) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+84
-45
@@ -49,25 +49,28 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
CreateMfaRecoveryCodes(params *CreateMfaRecoveryCodesParams, authInfo runtime.ClientAuthInfoWriter) (*CreateMfaRecoveryCodesOK, error)
|
||||
CreateMfaRecoveryCodes(params *CreateMfaRecoveryCodesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateMfaRecoveryCodesOK, error)
|
||||
|
||||
DeleteMfa(params *DeleteMfaParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteMfaOK, error)
|
||||
DeleteMfa(params *DeleteMfaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteMfaOK, error)
|
||||
|
||||
DetailMfa(params *DetailMfaParams, authInfo runtime.ClientAuthInfoWriter) (*DetailMfaOK, error)
|
||||
DetailMfa(params *DetailMfaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailMfaOK, error)
|
||||
|
||||
DetailMfaQrCode(params *DetailMfaQrCodeParams, authInfo runtime.ClientAuthInfoWriter) (*DetailMfaQrCodeOK, error)
|
||||
DetailMfaQrCode(params *DetailMfaQrCodeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailMfaQrCodeOK, error)
|
||||
|
||||
DetailMfaRecoveryCodes(params *DetailMfaRecoveryCodesParams, authInfo runtime.ClientAuthInfoWriter) (*DetailMfaRecoveryCodesOK, error)
|
||||
DetailMfaRecoveryCodes(params *DetailMfaRecoveryCodesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailMfaRecoveryCodesOK, error)
|
||||
|
||||
EnrollMfa(params *EnrollMfaParams, authInfo runtime.ClientAuthInfoWriter) (*EnrollMfaCreated, error)
|
||||
EnrollMfa(params *EnrollMfaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EnrollMfaCreated, error)
|
||||
|
||||
GetCurrentIdentity(params *GetCurrentIdentityParams, authInfo runtime.ClientAuthInfoWriter) (*GetCurrentIdentityOK, error)
|
||||
GetCurrentIdentity(params *GetCurrentIdentityParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCurrentIdentityOK, error)
|
||||
|
||||
GetCurrentIdentityEdgeRouters(params *GetCurrentIdentityEdgeRoutersParams, authInfo runtime.ClientAuthInfoWriter) (*GetCurrentIdentityEdgeRoutersOK, error)
|
||||
GetCurrentIdentityEdgeRouters(params *GetCurrentIdentityEdgeRoutersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCurrentIdentityEdgeRoutersOK, error)
|
||||
|
||||
VerifyMfa(params *VerifyMfaParams, authInfo runtime.ClientAuthInfoWriter) (*VerifyMfaOK, error)
|
||||
VerifyMfa(params *VerifyMfaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*VerifyMfaOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
@@ -78,13 +81,12 @@ type ClientService interface {
|
||||
Allows regeneration of recovery codes of an MFA enrollment. Requires a current valid time based one time password to interact with. Available after a completed MFA enrollment. This replaces all existing recovery codes.
|
||||
|
||||
*/
|
||||
func (a *Client) CreateMfaRecoveryCodes(params *CreateMfaRecoveryCodesParams, authInfo runtime.ClientAuthInfoWriter) (*CreateMfaRecoveryCodesOK, error) {
|
||||
func (a *Client) CreateMfaRecoveryCodes(params *CreateMfaRecoveryCodesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateMfaRecoveryCodesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewCreateMfaRecoveryCodesParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "createMfaRecoveryCodes",
|
||||
Method: "POST",
|
||||
PathPattern: "/current-identity/mfa/recovery-codes",
|
||||
@@ -96,7 +98,12 @@ func (a *Client) CreateMfaRecoveryCodes(params *CreateMfaRecoveryCodesParams, au
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -116,13 +123,12 @@ func (a *Client) CreateMfaRecoveryCodes(params *CreateMfaRecoveryCodesParams, au
|
||||
Disable MFA for the current identity. Requires a current valid time based one time password if MFA enrollment has been completed. If not, code should be an empty string. If one time passwords are not available and admin account can be used to remove MFA from the identity via `DELETE /identities/<id>/mfa`.
|
||||
|
||||
*/
|
||||
func (a *Client) DeleteMfa(params *DeleteMfaParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteMfaOK, error) {
|
||||
func (a *Client) DeleteMfa(params *DeleteMfaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteMfaOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteMfaParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "deleteMfa",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/current-identity/mfa",
|
||||
@@ -134,7 +140,12 @@ func (a *Client) DeleteMfa(params *DeleteMfaParams, authInfo runtime.ClientAuthI
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -154,13 +165,12 @@ func (a *Client) DeleteMfa(params *DeleteMfaParams, authInfo runtime.ClientAuthI
|
||||
Returns details about the current MFA enrollment. If enrollment has not been completed it will return the current MFA configuration details necessary to complete a `POST /current-identity/mfa/verify`.
|
||||
|
||||
*/
|
||||
func (a *Client) DetailMfa(params *DetailMfaParams, authInfo runtime.ClientAuthInfoWriter) (*DetailMfaOK, error) {
|
||||
func (a *Client) DetailMfa(params *DetailMfaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailMfaOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDetailMfaParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "detailMfa",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-identity/mfa",
|
||||
@@ -172,7 +182,12 @@ func (a *Client) DetailMfa(params *DetailMfaParams, authInfo runtime.ClientAuthI
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -192,13 +207,12 @@ func (a *Client) DetailMfa(params *DetailMfaParams, authInfo runtime.ClientAuthI
|
||||
Shows an QR code image for unverified MFA enrollments. 404s if the MFA enrollment has been completed or not started.
|
||||
|
||||
*/
|
||||
func (a *Client) DetailMfaQrCode(params *DetailMfaQrCodeParams, authInfo runtime.ClientAuthInfoWriter) (*DetailMfaQrCodeOK, error) {
|
||||
func (a *Client) DetailMfaQrCode(params *DetailMfaQrCodeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailMfaQrCodeOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDetailMfaQrCodeParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "detailMfaQrCode",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-identity/mfa/qr-code",
|
||||
@@ -210,7 +224,12 @@ func (a *Client) DetailMfaQrCode(params *DetailMfaQrCodeParams, authInfo runtime
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -230,13 +249,12 @@ func (a *Client) DetailMfaQrCode(params *DetailMfaQrCodeParams, authInfo runtime
|
||||
Allows the viewing of recovery codes of an MFA enrollment. Requires a current valid time based one time password to interact with. Available after a completed MFA enrollment.
|
||||
|
||||
*/
|
||||
func (a *Client) DetailMfaRecoveryCodes(params *DetailMfaRecoveryCodesParams, authInfo runtime.ClientAuthInfoWriter) (*DetailMfaRecoveryCodesOK, error) {
|
||||
func (a *Client) DetailMfaRecoveryCodes(params *DetailMfaRecoveryCodesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailMfaRecoveryCodesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDetailMfaRecoveryCodesParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "detailMfaRecoveryCodes",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-identity/mfa/recovery-codes",
|
||||
@@ -248,7 +266,12 @@ func (a *Client) DetailMfaRecoveryCodes(params *DetailMfaRecoveryCodesParams, au
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -268,13 +291,12 @@ func (a *Client) DetailMfaRecoveryCodes(params *DetailMfaRecoveryCodesParams, au
|
||||
Allows authenticator based MFA enrollment. If enrollment has already been completed, it must be disabled before attempting to re-enroll. Subsequent enrollment request is completed via `POST /current-identity/mfa/verify`
|
||||
|
||||
*/
|
||||
func (a *Client) EnrollMfa(params *EnrollMfaParams, authInfo runtime.ClientAuthInfoWriter) (*EnrollMfaCreated, error) {
|
||||
func (a *Client) EnrollMfa(params *EnrollMfaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EnrollMfaCreated, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewEnrollMfaParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "enrollMfa",
|
||||
Method: "POST",
|
||||
PathPattern: "/current-identity/mfa",
|
||||
@@ -286,7 +308,12 @@ func (a *Client) EnrollMfa(params *EnrollMfaParams, authInfo runtime.ClientAuthI
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -305,13 +332,12 @@ func (a *Client) EnrollMfa(params *EnrollMfaParams, authInfo runtime.ClientAuthI
|
||||
|
||||
Returns the identity associated with the API sessions used to issue the current request
|
||||
*/
|
||||
func (a *Client) GetCurrentIdentity(params *GetCurrentIdentityParams, authInfo runtime.ClientAuthInfoWriter) (*GetCurrentIdentityOK, error) {
|
||||
func (a *Client) GetCurrentIdentity(params *GetCurrentIdentityParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCurrentIdentityOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetCurrentIdentityParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "getCurrentIdentity",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-identity",
|
||||
@@ -323,7 +349,12 @@ func (a *Client) GetCurrentIdentity(params *GetCurrentIdentityParams, authInfo r
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -344,13 +375,12 @@ func (a *Client) GetCurrentIdentity(params *GetCurrentIdentityParams, authInfo r
|
||||
includes their address and online status
|
||||
|
||||
*/
|
||||
func (a *Client) GetCurrentIdentityEdgeRouters(params *GetCurrentIdentityEdgeRoutersParams, authInfo runtime.ClientAuthInfoWriter) (*GetCurrentIdentityEdgeRoutersOK, error) {
|
||||
func (a *Client) GetCurrentIdentityEdgeRouters(params *GetCurrentIdentityEdgeRoutersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCurrentIdentityEdgeRoutersOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetCurrentIdentityEdgeRoutersParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "getCurrentIdentityEdgeRouters",
|
||||
Method: "GET",
|
||||
PathPattern: "/current-identity/edge-routers",
|
||||
@@ -362,7 +392,12 @@ func (a *Client) GetCurrentIdentityEdgeRouters(params *GetCurrentIdentityEdgeRou
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -382,13 +417,12 @@ func (a *Client) GetCurrentIdentityEdgeRouters(params *GetCurrentIdentityEdgeRou
|
||||
Completes MFA enrollment by accepting a time based one time password as verification. Called after MFA enrollment has been initiated via `POST /current-identity/mfa`.
|
||||
|
||||
*/
|
||||
func (a *Client) VerifyMfa(params *VerifyMfaParams, authInfo runtime.ClientAuthInfoWriter) (*VerifyMfaOK, error) {
|
||||
func (a *Client) VerifyMfa(params *VerifyMfaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*VerifyMfaOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewVerifyMfaParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "verifyMfa",
|
||||
Method: "POST",
|
||||
PathPattern: "/current-identity/mfa/verify",
|
||||
@@ -400,7 +434,12 @@ func (a *Client) VerifyMfa(params *VerifyMfaParams, authInfo runtime.ClientAuthI
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
+32
-19
@@ -42,55 +42,55 @@ import (
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
// NewDeleteMfaParams creates a new DeleteMfaParams object
|
||||
// with the default values initialized.
|
||||
// NewDeleteMfaParams creates a new DeleteMfaParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeleteMfaParams() *DeleteMfaParams {
|
||||
var ()
|
||||
return &DeleteMfaParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteMfaParamsWithTimeout creates a new DeleteMfaParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteMfaParamsWithTimeout(timeout time.Duration) *DeleteMfaParams {
|
||||
var ()
|
||||
return &DeleteMfaParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteMfaParamsWithContext creates a new DeleteMfaParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteMfaParamsWithContext(ctx context.Context) *DeleteMfaParams {
|
||||
var ()
|
||||
return &DeleteMfaParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteMfaParamsWithHTTPClient creates a new DeleteMfaParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteMfaParamsWithHTTPClient(client *http.Client) *DeleteMfaParams {
|
||||
var ()
|
||||
return &DeleteMfaParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*DeleteMfaParams contains all the parameters to send to the API endpoint
|
||||
for the delete mfa operation typically these are written to a http.Request
|
||||
/* DeleteMfaParams contains all the parameters to send to the API endpoint
|
||||
for the delete mfa operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteMfaParams struct {
|
||||
|
||||
/*MfaValidationCode*/
|
||||
// MfaValidationCode.
|
||||
MfaValidationCode *string
|
||||
/*MfaValidation
|
||||
An MFA validation request
|
||||
|
||||
/* MfaValidation.
|
||||
|
||||
An MFA validation request
|
||||
*/
|
||||
MfaValidation *rest_model.MfaCode
|
||||
|
||||
@@ -99,6 +99,21 @@ type DeleteMfaParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete mfa params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteMfaParams) WithDefaults() *DeleteMfaParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete mfa params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteMfaParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete mfa params
|
||||
func (o *DeleteMfaParams) WithTimeout(timeout time.Duration) *DeleteMfaParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -168,9 +183,7 @@ func (o *DeleteMfaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg
|
||||
if err := r.SetHeaderParam("mfa-validation-code", *o.MfaValidationCode); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.MfaValidation != nil {
|
||||
if err := r.SetBodyParam(o.MfaValidation); err != nil {
|
||||
return err
|
||||
+3
-7
@@ -65,7 +65,6 @@ func (o *DeleteMfaReader) ReadResponse(response runtime.ClientResponse, consumer
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -76,7 +75,7 @@ func NewDeleteMfaOK() *DeleteMfaOK {
|
||||
return &DeleteMfaOK{}
|
||||
}
|
||||
|
||||
/*DeleteMfaOK handles this case with default header values.
|
||||
/* DeleteMfaOK describes a response with status code 200, with default header values.
|
||||
|
||||
Base empty response
|
||||
*/
|
||||
@@ -87,7 +86,6 @@ type DeleteMfaOK struct {
|
||||
func (o *DeleteMfaOK) Error() string {
|
||||
return fmt.Sprintf("[DELETE /current-identity/mfa][%d] deleteMfaOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteMfaOK) GetPayload() *rest_model.Empty {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -109,7 +107,7 @@ func NewDeleteMfaUnauthorized() *DeleteMfaUnauthorized {
|
||||
return &DeleteMfaUnauthorized{}
|
||||
}
|
||||
|
||||
/*DeleteMfaUnauthorized handles this case with default header values.
|
||||
/* DeleteMfaUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -120,7 +118,6 @@ type DeleteMfaUnauthorized struct {
|
||||
func (o *DeleteMfaUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[DELETE /current-identity/mfa][%d] deleteMfaUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteMfaUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -142,7 +139,7 @@ func NewDeleteMfaNotFound() *DeleteMfaNotFound {
|
||||
return &DeleteMfaNotFound{}
|
||||
}
|
||||
|
||||
/*DeleteMfaNotFound handles this case with default header values.
|
||||
/* DeleteMfaNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
The requested resource does not exist
|
||||
*/
|
||||
@@ -153,7 +150,6 @@ type DeleteMfaNotFound struct {
|
||||
func (o *DeleteMfaNotFound) Error() string {
|
||||
return fmt.Sprintf("[DELETE /current-identity/mfa][%d] deleteMfaNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteMfaNotFound) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+28
-14
@@ -40,47 +40,46 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDetailMfaParams creates a new DetailMfaParams object
|
||||
// with the default values initialized.
|
||||
// NewDetailMfaParams creates a new DetailMfaParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDetailMfaParams() *DetailMfaParams {
|
||||
|
||||
return &DetailMfaParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailMfaParamsWithTimeout creates a new DetailMfaParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDetailMfaParamsWithTimeout(timeout time.Duration) *DetailMfaParams {
|
||||
|
||||
return &DetailMfaParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailMfaParamsWithContext creates a new DetailMfaParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewDetailMfaParamsWithContext(ctx context.Context) *DetailMfaParams {
|
||||
|
||||
return &DetailMfaParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailMfaParamsWithHTTPClient creates a new DetailMfaParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDetailMfaParamsWithHTTPClient(client *http.Client) *DetailMfaParams {
|
||||
|
||||
return &DetailMfaParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*DetailMfaParams contains all the parameters to send to the API endpoint
|
||||
for the detail mfa operation typically these are written to a http.Request
|
||||
/* DetailMfaParams contains all the parameters to send to the API endpoint
|
||||
for the detail mfa operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DetailMfaParams struct {
|
||||
timeout time.Duration
|
||||
@@ -88,6 +87,21 @@ type DetailMfaParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the detail mfa params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DetailMfaParams) WithDefaults() *DetailMfaParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the detail mfa params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DetailMfaParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the detail mfa params
|
||||
func (o *DetailMfaParams) WithTimeout(timeout time.Duration) *DetailMfaParams {
|
||||
o.SetTimeout(timeout)
|
||||
+28
-14
@@ -40,47 +40,46 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDetailMfaQrCodeParams creates a new DetailMfaQrCodeParams object
|
||||
// with the default values initialized.
|
||||
// NewDetailMfaQrCodeParams creates a new DetailMfaQrCodeParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDetailMfaQrCodeParams() *DetailMfaQrCodeParams {
|
||||
|
||||
return &DetailMfaQrCodeParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailMfaQrCodeParamsWithTimeout creates a new DetailMfaQrCodeParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDetailMfaQrCodeParamsWithTimeout(timeout time.Duration) *DetailMfaQrCodeParams {
|
||||
|
||||
return &DetailMfaQrCodeParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailMfaQrCodeParamsWithContext creates a new DetailMfaQrCodeParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewDetailMfaQrCodeParamsWithContext(ctx context.Context) *DetailMfaQrCodeParams {
|
||||
|
||||
return &DetailMfaQrCodeParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailMfaQrCodeParamsWithHTTPClient creates a new DetailMfaQrCodeParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDetailMfaQrCodeParamsWithHTTPClient(client *http.Client) *DetailMfaQrCodeParams {
|
||||
|
||||
return &DetailMfaQrCodeParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*DetailMfaQrCodeParams contains all the parameters to send to the API endpoint
|
||||
for the detail mfa qr code operation typically these are written to a http.Request
|
||||
/* DetailMfaQrCodeParams contains all the parameters to send to the API endpoint
|
||||
for the detail mfa qr code operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DetailMfaQrCodeParams struct {
|
||||
timeout time.Duration
|
||||
@@ -88,6 +87,21 @@ type DetailMfaQrCodeParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the detail mfa qr code params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DetailMfaQrCodeParams) WithDefaults() *DetailMfaQrCodeParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the detail mfa qr code params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DetailMfaQrCodeParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the detail mfa qr code params
|
||||
func (o *DetailMfaQrCodeParams) WithTimeout(timeout time.Duration) *DetailMfaQrCodeParams {
|
||||
o.SetTimeout(timeout)
|
||||
+2
-3
@@ -56,7 +56,6 @@ func (o *DetailMfaQrCodeReader) ReadResponse(response runtime.ClientResponse, co
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -67,7 +66,7 @@ func NewDetailMfaQrCodeOK() *DetailMfaQrCodeOK {
|
||||
return &DetailMfaQrCodeOK{}
|
||||
}
|
||||
|
||||
/*DetailMfaQrCodeOK handles this case with default header values.
|
||||
/* DetailMfaQrCodeOK describes a response with status code 200, with default header values.
|
||||
|
||||
OK
|
||||
*/
|
||||
@@ -88,7 +87,7 @@ func NewDetailMfaQrCodeNotFound() *DetailMfaQrCodeNotFound {
|
||||
return &DetailMfaQrCodeNotFound{}
|
||||
}
|
||||
|
||||
/*DetailMfaQrCodeNotFound handles this case with default header values.
|
||||
/* DetailMfaQrCodeNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
No MFA enrollment or MFA enrollment is completed
|
||||
*/
|
||||
+32
-19
@@ -42,55 +42,55 @@ import (
|
||||
"github.com/openziti/edge/rest_model"
|
||||
)
|
||||
|
||||
// NewDetailMfaRecoveryCodesParams creates a new DetailMfaRecoveryCodesParams object
|
||||
// with the default values initialized.
|
||||
// NewDetailMfaRecoveryCodesParams creates a new DetailMfaRecoveryCodesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDetailMfaRecoveryCodesParams() *DetailMfaRecoveryCodesParams {
|
||||
var ()
|
||||
return &DetailMfaRecoveryCodesParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailMfaRecoveryCodesParamsWithTimeout creates a new DetailMfaRecoveryCodesParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDetailMfaRecoveryCodesParamsWithTimeout(timeout time.Duration) *DetailMfaRecoveryCodesParams {
|
||||
var ()
|
||||
return &DetailMfaRecoveryCodesParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailMfaRecoveryCodesParamsWithContext creates a new DetailMfaRecoveryCodesParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewDetailMfaRecoveryCodesParamsWithContext(ctx context.Context) *DetailMfaRecoveryCodesParams {
|
||||
var ()
|
||||
return &DetailMfaRecoveryCodesParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetailMfaRecoveryCodesParamsWithHTTPClient creates a new DetailMfaRecoveryCodesParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDetailMfaRecoveryCodesParamsWithHTTPClient(client *http.Client) *DetailMfaRecoveryCodesParams {
|
||||
var ()
|
||||
return &DetailMfaRecoveryCodesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*DetailMfaRecoveryCodesParams contains all the parameters to send to the API endpoint
|
||||
for the detail mfa recovery codes operation typically these are written to a http.Request
|
||||
/* DetailMfaRecoveryCodesParams contains all the parameters to send to the API endpoint
|
||||
for the detail mfa recovery codes operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DetailMfaRecoveryCodesParams struct {
|
||||
|
||||
/*MfaValidationCode*/
|
||||
// MfaValidationCode.
|
||||
MfaValidationCode *string
|
||||
/*MfaValidation
|
||||
An MFA validation request
|
||||
|
||||
/* MfaValidation.
|
||||
|
||||
An MFA validation request
|
||||
*/
|
||||
MfaValidation *rest_model.MfaCode
|
||||
|
||||
@@ -99,6 +99,21 @@ type DetailMfaRecoveryCodesParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the detail mfa recovery codes params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DetailMfaRecoveryCodesParams) WithDefaults() *DetailMfaRecoveryCodesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the detail mfa recovery codes params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DetailMfaRecoveryCodesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the detail mfa recovery codes params
|
||||
func (o *DetailMfaRecoveryCodesParams) WithTimeout(timeout time.Duration) *DetailMfaRecoveryCodesParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -168,9 +183,7 @@ func (o *DetailMfaRecoveryCodesParams) WriteToRequest(r runtime.ClientRequest, r
|
||||
if err := r.SetHeaderParam("mfa-validation-code", *o.MfaValidationCode); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.MfaValidation != nil {
|
||||
if err := r.SetBodyParam(o.MfaValidation); err != nil {
|
||||
return err
|
||||
+3
-7
@@ -65,7 +65,6 @@ func (o *DetailMfaRecoveryCodesReader) ReadResponse(response runtime.ClientRespo
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -76,7 +75,7 @@ func NewDetailMfaRecoveryCodesOK() *DetailMfaRecoveryCodesOK {
|
||||
return &DetailMfaRecoveryCodesOK{}
|
||||
}
|
||||
|
||||
/*DetailMfaRecoveryCodesOK handles this case with default header values.
|
||||
/* DetailMfaRecoveryCodesOK describes a response with status code 200, with default header values.
|
||||
|
||||
Base empty response
|
||||
*/
|
||||
@@ -87,7 +86,6 @@ type DetailMfaRecoveryCodesOK struct {
|
||||
func (o *DetailMfaRecoveryCodesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/mfa/recovery-codes][%d] detailMfaRecoveryCodesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailMfaRecoveryCodesOK) GetPayload() *rest_model.Empty {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -109,7 +107,7 @@ func NewDetailMfaRecoveryCodesUnauthorized() *DetailMfaRecoveryCodesUnauthorized
|
||||
return &DetailMfaRecoveryCodesUnauthorized{}
|
||||
}
|
||||
|
||||
/*DetailMfaRecoveryCodesUnauthorized handles this case with default header values.
|
||||
/* DetailMfaRecoveryCodesUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -120,7 +118,6 @@ type DetailMfaRecoveryCodesUnauthorized struct {
|
||||
func (o *DetailMfaRecoveryCodesUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/mfa/recovery-codes][%d] detailMfaRecoveryCodesUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailMfaRecoveryCodesUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -142,7 +139,7 @@ func NewDetailMfaRecoveryCodesNotFound() *DetailMfaRecoveryCodesNotFound {
|
||||
return &DetailMfaRecoveryCodesNotFound{}
|
||||
}
|
||||
|
||||
/*DetailMfaRecoveryCodesNotFound handles this case with default header values.
|
||||
/* DetailMfaRecoveryCodesNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
The requested resource does not exist
|
||||
*/
|
||||
@@ -153,7 +150,6 @@ type DetailMfaRecoveryCodesNotFound struct {
|
||||
func (o *DetailMfaRecoveryCodesNotFound) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/mfa/recovery-codes][%d] detailMfaRecoveryCodesNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailMfaRecoveryCodesNotFound) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+3
-7
@@ -65,7 +65,6 @@ func (o *DetailMfaReader) ReadResponse(response runtime.ClientResponse, consumer
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -76,7 +75,7 @@ func NewDetailMfaOK() *DetailMfaOK {
|
||||
return &DetailMfaOK{}
|
||||
}
|
||||
|
||||
/*DetailMfaOK handles this case with default header values.
|
||||
/* DetailMfaOK describes a response with status code 200, with default header values.
|
||||
|
||||
The details of an MFA enrollment
|
||||
*/
|
||||
@@ -87,7 +86,6 @@ type DetailMfaOK struct {
|
||||
func (o *DetailMfaOK) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/mfa][%d] detailMfaOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailMfaOK) GetPayload() *rest_model.DetailMfaEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -109,7 +107,7 @@ func NewDetailMfaUnauthorized() *DetailMfaUnauthorized {
|
||||
return &DetailMfaUnauthorized{}
|
||||
}
|
||||
|
||||
/*DetailMfaUnauthorized handles this case with default header values.
|
||||
/* DetailMfaUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
The currently supplied session does not have the correct access rights to request this resource
|
||||
*/
|
||||
@@ -120,7 +118,6 @@ type DetailMfaUnauthorized struct {
|
||||
func (o *DetailMfaUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/mfa][%d] detailMfaUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailMfaUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -142,7 +139,7 @@ func NewDetailMfaNotFound() *DetailMfaNotFound {
|
||||
return &DetailMfaNotFound{}
|
||||
}
|
||||
|
||||
/*DetailMfaNotFound handles this case with default header values.
|
||||
/* DetailMfaNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
The requested resource does not exist
|
||||
*/
|
||||
@@ -153,7 +150,6 @@ type DetailMfaNotFound struct {
|
||||
func (o *DetailMfaNotFound) Error() string {
|
||||
return fmt.Sprintf("[GET /current-identity/mfa][%d] detailMfaNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DetailMfaNotFound) GetPayload() *rest_model.APIErrorEnvelope {
|
||||
return o.Payload
|
||||
}
|
||||
+28
-14
@@ -40,47 +40,46 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewEnrollMfaParams creates a new EnrollMfaParams object
|
||||
// with the default values initialized.
|
||||
// NewEnrollMfaParams creates a new EnrollMfaParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewEnrollMfaParams() *EnrollMfaParams {
|
||||
|
||||
return &EnrollMfaParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewEnrollMfaParamsWithTimeout creates a new EnrollMfaParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewEnrollMfaParamsWithTimeout(timeout time.Duration) *EnrollMfaParams {
|
||||
|
||||
return &EnrollMfaParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewEnrollMfaParamsWithContext creates a new EnrollMfaParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewEnrollMfaParamsWithContext(ctx context.Context) *EnrollMfaParams {
|
||||
|
||||
return &EnrollMfaParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewEnrollMfaParamsWithHTTPClient creates a new EnrollMfaParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewEnrollMfaParamsWithHTTPClient(client *http.Client) *EnrollMfaParams {
|
||||
|
||||
return &EnrollMfaParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*EnrollMfaParams contains all the parameters to send to the API endpoint
|
||||
for the enroll mfa operation typically these are written to a http.Request
|
||||
/* EnrollMfaParams contains all the parameters to send to the API endpoint
|
||||
for the enroll mfa operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type EnrollMfaParams struct {
|
||||
timeout time.Duration
|
||||
@@ -88,6 +87,21 @@ type EnrollMfaParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the enroll mfa params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *EnrollMfaParams) WithDefaults() *EnrollMfaParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the enroll mfa params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *EnrollMfaParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the enroll mfa params
|
||||
func (o *EnrollMfaParams) WithTimeout(timeout time.Duration) *EnrollMfaParams {
|
||||
o.SetTimeout(timeout)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user