Documentation ¶
Overview ¶
Code generated by repackage.awk DO NOT EDIT.
Package adapters provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.12.4 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func RegisterHandlers(router *gin.Engine, si ServerInterface) *gin.Engine
- func RegisterHandlersWithOptions(router *gin.Engine, si ServerInterface, options GinServerOptions) *gin.Engine
- type Cpu
- type Devices
- type Disk
- type DiskDevice
- type DiskType
- type GetAllVMsList200Response
- type GetHost200Response
- type GetVMByVMId200Response
- type GetVMPowerByVMId200Response
- type GinServerOptions
- type Host
- type Memory
- type Metadata
- type MiddlewareFunc
- type PatchApiV1VmsVmIdJSONBody
- type PatchApiV1VmsVmIdJSONRequestBody
- type PatchUpdateVMByVMId200Response
- type PatchUpdateVMRequest
- type PostApiV1VmsJSONBody
- type PostApiV1VmsJSONRequestBody
- type PostApiV1VmsVmIdPowerJSONBody
- type PostApiV1VmsVmIdPowerJSONRequestBody
- type PostChangeVMsPowerStatusByVMIdRequest
- type PostCreateNewVM200Response
- type PostCreateNewVMRequest
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) DeleteApiV1VmsVmId(c *gin.Context)
- func (siw *ServerInterfaceWrapper) GetApiV1Host(c *gin.Context)
- func (siw *ServerInterfaceWrapper) GetApiV1Vms(c *gin.Context)
- func (siw *ServerInterfaceWrapper) GetApiV1VmsVmId(c *gin.Context)
- func (siw *ServerInterfaceWrapper) GetApiV1VmsVmIdPower(c *gin.Context)
- func (siw *ServerInterfaceWrapper) PatchApiV1VmsVmId(c *gin.Context)
- func (siw *ServerInterfaceWrapper) PostApiV1Vms(c *gin.Context)
- func (siw *ServerInterfaceWrapper) PostApiV1VmsVmIdPower(c *gin.Context)
- type StoragePool
- type StoragePoolStatus
- type Vm
- type VmPowerActions
- type VmPowerInfo
- type VmPowerInfoState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func RegisterHandlers ¶
func RegisterHandlers(router *gin.Engine, si ServerInterface) *gin.Engine
RegisterHandlers creates http.Handler with routing matching OpenAPI spec.
func RegisterHandlersWithOptions ¶
func RegisterHandlersWithOptions(router *gin.Engine, si ServerInterface, options GinServerOptions) *gin.Engine
RegisterHandlersWithOptions creates http.Handler with additional options
Types ¶
type Disk ¶
type Disk struct { Device DiskDevice `json:"device"` Name string `json:"name"` Pool string `json:"pool"` Type DiskType `json:"type"` }
Disk defines model for Disk.
type DiskDevice ¶
type DiskDevice string
DiskDevice defines model for Disk.Device.
const ( DiskDeviceCdrom DiskDevice = "cdrom" DiskDeviceDisk DiskDevice = "disk" DiskDeviceUnknown DiskDevice = "unknown" )
Defines values for DiskDevice.
type GetAllVMsList200Response ¶
type GetAllVMsList200Response struct {
Vms []Vm `json:"vms"`
}
GetAllVMsList200Response defines model for GetAllVMsList200Response.
type GetHost200Response ¶
type GetHost200Response struct {
Host Host `json:"host"`
}
GetHost200Response defines model for GetHost200Response.
type GetVMByVMId200Response ¶
type GetVMByVMId200Response struct { // Vm 仮想マシンを表すモデル Vm Vm `json:"vm"` }
GetVMByVMId200Response defines model for GetVMByVMId200Response.
type GetVMPowerByVMId200Response ¶
type GetVMPowerByVMId200Response struct {
VmPower VmPowerInfo `json:"vm_power"`
}
GetVMPowerByVMId200Response defines model for GetVMPowerByVMId200Response.
type GinServerOptions ¶
type GinServerOptions struct { BaseURL string Middlewares []MiddlewareFunc ErrorHandler func(*gin.Context, error, int) }
GinServerOptions provides options for the Gin server.
type Host ¶
type Host struct { // Cpu ホストのCPU情報 Cpu Cpu `json:"cpu"` // Memory ホストのメモリ情報 Memory Memory `json:"memory"` StoragePools []StoragePool `json:"storage_pools"` }
Host defines model for Host.
type Memory ¶
type Memory struct { Free uint64 `json:"free"` Percent float64 `json:"percent"` Total uint64 `json:"total"` Used uint64 `json:"used"` }
Memory ホストのメモリ情報
type Metadata ¶
type Metadata struct { ApiVersion string `json:"api_version"` Id openapi_types.UUID `json:"id"` }
Metadata defines model for Metadata.
type MiddlewareFunc ¶
type PatchApiV1VmsVmIdJSONBody ¶
type PatchApiV1VmsVmIdJSONBody struct { Cpu int `json:"cpu"` Memory uint64 `json:"memory"` Name string `json:"name"` }
PatchApiV1VmsVmIdJSONBody defines parameters for PatchApiV1VmsVmId.
type PatchApiV1VmsVmIdJSONRequestBody ¶
type PatchApiV1VmsVmIdJSONRequestBody PatchApiV1VmsVmIdJSONBody
PatchApiV1VmsVmIdJSONRequestBody defines body for PatchApiV1VmsVmId for application/json ContentType.
type PatchUpdateVMByVMId200Response ¶
type PatchUpdateVMByVMId200Response struct { // Vm 仮想マシンを表すモデル Vm Vm `json:"vm"` }
PatchUpdateVMByVMId200Response defines model for PatchUpdateVMByVMId200Response.
type PatchUpdateVMRequest ¶
type PatchUpdateVMRequest struct { Cpu int `json:"cpu"` Memory uint64 `json:"memory"` Name string `json:"name"` }
PatchUpdateVMRequest defines model for PatchUpdateVMRequest.
type PostApiV1VmsJSONBody ¶
type PostApiV1VmsJSONBody struct { Cpu int `json:"cpu"` Memory uint64 `json:"memory"` Name string `json:"name"` }
PostApiV1VmsJSONBody defines parameters for PostApiV1Vms.
type PostApiV1VmsJSONRequestBody ¶
type PostApiV1VmsJSONRequestBody PostApiV1VmsJSONBody
PostApiV1VmsJSONRequestBody defines body for PostApiV1Vms for application/json ContentType.
type PostApiV1VmsVmIdPowerJSONBody ¶
type PostApiV1VmsVmIdPowerJSONBody struct {
Action VmPowerActions `json:"action"`
}
PostApiV1VmsVmIdPowerJSONBody defines parameters for PostApiV1VmsVmIdPower.
type PostApiV1VmsVmIdPowerJSONRequestBody ¶
type PostApiV1VmsVmIdPowerJSONRequestBody PostApiV1VmsVmIdPowerJSONBody
PostApiV1VmsVmIdPowerJSONRequestBody defines body for PostApiV1VmsVmIdPower for application/json ContentType.
type PostChangeVMsPowerStatusByVMIdRequest ¶
type PostChangeVMsPowerStatusByVMIdRequest struct {
Action VmPowerActions `json:"action"`
}
PostChangeVMsPowerStatusByVMIdRequest defines model for PostChangeVMsPowerStatusByVMIdRequest.
type PostCreateNewVM200Response ¶
type PostCreateNewVM200Response struct { // Vm 仮想マシンを表すモデル Vm Vm `json:"vm"` }
PostCreateNewVM200Response defines model for PostCreateNewVM200Response.
type PostCreateNewVMRequest ¶
type PostCreateNewVMRequest struct { Cpu int `json:"cpu"` Memory uint64 `json:"memory"` Name string `json:"name"` }
PostCreateNewVMRequest defines model for PostCreateNewVMRequest.
type ServerInterface ¶
type ServerInterface interface { // Get a host // (GET /api/v1/host) GetApiV1Host(c *gin.Context) // Get all VMs list // (GET /api/v1/vms) GetApiV1Vms(c *gin.Context) // Create a new VM // (POST /api/v1/vms) PostApiV1Vms(c *gin.Context) // (DELETE /api/v1/vms/{vmId}) DeleteApiV1VmsVmId(c *gin.Context, vmId openapi_types.UUID) // Get a VM // (GET /api/v1/vms/{vmId}) GetApiV1VmsVmId(c *gin.Context, vmId openapi_types.UUID) // Update a VM // (PATCH /api/v1/vms/{vmId}) PatchApiV1VmsVmId(c *gin.Context, vmId openapi_types.UUID) // Get Power State // (GET /api/v1/vms/{vmId}/power) GetApiV1VmsVmIdPower(c *gin.Context, vmId openapi_types.UUID) // Change Power Status // (POST /api/v1/vms/{vmId}/power) PostApiV1VmsVmIdPower(c *gin.Context, vmId openapi_types.UUID) }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc ErrorHandler func(*gin.Context, error, int) }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) DeleteApiV1VmsVmId ¶
func (siw *ServerInterfaceWrapper) DeleteApiV1VmsVmId(c *gin.Context)
DeleteApiV1VmsVmId operation middleware
func (*ServerInterfaceWrapper) GetApiV1Host ¶
func (siw *ServerInterfaceWrapper) GetApiV1Host(c *gin.Context)
GetApiV1Host operation middleware
func (*ServerInterfaceWrapper) GetApiV1Vms ¶
func (siw *ServerInterfaceWrapper) GetApiV1Vms(c *gin.Context)
GetApiV1Vms operation middleware
func (*ServerInterfaceWrapper) GetApiV1VmsVmId ¶
func (siw *ServerInterfaceWrapper) GetApiV1VmsVmId(c *gin.Context)
GetApiV1VmsVmId operation middleware
func (*ServerInterfaceWrapper) GetApiV1VmsVmIdPower ¶
func (siw *ServerInterfaceWrapper) GetApiV1VmsVmIdPower(c *gin.Context)
GetApiV1VmsVmIdPower operation middleware
func (*ServerInterfaceWrapper) PatchApiV1VmsVmId ¶
func (siw *ServerInterfaceWrapper) PatchApiV1VmsVmId(c *gin.Context)
PatchApiV1VmsVmId operation middleware
func (*ServerInterfaceWrapper) PostApiV1Vms ¶
func (siw *ServerInterfaceWrapper) PostApiV1Vms(c *gin.Context)
PostApiV1Vms operation middleware
func (*ServerInterfaceWrapper) PostApiV1VmsVmIdPower ¶
func (siw *ServerInterfaceWrapper) PostApiV1VmsVmIdPower(c *gin.Context)
PostApiV1VmsVmIdPower operation middleware
type StoragePool ¶
type StoragePool struct { Name string `json:"name"` Path string `json:"path"` Status StoragePoolStatus `json:"status"` TotalSize uint64 `json:"total_size"` UsedSize uint64 `json:"used_size"` }
StoragePool ホストが持つストレージプールの情報
type StoragePoolStatus ¶
type StoragePoolStatus string
StoragePoolStatus defines model for StoragePool.Status.
const ( ACTIVE StoragePoolStatus = "ACTIVE" ERROR StoragePoolStatus = "ERROR" )
Defines values for StoragePoolStatus.
type Vm ¶
type Vm struct { Cpu int `json:"cpu"` Devices Devices `json:"devices"` Memory uint64 `json:"memory"` Metadata Metadata `json:"metadata"` Name string `json:"name"` }
Vm 仮想マシンを表すモデル
type VmPowerActions ¶
type VmPowerActions string
VmPowerActions defines model for VmPowerActions.
const ( Reboot VmPowerActions = "reboot" Reset VmPowerActions = "reset" Shutdown VmPowerActions = "shutdown" Start VmPowerActions = "start" )
Defines values for VmPowerActions.
type VmPowerInfo ¶
type VmPowerInfo struct { CleanPowerOff bool `json:"clean_power_off"` State VmPowerInfoState `json:"state"` }
VmPowerInfo defines model for VmPowerInfo.
type VmPowerInfoState ¶
type VmPowerInfoState string
VmPowerInfoState defines model for VmPowerInfo.State.
const ( RUNNING VmPowerInfoState = "RUNNING" SHUTDOWN VmPowerInfoState = "SHUTDOWN" UNKNOWN VmPowerInfoState = "UNKNOWN" )
Defines values for VmPowerInfoState.