Merge pull request #452 from openziti/session.certs

adds support of API Session Certificates
This commit is contained in:
Andrew
2021-01-07 13:29:03 -05:00
committed by GitHub
60 changed files with 6331 additions and 181 deletions
+9 -5
View File
@@ -126,6 +126,10 @@ func (ae *AppEnv) GetMetricsRegistry() metrics.Registry {
return ae.HostController.GetNetwork().GetMetricsRegistry()
}
func (ae *AppEnv) GetFingerprintGenerator() cert.FingerprintGenerator {
return ae.FingerprintGenerator
}
type HostController interface {
RegisterXctrl(x xctrl.Xctrl) error
RegisterXmgmt(x xmgmt.Xmgmt) error
@@ -280,11 +284,11 @@ func NewAppEnv(c *edgeConfig.Config) *AppEnv {
Api: "1.0.0",
EnrollmentApi: "1.0.0",
},
AuthCookieName: constants.ZitiSession,
AuthHeaderName: constants.ZitiSession,
AuthRegistry: &model.AuthProcessorRegistryImpl{},
EnrollRegistry: &model.EnrollmentRegistryImpl{},
Api: api,
AuthCookieName: constants.ZitiSession,
AuthHeaderName: constants.ZitiSession,
AuthRegistry: &model.AuthProcessorRegistryImpl{},
EnrollRegistry: &model.EnrollmentRegistryImpl{},
Api: api,
}
api.APIAuthorizer = authorizer{}
+90 -17
View File
@@ -29,6 +29,7 @@ import (
"github.com/openziti/foundation/channel2"
"github.com/openziti/foundation/storage/boltz"
"github.com/openziti/foundation/util/concurrenz"
"go.etcd.io/bbolt"
"sync"
"time"
)
@@ -193,6 +194,14 @@ func NewBroker(ae *AppEnv) *Broker {
b.apiSessionDeleteEventHandler,
},
},
b.ae.GetStores().ApiSessionCertificate: {
boltz.EventCreate: []events.Listener{
b.apiSessionCertificateEventHandler,
},
boltz.EventDelete: []events.Listener{
b.apiSessionCertificateEventHandler,
},
},
}
b.registerEventHandlers()
@@ -280,7 +289,7 @@ func (b *Broker) sendApiSessionCreates(apiSession *persistence.ApiSession) {
apiSessionMsg.IsFullState = false
fingerprints, err := b.getApiSessionFingerprints(apiSession.IdentityId)
fingerprints, err := b.getFingerprints(apiSession.IdentityId, apiSession.Id)
if err != nil {
pfxlog.Logger().WithError(err).Errorf("could not get session fingerprints")
return
@@ -293,6 +302,7 @@ func (b *Broker) sendApiSessionCreates(apiSession *persistence.ApiSession) {
apiSessionMsg.ApiSessions = append(apiSessionMsg.ApiSessions, &edge_ctrl_pb.ApiSession{
Token: apiSession.Token,
CertFingerprints: fingerprints,
Id: apiSession.Id,
})
byteMsg, err := proto.Marshal(apiSessionMsg)
@@ -326,7 +336,7 @@ func (b *Broker) apiSessionUpdateEventHandler(args ...interface{}) {
func (b *Broker) sendApiSessionUpdates(apiSession *persistence.ApiSession) {
apiSessionMsg := &edge_ctrl_pb.ApiSessionUpdated{}
fingerprints, err := b.getApiSessionFingerprints(apiSession.IdentityId)
fingerprints, err := b.getFingerprints(apiSession.IdentityId, apiSession.Id)
if err != nil {
pfxlog.Logger().WithError(err).Errorf("could not get api session fingerprints")
return
@@ -340,6 +350,7 @@ func (b *Broker) sendApiSessionUpdates(apiSession *persistence.ApiSession) {
apiSessionMsg.ApiSessions = append(apiSessionMsg.ApiSessions, &edge_ctrl_pb.ApiSession{
Token: apiSession.Token,
CertFingerprints: fingerprints,
Id: apiSession.Id,
})
byteMsg, err := proto.Marshal(apiSessionMsg)
@@ -459,7 +470,7 @@ func (b *Broker) sendSessionCreates(session *persistence.Session) {
return
}
fps, err := b.getActiveFingerprints(session.Id)
fps, err := b.getFingerprintsByApiSessionId(session.ApiSessionId)
if err != nil {
pfxlog.Logger().Errorf("could not obtain a fingerprint for the api session [%s] and session [%s]", session.ApiSessionId, session.Id)
@@ -484,6 +495,7 @@ func (b *Broker) sendSessionCreates(session *persistence.Session) {
Service: svc,
CertFingerprints: fps,
Type: sessionType,
ApiSessionId: session.ApiSessionId,
})
if buf, err := proto.Marshal(sessionAdded); err == nil {
@@ -530,7 +542,7 @@ func (b *Broker) streamApiSessions(chunkSize int, callback func(addedMsg *edge_c
return nil
}
apiSessionProto, err := b.modelApiSessionToProto(apiSession.Token, apiSession.IdentityId)
apiSessionProto, err := b.modelApiSessionToProto(apiSession.Token, apiSession.IdentityId, apiSession.Id)
if err != nil {
logger.Errorf("error converting api session to proto: %v", err)
@@ -584,24 +596,37 @@ func (b *Broker) streamSessions(edgeRouterId string, chunkSize int, callback fun
})
}
func (b *Broker) getActiveFingerprints(sessionId string) ([]string, error) {
certs, err := b.ae.Handlers.Session.ReadSessionCerts(sessionId)
func (b *Broker) getFingerprints(identityId, apiSessionId string) ([]string, error) {
identityPrints, err := b.getIdentityAuthenticatorFingerprints(identityId)
if err != nil {
return nil, err
}
var ret []string
now := time.Now()
for _, c := range certs {
if (now.Equal(c.ValidFrom) || now.After(c.ValidFrom)) && now.Before(c.ValidTo) {
ret = append(ret, c.Fingerprint)
}
apiSessionPrints, err := b.getApiSessionCertificateFingerprints(apiSessionId)
if err != nil {
return nil, err
}
return ret, nil
for _, apiSessionPrint := range apiSessionPrints {
identityPrints = append(identityPrints, apiSessionPrint)
}
return identityPrints, nil
}
func (b *Broker) getApiSessionFingerprints(identityId string) ([]string, error) {
func (b *Broker) getFingerprintsByApiSessionId(apiSessionId string) ([]string, error) {
apiSession, err := b.ae.GetHandlers().ApiSession.Read(apiSessionId)
if err != nil {
return nil, fmt.Errorf("could not query fingerprints by api session id [%s]: %s", apiSessionId, err)
}
return b.getFingerprints(apiSession.IdentityId, apiSessionId)
}
func (b *Broker) getIdentityAuthenticatorFingerprints(identityId string) ([]string, error) {
fingerprintsMap := map[string]struct{}{}
err := b.ae.Handlers.Identity.CollectAuthenticators(identityId, func(authenticator *model.Authenticator) error {
@@ -623,8 +648,28 @@ func (b *Broker) getApiSessionFingerprints(identityId string) ([]string, error)
return fingerprints, nil
}
func (b *Broker) modelApiSessionToProto(token, identityId string) (*edge_ctrl_pb.ApiSession, error) {
fingerprints, err := b.getApiSessionFingerprints(identityId)
func (b *Broker) getApiSessionCertificateFingerprints(apiSessionId string) ([]string, error) {
apiSessionCerts, err := b.ae.GetHandlers().ApiSessionCertificate.ReadByApiSessionId(apiSessionId)
if err != nil {
return nil, err
}
var validPrints []string
now := time.Now()
for _, apiSessionCert := range apiSessionCerts {
if apiSessionCert.ValidAfter != nil && now.After(*apiSessionCert.ValidAfter) &&
apiSessionCert.ValidBefore != nil && now.Before(*apiSessionCert.ValidBefore) {
validPrints = append(validPrints, apiSessionCert.Fingerprint)
}
}
return validPrints, nil
}
func (b *Broker) modelApiSessionToProto(token, identityId, apiSessionId string) (*edge_ctrl_pb.ApiSession, error) {
fingerprints, err := b.getFingerprints(identityId, apiSessionId)
if err != nil {
return nil, err
}
@@ -632,6 +677,7 @@ func (b *Broker) modelApiSessionToProto(token, identityId string) (*edge_ctrl_pb
return &edge_ctrl_pb.ApiSession{
Token: token,
CertFingerprints: fingerprints,
Id: apiSessionId,
}, nil
}
@@ -641,7 +687,7 @@ func (b *Broker) modelSessionToProto(ns *model.Session) (*edge_ctrl_pb.Session,
return nil, fmt.Errorf("could not convert to session proto, could not find service: %s", err)
}
fps, err := b.getActiveFingerprints(ns.Id)
fps, err := b.getFingerprintsByApiSessionId(ns.ApiSessionId)
if err != nil {
return nil, fmt.Errorf("could not get fingerprints for network session: %s", err)
@@ -664,6 +710,7 @@ func (b *Broker) modelSessionToProto(ns *model.Session) (*edge_ctrl_pb.Session,
Service: svc,
CertFingerprints: fps,
Type: sessionType,
ApiSessionId: ns.ApiSessionId,
}, nil
}
@@ -751,3 +798,29 @@ func (b *Broker) RouterDisconnected(r *network.Router) {
}
}()
}
func (b *Broker) apiSessionCertificateEventHandler(args ...interface{}) {
var apiSessionCert *persistence.ApiSessionCertificate
if len(args) == 1 {
apiSessionCert, _ = args[0].(*persistence.ApiSessionCertificate)
}
if apiSessionCert == nil {
log := pfxlog.Logger()
log.Error("could not cast event args to event details: create/delete api session cert")
return
}
var apiSession *persistence.ApiSession
var err error
err = b.ae.GetDbProvider().GetDb().View(func(tx *bbolt.Tx) error {
apiSession, err = b.ae.GetStores().ApiSession.LoadOneById(tx, apiSessionCert.ApiSessionId)
return err
})
if err != nil {
pfxlog.Logger().WithError(err).Error("could not process API Session certificate creation. Failed to query for parent API Session")
return
}
b.sendApiSessionUpdates(apiSession)
}
@@ -17,8 +17,12 @@
package routes
import (
"fmt"
"github.com/go-openapi/strfmt"
"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"
"github.com/openziti/foundation/util/stringz"
@@ -26,6 +30,9 @@ import (
)
const EntityNameCurrentSession = "current-api-session"
const EntityNameCurrentSessionCertificates = "certificates"
var CurrentApiSessionCertificateLinkFactory *BasicLinkFactory = NewBasicLinkFactory(EntityNameCurrentSession + "/" + EntityNameCurrentSessionCertificates)
var CurrentApiSessionLinkFactory LinksFactory = NewCurrentApiSessionLinkFactory()
@@ -65,3 +72,41 @@ func MapToCurrentApiSessionRestModel(s *model.ApiSession, sessionTimeout time.Du
return apiSession
}
func MapApiSessionCertificateToRestEntity(appEnv *env.AppEnv, context *response.RequestContext, e models.Entity) (interface{}, error) {
i, ok := e.(*model.ApiSessionCertificate)
if !ok {
err := fmt.Errorf("entity is not an API Session Certificate \"%s\"", e.GetId())
log := pfxlog.Logger()
log.Error(err)
return nil, err
}
al, err := MapApiSessionCertificateToRestModel(i)
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 al, nil
}
func MapApiSessionCertificateToRestModel(apiSessionCert *model.ApiSessionCertificate) (*rest_model.CurrentAPISessionCertificateDetail, error) {
validFrom := strfmt.DateTime(*apiSessionCert.ValidAfter)
validTo := strfmt.DateTime(*apiSessionCert.ValidBefore)
ret := &rest_model.CurrentAPISessionCertificateDetail{
BaseEntity: BaseEntityToRestModel(apiSessionCert, CurrentApiSessionCertificateLinkFactory),
Fingerprint: &apiSessionCert.Fingerprint,
Subject: &apiSessionCert.Subject,
ValidFrom: &validFrom,
ValidTo: &validTo,
Certificate: &apiSessionCert.PEM,
}
return ret, nil
}
@@ -24,6 +24,7 @@ import (
"github.com/openziti/edge/rest_model"
"github.com/openziti/edge/rest_server/operations/current_api_session"
"net/http"
"time"
)
func init() {
@@ -46,6 +47,24 @@ func (router *CurrentSessionRouter) Register(ae *env.AppEnv) {
ae.Api.CurrentAPISessionDeleteCurrentAPISessionHandler = current_api_session.DeleteCurrentAPISessionHandlerFunc(func(params current_api_session.DeleteCurrentAPISessionParams, i interface{}) middleware.Responder {
return ae.IsAllowed(router.Delete, params.HTTPRequest, "", "", permissions.IsAuthenticated())
})
ae.Api.CurrentAPISessionListCurrentAPISessionCertificatesHandler = current_api_session.ListCurrentAPISessionCertificatesHandlerFunc(func(params current_api_session.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 {
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 {
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 {
return ae.IsAllowed(router.DeleteCertificate, params.HTTPRequest, params.ID, "", permissions.IsAuthenticated())
})
}
func (router *CurrentSessionRouter) Detail(ae *env.AppEnv, rc *response.RequestContext) {
@@ -63,3 +82,101 @@ func (router *CurrentSessionRouter) Delete(ae *env.AppEnv, rc *response.RequestC
rc.RespondWithEmptyOk()
}
func (router *CurrentSessionRouter) ListCertificates(ae *env.AppEnv, rc *response.RequestContext) {
ListWithEnvelopeFactory(rc, defaultToListEnvelope, func(rc *response.RequestContext, queryOptions *QueryOptions) (*QueryResult, error) {
query, err := queryOptions.getFullQuery(ae.GetStores().ApiSessionCertificate)
if err != nil {
return nil, err
}
result, err := ae.GetHandlers().ApiSessionCertificate.BasePreparedList(query)
if err != nil {
return nil, err
}
apiEntities, err := modelToApi(ae, rc, MapApiSessionCertificateToRestEntity, result.GetEntities())
if err != nil {
return nil, err
}
return NewQueryResult(apiEntities, result.GetMetaData()), nil
})
}
func (router *CurrentSessionRouter) CreateCertificate(ae *env.AppEnv, rc *response.RequestContext, params current_api_session.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.Body.Csr))
})
}
func (router *CurrentSessionRouter) DetailCertificate(ae *env.AppEnv, rc *response.RequestContext) {
certId, _ := rc.GetEntityId()
cert, err := ae.GetHandlers().ApiSessionCertificate.Read(certId)
if err != nil {
rc.RespondWithError(err)
return
}
if cert.ApiSessionId != rc.ApiSession.Id {
rc.RespondWithNotFound()
return
}
entity, err := MapApiSessionCertificateToRestEntity(ae, rc, cert)
if err != nil {
rc.RespondWithError(err)
return
}
rc.RespondWithOk(entity, nil)
}
func (router *CurrentSessionRouter) DeleteCertificate(ae *env.AppEnv, rc *response.RequestContext) {
certId, _ := rc.GetEntityId()
cert, err := ae.GetHandlers().ApiSessionCertificate.Read(certId)
if err != nil {
rc.RespondWithError(err)
return
}
if cert.ApiSessionId != rc.ApiSession.Id {
rc.RespondWithNotFound()
return
}
if err := ae.GetHandlers().ApiSessionCertificate.Delete(certId); err != nil {
rc.RespondWithError(err)
return
}
rc.RespondWithEmptyOk()
}
type ApiSessionCertificateCreateResponder struct {
response.Responder
ae *env.AppEnv
}
func (nsr *ApiSessionCertificateCreateResponder) RespondWithCreatedId(id string, link rest_model.Link) {
sessionCert, _ := nsr.ae.GetHandlers().ApiSessionCertificate.Read(id)
certString := string(sessionCert.PEM)
newSessionEnvelope := &rest_model.CreateCurrentAPISessionCertificateEnvelope{
Data: &rest_model.CurrentAPISessionCertificateCreateResponse{
CreateLocation: rest_model.CreateLocation{
Links: CurrentApiSessionCertificateLinkFactory.Links(sessionCert),
ID: sessionCert.Id,
},
Certificate: &certString,
Cas: string(nsr.ae.Config.CaPems()),
},
Meta: &rest_model.Meta{},
}
nsr.Respond(newSessionEnvelope, http.StatusCreated)
}
@@ -0,0 +1,157 @@
/*
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 model
import (
"crypto/x509"
"encoding/pem"
"fmt"
"github.com/openziti/edge/controller/apierror"
"github.com/openziti/edge/internal/cert"
"github.com/openziti/fabric/controller/models"
"go.etcd.io/bbolt"
"time"
)
func NewApiSessionCertificateHandler(env Env) *ApiSessionCertificateHandler {
handler := &ApiSessionCertificateHandler{
baseHandler: newBaseHandler(env, env.GetStores().ApiSessionCertificate),
}
handler.impl = handler
return handler
}
type ApiSessionCertificateHandler struct {
baseHandler
}
func (handler *ApiSessionCertificateHandler) newModelEntity() boltEntitySink {
return &ApiSessionCertificate{}
}
func (handler *ApiSessionCertificateHandler) Create(entity *ApiSessionCertificate) (string, error) {
return handler.createEntity(entity)
}
func (handler *ApiSessionCertificateHandler) CreateFromCSR(apiSessionId string, lifespan time.Duration, csr []byte) (string, error) {
notBefore := time.Now()
notAfter := time.Now().Add(lifespan)
certRaw, err := handler.env.GetApiClientCsrSigner().Sign(csr, &cert.SigningOpts{
NotAfter: &notAfter,
NotBefore: &notBefore,
})
if err != nil {
apiErr := apierror.NewCouldNotProcessCsr()
apiErr.Cause = err
apiErr.AppendCause = true
return "", apiErr
}
fp := handler.env.GetFingerprintGenerator().FromRaw(certRaw)
certPem := pem.EncodeToMemory(&pem.Block{
Type: "CERTIFICATE",
Bytes: certRaw,
})
cert, _ := x509.ParseCertificate(certRaw)
entity := &ApiSessionCertificate{
BaseEntity: models.BaseEntity{},
ApiSessionId: apiSessionId,
Subject: cert.Subject.String(),
Fingerprint: fp,
ValidAfter: &notBefore,
ValidBefore: &notAfter,
PEM: string(certPem),
}
return handler.Create(entity)
}
func (handler *ApiSessionCertificateHandler) Read(id string) (*ApiSessionCertificate, error) {
modelApiSessionCertificate := &ApiSessionCertificate{}
if err := handler.readEntity(id, modelApiSessionCertificate); err != nil {
return nil, err
}
return modelApiSessionCertificate, nil
}
func (handler *ApiSessionCertificateHandler) ReadByFingerprint(fingerprint string) (*ApiSessionCertificate, error) {
modelApiSessionCertificate := &ApiSessionCertificate{}
tokenIndex := handler.env.GetStores().ApiSessionCertificate.GetFingerprintIndex()
if err := handler.readEntityWithIndex("fingerprint", []byte(fingerprint), tokenIndex, modelApiSessionCertificate); err != nil {
return nil, err
}
return modelApiSessionCertificate, nil
}
func (handler *ApiSessionCertificateHandler) readInTx(tx *bbolt.Tx, id string) (*ApiSessionCertificate, error) {
modelApiSessionCertificate := &ApiSessionCertificate{}
if err := handler.readEntityInTx(tx, id, modelApiSessionCertificate); err != nil {
return nil, err
}
return modelApiSessionCertificate, nil
}
func (handler *ApiSessionCertificateHandler) IsUpdated(_ string) bool {
return false
}
func (handler *ApiSessionCertificateHandler) Delete(id string) error {
return handler.deleteEntity(id)
}
func (handler *ApiSessionCertificateHandler) Query(query string) (*ApiSessionCertificateListResult, error) {
result := &ApiSessionCertificateListResult{handler: handler}
err := handler.list(query, result.collect)
if err != nil {
return nil, err
}
return result, nil
}
func (handler *ApiSessionCertificateHandler) ReadByApiSessionId(apiSessionId string) ([]*ApiSessionCertificate, error) {
result, err := handler.Query(fmt.Sprintf(`apiSession = "%s"`, apiSessionId))
if err != nil {
return nil, err
}
return result.ApiSessionCertificates, nil
}
type ApiSessionCertificateListResult struct {
handler *ApiSessionCertificateHandler
ApiSessionCertificates []*ApiSessionCertificate
models.QueryMetaData
}
func (result *ApiSessionCertificateListResult) collect(tx *bbolt.Tx, ids []string, queryMetaData *models.QueryMetaData) error {
result.QueryMetaData = *queryMetaData
for _, key := range ids {
ApiSessionCertificate, err := result.handler.readInTx(tx, key)
if err != nil {
return err
}
result.ApiSessionCertificates = append(result.ApiSessionCertificates, ApiSessionCertificate)
}
return nil
}
@@ -0,0 +1,95 @@
/*
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 model
import (
"github.com/openziti/edge/controller/persistence"
"github.com/openziti/fabric/controller/models"
"github.com/openziti/foundation/storage/boltz"
"github.com/openziti/foundation/validation"
"github.com/pkg/errors"
"go.etcd.io/bbolt"
"reflect"
"time"
)
type ApiSessionCertificate struct {
models.BaseEntity
ApiSession *ApiSession
ApiSessionId string
Subject string
Fingerprint string
ValidAfter *time.Time
ValidBefore *time.Time
PEM string
}
func (entity *ApiSessionCertificate) toBoltEntity(tx *bbolt.Tx, handler Handler) (boltz.Entity, error) {
if !handler.GetEnv().GetStores().ApiSession.IsEntityPresent(tx, entity.ApiSessionId) {
return nil, validation.NewFieldError("api session not found", "ApiSessionId", entity.ApiSessionId)
}
boltEntity := &persistence.ApiSessionCertificate{
BaseExtEntity: *boltz.NewExtEntity(entity.Id, entity.Tags),
ApiSessionId: entity.ApiSessionId,
Subject: entity.Subject,
Fingerprint: entity.Fingerprint,
ValidAfter: entity.ValidAfter,
ValidBefore: entity.ValidBefore,
PEM: entity.PEM,
}
return boltEntity, nil
}
func (entity *ApiSessionCertificate) toBoltEntityForCreate(tx *bbolt.Tx, handler Handler) (boltz.Entity, error) {
return entity.toBoltEntity(tx, handler)
}
func (entity *ApiSessionCertificate) toBoltEntityForUpdate(tx *bbolt.Tx, handler Handler) (boltz.Entity, error) {
return entity.toBoltEntity(tx, handler)
}
func (entity *ApiSessionCertificate) toBoltEntityForPatch(tx *bbolt.Tx, handler Handler) (boltz.Entity, error) {
return entity.toBoltEntity(tx, handler)
}
func (entity *ApiSessionCertificate) fillFrom(handler Handler, tx *bbolt.Tx, boltEntity boltz.Entity) error {
boltApiSessionCertificate, ok := boltEntity.(*persistence.ApiSessionCertificate)
if !ok {
return errors.Errorf("unexpected type %v when filling model ApiSessionCertificate", reflect.TypeOf(boltEntity))
}
entity.FillCommon(boltApiSessionCertificate)
entity.Subject = boltApiSessionCertificate.Subject
entity.Fingerprint = boltApiSessionCertificate.Fingerprint
entity.ValidAfter = boltApiSessionCertificate.ValidAfter
entity.ValidBefore = boltApiSessionCertificate.ValidBefore
entity.PEM = boltApiSessionCertificate.PEM
entity.ApiSessionId = boltApiSessionCertificate.ApiSessionId
boltApiSession, err := handler.GetEnv().GetStores().ApiSession.LoadOneById(tx, boltApiSessionCertificate.ApiSessionId)
if err != nil {
return err
}
modelApiSession := &ApiSession{}
if err := modelApiSession.fillFrom(handler, tx, boltApiSession); err != nil {
return err
}
entity.ApiSession = modelApiSession
return nil
}
+1
View File
@@ -40,6 +40,7 @@ type Env interface {
GetHostController() HostController
IsEdgeRouterOnline(id string) bool
GetMetricsRegistry() metrics.Registry
GetFingerprintGenerator() cert.FingerprintGenerator
}
type HostController interface {
+2
View File
@@ -28,6 +28,7 @@ type Handlers struct {
// edge
ApiSession *ApiSessionHandler
ApiSessionCertificate *ApiSessionCertificateHandler
Ca *CaHandler
Config *ConfigHandler
ConfigType *ConfigTypeHandler
@@ -58,6 +59,7 @@ func InitHandlers(env Env) *Handlers {
handlers.Terminator = env.GetDbProvider().GetControllers().Terminators
handlers.ApiSession = NewApiSessionHandler(env)
handlers.ApiSessionCertificate = NewApiSessionCertificateHandler(env)
handlers.Authenticator = NewAuthenticatorHandler(env)
handlers.Ca = NewCaHandler(env)
handlers.Config = NewConfigHandler(env)
+4
View File
@@ -86,6 +86,10 @@ func (ctx *TestContext) GetMetricsRegistry() metrics.Registry {
return ctx.metricsRegistry
}
func (ctx *TestContext) GetFingerprintGenerator() cert.FingerprintGenerator {
return nil
}
func newTestContext(t *testing.T) *TestContext {
context := &TestContext{
TestContext: persistence.NewTestContext(t),
@@ -0,0 +1,142 @@
/*
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 persistence
import (
"github.com/openziti/edge/eid"
"github.com/openziti/foundation/storage/ast"
"github.com/openziti/foundation/storage/boltz"
"go.etcd.io/bbolt"
"time"
)
const (
FieldApiSessionCertificateApiSession = "apiSession"
FieldApiSessionCertificateSubject = "subject"
FieldApiSessionCertificateFingerprint = "fingerprint"
FieldApiSessionCertificateValidAfter = "validAfter"
FieldApiSessionCertificateValidBefore = "validBefore"
FieldApiSessionCertificatePem = "pem"
)
type ApiSessionCertificate struct {
boltz.BaseExtEntity
ApiSessionId string
Subject string
Fingerprint string
ValidAfter *time.Time
ValidBefore *time.Time
PEM string
}
func NewApiSessionCertificate(apiSessionId string) *ApiSessionCertificate {
return &ApiSessionCertificate{
BaseExtEntity: boltz.BaseExtEntity{Id: eid.New()},
ApiSessionId: apiSessionId,
Subject: eid.New(),
}
}
func (entity *ApiSessionCertificate) LoadValues(_ boltz.CrudStore, bucket *boltz.TypedBucket) {
entity.LoadBaseValues(bucket)
entity.ApiSessionId = bucket.GetStringOrError(FieldApiSessionCertificateApiSession)
entity.Subject = bucket.GetStringOrError(FieldApiSessionCertificateSubject)
entity.Fingerprint = bucket.GetStringOrError(FieldApiSessionCertificateFingerprint)
entity.ValidAfter = bucket.GetTime(FieldApiSessionCertificateValidAfter)
entity.ValidBefore = bucket.GetTime(FieldApiSessionCertificateValidBefore)
entity.PEM = bucket.GetStringOrError((FieldApiSessionCertificatePem))
}
func (entity *ApiSessionCertificate) SetValues(ctx *boltz.PersistContext) {
entity.SetBaseValues(ctx)
ctx.SetString(FieldApiSessionCertificateApiSession, entity.ApiSessionId)
ctx.SetString(FieldApiSessionCertificateSubject, entity.Subject)
ctx.SetString(FieldApiSessionCertificateFingerprint, entity.Fingerprint)
ctx.SetTimeP(FieldApiSessionCertificateValidAfter, entity.ValidAfter)
ctx.SetTimeP(FieldApiSessionCertificateValidBefore, entity.ValidBefore)
ctx.SetString(FieldApiSessionCertificatePem, entity.PEM)
}
func (entity *ApiSessionCertificate) GetEntityType() string {
return EntityTypeApiSessionCertificates
}
type ApiSessionCertificateStore interface {
Store
LoadOneById(tx *bbolt.Tx, id string) (*ApiSessionCertificate, error)
LoadOneByFingerprint(tx *bbolt.Tx, token string) (*ApiSessionCertificate, error)
LoadOneByQuery(tx *bbolt.Tx, query string) (*ApiSessionCertificate, error)
GetFingerprintIndex() boltz.ReadIndex
}
func newApiSessionCertificateStore(stores *stores) *ApiSessionCertificateStoreImpl {
store := &ApiSessionCertificateStoreImpl{
baseStore: newBaseStore(stores, EntityTypeApiSessionCertificates),
}
store.InitImpl(store)
return store
}
type ApiSessionCertificateStoreImpl struct {
*baseStore
indexToken boltz.ReadIndex
symbolApiSession boltz.EntitySymbol
}
func (store *ApiSessionCertificateStoreImpl) NewStoreEntity() boltz.Entity {
return &ApiSessionCertificate{}
}
func (store *ApiSessionCertificateStoreImpl) GetFingerprintIndex() boltz.ReadIndex {
return store.indexToken
}
func (store *ApiSessionCertificateStoreImpl) initializeLocal() {
store.AddExtEntitySymbols()
symbolToken := store.AddSymbol(FieldApiSessionCertificateFingerprint, ast.NodeTypeString)
store.indexToken = store.AddUniqueIndex(symbolToken)
store.symbolApiSession = store.AddFkSymbol(FieldApiSessionCertificateApiSession, store.stores.apiSession)
store.AddFkConstraint(store.symbolApiSession, false, boltz.CascadeDelete)
}
func (store *ApiSessionCertificateStoreImpl) initializeLinked() {
}
func (store *ApiSessionCertificateStoreImpl) LoadOneById(tx *bbolt.Tx, id string) (*ApiSessionCertificate, error) {
entity := &ApiSessionCertificate{}
if err := store.baseLoadOneById(tx, id, entity); err != nil {
return nil, err
}
return entity, nil
}
func (store *ApiSessionCertificateStoreImpl) LoadOneByFingerprint(tx *bbolt.Tx, fingerprint string) (*ApiSessionCertificate, error) {
id := store.indexToken.Read(tx, []byte(fingerprint))
if id != nil {
return store.LoadOneById(tx, string(id))
}
return nil, boltz.NewNotFoundError(store.GetSingularEntityType(), "fingerprint", fingerprint)
}
func (store *ApiSessionCertificateStoreImpl) LoadOneByQuery(tx *bbolt.Tx, query string) (*ApiSessionCertificate, error) {
entity := &ApiSessionCertificate{}
if found, err := store.BaseLoadOneByQuery(tx, query, entity); !found || err != nil {
return nil, err
}
return entity, nil
}
+1
View File
@@ -23,6 +23,7 @@ import (
const (
EntityTypeApiSessions = "apiSessions"
EntityTypeApiSessionCertificates = "apiSessionCertificates"
EntityTypeCas = "cas"
EntityTypeConfigs = "configs"
EntityTypeConfigTypes = "configTypes"
+4
View File
@@ -36,6 +36,7 @@ type Stores struct {
Terminator db.TerminatorStore
ApiSession ApiSessionStore
ApiSessionCertificate ApiSessionCertificateStore
Ca CaStore
Config ConfigStore
ConfigType ConfigTypeStore
@@ -141,6 +142,7 @@ type stores struct {
authenticator *authenticatorStoreImpl
postureCheck *postureCheckStoreImpl
postureCheckType *postureCheckTypeStoreImpl
apiSessionCertificate *ApiSessionCertificateStoreImpl
}
func NewBoltStores(dbProvider DbProvider) (*Stores, error) {
@@ -155,6 +157,7 @@ func NewBoltStores(dbProvider DbProvider) (*Stores, error) {
internalStores.Service = dbProvider.GetStores().Service
internalStores.apiSession = newApiSessionStore(internalStores)
internalStores.apiSessionCertificate = newApiSessionCertificateStore(internalStores)
internalStores.authenticator = newAuthenticatorStore(internalStores)
internalStores.ca = newCaStore(internalStores)
internalStores.config = newConfigsStore(internalStores)
@@ -182,6 +185,7 @@ func NewBoltStores(dbProvider DbProvider) (*Stores, error) {
Service: dbProvider.GetStores().Service,
ApiSession: internalStores.apiSession,
ApiSessionCertificate: internalStores.apiSessionCertificate,
Ca: internalStores.ca,
Config: internalStores.config,
ConfigType: internalStores.configType,
+11
View File
@@ -50,6 +50,9 @@ type SigningOpts struct {
EmailAddresses []string
IPAddresses []net.IP
URIs []*url.URL
NotBefore *time.Time
NotAfter *time.Time
}
func (so *SigningOpts) Apply(c *x509.Certificate) {
@@ -57,6 +60,14 @@ func (so *SigningOpts) Apply(c *x509.Certificate) {
c.EmailAddresses = so.EmailAddresses
c.IPAddresses = so.IPAddresses
c.URIs = so.URIs
if so.NotBefore != nil {
c.NotBefore = *so.NotBefore
}
if so.NotAfter != nil {
c.NotAfter = *so.NotAfter
}
}
type SerialGenerator interface {
+2 -2
View File
@@ -12,8 +12,8 @@ Two options, run the command manually or use `go generate`
## Go Generate
1. Navigate to the root project
2. run `go generate edge/pb/edge_ctrl_pb/...`
1. Navigate to the root project directory `edge`
2. run `go generate ./pb/edge_ctrl_pb/...` or `go generate .\pb\edge_ctrl_pb\...`
Note: Running a naked `go generate` will trigger all `go:generate` tags in the project, which you most likely do not want
+100 -83
View File
@@ -448,6 +448,7 @@ type Session struct {
Urls []string `protobuf:"bytes,4,rep,name=urls,proto3" json:"urls,omitempty"`
Service *Service `protobuf:"bytes,5,opt,name=service,proto3" json:"service,omitempty"`
Id string `protobuf:"bytes,7,opt,name=id,proto3" json:"id,omitempty"`
ApiSessionId string `protobuf:"bytes,8,opt,name=apiSessionId,proto3" json:"apiSessionId,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -520,9 +521,17 @@ func (m *Session) GetId() string {
return ""
}
func (m *Session) GetApiSessionId() string {
if m != nil {
return m.ApiSessionId
}
return ""
}
type ApiSession struct {
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
CertFingerprints []string `protobuf:"bytes,2,rep,name=certFingerprints,proto3" json:"certFingerprints,omitempty"`
Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -567,6 +576,13 @@ func (m *ApiSession) GetCertFingerprints() []string {
return nil
}
func (m *ApiSession) GetId() string {
if m != nil {
return m.Id
}
return ""
}
type ApiSessionAdded struct {
IsFullState bool `protobuf:"varint,1,opt,name=isFullState,proto3" json:"isFullState,omitempty"`
ApiSessions []*ApiSession `protobuf:"bytes,2,rep,name=apiSessions,proto3" json:"apiSessions,omitempty"`
@@ -1477,88 +1493,89 @@ func init() {
}
var fileDescriptor_23f46a161f139ee1 = []byte{
// 1324 bytes of a gzipped FileDescriptorProto
// 1342 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xdd, 0x6e, 0xdb, 0xc6,
0x12, 0x16, 0x29, 0xc9, 0xb2, 0x46, 0x8e, 0xcd, 0xec, 0x91, 0x73, 0x18, 0xe5, 0x1c, 0x1f, 0x1f,
0x06, 0x28, 0x04, 0x27, 0x56, 0x11, 0x05, 0x45, 0x82, 0x34, 0x48, 0xa1, 0xc8, 0x72, 0x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 0xdf, 0xd1, 0xb5, 0xa3, 0x05, 0xf5, 0xd3, 0x70, 0xf7,
0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xe4, 0x24, 0x57, 0x51, 0x0d, 0x00, 0x00,
}
+2
View File
@@ -54,11 +54,13 @@ message Session {
repeated string urls = 4;
Service service = 5;
string id = 7;
string apiSessionId = 8;
}
message ApiSession {
string token = 1;
repeated string certFingerprints = 2;
string id = 3;
}
message ApiSessionAdded {
@@ -0,0 +1,162 @@
// 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 current_api_session
// 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/openziti/edge/rest_model"
)
// NewCreateCurrentAPISessionCertificateParams creates a new CreateCurrentAPISessionCertificateParams object
// with the default values initialized.
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
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
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
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
*/
type CreateCurrentAPISessionCertificateParams struct {
/*Body
The payload describing the CSR used to create a session certificate
*/
Body *rest_model.CurrentAPISessionCertificateCreate
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the create current Api session certificate params
func (o *CreateCurrentAPISessionCertificateParams) WithTimeout(timeout time.Duration) *CreateCurrentAPISessionCertificateParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the create current Api session certificate params
func (o *CreateCurrentAPISessionCertificateParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the create current Api session certificate params
func (o *CreateCurrentAPISessionCertificateParams) WithContext(ctx context.Context) *CreateCurrentAPISessionCertificateParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the create current Api session certificate params
func (o *CreateCurrentAPISessionCertificateParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the create current Api session certificate params
func (o *CreateCurrentAPISessionCertificateParams) WithHTTPClient(client *http.Client) *CreateCurrentAPISessionCertificateParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the create current Api session certificate params
func (o *CreateCurrentAPISessionCertificateParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the create current Api session certificate params
func (o *CreateCurrentAPISessionCertificateParams) WithBody(body *rest_model.CurrentAPISessionCertificateCreate) *CreateCurrentAPISessionCertificateParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the create current Api session certificate params
func (o *CreateCurrentAPISessionCertificateParams) SetBody(body *rest_model.CurrentAPISessionCertificateCreate) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *CreateCurrentAPISessionCertificateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Body != nil {
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
@@ -0,0 +1,171 @@
// 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 current_api_session
// 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"
)
// CreateCurrentAPISessionCertificateReader is a Reader for the CreateCurrentAPISessionCertificate structure.
type CreateCurrentAPISessionCertificateReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateCurrentAPISessionCertificateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewCreateCurrentAPISessionCertificateOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewCreateCurrentAPISessionCertificateBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 401:
result := NewCreateCurrentAPISessionCertificateUnauthorized()
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())
}
}
// NewCreateCurrentAPISessionCertificateOK creates a CreateCurrentAPISessionCertificateOK with default headers values
func NewCreateCurrentAPISessionCertificateOK() *CreateCurrentAPISessionCertificateOK {
return &CreateCurrentAPISessionCertificateOK{}
}
/*CreateCurrentAPISessionCertificateOK handles this case with default header values.
A response of a create API Session certificate
*/
type CreateCurrentAPISessionCertificateOK struct {
Payload *rest_model.CreateCurrentAPISessionCertificateEnvelope
}
func (o *CreateCurrentAPISessionCertificateOK) Error() string {
return fmt.Sprintf("[POST /current-api-session/certificates][%d] createCurrentApiSessionCertificateOK %+v", 200, o.Payload)
}
func (o *CreateCurrentAPISessionCertificateOK) GetPayload() *rest_model.CreateCurrentAPISessionCertificateEnvelope {
return o.Payload
}
func (o *CreateCurrentAPISessionCertificateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(rest_model.CreateCurrentAPISessionCertificateEnvelope)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateCurrentAPISessionCertificateBadRequest creates a CreateCurrentAPISessionCertificateBadRequest with default headers values
func NewCreateCurrentAPISessionCertificateBadRequest() *CreateCurrentAPISessionCertificateBadRequest {
return &CreateCurrentAPISessionCertificateBadRequest{}
}
/*CreateCurrentAPISessionCertificateBadRequest handles this case 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
*/
type CreateCurrentAPISessionCertificateBadRequest struct {
Payload *rest_model.APIErrorEnvelope
}
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
}
func (o *CreateCurrentAPISessionCertificateBadRequest) 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
}
// NewCreateCurrentAPISessionCertificateUnauthorized creates a CreateCurrentAPISessionCertificateUnauthorized with default headers values
func NewCreateCurrentAPISessionCertificateUnauthorized() *CreateCurrentAPISessionCertificateUnauthorized {
return &CreateCurrentAPISessionCertificateUnauthorized{}
}
/*CreateCurrentAPISessionCertificateUnauthorized handles this case with default header values.
The currently supplied session does not have the correct access rights to request this resource
*/
type CreateCurrentAPISessionCertificateUnauthorized struct {
Payload *rest_model.APIErrorEnvelope
}
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
}
func (o *CreateCurrentAPISessionCertificateUnauthorized) 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
}
@@ -53,12 +53,20 @@ type Client struct {
type ClientService interface {
DeleteCurrentAPISession(params *DeleteCurrentAPISessionParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCurrentAPISessionOK, error)
CreateCurrentAPISessionCertificate(params *CreateCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCurrentAPISessionCertificateOK, error)
DeleteCurrentAPISessionCertificate(params *DeleteCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCurrentAPISessionCertificateOK, error)
DetailCurrentAPISessionCertificate(params *DetailCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*DetailCurrentAPISessionCertificateOK, error)
DetailCurrentIdentityAuthenticator(params *DetailCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter) (*DetailCurrentIdentityAuthenticatorOK, error)
GetCurrentAPISession(params *GetCurrentAPISessionParams, authInfo runtime.ClientAuthInfoWriter) (*GetCurrentAPISessionOK, error)
GetCurrentIdentity(params *GetCurrentIdentityParams, authInfo runtime.ClientAuthInfoWriter) (*GetCurrentIdentityOK, error)
ListCurrentAPISessionCertificates(params *ListCurrentAPISessionCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*ListCurrentAPISessionCertificatesOK, error)
ListCurrentIdentityAuthenticators(params *ListCurrentIdentityAuthenticatorsParams, authInfo runtime.ClientAuthInfoWriter) (*ListCurrentIdentityAuthenticatorsOK, error)
PatchCurrentIdentityAuthenticator(params *PatchCurrentIdentityAuthenticatorParams, authInfo runtime.ClientAuthInfoWriter) (*PatchCurrentIdentityAuthenticatorOK, error)
@@ -105,6 +113,118 @@ func (a *Client) DeleteCurrentAPISession(params *DeleteCurrentAPISessionParams,
panic(msg)
}
/*
CreateCurrentAPISessionCertificate creates an ephemeral certificate for the current API session
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) (*CreateCurrentAPISessionCertificateOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateCurrentAPISessionCertificateParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "createCurrentApiSessionCertificate",
Method: "POST",
PathPattern: "/current-api-session/certificates",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &CreateCurrentAPISessionCertificateReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*CreateCurrentAPISessionCertificateOK)
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 createCurrentApiSessionCertificate: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DeleteCurrentAPISessionCertificate deletes an ephemeral certificate
Delete an ephemeral certificateby id
*/
func (a *Client) DeleteCurrentAPISessionCertificate(params *DeleteCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCurrentAPISessionCertificateOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteCurrentAPISessionCertificateParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "deleteCurrentApiSessionCertificate",
Method: "DELETE",
PathPattern: "/current-api-session/certificates/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DeleteCurrentAPISessionCertificateReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*DeleteCurrentAPISessionCertificateOK)
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 deleteCurrentApiSessionCertificate: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DetailCurrentAPISessionCertificate retrieves an ephemeral certificate
Retrieves a single ephemeral certificate by id
*/
func (a *Client) DetailCurrentAPISessionCertificate(params *DetailCurrentAPISessionCertificateParams, authInfo runtime.ClientAuthInfoWriter) (*DetailCurrentAPISessionCertificateOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDetailCurrentAPISessionCertificateParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "detailCurrentApiSessionCertificate",
Method: "GET",
PathPattern: "/current-api-session/certificates/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DetailCurrentAPISessionCertificateReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*DetailCurrentAPISessionCertificateOK)
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 detailCurrentApiSessionCertificate: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DetailCurrentIdentityAuthenticator retrieves an authenticator for the current identity
@@ -216,6 +336,43 @@ func (a *Client) GetCurrentIdentity(params *GetCurrentIdentityParams, authInfo r
panic(msg)
}
/*
ListCurrentAPISessionCertificates lists the ephemeral certificates available for the current API session
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) {
// TODO: Validate the params before sending
if params == nil {
params = NewListCurrentAPISessionCertificatesParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listCurrentApiSessionCertificates",
Method: "GET",
PathPattern: "/current-api-session/certificates",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListCurrentAPISessionCertificatesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListCurrentAPISessionCertificatesOK)
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 listCurrentApiSessionCertificates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListCurrentIdentityAuthenticators lists authenticators for the current identity
@@ -0,0 +1,159 @@
// 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 current_api_session
// 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"
)
// NewDeleteCurrentAPISessionCertificateParams creates a new DeleteCurrentAPISessionCertificateParams object
// with the default values initialized.
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
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
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
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
*/
type DeleteCurrentAPISessionCertificateParams 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 delete current Api session certificate params
func (o *DeleteCurrentAPISessionCertificateParams) WithTimeout(timeout time.Duration) *DeleteCurrentAPISessionCertificateParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete current Api session certificate params
func (o *DeleteCurrentAPISessionCertificateParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete current Api session certificate params
func (o *DeleteCurrentAPISessionCertificateParams) WithContext(ctx context.Context) *DeleteCurrentAPISessionCertificateParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete current Api session certificate params
func (o *DeleteCurrentAPISessionCertificateParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete current Api session certificate params
func (o *DeleteCurrentAPISessionCertificateParams) WithHTTPClient(client *http.Client) *DeleteCurrentAPISessionCertificateParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete current Api session certificate params
func (o *DeleteCurrentAPISessionCertificateParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the delete current Api session certificate params
func (o *DeleteCurrentAPISessionCertificateParams) WithID(id string) *DeleteCurrentAPISessionCertificateParams {
o.SetID(id)
return o
}
// SetID adds the id to the delete current Api session certificate params
func (o *DeleteCurrentAPISessionCertificateParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteCurrentAPISessionCertificateParams) 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
}
@@ -0,0 +1,171 @@
// 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 current_api_session
// 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"
)
// DeleteCurrentAPISessionCertificateReader is a Reader for the DeleteCurrentAPISessionCertificate structure.
type DeleteCurrentAPISessionCertificateReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteCurrentAPISessionCertificateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteCurrentAPISessionCertificateOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewDeleteCurrentAPISessionCertificateBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 401:
result := NewDeleteCurrentAPISessionCertificateUnauthorized()
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())
}
}
// NewDeleteCurrentAPISessionCertificateOK creates a DeleteCurrentAPISessionCertificateOK with default headers values
func NewDeleteCurrentAPISessionCertificateOK() *DeleteCurrentAPISessionCertificateOK {
return &DeleteCurrentAPISessionCertificateOK{}
}
/*DeleteCurrentAPISessionCertificateOK handles this case with default header values.
The delete request was successful and the resource has been removed
*/
type DeleteCurrentAPISessionCertificateOK struct {
Payload *rest_model.Empty
}
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
}
func (o *DeleteCurrentAPISessionCertificateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(rest_model.Empty)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewDeleteCurrentAPISessionCertificateBadRequest creates a DeleteCurrentAPISessionCertificateBadRequest with default headers values
func NewDeleteCurrentAPISessionCertificateBadRequest() *DeleteCurrentAPISessionCertificateBadRequest {
return &DeleteCurrentAPISessionCertificateBadRequest{}
}
/*DeleteCurrentAPISessionCertificateBadRequest handles this case 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
*/
type DeleteCurrentAPISessionCertificateBadRequest struct {
Payload *rest_model.APIErrorEnvelope
}
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
}
func (o *DeleteCurrentAPISessionCertificateBadRequest) 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
}
// NewDeleteCurrentAPISessionCertificateUnauthorized creates a DeleteCurrentAPISessionCertificateUnauthorized with default headers values
func NewDeleteCurrentAPISessionCertificateUnauthorized() *DeleteCurrentAPISessionCertificateUnauthorized {
return &DeleteCurrentAPISessionCertificateUnauthorized{}
}
/*DeleteCurrentAPISessionCertificateUnauthorized handles this case with default header values.
The currently supplied session does not have the correct access rights to request this resource
*/
type DeleteCurrentAPISessionCertificateUnauthorized struct {
Payload *rest_model.APIErrorEnvelope
}
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
}
func (o *DeleteCurrentAPISessionCertificateUnauthorized) 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
}
@@ -0,0 +1,159 @@
// 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 current_api_session
// 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"
)
// NewDetailCurrentAPISessionCertificateParams creates a new DetailCurrentAPISessionCertificateParams object
// with the default values initialized.
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
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
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
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
*/
type DetailCurrentAPISessionCertificateParams 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 current Api session certificate params
func (o *DetailCurrentAPISessionCertificateParams) WithTimeout(timeout time.Duration) *DetailCurrentAPISessionCertificateParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the detail current Api session certificate params
func (o *DetailCurrentAPISessionCertificateParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the detail current Api session certificate params
func (o *DetailCurrentAPISessionCertificateParams) WithContext(ctx context.Context) *DetailCurrentAPISessionCertificateParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the detail current Api session certificate params
func (o *DetailCurrentAPISessionCertificateParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the detail current Api session certificate params
func (o *DetailCurrentAPISessionCertificateParams) WithHTTPClient(client *http.Client) *DetailCurrentAPISessionCertificateParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the detail current Api session certificate params
func (o *DetailCurrentAPISessionCertificateParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the detail current Api session certificate params
func (o *DetailCurrentAPISessionCertificateParams) WithID(id string) *DetailCurrentAPISessionCertificateParams {
o.SetID(id)
return o
}
// SetID adds the id to the detail current Api session certificate params
func (o *DetailCurrentAPISessionCertificateParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *DetailCurrentAPISessionCertificateParams) 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
}
@@ -0,0 +1,171 @@
// 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 current_api_session
// 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"
)
// DetailCurrentAPISessionCertificateReader is a Reader for the DetailCurrentAPISessionCertificate structure.
type DetailCurrentAPISessionCertificateReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DetailCurrentAPISessionCertificateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDetailCurrentAPISessionCertificateOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewDetailCurrentAPISessionCertificateUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewDetailCurrentAPISessionCertificateNotFound()
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())
}
}
// NewDetailCurrentAPISessionCertificateOK creates a DetailCurrentAPISessionCertificateOK with default headers values
func NewDetailCurrentAPISessionCertificateOK() *DetailCurrentAPISessionCertificateOK {
return &DetailCurrentAPISessionCertificateOK{}
}
/*DetailCurrentAPISessionCertificateOK handles this case with default header values.
A response containing a single API Session certificate
*/
type DetailCurrentAPISessionCertificateOK struct {
Payload *rest_model.DetailCurrentAPISessionCertificateEnvelope
}
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
}
func (o *DetailCurrentAPISessionCertificateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(rest_model.DetailCurrentAPISessionCertificateEnvelope)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewDetailCurrentAPISessionCertificateUnauthorized creates a DetailCurrentAPISessionCertificateUnauthorized with default headers values
func NewDetailCurrentAPISessionCertificateUnauthorized() *DetailCurrentAPISessionCertificateUnauthorized {
return &DetailCurrentAPISessionCertificateUnauthorized{}
}
/*DetailCurrentAPISessionCertificateUnauthorized handles this case with default header values.
The currently supplied session does not have the correct access rights to request this resource
*/
type DetailCurrentAPISessionCertificateUnauthorized struct {
Payload *rest_model.APIErrorEnvelope
}
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
}
func (o *DetailCurrentAPISessionCertificateUnauthorized) 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
}
// NewDetailCurrentAPISessionCertificateNotFound creates a DetailCurrentAPISessionCertificateNotFound with default headers values
func NewDetailCurrentAPISessionCertificateNotFound() *DetailCurrentAPISessionCertificateNotFound {
return &DetailCurrentAPISessionCertificateNotFound{}
}
/*DetailCurrentAPISessionCertificateNotFound handles this case with default header values.
The requested resource does not exist
*/
type DetailCurrentAPISessionCertificateNotFound struct {
Payload *rest_model.APIErrorEnvelope
}
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
}
func (o *DetailCurrentAPISessionCertificateNotFound) 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
}
@@ -0,0 +1,226 @@
// 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 current_api_session
// 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"
)
// NewListCurrentAPISessionCertificatesParams creates a new ListCurrentAPISessionCertificatesParams object
// with the default values initialized.
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
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
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
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
*/
type ListCurrentAPISessionCertificatesParams 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 current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) WithTimeout(timeout time.Duration) *ListCurrentAPISessionCertificatesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) WithContext(ctx context.Context) *ListCurrentAPISessionCertificatesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) WithHTTPClient(client *http.Client) *ListCurrentAPISessionCertificatesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithFilter adds the filter to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) WithFilter(filter *string) *ListCurrentAPISessionCertificatesParams {
o.SetFilter(filter)
return o
}
// SetFilter adds the filter to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) SetFilter(filter *string) {
o.Filter = filter
}
// WithLimit adds the limit to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) WithLimit(limit *int64) *ListCurrentAPISessionCertificatesParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) WithOffset(offset *int64) *ListCurrentAPISessionCertificatesParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the list current Api session certificates params
func (o *ListCurrentAPISessionCertificatesParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WriteToRequest writes these params to a swagger request
func (o *ListCurrentAPISessionCertificatesParams) 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
}
@@ -0,0 +1,93 @@
// 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 current_api_session
// 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"
)
// ListCurrentAPISessionCertificatesReader is a Reader for the ListCurrentAPISessionCertificates structure.
type ListCurrentAPISessionCertificatesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListCurrentAPISessionCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListCurrentAPISessionCertificatesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
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())
}
}
// NewListCurrentAPISessionCertificatesOK creates a ListCurrentAPISessionCertificatesOK with default headers values
func NewListCurrentAPISessionCertificatesOK() *ListCurrentAPISessionCertificatesOK {
return &ListCurrentAPISessionCertificatesOK{}
}
/*ListCurrentAPISessionCertificatesOK handles this case with default header values.
A list of the current API Session's certificate
*/
type ListCurrentAPISessionCertificatesOK struct {
Payload *rest_model.ListCurrentAPISessionCertificatesEnvelope
}
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
}
func (o *ListCurrentAPISessionCertificatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(rest_model.ListCurrentAPISessionCertificatesEnvelope)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
@@ -0,0 +1,123 @@
// 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 rest_model
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// CreateCurrentAPISessionCertificateEnvelope create current Api session certificate envelope
//
// swagger:model createCurrentApiSessionCertificateEnvelope
type CreateCurrentAPISessionCertificateEnvelope struct {
// data
// Required: true
Data *CurrentAPISessionCertificateCreateResponse `json:"data"`
// meta
// Required: true
Meta *Meta `json:"meta"`
}
// Validate validates this create current Api session certificate envelope
func (m *CreateCurrentAPISessionCertificateEnvelope) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateData(formats); err != nil {
res = append(res, err)
}
if err := m.validateMeta(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CreateCurrentAPISessionCertificateEnvelope) validateData(formats strfmt.Registry) error {
if err := validate.Required("data", "body", m.Data); err != nil {
return err
}
if m.Data != nil {
if err := m.Data.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data")
}
return err
}
}
return nil
}
func (m *CreateCurrentAPISessionCertificateEnvelope) validateMeta(formats strfmt.Registry) error {
if err := validate.Required("meta", "body", m.Meta); err != nil {
return err
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("meta")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *CreateCurrentAPISessionCertificateEnvelope) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CreateCurrentAPISessionCertificateEnvelope) UnmarshalBinary(b []byte) error {
var res CreateCurrentAPISessionCertificateEnvelope
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
@@ -0,0 +1,88 @@
// 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 rest_model
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// CurrentAPISessionCertificateCreate current Api session certificate create
//
// swagger:model currentApiSessionCertificateCreate
type CurrentAPISessionCertificateCreate struct {
// csr
// Required: true
Csr *string `json:"csr"`
}
// Validate validates this current Api session certificate create
func (m *CurrentAPISessionCertificateCreate) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCsr(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CurrentAPISessionCertificateCreate) validateCsr(formats strfmt.Registry) error {
if err := validate.Required("csr", "body", m.Csr); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *CurrentAPISessionCertificateCreate) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CurrentAPISessionCertificateCreate) UnmarshalBinary(b []byte) error {
var res CurrentAPISessionCertificateCreate
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
@@ -0,0 +1,150 @@
// 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 rest_model
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// CurrentAPISessionCertificateCreateResponse current Api session certificate create response
//
// swagger:model currentApiSessionCertificateCreateResponse
type CurrentAPISessionCertificateCreateResponse struct {
CreateLocation
// cas
Cas string `json:"cas,omitempty"`
// certificate
// Required: true
Certificate *string `json:"certificate"`
}
// UnmarshalJSON unmarshals this object from a JSON structure
func (m *CurrentAPISessionCertificateCreateResponse) UnmarshalJSON(raw []byte) error {
// AO0
var aO0 CreateLocation
if err := swag.ReadJSON(raw, &aO0); err != nil {
return err
}
m.CreateLocation = aO0
// AO1
var dataAO1 struct {
Cas string `json:"cas,omitempty"`
Certificate *string `json:"certificate"`
}
if err := swag.ReadJSON(raw, &dataAO1); err != nil {
return err
}
m.Cas = dataAO1.Cas
m.Certificate = dataAO1.Certificate
return nil
}
// MarshalJSON marshals this object to a JSON structure
func (m CurrentAPISessionCertificateCreateResponse) MarshalJSON() ([]byte, error) {
_parts := make([][]byte, 0, 2)
aO0, err := swag.WriteJSON(m.CreateLocation)
if err != nil {
return nil, err
}
_parts = append(_parts, aO0)
var dataAO1 struct {
Cas string `json:"cas,omitempty"`
Certificate *string `json:"certificate"`
}
dataAO1.Cas = m.Cas
dataAO1.Certificate = m.Certificate
jsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)
if errAO1 != nil {
return nil, errAO1
}
_parts = append(_parts, jsonDataAO1)
return swag.ConcatJSON(_parts...), nil
}
// Validate validates this current Api session certificate create response
func (m *CurrentAPISessionCertificateCreateResponse) Validate(formats strfmt.Registry) error {
var res []error
// validation for a type composition with CreateLocation
if err := m.CreateLocation.Validate(formats); err != nil {
res = append(res, err)
}
if err := m.validateCertificate(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CurrentAPISessionCertificateCreateResponse) validateCertificate(formats strfmt.Registry) error {
if err := validate.Required("certificate", "body", m.Certificate); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *CurrentAPISessionCertificateCreateResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CurrentAPISessionCertificateCreateResponse) UnmarshalBinary(b []byte) error {
var res CurrentAPISessionCertificateCreateResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
@@ -0,0 +1,249 @@
// 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 rest_model
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// CurrentAPISessionCertificateDetail current Api session certificate detail
//
// swagger:model currentApiSessionCertificateDetail
type CurrentAPISessionCertificateDetail struct {
BaseEntity
// certificate
// Required: true
Certificate *string `json:"certificate"`
// fingerprint
// Required: true
Fingerprint *string `json:"fingerprint"`
// subject
// Required: true
Subject *string `json:"subject"`
// valid from
// Required: true
// Format: date-time
ValidFrom *strfmt.DateTime `json:"validFrom"`
// valid to
// Required: true
// Format: date-time
ValidTo *strfmt.DateTime `json:"validTo"`
}
// UnmarshalJSON unmarshals this object from a JSON structure
func (m *CurrentAPISessionCertificateDetail) UnmarshalJSON(raw []byte) error {
// AO0
var aO0 BaseEntity
if err := swag.ReadJSON(raw, &aO0); err != nil {
return err
}
m.BaseEntity = aO0
// AO1
var dataAO1 struct {
Certificate *string `json:"certificate"`
Fingerprint *string `json:"fingerprint"`
Subject *string `json:"subject"`
ValidFrom *strfmt.DateTime `json:"validFrom"`
ValidTo *strfmt.DateTime `json:"validTo"`
}
if err := swag.ReadJSON(raw, &dataAO1); err != nil {
return err
}
m.Certificate = dataAO1.Certificate
m.Fingerprint = dataAO1.Fingerprint
m.Subject = dataAO1.Subject
m.ValidFrom = dataAO1.ValidFrom
m.ValidTo = dataAO1.ValidTo
return nil
}
// MarshalJSON marshals this object to a JSON structure
func (m CurrentAPISessionCertificateDetail) MarshalJSON() ([]byte, error) {
_parts := make([][]byte, 0, 2)
aO0, err := swag.WriteJSON(m.BaseEntity)
if err != nil {
return nil, err
}
_parts = append(_parts, aO0)
var dataAO1 struct {
Certificate *string `json:"certificate"`
Fingerprint *string `json:"fingerprint"`
Subject *string `json:"subject"`
ValidFrom *strfmt.DateTime `json:"validFrom"`
ValidTo *strfmt.DateTime `json:"validTo"`
}
dataAO1.Certificate = m.Certificate
dataAO1.Fingerprint = m.Fingerprint
dataAO1.Subject = m.Subject
dataAO1.ValidFrom = m.ValidFrom
dataAO1.ValidTo = m.ValidTo
jsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)
if errAO1 != nil {
return nil, errAO1
}
_parts = append(_parts, jsonDataAO1)
return swag.ConcatJSON(_parts...), nil
}
// Validate validates this current Api session certificate detail
func (m *CurrentAPISessionCertificateDetail) Validate(formats strfmt.Registry) error {
var res []error
// validation for a type composition with BaseEntity
if err := m.BaseEntity.Validate(formats); err != nil {
res = append(res, err)
}
if err := m.validateCertificate(formats); err != nil {
res = append(res, err)
}
if err := m.validateFingerprint(formats); err != nil {
res = append(res, err)
}
if err := m.validateSubject(formats); err != nil {
res = append(res, err)
}
if err := m.validateValidFrom(formats); err != nil {
res = append(res, err)
}
if err := m.validateValidTo(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CurrentAPISessionCertificateDetail) validateCertificate(formats strfmt.Registry) error {
if err := validate.Required("certificate", "body", m.Certificate); err != nil {
return err
}
return nil
}
func (m *CurrentAPISessionCertificateDetail) validateFingerprint(formats strfmt.Registry) error {
if err := validate.Required("fingerprint", "body", m.Fingerprint); err != nil {
return err
}
return nil
}
func (m *CurrentAPISessionCertificateDetail) validateSubject(formats strfmt.Registry) error {
if err := validate.Required("subject", "body", m.Subject); err != nil {
return err
}
return nil
}
func (m *CurrentAPISessionCertificateDetail) validateValidFrom(formats strfmt.Registry) error {
if err := validate.Required("validFrom", "body", m.ValidFrom); err != nil {
return err
}
if err := validate.FormatOf("validFrom", "body", "date-time", m.ValidFrom.String(), formats); err != nil {
return err
}
return nil
}
func (m *CurrentAPISessionCertificateDetail) validateValidTo(formats strfmt.Registry) error {
if err := validate.Required("validTo", "body", m.ValidTo); err != nil {
return err
}
if err := validate.FormatOf("validTo", "body", "date-time", m.ValidTo.String(), formats); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *CurrentAPISessionCertificateDetail) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CurrentAPISessionCertificateDetail) UnmarshalBinary(b []byte) error {
var res CurrentAPISessionCertificateDetail
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
@@ -0,0 +1,69 @@
// 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 rest_model
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// CurrentAPISessionCertificateList current Api session certificate list
//
// swagger:model currentApiSessionCertificateList
type CurrentAPISessionCertificateList []*CurrentAPISessionCertificateDetail
// Validate validates this current Api session certificate list
func (m CurrentAPISessionCertificateList) Validate(formats strfmt.Registry) error {
var res []error
for i := 0; i < len(m); i++ {
if swag.IsZero(m[i]) { // not required
continue
}
if m[i] != nil {
if err := m[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName(strconv.Itoa(i))
}
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
@@ -0,0 +1,123 @@
// 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 rest_model
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// DetailCurrentAPISessionCertificateEnvelope detail current Api session certificate envelope
//
// swagger:model detailCurrentApiSessionCertificateEnvelope
type DetailCurrentAPISessionCertificateEnvelope struct {
// data
// Required: true
Data *CurrentAPISessionCertificateDetail `json:"data"`
// meta
// Required: true
Meta *Meta `json:"meta"`
}
// Validate validates this detail current Api session certificate envelope
func (m *DetailCurrentAPISessionCertificateEnvelope) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateData(formats); err != nil {
res = append(res, err)
}
if err := m.validateMeta(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *DetailCurrentAPISessionCertificateEnvelope) validateData(formats strfmt.Registry) error {
if err := validate.Required("data", "body", m.Data); err != nil {
return err
}
if m.Data != nil {
if err := m.Data.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data")
}
return err
}
}
return nil
}
func (m *DetailCurrentAPISessionCertificateEnvelope) validateMeta(formats strfmt.Registry) error {
if err := validate.Required("meta", "body", m.Meta); err != nil {
return err
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("meta")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *DetailCurrentAPISessionCertificateEnvelope) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DetailCurrentAPISessionCertificateEnvelope) UnmarshalBinary(b []byte) error {
var res DetailCurrentAPISessionCertificateEnvelope
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
@@ -0,0 +1,121 @@
// 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 rest_model
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// ListCurrentAPISessionCertificatesEnvelope list current API session certificates envelope
//
// swagger:model listCurrentAPISessionCertificatesEnvelope
type ListCurrentAPISessionCertificatesEnvelope struct {
// data
// Required: true
Data CurrentAPISessionCertificateList `json:"data"`
// meta
// Required: true
Meta *Meta `json:"meta"`
}
// Validate validates this list current API session certificates envelope
func (m *ListCurrentAPISessionCertificatesEnvelope) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateData(formats); err != nil {
res = append(res, err)
}
if err := m.validateMeta(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ListCurrentAPISessionCertificatesEnvelope) validateData(formats strfmt.Registry) error {
if err := validate.Required("data", "body", m.Data); err != nil {
return err
}
if err := m.Data.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data")
}
return err
}
return nil
}
func (m *ListCurrentAPISessionCertificatesEnvelope) validateMeta(formats strfmt.Registry) error {
if err := validate.Required("meta", "body", m.Meta); err != nil {
return err
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("meta")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *ListCurrentAPISessionCertificatesEnvelope) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ListCurrentAPISessionCertificatesEnvelope) UnmarshalBinary(b []byte) error {
var res ListCurrentAPISessionCertificatesEnvelope
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
+20
View File
@@ -159,6 +159,11 @@ func configureAPI(api *operations.ZitiEdgeAPI) http.Handler {
return middleware.NotImplemented("operation config.CreateConfigType has not yet been implemented")
})
}
if api.CurrentAPISessionCreateCurrentAPISessionCertificateHandler == nil {
api.CurrentAPISessionCreateCurrentAPISessionCertificateHandler = current_api_session.CreateCurrentAPISessionCertificateHandlerFunc(func(params current_api_session.CreateCurrentAPISessionCertificateParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.CreateCurrentAPISessionCertificate has not yet been implemented")
})
}
if api.DatabaseCreateDatabaseSnapshotHandler == nil {
api.DatabaseCreateDatabaseSnapshotHandler = database.CreateDatabaseSnapshotHandlerFunc(func(params database.CreateDatabaseSnapshotParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation database.CreateDatabaseSnapshot has not yet been implemented")
@@ -244,6 +249,11 @@ func configureAPI(api *operations.ZitiEdgeAPI) http.Handler {
return middleware.NotImplemented("operation config.DeleteConfigType has not yet been implemented")
})
}
if api.CurrentAPISessionDeleteCurrentAPISessionCertificateHandler == nil {
api.CurrentAPISessionDeleteCurrentAPISessionCertificateHandler = current_api_session.DeleteCurrentAPISessionCertificateHandlerFunc(func(params current_api_session.DeleteCurrentAPISessionCertificateParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.DeleteCurrentAPISessionCertificate has not yet been implemented")
})
}
if api.EdgeRouterDeleteEdgeRouterHandler == nil {
api.EdgeRouterDeleteEdgeRouterHandler = edge_router.DeleteEdgeRouterHandlerFunc(func(params edge_router.DeleteEdgeRouterParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation edge_router.DeleteEdgeRouter has not yet been implemented")
@@ -324,6 +334,11 @@ func configureAPI(api *operations.ZitiEdgeAPI) http.Handler {
return middleware.NotImplemented("operation config.DetailConfigType has not yet been implemented")
})
}
if api.CurrentAPISessionDetailCurrentAPISessionCertificateHandler == nil {
api.CurrentAPISessionDetailCurrentAPISessionCertificateHandler = current_api_session.DetailCurrentAPISessionCertificateHandlerFunc(func(params current_api_session.DetailCurrentAPISessionCertificateParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.DetailCurrentAPISessionCertificate has not yet been implemented")
})
}
if api.CurrentAPISessionDetailCurrentIdentityAuthenticatorHandler == nil {
api.CurrentAPISessionDetailCurrentIdentityAuthenticatorHandler = current_api_session.DetailCurrentIdentityAuthenticatorHandlerFunc(func(params current_api_session.DetailCurrentIdentityAuthenticatorParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.DetailCurrentIdentityAuthenticator has not yet been implemented")
@@ -504,6 +519,11 @@ func configureAPI(api *operations.ZitiEdgeAPI) http.Handler {
return middleware.NotImplemented("operation config.ListConfigsForConfigType has not yet been implemented")
})
}
if api.CurrentAPISessionListCurrentAPISessionCertificatesHandler == nil {
api.CurrentAPISessionListCurrentAPISessionCertificatesHandler = current_api_session.ListCurrentAPISessionCertificatesHandlerFunc(func(params current_api_session.ListCurrentAPISessionCertificatesParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.ListCurrentAPISessionCertificates has not yet been implemented")
})
}
if api.CurrentAPISessionListCurrentIdentityAuthenticatorsHandler == nil {
api.CurrentAPISessionListCurrentIdentityAuthenticatorsHandler = current_api_session.ListCurrentIdentityAuthenticatorsHandlerFunc(func(params current_api_session.ListCurrentIdentityAuthenticatorsParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.ListCurrentIdentityAuthenticators has not yet been implemented")
+690 -2
View File
@@ -1154,7 +1154,7 @@ func init() {
],
"description": "Terminates the current API session",
"tags": [
"CurrentAPI Session"
"Current API Session"
],
"summary": "Logout",
"responses": {
@@ -1167,6 +1167,127 @@ func init() {
}
}
},
"/current-api-session/certificates": {
"get": {
"security": [
{
"ztSession": []
}
],
"description": "Retrieves a list of certificate resources for the current API session; supports filtering, sorting, and pagination",
"tags": [
"Current API Session"
],
"summary": "List the ephemeral certificates available for the current API Session",
"operationId": "listCurrentApiSessionCertificates",
"parameters": [
{
"$ref": "#/parameters/limit"
},
{
"$ref": "#/parameters/offset"
},
{
"$ref": "#/parameters/filter"
}
],
"responses": {
"200": {
"$ref": "#/responses/listCurrentApiSessionCertificates"
}
}
},
"post": {
"security": [
{
"ztSession": []
}
],
"description": "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.",
"tags": [
"Current API Session"
],
"summary": "Creates an ephemeral certificate for the current API Session",
"operationId": "createCurrentApiSessionCertificate",
"parameters": [
{
"description": "The payload describing the CSR used to create a session certificate",
"name": "Body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/currentApiSessionCertificateCreate"
}
}
],
"responses": {
"200": {
"$ref": "#/responses/createCurrentApiSessionCertificateResponse"
},
"400": {
"$ref": "#/responses/badRequestResponse"
},
"401": {
"$ref": "#/responses/unauthorizedResponse"
}
}
}
},
"/current-api-session/certificates/{id}": {
"get": {
"security": [
{
"ztSession": []
}
],
"description": "Retrieves a single ephemeral certificate by id",
"tags": [
"Current API Session"
],
"summary": "Retrieves an ephemeral certificate",
"operationId": "detailCurrentApiSessionCertificate",
"responses": {
"200": {
"$ref": "#/responses/detailCurrentApiSessionCertificate"
},
"401": {
"$ref": "#/responses/unauthorizedResponse"
},
"404": {
"$ref": "#/responses/notFoundResponse"
}
}
},
"delete": {
"security": [
{
"ztSession": []
}
],
"description": "Delete an ephemeral certificateby id\n",
"tags": [
"Current API Session"
],
"summary": "Delete an ephemeral certificate",
"operationId": "deleteCurrentApiSessionCertificate",
"responses": {
"200": {
"$ref": "#/responses/deleteResponse"
},
"400": {
"$ref": "#/responses/badRequestResponse"
},
"401": {
"$ref": "#/responses/unauthorizedResponse"
}
}
},
"parameters": [
{
"$ref": "#/parameters/id"
}
]
},
"/current-identity": {
"get": {
"security": [
@@ -6290,6 +6411,20 @@ func init() {
"name": "example-config-name"
}
},
"createCurrentApiSessionCertificateEnvelope": {
"required": [
"meta",
"data"
],
"properties": {
"data": {
"$ref": "#/definitions/currentApiSessionCertificateCreateResponse"
},
"meta": {
"$ref": "#/definitions/meta"
}
}
},
"createEnvelope": {
"type": "object",
"properties": {
@@ -6327,6 +6462,81 @@ func init() {
}
}
},
"currentApiSessionCertificateCreate": {
"type": "object",
"required": [
"csr"
],
"properties": {
"csr": {
"type": "string"
}
}
},
"currentApiSessionCertificateCreateResponse": {
"allOf": [
{
"$ref": "#/definitions/createLocation"
},
{
"type": "object",
"required": [
"certificate"
],
"properties": {
"cas": {
"type": "string"
},
"certificate": {
"type": "string"
}
}
}
]
},
"currentApiSessionCertificateDetail": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/baseEntity"
},
{
"type": "object",
"required": [
"subject",
"fingerprint",
"validFrom",
"validTo",
"certificate"
],
"properties": {
"certificate": {
"type": "string"
},
"fingerprint": {
"type": "string"
},
"subject": {
"type": "string"
},
"validFrom": {
"type": "string",
"format": "date-time"
},
"validTo": {
"type": "string",
"format": "date-time"
}
}
}
]
},
"currentApiSessionCertificateList": {
"type": "array",
"items": {
"$ref": "#/definitions/currentApiSessionCertificateDetail"
}
},
"currentApiSessionDetail": {
"description": "An API Session object for the current API session",
"type": "object",
@@ -6474,6 +6684,20 @@ func init() {
}
}
},
"detailCurrentApiSessionCertificateEnvelope": {
"required": [
"meta",
"data"
],
"properties": {
"data": {
"$ref": "#/definitions/currentApiSessionCertificateDetail"
},
"meta": {
"$ref": "#/definitions/meta"
}
}
},
"detailEdgeRouterPolicyEnvelope": {
"type": "object",
"required": [
@@ -7579,6 +7803,20 @@ func init() {
}
}
},
"listCurrentAPISessionCertificatesEnvelope": {
"required": [
"meta",
"data"
],
"properties": {
"data": {
"$ref": "#/definitions/currentApiSessionCertificateList"
},
"meta": {
"$ref": "#/definitions/meta"
}
}
},
"listEdgeRouterPoliciesEnvelope": {
"type": "object",
"required": [
@@ -9313,6 +9551,12 @@ func init() {
}
}
},
"createCurrentApiSessionCertificateResponse": {
"description": "A response of a create API Session certificate",
"schema": {
"$ref": "#/definitions/createCurrentApiSessionCertificateEnvelope"
}
},
"createResponse": {
"description": "The create request was successful and the resource has been added at the following location",
"schema": {
@@ -9403,6 +9647,12 @@ func init() {
}
}
},
"detailCurrentApiSessionCertificate": {
"description": "A response containing a single API Session certificate",
"schema": {
"$ref": "#/definitions/detailCurrentApiSessionCertificateEnvelope"
}
},
"detailCurrentIdentity": {
"description": "The identity associated with the API Session used to issue the request",
"schema": {
@@ -9627,6 +9877,12 @@ func init() {
"$ref": "#/definitions/listConfigsEnvelope"
}
},
"listCurrentApiSessionCertificates": {
"description": "A list of the current API Session's certificate",
"schema": {
"$ref": "#/definitions/listCurrentAPISessionCertificatesEnvelope"
}
},
"listEdgeRouterPolicies": {
"description": "A list of edge router policies",
"schema": {
@@ -12788,7 +13044,7 @@ func init() {
],
"description": "Terminates the current API session",
"tags": [
"CurrentAPI Session"
"Current API Session"
],
"summary": "Logout",
"responses": {
@@ -12825,6 +13081,303 @@ func init() {
}
}
},
"/current-api-session/certificates": {
"get": {
"security": [
{
"ztSession": []
}
],
"description": "Retrieves a list of certificate resources for the current API session; supports filtering, sorting, and pagination",
"tags": [
"Current API Session"
],
"summary": "List the ephemeral certificates available for the current API Session",
"operationId": "listCurrentApiSessionCertificates",
"parameters": [
{
"type": "integer",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"name": "offset",
"in": "query"
},
{
"type": "string",
"name": "filter",
"in": "query"
}
],
"responses": {
"200": {
"description": "A list of the current API Session's certificate",
"schema": {
"$ref": "#/definitions/listCurrentAPISessionCertificatesEnvelope"
}
}
}
},
"post": {
"security": [
{
"ztSession": []
}
],
"description": "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.",
"tags": [
"Current API Session"
],
"summary": "Creates an ephemeral certificate for the current API Session",
"operationId": "createCurrentApiSessionCertificate",
"parameters": [
{
"description": "The payload describing the CSR used to create a session certificate",
"name": "Body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/currentApiSessionCertificateCreate"
}
}
],
"responses": {
"200": {
"description": "A response of a create API Session certificate",
"schema": {
"$ref": "#/definitions/createCurrentApiSessionCertificateEnvelope"
}
},
"400": {
"description": "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",
"schema": {
"$ref": "#/definitions/apiErrorEnvelope"
},
"examples": {
"application/json": {
"error": {
"args": {
"urlVars": {}
},
"cause": {
"details": {
"context": "(root)",
"field": "(root)",
"property": "fooField3"
},
"field": "(root)",
"message": "(root): fooField3 is required",
"type": "required",
"value": {
"fooField": "abc",
"fooField2": "def"
}
},
"causeMessage": "schema validation failed",
"code": "COULD_NOT_VALIDATE",
"message": "The supplied request contains an invalid document",
"requestId": "ac6766d6-3a09-44b3-8d8a-1b541d97fdd9"
},
"meta": {
"apiEnrolmentVersion": "0.0.1",
"apiVersion": "0.0.1"
}
}
}
},
"401": {
"description": "The currently supplied session does not have the correct access rights to request this resource",
"schema": {
"$ref": "#/definitions/apiErrorEnvelope"
},
"examples": {
"application/json": {
"error": {
"args": {
"urlVars": {}
},
"cause": "",
"causeMessage": "",
"code": "UNAUTHORIZED",
"message": "The request could not be completed. The session is not authorized or the credentials are invalid",
"requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f"
},
"meta": {
"apiEnrolmentVersion": "0.0.1",
"apiVersion": "0.0.1"
}
}
}
}
}
}
},
"/current-api-session/certificates/{id}": {
"get": {
"security": [
{
"ztSession": []
}
],
"description": "Retrieves a single ephemeral certificate by id",
"tags": [
"Current API Session"
],
"summary": "Retrieves an ephemeral certificate",
"operationId": "detailCurrentApiSessionCertificate",
"responses": {
"200": {
"description": "A response containing a single API Session certificate",
"schema": {
"$ref": "#/definitions/detailCurrentApiSessionCertificateEnvelope"
}
},
"401": {
"description": "The currently supplied session does not have the correct access rights to request this resource",
"schema": {
"$ref": "#/definitions/apiErrorEnvelope"
},
"examples": {
"application/json": {
"error": {
"args": {
"urlVars": {}
},
"cause": "",
"causeMessage": "",
"code": "UNAUTHORIZED",
"message": "The request could not be completed. The session is not authorized or the credentials are invalid",
"requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f"
},
"meta": {
"apiEnrolmentVersion": "0.0.1",
"apiVersion": "0.0.1"
}
}
}
},
"404": {
"description": "The requested resource does not exist",
"schema": {
"$ref": "#/definitions/apiErrorEnvelope"
},
"examples": {
"application/json": {
"error": {
"args": {
"urlVars": {
"id": "71a3000f-7dda-491a-9b90-a19f4ee6c406"
}
},
"cause": null,
"causeMessage": "",
"code": "NOT_FOUND",
"message": "The resource requested was not found or is no longer available",
"requestId": "270908d6-f2ef-4577-b973-67bec18ae376"
},
"meta": {
"apiEnrolmentVersion": "0.0.1",
"apiVersion": "0.0.1"
}
}
}
}
}
},
"delete": {
"security": [
{
"ztSession": []
}
],
"description": "Delete an ephemeral certificateby id\n",
"tags": [
"Current API Session"
],
"summary": "Delete an ephemeral certificate",
"operationId": "deleteCurrentApiSessionCertificate",
"responses": {
"200": {
"description": "The delete request was successful and the resource has been removed",
"schema": {
"$ref": "#/definitions/empty"
}
},
"400": {
"description": "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",
"schema": {
"$ref": "#/definitions/apiErrorEnvelope"
},
"examples": {
"application/json": {
"error": {
"args": {
"urlVars": {}
},
"cause": {
"details": {
"context": "(root)",
"field": "(root)",
"property": "fooField3"
},
"field": "(root)",
"message": "(root): fooField3 is required",
"type": "required",
"value": {
"fooField": "abc",
"fooField2": "def"
}
},
"causeMessage": "schema validation failed",
"code": "COULD_NOT_VALIDATE",
"message": "The supplied request contains an invalid document",
"requestId": "ac6766d6-3a09-44b3-8d8a-1b541d97fdd9"
},
"meta": {
"apiEnrolmentVersion": "0.0.1",
"apiVersion": "0.0.1"
}
}
}
},
"401": {
"description": "The currently supplied session does not have the correct access rights to request this resource",
"schema": {
"$ref": "#/definitions/apiErrorEnvelope"
},
"examples": {
"application/json": {
"error": {
"args": {
"urlVars": {}
},
"cause": "",
"causeMessage": "",
"code": "UNAUTHORIZED",
"message": "The request could not be completed. The session is not authorized or the credentials are invalid",
"requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f"
},
"meta": {
"apiEnrolmentVersion": "0.0.1",
"apiVersion": "0.0.1"
}
}
}
}
}
},
"parameters": [
{
"type": "string",
"description": "The id of the requested resource",
"name": "id",
"in": "path",
"required": true
}
]
},
"/current-identity": {
"get": {
"security": [
@@ -24052,6 +24605,20 @@ func init() {
"name": "example-config-name"
}
},
"createCurrentApiSessionCertificateEnvelope": {
"required": [
"meta",
"data"
],
"properties": {
"data": {
"$ref": "#/definitions/currentApiSessionCertificateCreateResponse"
},
"meta": {
"$ref": "#/definitions/meta"
}
}
},
"createEnvelope": {
"type": "object",
"properties": {
@@ -24089,6 +24656,81 @@ func init() {
}
}
},
"currentApiSessionCertificateCreate": {
"type": "object",
"required": [
"csr"
],
"properties": {
"csr": {
"type": "string"
}
}
},
"currentApiSessionCertificateCreateResponse": {
"allOf": [
{
"$ref": "#/definitions/createLocation"
},
{
"type": "object",
"required": [
"certificate"
],
"properties": {
"cas": {
"type": "string"
},
"certificate": {
"type": "string"
}
}
}
]
},
"currentApiSessionCertificateDetail": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/baseEntity"
},
{
"type": "object",
"required": [
"subject",
"fingerprint",
"validFrom",
"validTo",
"certificate"
],
"properties": {
"certificate": {
"type": "string"
},
"fingerprint": {
"type": "string"
},
"subject": {
"type": "string"
},
"validFrom": {
"type": "string",
"format": "date-time"
},
"validTo": {
"type": "string",
"format": "date-time"
}
}
}
]
},
"currentApiSessionCertificateList": {
"type": "array",
"items": {
"$ref": "#/definitions/currentApiSessionCertificateDetail"
}
},
"currentApiSessionDetail": {
"description": "An API Session object for the current API session",
"type": "object",
@@ -24236,6 +24878,20 @@ func init() {
}
}
},
"detailCurrentApiSessionCertificateEnvelope": {
"required": [
"meta",
"data"
],
"properties": {
"data": {
"$ref": "#/definitions/currentApiSessionCertificateDetail"
},
"meta": {
"$ref": "#/definitions/meta"
}
}
},
"detailEdgeRouterPolicyEnvelope": {
"type": "object",
"required": [
@@ -25341,6 +25997,20 @@ func init() {
}
}
},
"listCurrentAPISessionCertificatesEnvelope": {
"required": [
"meta",
"data"
],
"properties": {
"data": {
"$ref": "#/definitions/currentApiSessionCertificateList"
},
"meta": {
"$ref": "#/definitions/meta"
}
}
},
"listEdgeRouterPoliciesEnvelope": {
"type": "object",
"required": [
@@ -27076,6 +27746,12 @@ func init() {
}
}
},
"createCurrentApiSessionCertificateResponse": {
"description": "A response of a create API Session certificate",
"schema": {
"$ref": "#/definitions/createCurrentApiSessionCertificateEnvelope"
}
},
"createResponse": {
"description": "The create request was successful and the resource has been added at the following location",
"schema": {
@@ -27166,6 +27842,12 @@ func init() {
}
}
},
"detailCurrentApiSessionCertificate": {
"description": "A response containing a single API Session certificate",
"schema": {
"$ref": "#/definitions/detailCurrentApiSessionCertificateEnvelope"
}
},
"detailCurrentIdentity": {
"description": "The identity associated with the API Session used to issue the request",
"schema": {
@@ -27390,6 +28072,12 @@ func init() {
"$ref": "#/definitions/listConfigsEnvelope"
}
},
"listCurrentApiSessionCertificates": {
"description": "A list of the current API Session's certificate",
"schema": {
"$ref": "#/definitions/listCurrentAPISessionCertificatesEnvelope"
}
},
"listEdgeRouterPolicies": {
"description": "A list of edge router policies",
"schema": {
@@ -0,0 +1,97 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
)
// CreateCurrentAPISessionCertificateHandlerFunc turns a function with the right signature into a create current Api session certificate handler
type CreateCurrentAPISessionCertificateHandlerFunc func(CreateCurrentAPISessionCertificateParams, interface{}) middleware.Responder
// Handle executing the request and returning a response
func (fn CreateCurrentAPISessionCertificateHandlerFunc) Handle(params CreateCurrentAPISessionCertificateParams, principal interface{}) middleware.Responder {
return fn(params, principal)
}
// CreateCurrentAPISessionCertificateHandler interface for that can handle valid create current Api session certificate params
type CreateCurrentAPISessionCertificateHandler interface {
Handle(CreateCurrentAPISessionCertificateParams, interface{}) middleware.Responder
}
// NewCreateCurrentAPISessionCertificate creates a new http.Handler for the create current Api session certificate operation
func NewCreateCurrentAPISessionCertificate(ctx *middleware.Context, handler CreateCurrentAPISessionCertificateHandler) *CreateCurrentAPISessionCertificate {
return &CreateCurrentAPISessionCertificate{Context: ctx, Handler: handler}
}
/*CreateCurrentAPISessionCertificate swagger:route POST /current-api-session/certificates Current API Session createCurrentApiSessionCertificate
Creates an ephemeral certificate for the current API Session
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.
*/
type CreateCurrentAPISessionCertificate struct {
Context *middleware.Context
Handler CreateCurrentAPISessionCertificateHandler
}
func (o *CreateCurrentAPISessionCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
r = rCtx
}
var Params = NewCreateCurrentAPISessionCertificateParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
r = aCtx
}
var principal interface{}
if uprinc != nil {
principal = uprinc
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}
@@ -0,0 +1,101 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/openziti/edge/rest_model"
)
// NewCreateCurrentAPISessionCertificateParams creates a new CreateCurrentAPISessionCertificateParams object
// no default values defined in spec.
func NewCreateCurrentAPISessionCertificateParams() CreateCurrentAPISessionCertificateParams {
return CreateCurrentAPISessionCertificateParams{}
}
// CreateCurrentAPISessionCertificateParams contains all the bound params for the create current Api session certificate operation
// typically these are obtained from a http.Request
//
// swagger:parameters createCurrentApiSessionCertificate
type CreateCurrentAPISessionCertificateParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*The payload describing the CSR used to create a session certificate
Required: true
In: body
*/
Body *rest_model.CurrentAPISessionCertificateCreate
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewCreateCurrentAPISessionCertificateParams() beforehand.
func (o *CreateCurrentAPISessionCertificateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body rest_model.CurrentAPISessionCertificateCreate
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("body", "body", ""))
} else {
res = append(res, errors.NewParseError("body", "body", "", err))
}
} else {
// validate body object
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Body = &body
}
}
} else {
res = append(res, errors.Required("body", "body", ""))
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
@@ -0,0 +1,170 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/openziti/edge/rest_model"
)
// CreateCurrentAPISessionCertificateOKCode is the HTTP code returned for type CreateCurrentAPISessionCertificateOK
const CreateCurrentAPISessionCertificateOKCode int = 200
/*CreateCurrentAPISessionCertificateOK A response of a create API Session certificate
swagger:response createCurrentApiSessionCertificateOK
*/
type CreateCurrentAPISessionCertificateOK struct {
/*
In: Body
*/
Payload *rest_model.CreateCurrentAPISessionCertificateEnvelope `json:"body,omitempty"`
}
// NewCreateCurrentAPISessionCertificateOK creates CreateCurrentAPISessionCertificateOK with default headers values
func NewCreateCurrentAPISessionCertificateOK() *CreateCurrentAPISessionCertificateOK {
return &CreateCurrentAPISessionCertificateOK{}
}
// WithPayload adds the payload to the create current Api session certificate o k response
func (o *CreateCurrentAPISessionCertificateOK) WithPayload(payload *rest_model.CreateCurrentAPISessionCertificateEnvelope) *CreateCurrentAPISessionCertificateOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the create current Api session certificate o k response
func (o *CreateCurrentAPISessionCertificateOK) SetPayload(payload *rest_model.CreateCurrentAPISessionCertificateEnvelope) {
o.Payload = payload
}
// WriteResponse to the client
func (o *CreateCurrentAPISessionCertificateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// CreateCurrentAPISessionCertificateBadRequestCode is the HTTP code returned for type CreateCurrentAPISessionCertificateBadRequest
const CreateCurrentAPISessionCertificateBadRequestCode int = 400
/*CreateCurrentAPISessionCertificateBadRequest 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
swagger:response createCurrentApiSessionCertificateBadRequest
*/
type CreateCurrentAPISessionCertificateBadRequest struct {
/*
In: Body
*/
Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"`
}
// NewCreateCurrentAPISessionCertificateBadRequest creates CreateCurrentAPISessionCertificateBadRequest with default headers values
func NewCreateCurrentAPISessionCertificateBadRequest() *CreateCurrentAPISessionCertificateBadRequest {
return &CreateCurrentAPISessionCertificateBadRequest{}
}
// WithPayload adds the payload to the create current Api session certificate bad request response
func (o *CreateCurrentAPISessionCertificateBadRequest) WithPayload(payload *rest_model.APIErrorEnvelope) *CreateCurrentAPISessionCertificateBadRequest {
o.Payload = payload
return o
}
// SetPayload sets the payload to the create current Api session certificate bad request response
func (o *CreateCurrentAPISessionCertificateBadRequest) SetPayload(payload *rest_model.APIErrorEnvelope) {
o.Payload = payload
}
// WriteResponse to the client
func (o *CreateCurrentAPISessionCertificateBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(400)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// CreateCurrentAPISessionCertificateUnauthorizedCode is the HTTP code returned for type CreateCurrentAPISessionCertificateUnauthorized
const CreateCurrentAPISessionCertificateUnauthorizedCode int = 401
/*CreateCurrentAPISessionCertificateUnauthorized The currently supplied session does not have the correct access rights to request this resource
swagger:response createCurrentApiSessionCertificateUnauthorized
*/
type CreateCurrentAPISessionCertificateUnauthorized struct {
/*
In: Body
*/
Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"`
}
// NewCreateCurrentAPISessionCertificateUnauthorized creates CreateCurrentAPISessionCertificateUnauthorized with default headers values
func NewCreateCurrentAPISessionCertificateUnauthorized() *CreateCurrentAPISessionCertificateUnauthorized {
return &CreateCurrentAPISessionCertificateUnauthorized{}
}
// WithPayload adds the payload to the create current Api session certificate unauthorized response
func (o *CreateCurrentAPISessionCertificateUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *CreateCurrentAPISessionCertificateUnauthorized {
o.Payload = payload
return o
}
// SetPayload sets the payload to the create current Api session certificate unauthorized response
func (o *CreateCurrentAPISessionCertificateUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) {
o.Payload = payload
}
// WriteResponse to the client
func (o *CreateCurrentAPISessionCertificateUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(401)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
@@ -0,0 +1,111 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
)
// CreateCurrentAPISessionCertificateURL generates an URL for the create current Api session certificate operation
type CreateCurrentAPISessionCertificateURL struct {
_basePath string
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *CreateCurrentAPISessionCertificateURL) WithBasePath(bp string) *CreateCurrentAPISessionCertificateURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *CreateCurrentAPISessionCertificateURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *CreateCurrentAPISessionCertificateURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/current-api-session/certificates"
_basePath := o._basePath
if _basePath == "" {
_basePath = "/edge/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *CreateCurrentAPISessionCertificateURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *CreateCurrentAPISessionCertificateURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *CreateCurrentAPISessionCertificateURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on CreateCurrentAPISessionCertificateURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on CreateCurrentAPISessionCertificateURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *CreateCurrentAPISessionCertificateURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}
@@ -53,7 +53,7 @@ func NewDeleteCurrentAPISession(ctx *middleware.Context, handler DeleteCurrentAP
return &DeleteCurrentAPISession{Context: ctx, Handler: handler}
}
/*DeleteCurrentAPISession swagger:route DELETE /current-api-session CurrentAPI Session deleteCurrentApiSession
/*DeleteCurrentAPISession swagger:route DELETE /current-api-session Current API Session deleteCurrentApiSession
Logout
@@ -0,0 +1,98 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
)
// DeleteCurrentAPISessionCertificateHandlerFunc turns a function with the right signature into a delete current Api session certificate handler
type DeleteCurrentAPISessionCertificateHandlerFunc func(DeleteCurrentAPISessionCertificateParams, interface{}) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteCurrentAPISessionCertificateHandlerFunc) Handle(params DeleteCurrentAPISessionCertificateParams, principal interface{}) middleware.Responder {
return fn(params, principal)
}
// DeleteCurrentAPISessionCertificateHandler interface for that can handle valid delete current Api session certificate params
type DeleteCurrentAPISessionCertificateHandler interface {
Handle(DeleteCurrentAPISessionCertificateParams, interface{}) middleware.Responder
}
// NewDeleteCurrentAPISessionCertificate creates a new http.Handler for the delete current Api session certificate operation
func NewDeleteCurrentAPISessionCertificate(ctx *middleware.Context, handler DeleteCurrentAPISessionCertificateHandler) *DeleteCurrentAPISessionCertificate {
return &DeleteCurrentAPISessionCertificate{Context: ctx, Handler: handler}
}
/*DeleteCurrentAPISessionCertificate swagger:route DELETE /current-api-session/certificates/{id} Current API Session deleteCurrentApiSessionCertificate
Delete an ephemeral certificate
Delete an ephemeral certificateby id
*/
type DeleteCurrentAPISessionCertificate struct {
Context *middleware.Context
Handler DeleteCurrentAPISessionCertificateHandler
}
func (o *DeleteCurrentAPISessionCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
r = rCtx
}
var Params = NewDeleteCurrentAPISessionCertificateParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
r = aCtx
}
var principal interface{}
if uprinc != nil {
principal = uprinc
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}
@@ -0,0 +1,96 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
)
// NewDeleteCurrentAPISessionCertificateParams creates a new DeleteCurrentAPISessionCertificateParams object
// no default values defined in spec.
func NewDeleteCurrentAPISessionCertificateParams() DeleteCurrentAPISessionCertificateParams {
return DeleteCurrentAPISessionCertificateParams{}
}
// DeleteCurrentAPISessionCertificateParams contains all the bound params for the delete current Api session certificate operation
// typically these are obtained from a http.Request
//
// swagger:parameters deleteCurrentApiSessionCertificate
type DeleteCurrentAPISessionCertificateParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*The id of the requested resource
Required: true
In: path
*/
ID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewDeleteCurrentAPISessionCertificateParams() beforehand.
func (o *DeleteCurrentAPISessionCertificateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindID binds and validates parameter ID from path.
func (o *DeleteCurrentAPISessionCertificateParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.ID = raw
return nil
}
@@ -0,0 +1,170 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/openziti/edge/rest_model"
)
// DeleteCurrentAPISessionCertificateOKCode is the HTTP code returned for type DeleteCurrentAPISessionCertificateOK
const DeleteCurrentAPISessionCertificateOKCode int = 200
/*DeleteCurrentAPISessionCertificateOK The delete request was successful and the resource has been removed
swagger:response deleteCurrentApiSessionCertificateOK
*/
type DeleteCurrentAPISessionCertificateOK struct {
/*
In: Body
*/
Payload *rest_model.Empty `json:"body,omitempty"`
}
// NewDeleteCurrentAPISessionCertificateOK creates DeleteCurrentAPISessionCertificateOK with default headers values
func NewDeleteCurrentAPISessionCertificateOK() *DeleteCurrentAPISessionCertificateOK {
return &DeleteCurrentAPISessionCertificateOK{}
}
// WithPayload adds the payload to the delete current Api session certificate o k response
func (o *DeleteCurrentAPISessionCertificateOK) WithPayload(payload *rest_model.Empty) *DeleteCurrentAPISessionCertificateOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete current Api session certificate o k response
func (o *DeleteCurrentAPISessionCertificateOK) SetPayload(payload *rest_model.Empty) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteCurrentAPISessionCertificateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// DeleteCurrentAPISessionCertificateBadRequestCode is the HTTP code returned for type DeleteCurrentAPISessionCertificateBadRequest
const DeleteCurrentAPISessionCertificateBadRequestCode int = 400
/*DeleteCurrentAPISessionCertificateBadRequest 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
swagger:response deleteCurrentApiSessionCertificateBadRequest
*/
type DeleteCurrentAPISessionCertificateBadRequest struct {
/*
In: Body
*/
Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"`
}
// NewDeleteCurrentAPISessionCertificateBadRequest creates DeleteCurrentAPISessionCertificateBadRequest with default headers values
func NewDeleteCurrentAPISessionCertificateBadRequest() *DeleteCurrentAPISessionCertificateBadRequest {
return &DeleteCurrentAPISessionCertificateBadRequest{}
}
// WithPayload adds the payload to the delete current Api session certificate bad request response
func (o *DeleteCurrentAPISessionCertificateBadRequest) WithPayload(payload *rest_model.APIErrorEnvelope) *DeleteCurrentAPISessionCertificateBadRequest {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete current Api session certificate bad request response
func (o *DeleteCurrentAPISessionCertificateBadRequest) SetPayload(payload *rest_model.APIErrorEnvelope) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteCurrentAPISessionCertificateBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(400)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// DeleteCurrentAPISessionCertificateUnauthorizedCode is the HTTP code returned for type DeleteCurrentAPISessionCertificateUnauthorized
const DeleteCurrentAPISessionCertificateUnauthorizedCode int = 401
/*DeleteCurrentAPISessionCertificateUnauthorized The currently supplied session does not have the correct access rights to request this resource
swagger:response deleteCurrentApiSessionCertificateUnauthorized
*/
type DeleteCurrentAPISessionCertificateUnauthorized struct {
/*
In: Body
*/
Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"`
}
// NewDeleteCurrentAPISessionCertificateUnauthorized creates DeleteCurrentAPISessionCertificateUnauthorized with default headers values
func NewDeleteCurrentAPISessionCertificateUnauthorized() *DeleteCurrentAPISessionCertificateUnauthorized {
return &DeleteCurrentAPISessionCertificateUnauthorized{}
}
// WithPayload adds the payload to the delete current Api session certificate unauthorized response
func (o *DeleteCurrentAPISessionCertificateUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *DeleteCurrentAPISessionCertificateUnauthorized {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete current Api session certificate unauthorized response
func (o *DeleteCurrentAPISessionCertificateUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteCurrentAPISessionCertificateUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(401)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
@@ -0,0 +1,123 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
"strings"
)
// DeleteCurrentAPISessionCertificateURL generates an URL for the delete current Api session certificate operation
type DeleteCurrentAPISessionCertificateURL struct {
ID string
_basePath string
// avoid unkeyed usage
_ struct{}
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *DeleteCurrentAPISessionCertificateURL) WithBasePath(bp string) *DeleteCurrentAPISessionCertificateURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *DeleteCurrentAPISessionCertificateURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *DeleteCurrentAPISessionCertificateURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/current-api-session/certificates/{id}"
id := o.ID
if id != "" {
_path = strings.Replace(_path, "{id}", id, -1)
} else {
return nil, errors.New("id is required on DeleteCurrentAPISessionCertificateURL")
}
_basePath := o._basePath
if _basePath == "" {
_basePath = "/edge/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *DeleteCurrentAPISessionCertificateURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *DeleteCurrentAPISessionCertificateURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *DeleteCurrentAPISessionCertificateURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on DeleteCurrentAPISessionCertificateURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on DeleteCurrentAPISessionCertificateURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *DeleteCurrentAPISessionCertificateURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}
@@ -0,0 +1,97 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
)
// DetailCurrentAPISessionCertificateHandlerFunc turns a function with the right signature into a detail current Api session certificate handler
type DetailCurrentAPISessionCertificateHandlerFunc func(DetailCurrentAPISessionCertificateParams, interface{}) middleware.Responder
// Handle executing the request and returning a response
func (fn DetailCurrentAPISessionCertificateHandlerFunc) Handle(params DetailCurrentAPISessionCertificateParams, principal interface{}) middleware.Responder {
return fn(params, principal)
}
// DetailCurrentAPISessionCertificateHandler interface for that can handle valid detail current Api session certificate params
type DetailCurrentAPISessionCertificateHandler interface {
Handle(DetailCurrentAPISessionCertificateParams, interface{}) middleware.Responder
}
// NewDetailCurrentAPISessionCertificate creates a new http.Handler for the detail current Api session certificate operation
func NewDetailCurrentAPISessionCertificate(ctx *middleware.Context, handler DetailCurrentAPISessionCertificateHandler) *DetailCurrentAPISessionCertificate {
return &DetailCurrentAPISessionCertificate{Context: ctx, Handler: handler}
}
/*DetailCurrentAPISessionCertificate swagger:route GET /current-api-session/certificates/{id} Current API Session detailCurrentApiSessionCertificate
Retrieves an ephemeral certificate
Retrieves a single ephemeral certificate by id
*/
type DetailCurrentAPISessionCertificate struct {
Context *middleware.Context
Handler DetailCurrentAPISessionCertificateHandler
}
func (o *DetailCurrentAPISessionCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
r = rCtx
}
var Params = NewDetailCurrentAPISessionCertificateParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
r = aCtx
}
var principal interface{}
if uprinc != nil {
principal = uprinc
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}
@@ -0,0 +1,96 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
)
// NewDetailCurrentAPISessionCertificateParams creates a new DetailCurrentAPISessionCertificateParams object
// no default values defined in spec.
func NewDetailCurrentAPISessionCertificateParams() DetailCurrentAPISessionCertificateParams {
return DetailCurrentAPISessionCertificateParams{}
}
// DetailCurrentAPISessionCertificateParams contains all the bound params for the detail current Api session certificate operation
// typically these are obtained from a http.Request
//
// swagger:parameters detailCurrentApiSessionCertificate
type DetailCurrentAPISessionCertificateParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*The id of the requested resource
Required: true
In: path
*/
ID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewDetailCurrentAPISessionCertificateParams() beforehand.
func (o *DetailCurrentAPISessionCertificateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindID binds and validates parameter ID from path.
func (o *DetailCurrentAPISessionCertificateParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.ID = raw
return nil
}
@@ -0,0 +1,170 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/openziti/edge/rest_model"
)
// DetailCurrentAPISessionCertificateOKCode is the HTTP code returned for type DetailCurrentAPISessionCertificateOK
const DetailCurrentAPISessionCertificateOKCode int = 200
/*DetailCurrentAPISessionCertificateOK A response containing a single API Session certificate
swagger:response detailCurrentApiSessionCertificateOK
*/
type DetailCurrentAPISessionCertificateOK struct {
/*
In: Body
*/
Payload *rest_model.DetailCurrentAPISessionCertificateEnvelope `json:"body,omitempty"`
}
// NewDetailCurrentAPISessionCertificateOK creates DetailCurrentAPISessionCertificateOK with default headers values
func NewDetailCurrentAPISessionCertificateOK() *DetailCurrentAPISessionCertificateOK {
return &DetailCurrentAPISessionCertificateOK{}
}
// WithPayload adds the payload to the detail current Api session certificate o k response
func (o *DetailCurrentAPISessionCertificateOK) WithPayload(payload *rest_model.DetailCurrentAPISessionCertificateEnvelope) *DetailCurrentAPISessionCertificateOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the detail current Api session certificate o k response
func (o *DetailCurrentAPISessionCertificateOK) SetPayload(payload *rest_model.DetailCurrentAPISessionCertificateEnvelope) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DetailCurrentAPISessionCertificateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// DetailCurrentAPISessionCertificateUnauthorizedCode is the HTTP code returned for type DetailCurrentAPISessionCertificateUnauthorized
const DetailCurrentAPISessionCertificateUnauthorizedCode int = 401
/*DetailCurrentAPISessionCertificateUnauthorized The currently supplied session does not have the correct access rights to request this resource
swagger:response detailCurrentApiSessionCertificateUnauthorized
*/
type DetailCurrentAPISessionCertificateUnauthorized struct {
/*
In: Body
*/
Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"`
}
// NewDetailCurrentAPISessionCertificateUnauthorized creates DetailCurrentAPISessionCertificateUnauthorized with default headers values
func NewDetailCurrentAPISessionCertificateUnauthorized() *DetailCurrentAPISessionCertificateUnauthorized {
return &DetailCurrentAPISessionCertificateUnauthorized{}
}
// WithPayload adds the payload to the detail current Api session certificate unauthorized response
func (o *DetailCurrentAPISessionCertificateUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *DetailCurrentAPISessionCertificateUnauthorized {
o.Payload = payload
return o
}
// SetPayload sets the payload to the detail current Api session certificate unauthorized response
func (o *DetailCurrentAPISessionCertificateUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DetailCurrentAPISessionCertificateUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(401)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// DetailCurrentAPISessionCertificateNotFoundCode is the HTTP code returned for type DetailCurrentAPISessionCertificateNotFound
const DetailCurrentAPISessionCertificateNotFoundCode int = 404
/*DetailCurrentAPISessionCertificateNotFound The requested resource does not exist
swagger:response detailCurrentApiSessionCertificateNotFound
*/
type DetailCurrentAPISessionCertificateNotFound struct {
/*
In: Body
*/
Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"`
}
// NewDetailCurrentAPISessionCertificateNotFound creates DetailCurrentAPISessionCertificateNotFound with default headers values
func NewDetailCurrentAPISessionCertificateNotFound() *DetailCurrentAPISessionCertificateNotFound {
return &DetailCurrentAPISessionCertificateNotFound{}
}
// WithPayload adds the payload to the detail current Api session certificate not found response
func (o *DetailCurrentAPISessionCertificateNotFound) WithPayload(payload *rest_model.APIErrorEnvelope) *DetailCurrentAPISessionCertificateNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the detail current Api session certificate not found response
func (o *DetailCurrentAPISessionCertificateNotFound) SetPayload(payload *rest_model.APIErrorEnvelope) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DetailCurrentAPISessionCertificateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
@@ -0,0 +1,123 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
"strings"
)
// DetailCurrentAPISessionCertificateURL generates an URL for the detail current Api session certificate operation
type DetailCurrentAPISessionCertificateURL struct {
ID string
_basePath string
// avoid unkeyed usage
_ struct{}
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *DetailCurrentAPISessionCertificateURL) WithBasePath(bp string) *DetailCurrentAPISessionCertificateURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *DetailCurrentAPISessionCertificateURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *DetailCurrentAPISessionCertificateURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/current-api-session/certificates/{id}"
id := o.ID
if id != "" {
_path = strings.Replace(_path, "{id}", id, -1)
} else {
return nil, errors.New("id is required on DetailCurrentAPISessionCertificateURL")
}
_basePath := o._basePath
if _basePath == "" {
_basePath = "/edge/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *DetailCurrentAPISessionCertificateURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *DetailCurrentAPISessionCertificateURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *DetailCurrentAPISessionCertificateURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on DetailCurrentAPISessionCertificateURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on DetailCurrentAPISessionCertificateURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *DetailCurrentAPISessionCertificateURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}
@@ -0,0 +1,97 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
)
// ListCurrentAPISessionCertificatesHandlerFunc turns a function with the right signature into a list current Api session certificates handler
type ListCurrentAPISessionCertificatesHandlerFunc func(ListCurrentAPISessionCertificatesParams, interface{}) middleware.Responder
// Handle executing the request and returning a response
func (fn ListCurrentAPISessionCertificatesHandlerFunc) Handle(params ListCurrentAPISessionCertificatesParams, principal interface{}) middleware.Responder {
return fn(params, principal)
}
// ListCurrentAPISessionCertificatesHandler interface for that can handle valid list current Api session certificates params
type ListCurrentAPISessionCertificatesHandler interface {
Handle(ListCurrentAPISessionCertificatesParams, interface{}) middleware.Responder
}
// NewListCurrentAPISessionCertificates creates a new http.Handler for the list current Api session certificates operation
func NewListCurrentAPISessionCertificates(ctx *middleware.Context, handler ListCurrentAPISessionCertificatesHandler) *ListCurrentAPISessionCertificates {
return &ListCurrentAPISessionCertificates{Context: ctx, Handler: handler}
}
/*ListCurrentAPISessionCertificates swagger:route GET /current-api-session/certificates Current API Session listCurrentApiSessionCertificates
List the ephemeral certificates available for the current API Session
Retrieves a list of certificate resources for the current API session; supports filtering, sorting, and pagination
*/
type ListCurrentAPISessionCertificates struct {
Context *middleware.Context
Handler ListCurrentAPISessionCertificatesHandler
}
func (o *ListCurrentAPISessionCertificates) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
r = rCtx
}
var Params = NewListCurrentAPISessionCertificatesParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
r = aCtx
}
var principal interface{}
if uprinc != nil {
principal = uprinc
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}
@@ -0,0 +1,164 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewListCurrentAPISessionCertificatesParams creates a new ListCurrentAPISessionCertificatesParams object
// no default values defined in spec.
func NewListCurrentAPISessionCertificatesParams() ListCurrentAPISessionCertificatesParams {
return ListCurrentAPISessionCertificatesParams{}
}
// ListCurrentAPISessionCertificatesParams contains all the bound params for the list current Api session certificates operation
// typically these are obtained from a http.Request
//
// swagger:parameters listCurrentApiSessionCertificates
type ListCurrentAPISessionCertificatesParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
In: query
*/
Filter *string
/*
In: query
*/
Limit *int64
/*
In: query
*/
Offset *int64
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewListCurrentAPISessionCertificatesParams() beforehand.
func (o *ListCurrentAPISessionCertificatesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
qs := runtime.Values(r.URL.Query())
qFilter, qhkFilter, _ := qs.GetOK("filter")
if err := o.bindFilter(qFilter, qhkFilter, route.Formats); err != nil {
res = append(res, err)
}
qLimit, qhkLimit, _ := qs.GetOK("limit")
if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil {
res = append(res, err)
}
qOffset, qhkOffset, _ := qs.GetOK("offset")
if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindFilter binds and validates parameter Filter from query.
func (o *ListCurrentAPISessionCertificatesParams) bindFilter(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
return nil
}
o.Filter = &raw
return nil
}
// bindLimit binds and validates parameter Limit from query.
func (o *ListCurrentAPISessionCertificatesParams) bindLimit(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
return nil
}
value, err := swag.ConvertInt64(raw)
if err != nil {
return errors.InvalidType("limit", "query", "int64", raw)
}
o.Limit = &value
return nil
}
// bindOffset binds and validates parameter Offset from query.
func (o *ListCurrentAPISessionCertificatesParams) bindOffset(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
return nil
}
value, err := swag.ConvertInt64(raw)
if err != nil {
return errors.InvalidType("offset", "query", "int64", raw)
}
o.Offset = &value
return nil
}
@@ -0,0 +1,82 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/openziti/edge/rest_model"
)
// ListCurrentAPISessionCertificatesOKCode is the HTTP code returned for type ListCurrentAPISessionCertificatesOK
const ListCurrentAPISessionCertificatesOKCode int = 200
/*ListCurrentAPISessionCertificatesOK A list of the current API Session's certificate
swagger:response listCurrentApiSessionCertificatesOK
*/
type ListCurrentAPISessionCertificatesOK struct {
/*
In: Body
*/
Payload *rest_model.ListCurrentAPISessionCertificatesEnvelope `json:"body,omitempty"`
}
// NewListCurrentAPISessionCertificatesOK creates ListCurrentAPISessionCertificatesOK with default headers values
func NewListCurrentAPISessionCertificatesOK() *ListCurrentAPISessionCertificatesOK {
return &ListCurrentAPISessionCertificatesOK{}
}
// WithPayload adds the payload to the list current Api session certificates o k response
func (o *ListCurrentAPISessionCertificatesOK) WithPayload(payload *rest_model.ListCurrentAPISessionCertificatesEnvelope) *ListCurrentAPISessionCertificatesOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the list current Api session certificates o k response
func (o *ListCurrentAPISessionCertificatesOK) SetPayload(payload *rest_model.ListCurrentAPISessionCertificatesEnvelope) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ListCurrentAPISessionCertificatesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
@@ -0,0 +1,147 @@
// 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 current_api_session
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
"github.com/go-openapi/swag"
)
// ListCurrentAPISessionCertificatesURL generates an URL for the list current Api session certificates operation
type ListCurrentAPISessionCertificatesURL struct {
Filter *string
Limit *int64
Offset *int64
_basePath string
// avoid unkeyed usage
_ struct{}
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *ListCurrentAPISessionCertificatesURL) WithBasePath(bp string) *ListCurrentAPISessionCertificatesURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *ListCurrentAPISessionCertificatesURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *ListCurrentAPISessionCertificatesURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/current-api-session/certificates"
_basePath := o._basePath
if _basePath == "" {
_basePath = "/edge/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
qs := make(url.Values)
var filterQ string
if o.Filter != nil {
filterQ = *o.Filter
}
if filterQ != "" {
qs.Set("filter", filterQ)
}
var limitQ string
if o.Limit != nil {
limitQ = swag.FormatInt64(*o.Limit)
}
if limitQ != "" {
qs.Set("limit", limitQ)
}
var offsetQ string
if o.Offset != nil {
offsetQ = swag.FormatInt64(*o.Offset)
}
if offsetQ != "" {
qs.Set("offset", offsetQ)
}
_result.RawQuery = qs.Encode()
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *ListCurrentAPISessionCertificatesURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *ListCurrentAPISessionCertificatesURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *ListCurrentAPISessionCertificatesURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on ListCurrentAPISessionCertificatesURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on ListCurrentAPISessionCertificatesURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *ListCurrentAPISessionCertificatesURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}
+48
View File
@@ -137,6 +137,9 @@ func NewZitiEdgeAPI(spec *loads.Document) *ZitiEdgeAPI {
ConfigCreateConfigTypeHandler: config.CreateConfigTypeHandlerFunc(func(params config.CreateConfigTypeParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation config.CreateConfigType has not yet been implemented")
}),
CurrentAPISessionCreateCurrentAPISessionCertificateHandler: current_api_session.CreateCurrentAPISessionCertificateHandlerFunc(func(params current_api_session.CreateCurrentAPISessionCertificateParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.CreateCurrentAPISessionCertificate has not yet been implemented")
}),
DatabaseCreateDatabaseSnapshotHandler: database.CreateDatabaseSnapshotHandlerFunc(func(params database.CreateDatabaseSnapshotParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation database.CreateDatabaseSnapshot has not yet been implemented")
}),
@@ -188,6 +191,9 @@ func NewZitiEdgeAPI(spec *loads.Document) *ZitiEdgeAPI {
ConfigDeleteConfigTypeHandler: config.DeleteConfigTypeHandlerFunc(func(params config.DeleteConfigTypeParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation config.DeleteConfigType has not yet been implemented")
}),
CurrentAPISessionDeleteCurrentAPISessionCertificateHandler: current_api_session.DeleteCurrentAPISessionCertificateHandlerFunc(func(params current_api_session.DeleteCurrentAPISessionCertificateParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.DeleteCurrentAPISessionCertificate has not yet been implemented")
}),
EdgeRouterDeleteEdgeRouterHandler: edge_router.DeleteEdgeRouterHandlerFunc(func(params edge_router.DeleteEdgeRouterParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation edge_router.DeleteEdgeRouter has not yet been implemented")
}),
@@ -236,6 +242,9 @@ func NewZitiEdgeAPI(spec *loads.Document) *ZitiEdgeAPI {
ConfigDetailConfigTypeHandler: config.DetailConfigTypeHandlerFunc(func(params config.DetailConfigTypeParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation config.DetailConfigType has not yet been implemented")
}),
CurrentAPISessionDetailCurrentAPISessionCertificateHandler: current_api_session.DetailCurrentAPISessionCertificateHandlerFunc(func(params current_api_session.DetailCurrentAPISessionCertificateParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.DetailCurrentAPISessionCertificate has not yet been implemented")
}),
CurrentAPISessionDetailCurrentIdentityAuthenticatorHandler: current_api_session.DetailCurrentIdentityAuthenticatorHandlerFunc(func(params current_api_session.DetailCurrentIdentityAuthenticatorParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.DetailCurrentIdentityAuthenticator has not yet been implemented")
}),
@@ -344,6 +353,9 @@ func NewZitiEdgeAPI(spec *loads.Document) *ZitiEdgeAPI {
ConfigListConfigsForConfigTypeHandler: config.ListConfigsForConfigTypeHandlerFunc(func(params config.ListConfigsForConfigTypeParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation config.ListConfigsForConfigType has not yet been implemented")
}),
CurrentAPISessionListCurrentAPISessionCertificatesHandler: current_api_session.ListCurrentAPISessionCertificatesHandlerFunc(func(params current_api_session.ListCurrentAPISessionCertificatesParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.ListCurrentAPISessionCertificates has not yet been implemented")
}),
CurrentAPISessionListCurrentIdentityAuthenticatorsHandler: current_api_session.ListCurrentIdentityAuthenticatorsHandlerFunc(func(params current_api_session.ListCurrentIdentityAuthenticatorsParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation current_api_session.ListCurrentIdentityAuthenticators has not yet been implemented")
}),
@@ -657,6 +669,8 @@ type ZitiEdgeAPI struct {
ConfigCreateConfigHandler config.CreateConfigHandler
// ConfigCreateConfigTypeHandler sets the operation handler for the create config type operation
ConfigCreateConfigTypeHandler config.CreateConfigTypeHandler
// CurrentAPISessionCreateCurrentAPISessionCertificateHandler sets the operation handler for the create current Api session certificate operation
CurrentAPISessionCreateCurrentAPISessionCertificateHandler current_api_session.CreateCurrentAPISessionCertificateHandler
// DatabaseCreateDatabaseSnapshotHandler sets the operation handler for the create database snapshot operation
DatabaseCreateDatabaseSnapshotHandler database.CreateDatabaseSnapshotHandler
// EdgeRouterCreateEdgeRouterHandler sets the operation handler for the create edge router operation
@@ -691,6 +705,8 @@ type ZitiEdgeAPI struct {
ConfigDeleteConfigHandler config.DeleteConfigHandler
// ConfigDeleteConfigTypeHandler sets the operation handler for the delete config type operation
ConfigDeleteConfigTypeHandler config.DeleteConfigTypeHandler
// CurrentAPISessionDeleteCurrentAPISessionCertificateHandler sets the operation handler for the delete current Api session certificate operation
CurrentAPISessionDeleteCurrentAPISessionCertificateHandler current_api_session.DeleteCurrentAPISessionCertificateHandler
// EdgeRouterDeleteEdgeRouterHandler sets the operation handler for the delete edge router operation
EdgeRouterDeleteEdgeRouterHandler edge_router.DeleteEdgeRouterHandler
// EdgeRouterPolicyDeleteEdgeRouterPolicyHandler sets the operation handler for the delete edge router policy operation
@@ -723,6 +739,8 @@ type ZitiEdgeAPI struct {
ConfigDetailConfigHandler config.DetailConfigHandler
// ConfigDetailConfigTypeHandler sets the operation handler for the detail config type operation
ConfigDetailConfigTypeHandler config.DetailConfigTypeHandler
// CurrentAPISessionDetailCurrentAPISessionCertificateHandler sets the operation handler for the detail current Api session certificate operation
CurrentAPISessionDetailCurrentAPISessionCertificateHandler current_api_session.DetailCurrentAPISessionCertificateHandler
// CurrentAPISessionDetailCurrentIdentityAuthenticatorHandler sets the operation handler for the detail current identity authenticator operation
CurrentAPISessionDetailCurrentIdentityAuthenticatorHandler current_api_session.DetailCurrentIdentityAuthenticatorHandler
// EdgeRouterDetailEdgeRouterHandler sets the operation handler for the detail edge router operation
@@ -795,6 +813,8 @@ type ZitiEdgeAPI struct {
ConfigListConfigsHandler config.ListConfigsHandler
// ConfigListConfigsForConfigTypeHandler sets the operation handler for the list configs for config type operation
ConfigListConfigsForConfigTypeHandler config.ListConfigsForConfigTypeHandler
// CurrentAPISessionListCurrentAPISessionCertificatesHandler sets the operation handler for the list current Api session certificates operation
CurrentAPISessionListCurrentAPISessionCertificatesHandler current_api_session.ListCurrentAPISessionCertificatesHandler
// CurrentAPISessionListCurrentIdentityAuthenticatorsHandler sets the operation handler for the list current identity authenticators operation
CurrentAPISessionListCurrentIdentityAuthenticatorsHandler current_api_session.ListCurrentIdentityAuthenticatorsHandler
// EdgeRouterListEdgeRouterEdgeRouterPoliciesHandler sets the operation handler for the list edge router edge router policies operation
@@ -1073,6 +1093,9 @@ func (o *ZitiEdgeAPI) Validate() error {
if o.ConfigCreateConfigTypeHandler == nil {
unregistered = append(unregistered, "config.CreateConfigTypeHandler")
}
if o.CurrentAPISessionCreateCurrentAPISessionCertificateHandler == nil {
unregistered = append(unregistered, "current_api_session.CreateCurrentAPISessionCertificateHandler")
}
if o.DatabaseCreateDatabaseSnapshotHandler == nil {
unregistered = append(unregistered, "database.CreateDatabaseSnapshotHandler")
}
@@ -1124,6 +1147,9 @@ func (o *ZitiEdgeAPI) Validate() error {
if o.ConfigDeleteConfigTypeHandler == nil {
unregistered = append(unregistered, "config.DeleteConfigTypeHandler")
}
if o.CurrentAPISessionDeleteCurrentAPISessionCertificateHandler == nil {
unregistered = append(unregistered, "current_api_session.DeleteCurrentAPISessionCertificateHandler")
}
if o.EdgeRouterDeleteEdgeRouterHandler == nil {
unregistered = append(unregistered, "edge_router.DeleteEdgeRouterHandler")
}
@@ -1172,6 +1198,9 @@ func (o *ZitiEdgeAPI) Validate() error {
if o.ConfigDetailConfigTypeHandler == nil {
unregistered = append(unregistered, "config.DetailConfigTypeHandler")
}
if o.CurrentAPISessionDetailCurrentAPISessionCertificateHandler == nil {
unregistered = append(unregistered, "current_api_session.DetailCurrentAPISessionCertificateHandler")
}
if o.CurrentAPISessionDetailCurrentIdentityAuthenticatorHandler == nil {
unregistered = append(unregistered, "current_api_session.DetailCurrentIdentityAuthenticatorHandler")
}
@@ -1280,6 +1309,9 @@ func (o *ZitiEdgeAPI) Validate() error {
if o.ConfigListConfigsForConfigTypeHandler == nil {
unregistered = append(unregistered, "config.ListConfigsForConfigTypeHandler")
}
if o.CurrentAPISessionListCurrentAPISessionCertificatesHandler == nil {
unregistered = append(unregistered, "current_api_session.ListCurrentAPISessionCertificatesHandler")
}
if o.CurrentAPISessionListCurrentIdentityAuthenticatorsHandler == nil {
unregistered = append(unregistered, "current_api_session.ListCurrentIdentityAuthenticatorsHandler")
}
@@ -1653,6 +1685,10 @@ func (o *ZitiEdgeAPI) initHandlerCache() {
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/current-api-session/certificates"] = current_api_session.NewCreateCurrentAPISessionCertificate(o.context, o.CurrentAPISessionCreateCurrentAPISessionCertificateHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/database/snapshot"] = database.NewCreateDatabaseSnapshot(o.context, o.DatabaseCreateDatabaseSnapshotHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
@@ -1721,6 +1757,10 @@ func (o *ZitiEdgeAPI) initHandlerCache() {
if o.handlers["DELETE"] == nil {
o.handlers["DELETE"] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/current-api-session/certificates/{id}"] = current_api_session.NewDeleteCurrentAPISessionCertificate(o.context, o.CurrentAPISessionDeleteCurrentAPISessionCertificateHandler)
if o.handlers["DELETE"] == nil {
o.handlers["DELETE"] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/edge-routers/{id}"] = edge_router.NewDeleteEdgeRouter(o.context, o.EdgeRouterDeleteEdgeRouterHandler)
if o.handlers["DELETE"] == nil {
o.handlers["DELETE"] = make(map[string]http.Handler)
@@ -1785,6 +1825,10 @@ func (o *ZitiEdgeAPI) initHandlerCache() {
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/current-api-session/certificates/{id}"] = current_api_session.NewDetailCurrentAPISessionCertificate(o.context, o.CurrentAPISessionDetailCurrentAPISessionCertificateHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/current-identity/authenticators/{id}"] = current_api_session.NewDetailCurrentIdentityAuthenticator(o.context, o.CurrentAPISessionDetailCurrentIdentityAuthenticatorHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
@@ -1929,6 +1973,10 @@ func (o *ZitiEdgeAPI) initHandlerCache() {
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/current-api-session/certificates"] = current_api_session.NewListCurrentAPISessionCertificates(o.context, o.CurrentAPISessionListCurrentAPISessionCertificatesHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/current-identity/authenticators"] = current_api_session.NewListCurrentIdentityAuthenticators(o.context, o.CurrentAPISessionListCurrentIdentityAuthenticatorsHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
+67 -49
View File
@@ -42,34 +42,40 @@ type RemoveListener func()
type DisconnectCB func(token string)
type StateManager interface {
//"Network" Sessions
GetSession(token string) *edge_ctrl_pb.Session
GetSessionWithTimeout(token string, timeout time.Duration) *edge_ctrl_pb.Session
AddSession(ns *edge_ctrl_pb.Session)
UpdateSession(ns *edge_ctrl_pb.Session)
RemoveSession(token string)
RemoveMissingSessions(knownSessions []*edge_ctrl_pb.Session)
AddSessionRemovedListener(token string, callBack func(token string)) RemoveListener
//ApiSessions
GetApiSession(token string) *edge_ctrl_pb.ApiSession
GetApiSessionByFingerprint(fingerprint string) chan *edge_ctrl_pb.ApiSession
AddApiSession(ns *edge_ctrl_pb.ApiSession)
UpdateApiSession(ns *edge_ctrl_pb.ApiSession)
RemoveApiSession(token string)
RemoveMissingApiSessions(knownSessions []*edge_ctrl_pb.ApiSession)
GetNetworkSession(token string) *edge_ctrl_pb.Session
GetNetworkSessionWithTimeout(token string, timeout time.Duration) *edge_ctrl_pb.Session
GetSessionByFingerprint(fingerprint string) chan *edge_ctrl_pb.ApiSession
GetSession(token string) *edge_ctrl_pb.ApiSession
AddNetworkSessionRemovedListener(token string, callBack func(token string)) RemoveListener
AddSessionRemovedListener(token string, callBack func(token string)) RemoveListener
AddConnectedApiSession(token string, removeCB func(), ch channel2.Channel)
RemoveConnectedApiSession(token string, underlay channel2.Channel)
AddApiSessionRemovedListener(token string, callBack func(token string)) RemoveListener
StartHeartbeat(channel channel2.Channel, seconds int)
AddConnectedSession(token string, removeCB func(), ch channel2.Channel)
RemoveConnectedSession(token string, underlay channel2.Channel)
}
type StateManagerImpl struct {
networkSessionsByToken *sync.Map
sessionsByToken *sync.Map
supportedFabrics *sync.Map
activeSessions *sync.Map
Hostname string
ControllerAddr string
ClusterId string
NodeId string
sessionsByToken *sync.Map //"network" sessions
apiSessionsByToken *sync.Map
supportedFabrics *sync.Map
activeApiSessions *sync.Map
Hostname string
ControllerAddr string
ClusterId string
NodeId string
events.EventEmmiter
heartbeatRunner runner.Runner
heartbeatOperation *heartbeatOperation
@@ -83,11 +89,11 @@ func GetStateManager() StateManager {
}
singleStateManager = &StateManagerImpl{
EventEmmiter: events.New(),
networkSessionsByToken: &sync.Map{},
sessionsByToken: &sync.Map{},
supportedFabrics: &sync.Map{},
activeSessions: &sync.Map{},
EventEmmiter: events.New(),
sessionsByToken: &sync.Map{},
apiSessionsByToken: &sync.Map{},
supportedFabrics: &sync.Map{},
activeApiSessions: &sync.Map{},
}
return singleStateManager
@@ -95,20 +101,32 @@ func GetStateManager() StateManager {
func (sm *StateManagerImpl) AddApiSession(session *edge_ctrl_pb.ApiSession) {
pfxlog.Logger().Debugf("adding session [%s] fingerprints [%s]", session.Token, session.CertFingerprints)
sm.sessionsByToken.Store(session.Token, session)
sm.apiSessionsByToken.Store(session.Token, session)
sm.Emit(EventAddedSession, session)
}
func (sm *StateManagerImpl) UpdateApiSession(session *edge_ctrl_pb.ApiSession) {
pfxlog.Logger().Debugf("updating session [%s] fingerprints [%s]", session.Token, session.CertFingerprints)
sm.sessionsByToken.Store(session.Token, session)
sm.apiSessionsByToken.Store(session.Token, session)
sm.sessionsByToken.Range(func(key, value interface{}) bool {
if ns, ok := value.(*edge_ctrl_pb.Session); ok {
if ns.ApiSessionId == session.Id { //only update the specific api session's sessions
ns.CertFingerprints = session.CertFingerprints //session.CertFingerprints is all currently valid
}
} else {
pfxlog.Logger().Warn("could not convert value from concurrent map sessionsByToken to Session, this should not happen")
}
return true
})
sm.Emit(EventUpdatedSession, session)
}
func (sm *StateManagerImpl) RemoveApiSession(token string) {
if ns, ok := sm.sessionsByToken.Load(token); ok {
if ns, ok := sm.apiSessionsByToken.Load(token); ok {
pfxlog.Logger().Debugf("removing session [%s]", token)
sm.sessionsByToken.Delete(token)
sm.apiSessionsByToken.Delete(token)
eventName := sm.getSessionRemovedEventName(token)
sm.Emit(eventName)
sm.RemoveAllListeners(eventName)
@@ -124,7 +142,7 @@ func (sm *StateManagerImpl) RemoveMissingApiSessions(knownSessions []*edge_ctrl_
}
var tokensToRemove []string
sm.sessionsByToken.Range(func(key, _ interface{}) bool {
sm.apiSessionsByToken.Range(func(key, _ interface{}) bool {
token, _ := key.(string)
if _, ok := validTokens[token]; !ok {
tokensToRemove = append(tokensToRemove, token)
@@ -145,7 +163,7 @@ func (sm *StateManagerImpl) AddSession(ns *edge_ctrl_pb.Session) {
}
pfxlog.Logger().Debugf("adding network session [%s] fingerprints [%s] TypeId [%v]", ns.Token, ns.CertFingerprints, ns.Type.String())
sm.networkSessionsByToken.Store(ns.Token, ns)
sm.sessionsByToken.Store(ns.Token, ns)
sm.Emit(EventAddedNetworkSession, ns)
}
@@ -157,7 +175,7 @@ func (sm *StateManagerImpl) UpdateSession(ns *edge_ctrl_pb.Session) {
}
pfxlog.Logger().Debugf("updating network session [%s] fingerprints [%s]", ns.Token, ns.CertFingerprints)
sm.networkSessionsByToken.Store(ns.Token, ns)
sm.sessionsByToken.Store(ns.Token, ns)
sm.Emit(EventUpdatedNetworkSession, ns)
}
@@ -168,7 +186,7 @@ func (sm *StateManagerImpl) RemoveMissingSessions(knownSessions []*edge_ctrl_pb.
}
var tokensToRemove []string
sm.networkSessionsByToken.Range(func(key, _ interface{}) bool {
sm.sessionsByToken.Range(func(key, _ interface{}) bool {
token, _ := key.(string)
if _, ok := validTokens[token]; !ok {
tokensToRemove = append(tokensToRemove, token)
@@ -182,9 +200,9 @@ func (sm *StateManagerImpl) RemoveMissingSessions(knownSessions []*edge_ctrl_pb.
}
func (sm *StateManagerImpl) RemoveSession(token string) {
if ns, ok := sm.networkSessionsByToken.Load(token); ok {
if ns, ok := sm.sessionsByToken.Load(token); ok {
pfxlog.Logger().Debugf("removing network session [%s]", token)
sm.networkSessionsByToken.Delete(token)
sm.sessionsByToken.Delete(token)
sm.Emit(EventRemovedNetworkSession, ns)
eventName := sm.getNetworkSessionRemovedEventName(token)
sm.Emit(eventName)
@@ -194,8 +212,8 @@ func (sm *StateManagerImpl) RemoveSession(token string) {
}
}
func (sm *StateManagerImpl) GetSession(token string) *edge_ctrl_pb.ApiSession {
if val, ok := sm.sessionsByToken.Load(token); ok {
func (sm *StateManagerImpl) GetApiSession(token string) *edge_ctrl_pb.ApiSession {
if val, ok := sm.apiSessionsByToken.Load(token); ok {
if session, ok := val.(*edge_ctrl_pb.ApiSession); ok {
return session
}
@@ -203,11 +221,11 @@ func (sm *StateManagerImpl) GetSession(token string) *edge_ctrl_pb.ApiSession {
return nil
}
func (sm *StateManagerImpl) GetSessionByFingerprint(fingerprint string) chan *edge_ctrl_pb.ApiSession {
func (sm *StateManagerImpl) GetApiSessionByFingerprint(fingerprint string) chan *edge_ctrl_pb.ApiSession {
ch := make(chan *edge_ctrl_pb.ApiSession)
go func() {
found := false
sm.sessionsByToken.Range(func(_, value interface{}) bool {
sm.apiSessionsByToken.Range(func(_, value interface{}) bool {
if session, ok := value.(*edge_ctrl_pb.ApiSession); ok {
for _, curPrint := range session.CertFingerprints {
if fingerprint == curPrint {
@@ -228,8 +246,8 @@ func (sm *StateManagerImpl) GetSessionByFingerprint(fingerprint string) chan *ed
return ch
}
func (sm *StateManagerImpl) GetNetworkSession(token string) *edge_ctrl_pb.Session {
if obj, ok := sm.networkSessionsByToken.Load(token); ok {
func (sm *StateManagerImpl) GetSession(token string) *edge_ctrl_pb.Session {
if obj, ok := sm.sessionsByToken.Load(token); ok {
if ns, ok := obj.(*edge_ctrl_pb.Session); ok {
return ns
}
@@ -239,15 +257,15 @@ func (sm *StateManagerImpl) GetNetworkSession(token string) *edge_ctrl_pb.Sessio
return nil
}
func (sm *StateManagerImpl) GetNetworkSessionWithTimeout(token string, timeout time.Duration) *edge_ctrl_pb.Session {
func (sm *StateManagerImpl) GetSessionWithTimeout(token string, timeout time.Duration) *edge_ctrl_pb.Session {
deadline := time.Now().Add(timeout)
session := sm.GetNetworkSession(token)
session := sm.GetSession(token)
if session == nil {
//convert this to return a channel instead of sleeping
waitTime := time.Millisecond
for time.Now().Before(deadline) {
session = sm.GetNetworkSession(token)
session = sm.GetSession(token)
if session != nil {
return session
}
@@ -260,7 +278,7 @@ func (sm *StateManagerImpl) GetNetworkSessionWithTimeout(token string, timeout t
return session
}
func (sm *StateManagerImpl) AddNetworkSessionRemovedListener(token string, callBack func(token string)) RemoveListener {
func (sm *StateManagerImpl) AddSessionRemovedListener(token string, callBack func(token string)) RemoveListener {
eventName := sm.getNetworkSessionRemovedEventName(token)
listener := func(args ...interface{}) {
callBack(token)
@@ -272,7 +290,7 @@ func (sm *StateManagerImpl) AddNetworkSessionRemovedListener(token string, callB
}
}
func (sm *StateManagerImpl) AddSessionRemovedListener(token string, callBack func(token string)) RemoveListener {
func (sm *StateManagerImpl) AddApiSessionRemovedListener(token string, callBack func(token string)) RemoveListener {
eventName := sm.getSessionRemovedEventName(token)
listener := func(args ...interface{}) {
callBack(token)
@@ -317,10 +335,10 @@ func (sm *StateManagerImpl) StartHeartbeat(ctrl channel2.Channel, intervalSecond
pfxlog.Logger().Info("heartbeat starting")
}
func (sm *StateManagerImpl) AddConnectedSession(token string, removeCB func(), ch channel2.Channel) {
func (sm *StateManagerImpl) AddConnectedApiSession(token string, removeCB func(), ch channel2.Channel) {
var sessions map[channel2.Channel]func()
if val, ok := sm.activeSessions.Load(token); ok {
if val, ok := sm.activeApiSessions.Load(token); ok {
if sessions, ok = val.(map[channel2.Channel]func()); !ok {
pfxlog.Logger().Panic("could not convert to active sessions")
}
@@ -329,11 +347,11 @@ func (sm *StateManagerImpl) AddConnectedSession(token string, removeCB func(), c
}
sessions[ch] = removeCB
sm.activeSessions.Store(token, sessions)
sm.activeApiSessions.Store(token, sessions)
}
func (sm *StateManagerImpl) RemoveConnectedSession(token string, ch channel2.Channel) {
if val, ok := sm.activeSessions.Load(token); ok {
func (sm *StateManagerImpl) RemoveConnectedApiSession(token string, ch channel2.Channel) {
if val, ok := sm.activeApiSessions.Load(token); ok {
sessions, ok := val.(map[channel2.Channel]func())
if !ok {
@@ -346,7 +364,7 @@ func (sm *StateManagerImpl) RemoveConnectedSession(token string, ch channel2.Cha
}
if len(sessions) == 0 {
sm.activeSessions.Delete(token)
sm.activeApiSessions.Delete(token)
}
}
}
@@ -354,7 +372,7 @@ func (sm *StateManagerImpl) RemoveConnectedSession(token string, ch channel2.Cha
func (sm *StateManagerImpl) ActiveSessionTokens() []string {
var tokens []string
sm.activeSessions.Range(func(key, _ interface{}) bool {
sm.activeApiSessions.Range(func(key, _ interface{}) bool {
if token, ok := key.(string); ok {
tokens = append(tokens, token)
} else {
+8 -8
View File
@@ -49,9 +49,9 @@ func (handler *sessionConnectionHandler) BindChannel(ch channel2.Channel) error
fpg := cert.NewFingerprintGenerator()
fingerprints := fpg.FromCerts(certificates)
session := handler.stateManager.GetSession(token)
apiSession := handler.stateManager.GetApiSession(token)
if session == nil {
if apiSession == nil {
_ = ch.Close()
subjects := []string{}
@@ -63,25 +63,25 @@ func (handler *sessionConnectionHandler) BindChannel(ch channel2.Channel) error
return fmt.Errorf("no api session found for token [%s], fingerprints: [%v], subjects [%v]", token, fingerprints, subjects)
}
for _, fingerprint := range session.CertFingerprints {
for _, fingerprint := range apiSession.CertFingerprints {
if fingerprints.Contains(fingerprint) {
removeListener := handler.stateManager.AddSessionRemovedListener(token, func(token string) {
removeListener := handler.stateManager.AddApiSessionRemovedListener(token, func(token string) {
if !ch.IsClosed() {
err := ch.Close()
if err != nil {
pfxlog.Logger().WithError(err).Error("could not close channel during session removal")
pfxlog.Logger().WithError(err).Error("could not close channel during api session removal")
}
}
})
handler.stateManager.AddConnectedSession(token, removeListener, ch)
handler.stateManager.AddConnectedApiSession(token, removeListener, ch)
return nil
}
}
_ = ch.Close()
return errors.New("invalid client certificate for session")
return errors.New("invalid client certificate for api session")
}
_ = ch.Close()
return errors.New("no token attribute provided")
@@ -92,7 +92,7 @@ func (handler *sessionConnectionHandler) HandleClose(ch channel2.Channel) {
if byteToken, ok := ch.Underlay().Headers()[edge.SessionTokenHeader]; ok {
token = string(byteToken)
handler.stateManager.RemoveConnectedSession(token, ch)
handler.stateManager.RemoveConnectedApiSession(token, ch)
} else {
pfxlog.Logger().
WithField("id", ch.Id()).
+10 -10
View File
@@ -112,7 +112,7 @@ func (proxy *ingressProxy) processConnect(req *channel2.Message, ch channel2.Cha
}
log.Debug("validating network session")
sm := fabric.GetStateManager()
ns := sm.GetNetworkSessionWithTimeout(token, time.Second*5)
ns := sm.GetSessionWithTimeout(token, time.Second*5)
if ns == nil || ns.Type != edge_ctrl_pb.SessionType_Dial {
log.WithField("token", token).Error("session not found")
@@ -124,14 +124,14 @@ func (proxy *ingressProxy) processConnect(req *channel2.Message, ch channel2.Cha
log.WithField("token", token).
WithField("serviceFingerprints", ns.CertFingerprints).
WithField("clientFingerprints", proxy.fingerprints.Prints()).
Error("matching fingerprint not found")
Error("matching fingerprint not found for connect")
proxy.sendStateClosedReply("Invalid Session", req)
return
}
log.Debug("validating connection id")
removeListener := sm.AddNetworkSessionRemovedListener(ns.Token, func(token string) {
removeListener := sm.AddSessionRemovedListener(ns.Token, func(token string) {
proxy.sendStateClosed(connId, "session closed")
proxy.closeConn(connId)
})
@@ -211,7 +211,7 @@ func (proxy *ingressProxy) processBind(req *channel2.Message, ch channel2.Channe
}
log.Debug("validating network session")
sm := fabric.GetStateManager()
ns := sm.GetNetworkSessionWithTimeout(token, time.Second*5)
ns := sm.GetSessionWithTimeout(token, time.Second*5)
if ns == nil || ns.Type != edge_ctrl_pb.SessionType_Bind {
log.WithField("token", token).Error("session not found")
@@ -223,7 +223,7 @@ func (proxy *ingressProxy) processBind(req *channel2.Message, ch channel2.Channe
log.WithField("token", token).
WithField("serviceFingerprints", ns.CertFingerprints).
WithField("clientFingerprints", proxy.fingerprints.Prints()).
Error("matching fingerprint not found")
Error("matching fingerprint not found for bind")
proxy.sendStateClosedReply("Invalid Session", req)
return
}
@@ -253,7 +253,7 @@ func (proxy *ingressProxy) processBind(req *channel2.Message, ch channel2.Channe
terminatorIdRef := &concurrenz.AtomicString{}
removeListener := sm.AddNetworkSessionRemovedListener(ns.Token, func(token string) {
removeListener := sm.AddSessionRemovedListener(ns.Token, func(token string) {
terminatorId := terminatorIdRef.Get()
defer func() {
log.Debugf("removing listener for terminator %v, token: %v", terminatorId, token)
@@ -320,7 +320,7 @@ func (proxy *ingressProxy) processUnbind(req *channel2.Message, ch channel2.Chan
log := pfxlog.ContextLogger(ch.Label()).WithField("sessionId", token).WithFields(edge.GetLoggerFields(req))
sm := fabric.GetStateManager()
ns := sm.GetNetworkSession(token)
ns := sm.GetSession(token)
if ns == nil {
log.WithField("token", token).Error("session not found")
@@ -332,7 +332,7 @@ func (proxy *ingressProxy) processUnbind(req *channel2.Message, ch channel2.Chan
log.WithField("token", token).
WithField("serviceFingerprints", ns.CertFingerprints).
WithField("clientFingerprints", proxy.fingerprints.Prints()).
Error("matching fingerprint not found")
Error("matching fingerprint not found for unbind")
proxy.sendStateClosedReply("Invalid Session", req)
return
}
@@ -364,7 +364,7 @@ func (proxy *ingressProxy) processUpdateBind(req *channel2.Message, ch channel2.
}
sm := fabric.GetStateManager()
ns := sm.GetNetworkSession(token)
ns := sm.GetSession(token)
if ns == nil {
log.WithField("token", token).Error("session not found")
@@ -376,7 +376,7 @@ func (proxy *ingressProxy) processUpdateBind(req *channel2.Message, ch channel2.
log.WithField("token", token).
WithField("serviceFingerprints", ns.CertFingerprints).
WithField("clientFingerprints", proxy.fingerprints.Prints()).
Error("matching fingerprint not found")
Error("matching fingerprint not found for update bind")
proxy.sendStateClosedReply("Invalid Session", req)
return
}
+163 -4
View File
@@ -884,12 +884,86 @@ paths:
security:
- ztSession: [ ]
tags:
- CurrentAPI Session
- Current API Session
responses:
200:
$ref: '#/responses/emptyResponse'
401:
$ref: '#/responses/unauthorizedResponse'
'/current-api-session/certificates':
get:
summary: List the ephemeral certificates available for the current API Session
description: Retrieves a list of certificate resources for the current API session; supports filtering, sorting, and pagination
security:
- ztSession: [ ]
tags:
- Current API Session
operationId: listCurrentApiSessionCertificates
parameters:
- $ref: '#/parameters/limit'
- $ref: '#/parameters/offset'
- $ref: '#/parameters/filter'
responses:
'200':
$ref: '#/responses/listCurrentApiSessionCertificates'
post:
summary: Creates an ephemeral certificate for the current API Session
description: 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.
security:
- ztSession: [ ]
tags:
- Current API Session
operationId: createCurrentApiSessionCertificate
parameters:
- name: Body
in: body
required: true
description: The payload describing the CSR used to create a session certificate
schema:
$ref: '#/definitions/currentApiSessionCertificateCreate'
responses:
'200':
$ref: '#/responses/createCurrentApiSessionCertificateResponse'
'400':
$ref: '#/responses/badRequestResponse'
'401':
$ref: '#/responses/unauthorizedResponse'
'/current-api-session/certificates/{id}':
parameters:
- $ref: '#/parameters/id'
get:
summary: Retrieves an ephemeral certificate
description: Retrieves a single ephemeral certificate by id
security:
- ztSession: [ ]
tags:
- Current API Session
operationId: detailCurrentApiSessionCertificate
responses:
'200':
$ref: '#/responses/detailCurrentApiSessionCertificate'
'404':
$ref: '#/responses/notFoundResponse'
'401':
$ref: '#/responses/unauthorizedResponse'
delete:
summary: Delete an ephemeral certificate
description: |
Delete an ephemeral certificateby id
security:
- ztSession: [ ]
tags:
- Current API Session
operationId: deleteCurrentApiSessionCertificate
responses:
'200':
$ref: '#/responses/deleteResponse'
'400':
$ref: '#/responses/badRequestResponse'
'401':
$ref: '#/responses/unauthorizedResponse'
'/current-identity':
get:
summary: Return the current identity
@@ -3464,7 +3538,18 @@ responses:
enrollment: { }
roleAttributes:
$ref: '#/definitions/attributes'
listCurrentApiSessionCertificates:
description: A list of the current API Session's certificate
schema:
$ref: '#/definitions/listCurrentAPISessionCertificatesEnvelope'
createCurrentApiSessionCertificateResponse:
description: A response of a create API Session certificate
schema:
$ref: '#/definitions/createCurrentApiSessionCertificateEnvelope'
detailCurrentApiSessionCertificate:
description: A response containing a single API Session certificate
schema:
$ref: '#/definitions/detailCurrentApiSessionCertificateEnvelope'
###################################################################
# API Session
##################################################################
@@ -3775,6 +3860,7 @@ responses:
schema:
$ref: '#/definitions/detailPostureCheckEnvelope'
#######################################################################################################################
#
# Definitions - In & Out Models Only
@@ -5456,6 +5542,33 @@ definitions:
$ref: '#/definitions/meta'
data:
$ref: '#/definitions/apiSessionList'
listCurrentAPISessionCertificatesEnvelope:
required:
- meta
- data
properties:
meta:
$ref: '#/definitions/meta'
data:
$ref: '#/definitions/currentApiSessionCertificateList'
createCurrentApiSessionCertificateEnvelope:
required:
- meta
- data
properties:
meta:
$ref: '#/definitions/meta'
data:
$ref: '#/definitions/currentApiSessionCertificateCreateResponse'
detailCurrentApiSessionCertificateEnvelope:
required:
- meta
- data
properties:
meta:
$ref: '#/definitions/meta'
data:
$ref: '#/definitions/currentApiSessionCertificateDetail'
detailAPISessionEnvelope:
required:
- meta
@@ -6189,7 +6302,6 @@ definitions:
- default
- required
- failed
dataIntegrityCheckResultEnvelope:
type: object
required:
@@ -6692,4 +6804,51 @@ definitions:
type: array
items:
type: string
x-class: "PROCESS"
x-class: "PROCESS"
currentApiSessionCertificateList:
type: array
items:
$ref: '#/definitions/currentApiSessionCertificateDetail'
currentApiSessionCertificateDetail:
type: object
allOf:
- $ref: '#/definitions/baseEntity'
- type: object
required:
- subject
- fingerprint
- validFrom
- validTo
- certificate
properties:
subject:
type: string
fingerprint:
type: string
validFrom:
type: string
format: date-time
validTo:
type: string
format: date-time
certificate:
type: string
currentApiSessionCertificateCreate:
type: object
required:
- csr
properties:
csr:
type: string
currentApiSessionCertificateCreateResponse:
allOf:
- $ref: '#/definitions/createLocation'
- type: object
required:
- certificate
properties:
certificate:
type: string
cas:
type: string
+208
View File
@@ -0,0 +1,208 @@
// +build apitests
/*
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 tests
import (
"crypto"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"encoding/pem"
"github.com/Jeffail/gabs"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/foundation/identity/certtools"
"net/http"
"os"
"testing"
)
func Test_Api_Session_Certs(t *testing.T) {
ctx := NewTestContext(t)
defer ctx.Teardown()
ctx.StartServer()
t.Run("as the default admin, session certs", func(t *testing.T) {
var createdResponseBody *gabs.Container //used across multiple subtests, set in first
var createdId string //used across multiple subtests, set in first
t.Run("can be created", func(t *testing.T) {
ctx.testContextChanged(t)
ctx.RequireAdminLogin()
csr, _, err := generateCsr()
ctx.Req.NoError(err)
csrPem := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE REQUEST", Bytes: csr})
ctx.Req.NotEmpty(csrPem)
request := ctx.AdminSession.newAuthenticatedRequest()
body := gabs.New()
body.Set(string(csrPem), "csr")
bodyStr := body.String()
request.SetBody(bodyStr)
resp, err := request.Post("/current-api-session/certificates")
ctx.Req.NoError(err)
standardJsonResponseTests(resp, http.StatusCreated, t)
createdResponseBody, err = gabs.ParseJSON(resp.Body())
ctx.Req.NoError(err)
var ok bool
createdId, ok = createdResponseBody.Path("data.id").Data().(string)
ctx.Req.True(ok)
ctx.Req.NotEmpty(createdId)
certificate := createdResponseBody.Path("data.certificate").Data().(string)
ctx.Req.NotEmpty(certificate)
x509Cert, err := certtools.LoadCert([]byte(certificate))
ctx.Req.NotEmpty(x509Cert)
ctx.Req.NoError(err)
})
t.Run("can be listed", func(t *testing.T) {
ctx.testContextChanged(t)
resp, err := ctx.AdminSession.newAuthenticatedRequest().Get("/current-api-session/certificates")
ctx.Req.NoError(err)
ctx.Req.Equal(http.StatusOK, resp.StatusCode())
t.Run("list contains the API session cert", func(t *testing.T) {
ctx.testContextChanged(t)
bodyStr := resp.Body()
body, err := gabs.ParseJSON(bodyStr)
ctx.Req.NoError(err)
data := body.Path("data")
ctx.Req.NotEmpty(data)
children, err := data.Children()
ctx.Req.NoError(err)
ctx.Req.Len(children, 1)
subject := children[0].Path("subject").Data().(string)
ctx.Req.NotEmpty(subject)
fingerprint := children[0].Path("fingerprint").Data().(string)
ctx.Req.NotEmpty(fingerprint)
validFrom := children[0].Path("validFrom").Data().(string)
ctx.Req.NotEmpty(validFrom)
validTo := children[0].Path("validTo").Data().(string)
ctx.Req.NotEmpty(validTo)
certificate := children[0].Path("certificate").Data().(string)
ctx.Req.NotEmpty(certificate)
x509Cert, err := certtools.LoadCert([]byte(certificate))
ctx.Req.NotEmpty(x509Cert)
ctx.Req.NoError(err)
})
})
t.Run("can be detailed", func(t *testing.T) {
ctx.testContextChanged(t)
resp, err := ctx.AdminSession.newAuthenticatedRequest().Get("/current-api-session/certificates/" + createdId)
ctx.Req.NoError(err)
ctx.Req.Equal(http.StatusOK, resp.StatusCode())
t.Run("contains proper values", func(t *testing.T) {
ctx.testContextChanged(t)
bodyStr := resp.Body()
body, err := gabs.ParseJSON(bodyStr)
ctx.Req.NoError(err)
data := body.Path("data")
ctx.Req.NotEmpty(data)
subject := data.Path("subject").Data().(string)
ctx.Req.NotEmpty(subject)
fingerprint := data.Path("fingerprint").Data().(string)
ctx.Req.NotEmpty(fingerprint)
validFrom := data.Path("validFrom").Data().(string)
ctx.Req.NotEmpty(validFrom)
validTo := data.Path("validTo").Data().(string)
ctx.Req.NotEmpty(validTo)
certificate := data.Path("certificate").Data().(string)
ctx.Req.NotEmpty(certificate)
x509Cert, err := certtools.LoadCert([]byte(certificate))
ctx.Req.NotEmpty(x509Cert)
ctx.Req.NoError(err)
})
})
t.Run("can be deleted", func(t *testing.T) {
ctx.testContextChanged(t)
resp, err := ctx.AdminSession.newAuthenticatedRequest().Delete("/current-api-session/certificates/" + createdId)
ctx.Req.NoError(err)
standardJsonResponseTests(resp, http.StatusOK, t)
})
})
}
func generateCsr() ([]byte, crypto.PrivateKey, error) {
p384 := elliptic.P384()
pfxlog.Logger().Infof("generating %s EC key", p384.Params().Name)
privateKey, err := ecdsa.GenerateKey(p384, rand.Reader)
if err != nil {
return nil, nil, err
}
hostname, err := os.Hostname()
if err != nil {
return nil, nil, err
}
request, err := certtools.NewCertRequest(map[string]string{
"C": "US", "O": "TEST", "CN": hostname,
}, nil)
if err != nil {
return nil, nil, err
}
csr, err := x509.CreateCertificateRequest(rand.Reader, request, privateKey)
if err != nil {
return nil, nil, err
}
return csr, privateKey, nil
}