Documentation ¶
Index ¶
- Constants
- Variables
- func FilterAndPaginate(db *gorm.DB, model interface{}, c *gin.Context, orderBy string) *gorm.DB
- func FilterAndPaginateWithQuery(db *gorm.DB, model interface{}, c *gin.Context, query Query, ...) *gorm.DB
- func KeyUsagesForCertificateOrCertificateRequest(isCA bool, usages ...models.KeyUsage) (ku x509.KeyUsage, eku []x509.ExtKeyUsage, err error)
- func NewCertPools(pemBytes []byte) (*x509.CertPool, *x509.CertPool, error)
- func NewInternalServerError(c *gin.Context, logger *zap.SugaredLogger, err error) *models.InternalServerError
- func SendInternalServerError(c *gin.Context, logger *zap.SugaredLogger, err error)
- func ValidateCreateSecurityGroupRules(sg models.AddSecurityGroup) error
- func ValidateRule(rule models.SecurityRule) error
- func ValidateUpdateSecurityGroupRules(sg models.UpdateSecurityGroup) error
- func VerifyCertificate(certPEMBlock []byte, caCertPEMBlock []byte, keyUsages ...x509.ExtKeyUsage) error
- type API
- func (api *API) AcceptInvitation(c *gin.Context)
- func (api *API) Certs(c *gin.Context)
- func (api *API) Check(ctx context.Context, checkReq *auth.CheckRequest) (*auth.CheckResponse, error)
- func (api *API) CreateDevice(c *gin.Context)
- func (api *API) CreateInvitation(c *gin.Context)
- func (api *API) CreateOrganization(c *gin.Context)
- func (api *API) CreateRegKey(c *gin.Context)
- func (api *API) CreateSecurityGroup(c *gin.Context)
- func (api *API) CreateServiceNetwork(c *gin.Context)
- func (api *API) CreateServiceNetworkCertKeyPair(serviceNetwork *models.ServiceNetwork) (string, string, error)
- func (api *API) CreateSite(c *gin.Context)
- func (api *API) CreateUserIfNotExists(ctx context.Context, idpId string, userName string, ...) (uuid.UUID, error)
- func (api *API) CreateVPC(c *gin.Context)
- func (api *API) CurrentUserHasRole(c *gin.Context, db *gorm.DB, orgIdField string, allowedRoles []string) *gorm.DB
- func (api *API) DeleteDevice(c *gin.Context)
- func (api *API) DeleteDeviceMetadata(c *gin.Context)
- func (api *API) DeleteDeviceMetadataKey(c *gin.Context)
- func (api *API) DeleteInvitation(c *gin.Context)
- func (api *API) DeleteOrganization(c *gin.Context)
- func (api *API) DeleteOrganizationUser(c *gin.Context)
- func (api *API) DeleteRegKey(c *gin.Context)
- func (api *API) DeleteSecurityGroup(c *gin.Context)
- func (api *API) DeleteServiceNetwork(c *gin.Context)
- func (api *API) DeleteSite(c *gin.Context)
- func (api *API) DeleteUser(c *gin.Context)
- func (api *API) DeleteUserFromOrganization(c *gin.Context)
- func (api *API) DeleteVPC(c *gin.Context)
- func (api *API) DeviceIsOwnedByCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) FlagCheck(c *gin.Context, name string) bool
- func (api *API) GarbageCollect(c *gin.Context)
- func (api *API) GetCurrentUserID(c *gin.Context) uuid.UUID
- func (api *API) GetDevice(c *gin.Context)
- func (api *API) GetDeviceMetadataKey(c *gin.Context)
- func (api *API) GetFeatureFlag(c *gin.Context)
- func (api *API) GetInvitation(c *gin.Context)
- func (api *API) GetOrganizationUser(c *gin.Context)
- func (api *API) GetOrganizations(c *gin.Context)
- func (api *API) GetRegKey(c *gin.Context)
- func (api *API) GetSecurityGroup(c *gin.Context)
- func (api *API) GetServiceNetwork(c *gin.Context)
- func (api *API) GetSite(c *gin.Context)
- func (api *API) GetUser(c *gin.Context)
- func (api *API) GetVPC(c *gin.Context)
- func (api *API) InvitationIsForCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) InvitationIsForCurrentUserOrOrgOwner(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) IsMemberOfOrg(c *gin.Context, orgId uuid.UUID) (bool, error)
- func (api *API) IsOwnerOfOrg(c *gin.Context, orgId uuid.UUID) (bool, error)
- func (api *API) JSONWebKeySet() ([]byte, error)
- func (api *API) ListDeviceMetadata(c *gin.Context)
- func (api *API) ListDevices(c *gin.Context)
- func (api *API) ListDevicesInVPC(c *gin.Context)
- func (api *API) ListFeatureFlags(c *gin.Context)
- func (api *API) ListInvitations(c *gin.Context)
- func (api *API) ListMetadataInVPC(c *gin.Context)
- func (api *API) ListOrganizationUsers(c *gin.Context)
- func (api *API) ListOrganizations(c *gin.Context)
- func (api *API) ListRegKeys(c *gin.Context)
- func (api *API) ListSecurityGroups(c *gin.Context)
- func (api *API) ListSecurityGroupsInVPC(c *gin.Context)
- func (api *API) ListServiceNetworks(c *gin.Context)
- func (api *API) ListSites(c *gin.Context)
- func (api *API) ListSitesInServiceNetwork(c *gin.Context)
- func (api *API) ListUsers(c *gin.Context)
- func (api *API) ListVPCs(c *gin.Context)
- func (api *API) Live(c *gin.Context)
- func (api *API) Logger(ctx context.Context) *zap.SugaredLogger
- func (api *API) NewInternalServerError(c *gin.Context, err error) *models.InternalServerError
- func (api *API) OrganizationIsOwnedByCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) OrganizationIsReadableByCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) Ready(c *gin.Context)
- func (api *API) RegKeyIsForCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) RegKeyIsForCurrentUserOrOrgOwner(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) SecurityGroupIsReadableByCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) SecurityGroupIsWriteableByCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) SendEmail(message email.Message) error
- func (api *API) SendInternalServerError(c *gin.Context, err error)
- func (api *API) ServiceNetworkIsOwnedByCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) ServiceNetworkIsReadableByCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) SignCSR(c *gin.Context)
- func (api *API) SiteIsOwnedByCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) UpdateDevice(c *gin.Context)
- func (api *API) UpdateDeviceMetadataKey(c *gin.Context)
- func (api *API) UpdateRegKey(c *gin.Context)
- func (api *API) UpdateSecurityGroup(c *gin.Context)
- func (api *API) UpdateServiceNetwork(c *gin.Context)
- func (api *API) UpdateSite(c *gin.Context)
- func (api *API) UpdateVPC(c *gin.Context)
- func (api *API) UserIsCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) VPCIsOwnedByCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) VPCIsReadableByCurrentUser(c *gin.Context, db *gorm.DB) *gorm.DB
- func (api *API) WatchEvents(c *gin.Context)
- func (api *API) WatchEventsInVPC(c *gin.Context)
- type AgentTracker
- type ApiResponseError
- type CertificateKeyPair
- type Query
- type Watch
Constants ¶
const AuthUserName string = "_nexodus.UserName"
key for username in gin.Context
const CacheExp time.Duration = 0
CacheExp Zero expiration means the key has no expiration time.
const CachePrefix = "user:"
const SESSION_ID_COOKIE_NAME = "sid"
const (
TotalCountHeader = "X-Total-Count"
)
Variables ¶
var MemberRoles = []string{"owner", "member"}
var OwnerRoles = []string{"owner"}
Functions ¶
func FilterAndPaginate ¶
func NewCertPools ¶
NewCertPools creates x509 cert pools from the given PEM bytes.
func NewInternalServerError ¶
func NewInternalServerError(c *gin.Context, logger *zap.SugaredLogger, err error) *models.InternalServerError
func SendInternalServerError ¶
func SendInternalServerError(c *gin.Context, logger *zap.SugaredLogger, err error)
func ValidateCreateSecurityGroupRules ¶
func ValidateCreateSecurityGroupRules(sg models.AddSecurityGroup) error
ValidateCreateSecurityGroupRules validates rules for creating a new security group
func ValidateRule ¶
func ValidateRule(rule models.SecurityRule) error
ValidateRule validates individual rule
func ValidateUpdateSecurityGroupRules ¶
func ValidateUpdateSecurityGroupRules(sg models.UpdateSecurityGroup) error
ValidateUpdateSecurityGroupRules validates rules for updating the security group
func VerifyCertificate ¶
func VerifyCertificate(certPEMBlock []byte, caCertPEMBlock []byte, keyUsages ...x509.ExtKeyUsage) error
Types ¶
type API ¶
type API struct { Redis *redis.Client URL string URLParsed *url.URL PrivateKey *rsa.PrivateKey Certificates []*x509.Certificate SmtpServer email.SmtpServer SmtpFrom string FrontendURL string // contains filtered or unexported fields }
func (*API) AcceptInvitation ¶
AcceptInvitation accepts an invitation @Summary Accept an invitation @Description Accept an invitation to an organization @Id AcceptInvitation @Tags Invitation @Accept json @Produce json @Param id path string true "Invitation ID" @Success 204 @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/invitations/{id}/accept [post]
func (*API) Certs ¶
Certs gets the jwks that can be used to verify JWTs created by this server. @Summary gets the jwks @Description gets the jwks that can be used to verify JWTs created by this server. @Id Certs @Tags Auth @Accept json @Produce json @Success 200 {object} interface{} @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /device/certs [get]
func (*API) Check ¶
func (api *API) Check(ctx context.Context, checkReq *auth.CheckRequest) (*auth.CheckResponse, error)
Check implements Envoy Authorization service. Proto file: https://github.com/envoyproxy/envoy/blob/main/api/envoy/service/auth/v3/external_auth.proto
We use this to convert the browser cookie to a JWT in the authorization header. This can then be used by envoy to rate limit requests.
func (*API) CreateDevice ¶
CreateDevice handles adding a new device @Summary Add Devices @Id CreateDevice @Tags Devices @Description Adds a new device @Accept json @Produce json @Param Device body models.AddDevice true "Add Device" @Success 201 {object} models.Device @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 409 {object} models.ConflictsError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/devices [post]
func (*API) CreateInvitation ¶
CreateInvitation creates an invitation @Summary Create an invitation @Description Create an invitation to an organization @Id CreateInvitation @Tags Invitation @Accept json @Produce json @Param Invitation body models.AddInvitation true "Add Invitation" @Success 201 {object} models.Invitation @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/invitations [post]
func (*API) CreateOrganization ¶
CreateOrganization creates a new Organization @Summary Create an Organization @Description Creates a named organization with the given CIDR @Id CreateOrganization @Tags Organizations @Accept json @Produce json @Param Organization body models.AddOrganization true "Add Organization" @Success 201 {object} models.Organization @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 405 {object} models.BaseError @Failure 409 {object} models.ConflictsError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/organizations [post]
func (*API) CreateRegKey ¶
CreateRegKey creates a RegKey @Summary Create a RegKey @Description Create a RegKey for a vpc @Id CreateRegKey @Tags RegKey @Accept json @Produce json @Param RegKey body models.AddRegKey true "Add RegKey" @Success 201 {object} models.RegKey @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/reg-keys [post]
func (*API) CreateSecurityGroup ¶
CreateSecurityGroup handles adding a new SecurityGroup @Summary Add SecurityGroup @Id CreateSecurityGroup @Tags SecurityGroup @Description Adds a new Security Group @Accepts json @Produce json @Param SecurityGroup body models.AddSecurityGroup true "Add SecurityGroup" @Success 201 {object} models.SecurityGroup @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 409 {object} models.ConflictsError @Failure 422 {object} models.ValidationError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/security-groups [post]
func (*API) CreateServiceNetwork ¶
CreateServiceNetwork creates a new ServiceNetwork @Summary Create an ServiceNetwork @Description Creates a named serviceNetwork with the given CIDR @Id CreateServiceNetwork @Tags ServiceNetwork @Accept json @Produce json @Param ServiceNetwork body models.AddServiceNetwork true "Add ServiceNetwork" @Success 201 {object} models.ServiceNetwork @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 405 {object} models.BaseError @Failure 409 {object} models.ConflictsError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/service-networks [post]
func (*API) CreateServiceNetworkCertKeyPair ¶
func (*API) CreateSite ¶
CreateSite handles adding a new site @Summary Add Sites @Id CreateSite @Tags Sites @Description Adds a new site @Accept json @Produce json @Param Site body models.AddSite true "Add Site" @Success 201 {object} models.Site @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 409 {object} models.ConflictsError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/sites [post]
func (*API) CreateUserIfNotExists ¶
func (*API) CreateVPC ¶
CreateVPC creates a new VPC @Summary Create an VPC @Description Creates a named vpc with the given CIDR @Id CreateVPC @Tags VPC @Accept json @Produce json @Param VPC body models.AddVPC true "Add VPC" @Success 201 {object} models.VPC @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 405 {object} models.BaseError @Failure 409 {object} models.ConflictsError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/vpcs [post]
func (*API) CurrentUserHasRole ¶
func (*API) DeleteDevice ¶
DeleteDevice handles deleting an existing device and associated ipam lease @Summary Delete Device @Description Deletes an existing device and associated IPAM lease @Id DeleteDevice @Tags Devices @Accept json @Produce json @Param id path string true "Device ID" @Success 204 {object} models.Device @Failure 400 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/devices/{id} [delete]
func (*API) DeleteDeviceMetadata ¶
DeleteDeviceMetadata Delete all metadata or a specific key on a device @Summary Delete all Device metadata @Id DeleteDeviceMetadata @Tags Devices @Description Delete all metadata for a device @Param id path string true "Device ID" @Success 204 @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/devices/{id}/metadata [delete]
func (*API) DeleteDeviceMetadataKey ¶
DeleteDeviceMetadataKey Delete all metadata or a specific key on a device @Summary Delete a Device metadata key @Id DeleteDeviceMetadataKey @Tags Devices @Description Delete a metadata key for a device @Param id path string true "Device ID" @Param key path string false "Metadata Key" @Success 204 @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/devices/{id}/metadata/{key} [delete]
func (*API) DeleteInvitation ¶
DeleteInvitation handles deleting an existing organization and associated ipam prefix @Summary Delete Invitation @Description Deletes an existing invitation @Id DeleteInvitation @Tags Invitation @Accept json @Produce json @Param id path string true "Invitation ID" @Success 204 {object} models.Organization @Failure 400 {object} models.BaseError @Failure 405 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/invitations/{id} [delete]
func (*API) DeleteOrganization ¶
DeleteOrganization handles deleting an existing organization and associated ipam prefix @Summary Delete Organization @Description Deletes an existing organization and associated IPAM prefix @Id DeleteOrganization @Tags Organizations @Accept json @Produce json @Param id path string true "Organization ID" @Success 204 {object} models.Organization @Failure 400 {object} models.BaseError @Failure 405 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/organizations/{id} [delete]
func (*API) DeleteOrganizationUser ¶
DeleteOrganizationUser handles deleting a user from an organization @Summary Delete a Organization User @Description Deletes an existing organization user @Id DeleteOrganizationUser @Tags Organizations @Accept json @Produce json @Param id path string true "Organization ID" @Param uid path string true "User ID" @Success 204 {object} models.UserOrganization @Failure 400 {object} models.ValidationError @Failure 404 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/organizations/{id}/users/{uid} [delete]
func (*API) DeleteRegKey ¶
DeleteRegKey handles deleting a RegKey @Summary Delete RegKey @Description Deletes an existing RegKey @Id DeleteRegKey @Tags RegKey @Accept json @Produce json @Param id path string true "RegKey ID" @Success 204 {object} models.RegKey @Failure 400 {object} models.BaseError @Failure 405 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/reg-keys/{id} [delete]
func (*API) DeleteSecurityGroup ¶
DeleteSecurityGroup handles deleting an existing security group @Summary Delete SecurityGroup @Description Deletes an existing SecurityGroup @Id DeleteSecurityGroup @Tags SecurityGroup @Accepts json @Produce json @Param id path string true "Security Group ID" @Success 204 {object} models.SecurityGroup @Failure 400 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/security-groups/{id} [delete]
func (*API) DeleteServiceNetwork ¶
DeleteServiceNetwork handles deleting an existing serviceNetwork @Summary Delete ServiceNetwork @Description Deletes an existing serviceNetwork @Id DeleteServiceNetwork @Tags ServiceNetwork @Accept json @Produce json @Param id path string true "ServiceNetwork ID" @Success 204 {object} models.ServiceNetwork @Failure 400 {object} models.BaseError @Failure 405 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/service-networks/{id} [delete]
func (*API) DeleteSite ¶
DeleteSite handles deleting an existing site and associated ipam lease @Summary Delete Site @Description Deletes an existing site and associated IPAM lease @Id DeleteSite @Tags Sites @Accept json @Produce json @Param id path string true "Site ID" @Success 204 {object} models.Site @Failure 400 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/sites/{id} [delete]
func (*API) DeleteUser ¶
DeleteUser delete a user @Summary Delete User @Description Delete a user @Id DeleteUser @Tags Users @Accept json @Produce json @Param id path string true "User ID" @Success 200 {object} models.User @Failure 400 {object} models.ValidationError @Failure 400 {object} models.NotAllowedError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/users/{id} [delete]
func (*API) DeleteUserFromOrganization ¶
DeleteUserFromOrganization removes a user from an organization @Summary Remove a User from an Organization @Description Deletes an existing organization associated to a user @Id DeleteUserFromOrganization @Tags Users @Accept json @Produce json @Param id path string true "User ID" @Param organization path string true "Organization ID" @Success 204 {object} models.User @Failure 400 {object} models.BaseError @Failure 400 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/users/{id}/organizations/{organization} [delete]
func (*API) DeleteVPC ¶
DeleteVPC handles deleting an existing vpc and associated ipam prefix @Summary Delete VPC @Description Deletes an existing vpc and associated IPAM prefix @Id DeleteVPC @Tags VPC @Accept json @Produce json @Param id path string true "VPC ID" @Success 204 {object} models.VPC @Failure 400 {object} models.BaseError @Failure 405 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/vpcs/{id} [delete]
func (*API) DeviceIsOwnedByCurrentUser ¶
func (*API) GarbageCollect ¶
GarbageCollect cleans up old soft deleted records @Summary Cleans up old soft deleted records @Description Cleans up old soft deleted records @Id GarbageCollect @Tags Private @Accept json @Produce json @Param retention query string false "how long to retain deleted records. defaults to '24h'" @Success 204 @Failure 400 {object} models.ValidationError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /admin/gc [post]
func (*API) GetDevice ¶
GetDevice gets a device by ID @Summary Get Devices @Description Gets a device by ID @Id GetDevice @Tags Devices @Accept json @Produce json @Param id path string true "Device ID" @Success 200 {object} models.Device @Failure 401 {object} models.BaseError @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/devices/{id} [get]
func (*API) GetDeviceMetadataKey ¶
GetDeviceMetadataKey Get value for a metadata key on a device @Summary Get Device Metadata @Id GetDeviceMetadataKey @Tags Devices @Description Get metadata for a device @Param id path string true "Device ID" @Param key path string true "Metadata Key" @Accept json @Produce json @Success 200 {object} models.DeviceMetadata @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/devices/{id}/metadata/{key} [get]
func (*API) GetFeatureFlag ¶
GetFeatureFlag gets a feature flag by name @Summary Get Feature Flag @Description Gets a Feature Flag by name @Id GetFeatureFlag @Tags FFlag @Accept json @Produce json @Param name path string true "feature flag name" @Success 200 {object} map[string]bool @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/fflags/{name} [get]
func (*API) GetInvitation ¶
GetInvitation gets a specific Invitation @Summary Get Invitation @Description Gets an Invitation by Invitation ID @Id GetInvitation @Tags Invitation @Accept json @Produce json @Param id path string true "Invitation ID" @Success 200 {object} models.Invitation @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/invitations/{id} [get]
func (*API) GetOrganizationUser ¶
GetOrganizationUser gets a specific Organization User @Summary Get Organization User @Description Gets a Organization User by Organization ID and User ID @Id GetOrganizationUser @Tags Organizations @Accept json @Produce json @Param id path string true "Organization ID" @Param uid path string true "User ID" @Success 200 {object} models.UserOrganization @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/organizations/{id}/users/{uid} [get]
func (*API) GetOrganizations ¶
GetOrganizations gets a specific Organization @Summary Get Organizations @Description Gets a Organization by Organization ID @Id GetOrganizations @Tags Organizations @Accept json @Produce json @Param id path string true "Organization ID" @Success 200 {object} models.Organization @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/organizations/{id} [get]
func (*API) GetRegKey ¶
GetRegKey gets a specific RegKey @Summary Get a RegKey @Description Gets a RegKey by RegKey ID @Id GetRegKey @Tags RegKey @Accept json @Produce json @Param id path string true "RegKey ID" @Success 200 {object} models.RegKey @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/reg-keys/{id} [get]
func (*API) GetSecurityGroup ¶
GetSecurityGroup gets a Security Group by ID @Summary Get SecurityGroup @Description Gets a security group by ID @Id GetSecurityGroup @Tags SecurityGroup @Accepts json @Produce json @Param id path string true "Security Group ID" @Success 200 {object} models.SecurityGroup @Failure 401 {object} models.BaseError @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/security-groups/{id} [get]
func (*API) GetServiceNetwork ¶
GetServiceNetwork gets a specific ServiceNetwork @Summary Get ServiceNetworks @Description Gets a ServiceNetwork by ServiceNetwork ID @Id GetServiceNetwork @Tags ServiceNetwork @Accept json @Produce json @Param id path string true "ServiceNetwork ID" @Success 200 {object} models.ServiceNetwork @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/service-networks/{id} [get]
func (*API) GetSite ¶
GetSite gets a site by ID @Summary Get Sites @Description Gets a site by ID @Id GetSite @Tags Sites @Accept json @Produce json @Param id path string true "Site ID" @Success 200 {object} models.Site @Failure 401 {object} models.BaseError @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/sites/{id} [get]
func (*API) GetUser ¶
GetUser gets a user @Summary Get User @Description Gets a user @Id GetUser @Tags Users @Accept json @Produce json @Param id path string true "User ID" @Success 200 {object} models.User @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/users/{id} [get]
func (*API) GetVPC ¶
GetVPC gets a specific VPC @Summary Get VPCs @Description Gets a VPC by VPC ID @Id GetVPC @Tags VPC @Accept json @Produce json @Param id path string true "VPC ID" @Success 200 {object} models.VPC @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/vpcs/{id} [get]
func (*API) InvitationIsForCurrentUser ¶
func (*API) InvitationIsForCurrentUserOrOrgOwner ¶
func (*API) IsMemberOfOrg ¶
IsMemberOfOrg checks if the current user is a member of the organization, returns true if he is.
func (*API) IsOwnerOfOrg ¶
IsOwnerOfOrg checks if the current user is a owner of the organization, returns true if he is.
func (*API) JSONWebKeySet ¶
func (*API) ListDeviceMetadata ¶
ListDeviceMetadata lists metadata for a device @Summary List Device Metadata @Id ListDeviceMetadata @Tags Devices @Description Lists metadata for a device @Param id path string true "Device ID" @Param gt_revision query uint64 false "greater than revision" @Accept json @Produce json @Success 200 {object} []models.DeviceMetadata @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/devices/{id}/metadata [get]
func (*API) ListDevices ¶
ListDevices lists all devices @Summary List Devices @Description Lists all devices @Id ListDevices @Tags Devices @Accept json @Produce json @Success 200 {object} []models.Device @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/devices [get]
func (*API) ListDevicesInVPC ¶
ListDevicesInVPC lists all devices in an VPC @Summary List Devices @Description Lists all devices for this VPC @Id ListDevicesInVPC @Tags VPC @Accept json @Produce json @Param gt_revision query uint64 false "greater than revision" @Param id path string true "VPC ID" @Success 200 {object} []models.Device @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/vpcs/{id}/devices [get]
func (*API) ListFeatureFlags ¶
ListFeatureFlags lists all feature flags @Summary List Feature Flags @Description Lists all feature flags @Id ListFeatureFlags @Tags FFlag @Accept json @Produce json @Success 200 {object} map[string]bool @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/fflags [get]
func (*API) ListInvitations ¶
ListInvitations lists invitations @Summary List Invitations @Description Lists all invitations @Id ListInvitations @Tags Invitation @Accept json @Produce json @Success 200 {object} []models.Invitation @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/invitations [get]
func (*API) ListMetadataInVPC ¶
ListMetadataInVPC lists metadata for all devices in the vpc @Summary List Device Metadata @Id ListMetadataInVPC @Tags VPC @Description Lists metadata for a device @Param id path string true "VPC ID" @Param gt_revision query uint64 false "greater than revision" @Param prefix query []string false "used to filter down to the specified key prefixes" @Param key query string false "used to filter down to the specified key" @Accept json @Produce json @Success 200 {object} []models.DeviceMetadata @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/vpcs/{id}/metadata [get]
func (*API) ListOrganizationUsers ¶
ListOrganizationUsers lists the users of an organization @Summary List Organization Users @Description Lists all the users of an organization @Id ListOrganizationUsers @Tags Organizations @Accept json @Produce json @Param id path string true "Organization ID" @Success 200 {object} []models.UserOrganization @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/organizations/{id}/users [get]
func (*API) ListOrganizations ¶
ListOrganizations lists all Organizations @Summary List Organizations @Description Lists all Organizations @Id ListOrganizations @Tags Organizations @Accept json @Produce json @Success 200 {object} []models.Organization @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/organizations [get]
func (*API) ListRegKeys ¶
ListRegKeys lists reg keys @Summary List reg keys @Description Lists all reg keys @Id ListRegKeys @Tags RegKey @Accept json @Produce json @Success 200 {object} []models.RegKey @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/reg-keys [get]
func (*API) ListSecurityGroups ¶
ListSecurityGroups lists all Security Groups @Summary List Security Groups @Description Lists all Security Groups @Id ListSecurityGroups @Tags SecurityGroup @Accepts json @Produce json @Param gt_revision query uint64 false "greater than revision" @Success 200 {object} []models.SecurityGroup @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/security-groups [get]
func (*API) ListSecurityGroupsInVPC ¶
ListSecurityGroupsInVPC lists all Security Groups in a VPC @Summary List Security Groups in a VPC @Description Lists all Security Groups in a VPC @Id ListSecurityGroupsInVPC @Tags VPC @Accepts json @Produce json @Param gt_revision query uint64 false "greater than revision" @Param id path string true "VPC ID" @Success 200 {object} []models.SecurityGroup @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/vpcs/{id}/security-groups [get]
func (*API) ListServiceNetworks ¶
ListServiceNetworks lists all ServiceNetworks @Summary List ServiceNetworks @Description Lists all ServiceNetworks @Id ListServiceNetworks @Tags ServiceNetwork @Accept json @Produce json @Success 200 {object} []models.ServiceNetwork @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/service-networks [get]
func (*API) ListSites ¶
ListSites lists all sites @Summary List Sites @Description Lists all sites @Id ListSites @Tags Sites @Accept json @Produce json @Success 200 {object} []models.Site @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/sites [get]
func (*API) ListSitesInServiceNetwork ¶
ListSitesInServiceNetwork lists all sites in an ServiceNetwork @Summary List Sites @Description Lists all sites for this ServiceNetwork @Id ListSitesInServiceNetwork @Tags ServiceNetwork @Accept json @Produce json @Param gt_revision query uint64 false "greater than revision" @Param id path string true "Service Network ID" @Success 200 {object} []models.Site @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/ServiceNetworks/{id}/sites [get]
func (*API) ListUsers ¶
ListUsers lists users @Summary List Users @Description Lists all users @Id ListUsers @Tags Users @Accept json @Produce json @Success 200 {object} []models.User @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/users [get]
func (*API) ListVPCs ¶
ListVPCs lists all VPCs @Summary List VPCs @Description Lists all VPCs @Id ListVPCs @Tags VPC @Accept json @Produce json @Success 200 {object} []models.VPC @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/vpcs [get]
func (*API) Live ¶
Live checks if the service is live @Summary Checks if the service is live @Description Checks if the service is live @Id Live @Tags Private @Accept json @Produce json @Success 200 @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /private/live [post]
func (*API) NewInternalServerError ¶
func (*API) OrganizationIsOwnedByCurrentUser ¶
func (*API) OrganizationIsReadableByCurrentUser ¶
func (*API) Ready ¶
Ready checks if the service is ready to accept requests @Summary Checks if the service is ready to accept requests @Description Checks if the service is ready to accept requests @Id Ready @Tags Private @Accept json @Produce json @Success 200 @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /private/ready [post]
func (*API) RegKeyIsForCurrentUser ¶
func (*API) RegKeyIsForCurrentUserOrOrgOwner ¶
func (*API) SecurityGroupIsReadableByCurrentUser ¶
func (*API) SecurityGroupIsWriteableByCurrentUser ¶
func (*API) SendInternalServerError ¶
func (*API) ServiceNetworkIsOwnedByCurrentUser ¶
func (*API) ServiceNetworkIsReadableByCurrentUser ¶
func (*API) SignCSR ¶
SignCSR signs a certificate signing request @Summary Signs a certificate signing request @Description Signs a certificate signing request @Id SignCSR @Tags CA @Accept json @Produce json @Param CertificateSigningRequest body models.CertificateSigningRequest true "Certificate signing request" @Success 201 {object} models.CertificateSigningResponse @Failure 400 {object} models.ValidationError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/ca/sign [post]
func (*API) SiteIsOwnedByCurrentUser ¶
func (*API) UpdateDevice ¶
UpdateDevice updates a Device @Summary Update Devices @Description Updates a device by ID @Id UpdateDevice @Tags Devices @Accept json @Produce json @Param id path string true "Device ID" @Param update body models.UpdateDevice true "Device Update" @Success 200 {object} models.Device @Failure 401 {object} models.BaseError @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/devices/{id} [patch]
func (*API) UpdateDeviceMetadataKey ¶
UpdateDeviceMetadataKey Set value for a metadata key on a device @Summary Set Device Metadata by key @Id UpdateDeviceMetadataKey @Tags Devices @Description Set metadata key for a device @Param id path string true "Device ID" @Param key path string false "Metadata Key" @Param value body any true "Metadata Value" @Accept json @Produce json @Success 200 {object} models.DeviceMetadata @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/devices/{id}/metadata/{key} [put]
func (*API) UpdateRegKey ¶
UpdateRegKey updates a RegKey @Summary Update RegKey @Description Updates a RegKey by ID @Id UpdateRegKey @Tags RegKey @Accepts json @Produce json @Param id path string true "RegKey ID" @Param update body models.UpdateRegKey true "RegKey Update" @Success 200 {object} models.RegKey @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 422 {object} models.ValidationError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/reg-keys/{id} [patch]
func (*API) UpdateSecurityGroup ¶
UpdateSecurityGroup updates a Security Group @Summary Update Security Group @Description Updates a Security Group by ID @Id UpdateSecurityGroup @Tags SecurityGroup @Accepts json @Produce json @Param id path string true "Security Group ID" @Param update body models.UpdateSecurityGroup true "Security Group Update" @Success 200 {object} models.SecurityGroup @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 422 {object} models.ValidationError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/security-groups/{id} [patch]
func (*API) UpdateServiceNetwork ¶
UpdateServiceNetwork updates a ServiceNetwork @Summary Update ServiceNetworks @Description Updates a serviceNetwork by ID @Id UpdateServiceNetwork @Tags ServiceNetwork @Accept json @Produce json @Param id path string true "ServiceNetwork ID" @Param update body models.UpdateServiceNetwork true "ServiceNetwork Update" @Success 200 {object} models.ServiceNetwork @Failure 401 {object} models.BaseError @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/service-networks/{id} [patch]
func (*API) UpdateSite ¶
UpdateSite updates a Site @Summary Update Sites @Description Updates a site by ID @Id UpdateSite @Tags Sites @Accept json @Produce json @Param id path string true "Site ID" @Param update body models.UpdateSite true "Site Update" @Success 200 {object} models.Site @Failure 401 {object} models.BaseError @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/sites/{id} [patch]
func (*API) UpdateVPC ¶
UpdateVPC updates a VPC @Summary Update VPCs @Description Updates a vpc by ID @Id UpdateVPC @Tags VPC @Accept json @Produce json @Param id path string true "VPC ID" @Param update body models.UpdateVPC true "VPC Update" @Success 200 {object} models.VPC @Failure 401 {object} models.BaseError @Failure 400 {object} models.BaseError @Failure 404 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/vpcs/{id} [patch]
func (*API) UserIsCurrentUser ¶
func (*API) VPCIsOwnedByCurrentUser ¶
func (*API) VPCIsReadableByCurrentUser ¶
func (*API) WatchEvents ¶
WatchEvents lets you watch for resource change events @Summary Watch events occurring in the control plane @Description Watches events occurring in the control plane @Id Watch @Tags Events @Accept json @Produce json @Param Watches body []models.Watch true "List of events to watch" @Success 200 {object} models.WatchEvent @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/events [post]
func (*API) WatchEventsInVPC ¶
WatchEventsInVPC lets you watch for resource change events @Summary Watch events occurring in the vpc @Description Watches events occurring in the vpc @Id WatchEvents @Tags VPC @Accept json @Produce json @Param public_key query string false "connect as the device with the given public key, device will be considered to be online for the duration of this request" @Param Watches body []models.Watch true "List of events to watch" @Param id path string true "VPC ID" @Success 200 {object} models.WatchEvent @Failure 400 {object} models.BaseError @Failure 401 {object} models.BaseError @Failure 429 {object} models.BaseError @Failure 500 {object} models.InternalServerError "Internal Server Error" @Router /api/vpc/{id}/events [post]
type AgentTracker ¶
type AgentTracker struct {
// contains filtered or unexported fields
}
One of these exists off of the top-level API object.
type ApiResponseError ¶
func NewApiResponseError ¶
func NewApiResponseError(status int, body any) *ApiResponseError
func NxodusClaims ¶
func NxodusClaims(c *gin.Context, tx *gorm.DB) (*models.NexodusClaims, *ApiResponseError)
func (ApiResponseError) Error ¶
func (e ApiResponseError) Error() string
type CertificateKeyPair ¶
type CertificateKeyPair struct { Certificate *x509.Certificate Key any CertificatePem []byte }
func ParseCertificateKeyPair ¶
func ParseCertificateKeyPair(certPEMBlock, keyPEMBlock []byte) (result CertificateKeyPair, err error)
Source Files ¶
- api.go
- ca.go
- device.go
- device_metadata.go
- envoy_authz.go
- error.go
- events.go
- fflags.go
- gc.go
- handlers.go
- health.go
- invitation_emails.go
- invitations.go
- online_tracker.go
- organization.go
- reg_key.go
- security_group.go
- service_network.go
- service_network_events.go
- site.go
- store.go
- user.go
- user_organization.go
- vpc.go