Documentation
¶
Overview ¶
Lists all the images. A image is a template which can be used to deploy machines
Index ¶
- type CreateRequest
- type CreateVirtualRequest
- type DeleteRequest
- type GetRequest
- type History
- type Image
- func (i Image) Create(ctx context.Context, req CreateRequest) (uint64, error)
- func (i Image) CreateVirtual(ctx context.Context, req CreateVirtualRequest) (uint64, error)
- func (i Image) Delete(ctx context.Context, req DeleteRequest) (bool, error)
- func (i Image) Get(ctx context.Context, req GetRequest) (*RecordImage, error)
- func (i Image) Link(ctx context.Context, req LinkRequest) (bool, error)
- func (i Image) List(ctx context.Context, req ListRequest) (ListImages, error)
- func (i Image) Rename(ctx context.Context, req RenameRequest) (bool, error)
- type ItemImage
- type LinkRequest
- type ListImages
- func (li ListImages) FilterByBootType(bootType string) ListImages
- func (li ListImages) FilterByID(id uint64) ListImages
- func (li ListImages) FilterByName(name string) ListImages
- func (li ListImages) FilterByStatus(status string) ListImages
- func (li ListImages) FilterFunc(predicate func(ItemImage) bool) ListImages
- func (li ListImages) FindOne() ItemImage
- func (li ListImages) Serialize(params ...string) (serialization.Serialized, error)
- type ListRequest
- type RecordImage
- type RenameRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
type CreateRequest struct { // Name of the rescue disk // Required: true Name string `url:"name" json:"name" validate:"required"` // URL where to download media from // Required: true URL string `url:"url" json:"url" validate:"required,url"` // Grid (platform) ID where this template should be create in // Required: true GID uint64 `url:"gid" json:"gid" validate:"required"` // Boot type of image bios or UEFI // Required: true BootType string `url:"boottype" json:"boottype" validate:"required,imageBootType"` // Image type // Should be: // - linux // - windows // - or other // Required: true ImageType string `url:"imagetype" json:"imagetype" validate:"required,imageType"` // Does this machine supports hot resize // Required: false HotResize bool `url:"hotresize,omitempty" json:"hotresize,omitempty"` // Optional username for the image // Required: false Username string `url:"username,omitempty" json:"username,omitempty"` // Optional password for the image // Required: false Password string `url:"password,omitempty" json:"password,omitempty"` // Account ID to make the image exclusive // Required: false AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"` // Username for upload binary media // Required: false UsernameDL string `url:"usernameDL,omitempty" json:"usernameDL,omitempty"` // Password for upload binary media // Required: false PasswordDL string `url:"passwordDL,omitempty" json:"passwordDL,omitempty"` // Storage endpoint provider ID // Required: false SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"` // Pool for image create // Required: false Pool string `url:"poolName,omitempty" json:"poolName,omitempty"` // Binary architecture of this image // Should be: // - X86_64 // - PPC64_LE // Required: false Architecture string `url:"architecture,omitempty" json:"architecture,omitempty" validate:"omitempty,imageArchitecture"` // List of types of compute suitable for image // Example: [ "KVM_X86" ] // Required: true Drivers []string `url:"drivers" json:"drivers" validate:"min=1,max=2,imageDrivers"` }
Request struct for create image
type CreateVirtualRequest ¶
type CreateVirtualRequest struct { // Name of the virtual image to create // Required: true Name string `url:"name" json:"name" validate:"required"` // ID of real image to link this virtual image to upon creation // Required: true TargetID uint64 `url:"targetId" json:"targetId" validate:"required"` }
Request struct for create virtual image
type DeleteRequest ¶
type DeleteRequest struct { // ID of the image to delete // Required: true ImageID uint64 `url:"imageId" json:"imageId" validate:"required"` // Whether to completely delete the image // Required: false Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"` }
Request struct for delete image
type GetRequest ¶
type GetRequest struct { // ID of image to get // Required: true ImageID uint64 `url:"imageId" json:"imageId" validate:"required"` // If set to False returns only images in status CREATED // Required: false ShowAll bool `url:"show_all,omitempty" json:"show_all,omitempty"` }
Request struct for get detailed information about image
type History ¶
type History struct { // GUID GUID string `json:"guid"` // ID ID uint64 `json:"id"` // Timestamp Timestamp uint64 `json:"timestamp"` }
History
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Structure for creating request to image
func (Image) CreateVirtual ¶
CreateVirtual creates virtual image
func (Image) Get ¶
func (i Image) Get(ctx context.Context, req GetRequest) (*RecordImage, error)
Get gets image by ID. Returns image if user has rights on it
func (Image) List ¶
func (i Image) List(ctx context.Context, req ListRequest) (ListImages, error)
List gets list available images, optionally filtering by account ID
type ItemImage ¶
type ItemImage struct { // Account ID AccountID uint64 `json:"accountId"` // Architecture Architecture string `json:"architecture"` // Boot type BootType string `json:"bootType"` // Bootable Bootable bool `json:"bootable"` // CDROM CDROM bool `json:"cdrom"` // Description Description string `json:"desc"` // List drivers Drivers []string `json:"drivers"` // HotResize HotResize bool `json:"hotResize"` // ID ID uint64 `json:"id"` // Link to LinkTo uint64 `json:"linkTo"` // Name Name string `json:"name"` // Pool Pool string `json:"pool"` // SepID SepID uint64 `json:"sepId"` // Size Size uint64 `json:"size"` // Status Status string `json:"status"` // Type Type string `json:"type"` // Username Username string `json:"username"` // Virtual Virtual bool `json:"virtual"` }
Main information about image
func (ItemImage) Serialize ¶
func (ii ItemImage) Serialize(params ...string) (serialization.Serialized, error)
Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
In order to serialize with indent make sure to follow these guidelines:
- First argument -> prefix
- Second argument -> indent
type LinkRequest ¶
type LinkRequest struct { // ID of the virtual image // Required: true ImageID uint64 `url:"imageId" json:"imageId" validate:"required"` // ID of real image to link this virtual image to // Required: true TargetID uint64 `url:"targetId" json:"targetId" validate:"required"` }
Request struct for link virtual image to another image
type ListImages ¶
type ListImages []ItemImage
List of information about images
func (ListImages) FilterByBootType ¶
func (li ListImages) FilterByBootType(bootType string) ListImages
FilterByBootType returns ListImages with specified BootType.
func (ListImages) FilterByID ¶
func (li ListImages) FilterByID(id uint64) ListImages
FilterByID returns ListImages with specified ID.
func (ListImages) FilterByName ¶
func (li ListImages) FilterByName(name string) ListImages
FilterByName returns ListImages with specified Name.
func (ListImages) FilterByStatus ¶
func (li ListImages) FilterByStatus(status string) ListImages
FilterByStatus returns ListImages with specified Status.
func (ListImages) FilterFunc ¶
func (li ListImages) FilterFunc(predicate func(ItemImage) bool) ListImages
FilterFunc allows filtering ListImages based on a user-specified predicate.
func (ListImages) FindOne ¶
func (li ListImages) FindOne() ItemImage
FindOne returns first found ItemImage If none was found, returns an empty struct.
func (ListImages) Serialize ¶
func (li ListImages) Serialize(params ...string) (serialization.Serialized, error)
Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
In order to serialize with indent make sure to follow these guidelines:
- First argument -> prefix
- Second argument -> indent
type ListRequest ¶
type ListRequest struct { // Optional account ID to include account images // Required: false AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"` // Page number // Required: false Page uint64 `url:"page,omitempty" json:"page,omitempty"` // Page size // Required: false Size uint64 `url:"size,omitempty" json:"size,omitempty"` }
Request struct for get list available images
type RecordImage ¶
type RecordImage struct { // UNCPathj UNCPath string `json:"UNCPath"` // CKey CKey string `json:"_ckey"` // Account ID AccountID uint64 `json:"accountId"` // Access Control List ACL interface{} `json:"acl"` // Architecture Architecture string `json:"architecture"` // Boot type BootType string `json:"bootType"` // Bootable Bootable bool `json:"bootable"` // ComputeCI ID ComputeCIID uint64 `json:"computeciId"` // Deleted time DeletedTime uint64 `json:"deletedTime"` // Description Description string `json:"desc"` // List of drivers Drivers []string `json:"drivers"` // Enabled Enabled bool `json:"enabled"` // Grid ID GID uint64 `json:"gid"` // GUID GUID uint64 `json:"guid"` // History History []History `json:"history"` // HotResize HotResize bool `json:"hotResize"` // ID ID uint64 `json:"id"` // Last modified LastModified uint64 `json:"lastModified"` // Link to LinkTo uint64 `json:"linkTo"` // Milestones Milestones uint64 `json:"milestones"` // Name Name string `json:"name"` // Password Password string `json:"password"` // Pool Pool string `json:"pool"` // Present to PresentTo []uint64 `json:"presentTo"` // ProviderName ProviderName string `json:"provider_name"` // Purge attempts PurgeAttempts uint64 `json:"purgeAttempts"` // Resource ID ResID string `json:"resId"` // RescueCD RescueCD bool `json:"rescuecd"` // SepID SepID uint64 `json:"sepId"` SharedWith []uint64 `json:"sharedWith"` // Size Size uint64 `json:"size"` // Status Status string `json:"status"` // Tech status TechStatus string `json:"techStatus"` // Type Type string `json:"type"` // Username Username string `json:"username"` // Version Version string `json:"version"` }
Detailed information about image
type RenameRequest ¶
type RenameRequest struct { // ID of the virtual image to rename // Required: true ImageID uint64 `url:"imageId" json:"imageId" validate:"required"` // New name // Required: true Name string `url:"name" json:"name" validate:"required"` }
Request struct for rename image