api

package
v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2022 License: GPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePasswords

func ComparePasswords(hashedPwd string, plainPwd []byte, username string) bool

func CreateAddress

func CreateAddress(c *gin.Context)

CreateAddress Create a new addresses @Summary Create a new addresses @Tags addresses @Accept json @Produce json @Param item body models.AddressForm true "Add ip address" @Success 200 {object} models.Address @Failure 400 {object} models.APIError @Failure 500 {object} models.APIError @Router /addresses [post]

func CreateDeviceClass

func CreateDeviceClass(c *gin.Context)

CreateDeviceClass Create a new device class @Summary Create a new device class @Tags device_classes @Accept json @Produce json @Param item body models.DeviceClassForm true "Add an device class" @Success 200 {object} models.DeviceClass @Failure 400 {object} models.APIError @Failure 500 {object} models.APIError @Router /device_classes [post]

func CreateGroup

func CreateGroup(key string) func(c *gin.Context)

CreateGroup Create a new groups @Summary Create a new group @Tags groups @Accept json @Produce json @Param item body models.GroupForm true "Add ip group" @Success 200 {object} models.Group @Failure 400 {object} models.APIError @Failure 500 {object} models.APIError @Router /groups [post]

func CreateImage

func CreateImage(conf *config.Config) func(c *gin.Context)

CreateImage Create a new images @Summary Create a new image @Tags images @Accept json @Produce json @Param item body models.ImageForm true "Add image" @Success 200 {object} models.Image @Failure 400 {object} models.APIError @Failure 500 {object} models.APIError @Router /images [post]

func CreateOption

func CreateOption(c *gin.Context)

CreateOption Create a new options @Summary Create a new option @Tags options @Accept json @Produce json @Param item body models.OptionForm true "Add ip option" @Success 200 {object} models.Option @Failure 400 {object} models.APIError @Failure 500 {object} models.APIError @Router /options [post]

func CreatePool

func CreatePool(c *gin.Context)

CreatePool Create a new pool @Summary Create a new pool @Tags pools @Accept json @Produce json @Param item body models.PoolForm true "Add ip pool" @Success 200 {object} models.Pool @Failure 400 {object} models.APIError @Failure 500 {object} models.APIError @Router /pools [post]

func CreateUser

func CreateUser(c *gin.Context)

CreateUser Create a new user @Summary Create a new user @Tags users @Accept json @Produce json @Param item body models.UserForm true "Add an user" @Success 200 {object} models.User @Failure 400 {object} models.APIError @Failure 500 {object} models.APIError @Router /users [post]

func DeleteAddress

func DeleteAddress(c *gin.Context)

DeleteAddress Remove an existing address @Summary Remove an existing address @Tags addresses @Accept json @Produce json @Param id path int true "Address ID" @Success 204 @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /addresses/{id} [delete]

func DeleteDeviceClass

func DeleteDeviceClass(c *gin.Context)

DeleteDeviceClass Remove an existing device class @Summary Remove an existing device class @Tags device_classes @Accept json @Produce json @Param id path int true "DeviceClass ID" @Success 204 @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /device_classes/{id} [delete]

func DeleteGroup

func DeleteGroup(c *gin.Context)

DeleteGroup Remove an existing group @Summary Remove an existing group @Tags groups @Accept json @Produce json @Param id path int true "Group ID" @Success 204 @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /groups/{id} [delete]

func DeleteImage

func DeleteImage(c *gin.Context)

DeleteImage Remove an existing image @Summary Remove an existing image @Tags images @Accept json @Produce json @Param id path int true "Image ID" @Success 204 @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /images/{id} [delete]

func DeleteOption

func DeleteOption(c *gin.Context)

DeleteOption Remove an existing option @Summary Remove an existing option @Tags options @Accept json @Produce json @Param id path int true "Option ID" @Success 204 @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /options/{id} [delete]

func DeletePool

func DeletePool(c *gin.Context)

DeletePool Remove an existing pool @Summary Remove an existing pool @Tags pools @Accept json @Produce json @Param id path int true "Pool ID" @Success 204 @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /pools/{id} [delete]

func DeleteUser

func DeleteUser(c *gin.Context)

DeleteUser Remove an existing user @Summary Remove an existing user @Tags users @Accept json @Produce json @Param id path int true "User ID" @Success 204 @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /users/{id} [delete]

func Error

func Error(c *gin.Context, status int, err error)

func FindPool

func FindPool(ip string) (*models.PoolWithAddresses, error)

func GetAddress

func GetAddress(c *gin.Context)

GetAddress Get an existing address @Summary Get an existing address @Tags addresses @Accept json @Produce json @Param id path int true "Address ID" @Success 200 {object} models.Address @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /addresses/{id} [get]

func GetDeviceClass

func GetDeviceClass(c *gin.Context)

GetDeviceClass Get an existing device class @Summary Get an existing device class @Tags device_classes @Accept json @Produce json @Param id path int true "DeviceClass ID" @Success 200 {object} models.DeviceClass @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /device_classes/{id} [get]

func GetGroup

func GetGroup(c *gin.Context)

GetGroup Get an existing group @Summary Get an existing group @Tags groups @Accept json @Produce json @Param id path int true "Group ID" @Success 200 {object} models.Group @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /groups/{id} [get]

func GetImage

func GetImage(c *gin.Context)

GetImage Get an existing image @Summary Get an existing image @Tags images @Accept json @Produce json @Param id path int true "Image ID" @Success 200 {object} models.Image @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /images/{id} [get]

func GetInterfaceIpv4Addr

func GetInterfaceIpv4Addr(interfaceName string) (addr string, err error)

func GetNextFreeIP

func GetNextFreeIP(c *gin.Context)

GetNextFreeIP Get the next free lease from a pool @Summary Get the next free lease from a pool @Tags pools @Accept json @Produce json @Param id path int true "Pool ID" @Success 200 {object} models.Address @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /pools/{id}/next [get]

func GetOption

func GetOption(c *gin.Context)

GetOption Get an existing option @Summary Get an existing option @Tags options @Accept json @Produce json @Param id path int true "Option ID" @Success 200 {object} models.Option @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /options/{id} [get]

func GetPool

func GetPool(c *gin.Context)

GetPool Get an existing pool @Summary Get an existing pool @Tags pools @Accept json @Produce json @Param id path int true "Pool ID" @Success 200 {object} models.Pool @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /pools/{id} [get]

func GetPoolByRelay

func GetPoolByRelay(c *gin.Context)

GetPoolByRelay Get an existing pool by the relay host IP @Summary Get an existing pool by the relay host IP @Tags pools @Accept json @Produce json @Param relay path string true "Relay host IP" @Success 200 {object} models.Pool @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /relay/{relay} [get]

func GetUser

func GetUser(c *gin.Context)

GetUser Get an existing user @Summary Get an existing user @Tags users @Accept json @Produce json @Param id path int true "User ID" @Success 200 {object} models.User @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /users/{id} [get]

func HashAndSalt

func HashAndSalt(pwd []byte) string

func Ks

func Ks(key string) func(c *gin.Context)

func Ks(c *gin.Context) {

func ListAddresses

func ListAddresses(c *gin.Context)

ListAddresses Get a list of all addresses @Summary Get all addresses @Tags addresses @Accept json @Produce json @Success 200 {array} models.Address @Failure 500 {object} models.APIError @Router /addresses [get]

func ListDeviceClasses

func ListDeviceClasses(c *gin.Context)

ListDeviceClasses Get a list of all device classes @Summary Get all device classes @Tags device_classes @Accept json @Produce json @Success 200 {array} models.DeviceClass @Failure 500 {object} models.APIError @Router /device_classes [get]

func ListGroups

func ListGroups(c *gin.Context)

ListGroups Get a list of all groups @Summary Get all groups @Tags groups @Accept json @Produce json @Success 200 {array} models.Group @Failure 500 {object} models.APIError @Router /groups [get]

func ListImages

func ListImages(c *gin.Context)

ListImages Get a list of all images @Summary Get all images @Tags images @Accept json @Produce json @Success 200 {array} models.Image @Failure 500 {object} models.APIError @Router /images [get]

func ListOptions

func ListOptions(c *gin.Context)

ListOptions Get a list of all options @Summary Get all options @Tags options @Accept json @Produce json @Success 200 {array} models.Option @Failure 500 {object} models.APIError @Router /options [get]

func ListPools

func ListPools(c *gin.Context)

ListPools Get a list of all pools @Summary Get all pools @Tags pools @Accept json @Produce json @Success 200 {array} models.Pool @Failure 500 {object} models.APIError @Router /pools [get]

func ListUsers

func ListUsers(c *gin.Context)

ListUsers Get a list of all users @Summary Get all users @Tags users @Accept json @Produce json @Success 200 {array} models.User @Failure 500 {object} models.APIError @Router /users [get]

func PostConfig

func PostConfig(key string) func(c *gin.Context)

func PostConfigCertificate added in v0.4.2

func PostConfigCertificate(e *esxcli.Executor, item models.Address, decryptedPassword string, ctx context.Context, timeout int, i int, c *govmomi.Client, url *url.URL) error

func PostConfigDomain added in v0.4.2

func PostConfigDomain(e *esxcli.Executor, item models.Address) error

func PostConfigID added in v0.3.10

func PostConfigID(key string) func(c *gin.Context)

func PostConfigNTP added in v0.4.2

func PostConfigNTP(e *esxcli.Executor, item models.Address, host *object.HostSystem, ctx context.Context) error

func PostConfigSSH added in v0.4.2

func PostConfigSSH(e *esxcli.Executor, item models.Address, host *object.HostSystem, ctx context.Context) error

func PostConfigSyslog added in v0.4.2

func PostConfigSyslog(e *esxcli.Executor, item models.Address) error

func PostConfigVlan added in v0.4.2

func PostConfigVlan(e *esxcli.Executor, item models.Address) error

func ProvisioningWorker

func ProvisioningWorker(item models.Address, key string)

func SaveUploadedFile

func SaveUploadedFile(file *multipart.FileHeader, dst string) (int64, error)

func SearchAddress

func SearchAddress(c *gin.Context)

SearchAddress Search for an address @Summary Search for an address @Tags addresses @Accept json @Produce json @Param item body models.Address true "Fields to search for" @Success 200 {object} models.Address @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /addresses/search [post]

func SearchDeviceClass

func SearchDeviceClass(c *gin.Context)

SearchDeviceClass Search for an device class @Summary Search for an device class @Tags device_classes @Accept json @Produce json @Param item body models.DeviceClass true "Fields to search for" @Success 200 {object} models.DeviceClass @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /device_classes/search [post]

func SearchOption

func SearchOption(c *gin.Context)

SearchOption Search for an option @Summary Search for an option @Tags options @Accept json @Produce json @Param item body models.Option true "Fields to search for" @Success 200 {object} models.Option @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /options/search [post]

func SearchPool

func SearchPool(c *gin.Context)

SearchPool Search for an pool @Summary Search for an pool @Tags pools @Accept json @Produce json @Param item body models.Pool true "Fields to search for" @Success 200 {object} models.Pool @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /pools/search [post]

func SearchUser

func SearchUser(c *gin.Context)

SearchUser Search for a user @Summary Search for a user @Tags users @Accept json @Produce json @Param item body models.User true "Fields to search for" @Success 200 {object} models.User @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /users/search [post]

func UpdateAddress

func UpdateAddress(c *gin.Context)

UpdateAddress Update an existing address @Summary Update an existing address @Tags addresses @Accept json @Produce json @Param id path int true "Address ID" @Param item body models.AddressForm true "Update an ip address" @Success 200 {object} models.Address @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /addresses/{id} [patch]

func UpdateDeviceClass

func UpdateDeviceClass(c *gin.Context)

UpdateDeviceClass Update an existing device class @Summary Update an existing device class @Tags device_classes @Accept json @Produce json @Param id path int true "DeviceClass ID" @Param item body models.DeviceClassForm true "Update an ip device class" @Success 200 {object} models.DeviceClass @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /device_classes/{id} [patch]

func UpdateGroup

func UpdateGroup(key string) func(c *gin.Context)

UpdateGroup Update an existing group @Summary Update an existing group @Tags groups @Accept json @Produce json @Param id path int true "Group ID" @Param item body models.GroupForm true "Update an group" @Success 200 {object} models.Group @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /groups/{id} [patch]

func UpdateImage

func UpdateImage(c *gin.Context)

UpdateImage Update an existing image @Summary Update an existing image @Tags images @Accept json @Produce json @Param id path int true "Image ID" @Param item body models.ImageForm true "Update an image" @Success 200 {object} models.Image @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /images/{id} [patch]

func UpdateOption

func UpdateOption(c *gin.Context)

UpdateOption Update an existing option @Summary Update an existing option @Tags options @Accept json @Produce json @Param id path int true "Option ID" @Param item body models.OptionForm true "Update an option" @Success 200 {object} models.Option @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /options/{id} [patch]

func UpdatePool

func UpdatePool(c *gin.Context)

UpdatePool Update an existing pool @Summary Update an existing pool @Tags pools @Accept json @Produce json @Param id path int true "Pool ID" @Param item body models.PoolForm true "Update an ip pool" @Success 200 {object} models.Pool @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /pools/{id} [patch]

func UpdateUser

func UpdateUser(c *gin.Context)

UpdateUser Update an existing user @Summary Update an existing user @Tags users @Accept json @Produce json @Param id path int true "User ID" @Param item body models.UserForm true "Update a user" @Success 200 {object} models.User @Failure 400 {object} models.APIError @Failure 404 {object} models.APIError @Failure 500 {object} models.APIError @Router /users/{id} [patch]

func Version added in v0.3.20

func Version(version string, commit string, date string) func(c *gin.Context)

func WriteToFile

func WriteToFile(filename string, data string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL