ai

package
v0.7.18 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachAIInstanceInterface

func AttachAIInstanceInterface(client *gcorecloud.ServiceClient, instance_id string, opts AttachInterfaceOptsBuilder) (r tasks.Result)

AttachInterface adds a interface to the AI instance

func Create

func Create(client *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r tasks.Result)

Create creates an AI Cluster

func Delete

func Delete(client *gcorecloud.ServiceClient, instanceID string, opts DeleteOptsBuilder) (r tasks.Result)

Delete an AI Cluster

func DetachAIInstanceInterface

func DetachAIInstanceInterface(client *gcorecloud.ServiceClient, instance_id string, opts DetachInterfaceOptsBuilder) (r tasks.Result)

DetachInterface removes a interface from the AI instance

func ExtractAIClusterIDFromTask

func ExtractAIClusterIDFromTask(task *tasks.Task) (string, error)

func ExtractAIClusterInterfacesInto

func ExtractAIClusterInterfacesInto(r pagination.Page, v interface{}) error

ExtractAIClusterInterfacesInto accepts a Page struct, specifically a AIClusterInterfacePage struct, and extracts the elements into a slice of AI Cluster interface structs. In other words, a generic collection is mapped into a relevant slice.

func ExtractAIClusterPortInto

func ExtractAIClusterPortInto(r pagination.Page, v interface{}) error

func ExtractAIClustersInto

func ExtractAIClustersInto(r pagination.Page, v interface{}) error

func ExtractMetadata

func ExtractMetadata(r pagination.Page) ([]metadata.Metadata, error)

ExtractMetadata accepts a Page struct, specifically a MetadataPage struct, and extracts the elements into a slice of ai cluster metadata structs. In other words, a generic collection is mapped into a relevant slice.

func ExtractMetadataInto

func ExtractMetadataInto(r pagination.Page, v interface{}) error

func List

func ListInterfaces

func ListInterfaces(client *gcorecloud.ServiceClient, id string) pagination.Pager

ListInterfaces retrieves network interfaces for AI Cluster

func ListPorts

func ListPorts(client *gcorecloud.ServiceClient, id string) pagination.Pager

ListPorts retrieves ports for AI Cluster

func MetadataList

func MetadataList(client *gcorecloud.ServiceClient, id string) pagination.Pager

func MetadataListAll

func MetadataListAll(client *gcorecloud.ServiceClient, id string) ([]metadata.Metadata, error)

func Resize

Resize AI Cluster.

func Resume

func Resume(client *gcorecloud.ServiceClient, id string) (r tasks.Result)

Resume AI Cluster.

func Suspend

func Suspend(client *gcorecloud.ServiceClient, id string) (r tasks.Result)

Suspend AI Cluster.

Types

type AICluster

type AICluster struct {
	ClusterID      string                         `json:"cluster_id"`
	ClusterName    string                         `json:"cluster_name"`
	ClusterStatus  string                         `json:"cluster_status"`
	TaskID         *string                        `json:"task_id"`
	TaskStatus     string                         `json:"task_status"`
	CreatedAt      gcorecloud.JSONRFC3339MilliNoZ `json:"instance_created"`
	ImageID        string                         `json:"image_id"`
	ImageName      string                         `json:"image_name"`
	Flavor         string                         `json:"flavor"`
	Volumes        []volumes.Volume               `json:"volumes"`
	SecurityGroups []PoplarInterfaceSecGrop       `json:"security_groups"`
	Interfaces     []AIClusterInterface           `json:"interfaces"`
	KeypairName    string                         `json:"keypair_name"`
	UserData       string                         `json:"user_data"`
	Username       string                         `json:"username"`
	Password       string                         `json:"password"`
	PoplarServer   []instances.Instance           `json:"poplar_servers"`
	Metadata       map[string]interface{}         `json:"cluster_metadata"`
	ProjectID      int                            `json:"project_id"`
	RegionID       int                            `json:"region_id"`
	Region         string                         `json:"region"`
}

AICluster represents a AI Cluster structure.

func ExtractAIClusters

func ExtractAIClusters(r pagination.Page) ([]AICluster, error)

ExtractAIClusters accepts a Page struct, specifically a AIClustersPage struct, and extracts the elements into a slice of AICluster structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

func ListAll(client *gcorecloud.ServiceClient) ([]AICluster, error)

ListAll is a convenience function that returns all AI Clusters

func (*AICluster) UnmarshalJSON

func (i *AICluster) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface

type AIClusterActionResult

type AIClusterActionResult struct {
	// contains filtered or unexported fields
}

AIClusterActionResult represents the result of an cluster operation. Call its Extract method to interpret it as a AI Cluster actions.

func PowerCycleAICluster

func PowerCycleAICluster(client *gcorecloud.ServiceClient, id string) (r AIClusterActionResult)

PowerCycle AI Cluster.

func RebootAICluster

func RebootAICluster(client *gcorecloud.ServiceClient, id string) (r AIClusterActionResult)

Reboot AI cluster.

func (AIClusterActionResult) Extract

func (r AIClusterActionResult) Extract() ([]instances.Instance, error)

Extract is a function that accepts a result and extracts a AI Cluster action resource.

func (AIClusterActionResult) ExtractInto

func (r AIClusterActionResult) ExtractInto(v interface{}) error

type AIClusterInterface

type AIClusterInterface struct {
	Type      string `json:"type"`
	NetworkID string `json:"network_id"`
	SubnetID  string `json:"subnet_id"`
	PortID    string `json:"port_id"`
}

type AIClusterInterfacePage

type AIClusterInterfacePage struct {
	pagination.LinkedPageBase
}

AIClusterInterfacePage is the page returned by a pager when traversing over a collection of cluster interfaces.

func (AIClusterInterfacePage) IsEmpty

func (r AIClusterInterfacePage) IsEmpty() (bool, error)

IsEmpty checks whether a AIClusterInterfacePage struct is empty.

func (AIClusterInterfacePage) NextPageURL

func (r AIClusterInterfacePage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of AI Cluster interfaces has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type AIClusterPage

type AIClusterPage struct {
	pagination.LinkedPageBase
}

AIClusterPage is the page returned by a pager when traversing over a collection of ai clusters.

func (AIClusterPage) IsEmpty

func (r AIClusterPage) IsEmpty() (bool, error)

IsEmpty checks whether a AIClusterPage struct is empty.

func (AIClusterPage) NextPageURL

func (r AIClusterPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of AI Clusters has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type AIClusterPort

type AIClusterPort struct {
	ID             string                  `json:"id"`
	Name           string                  `json:"name"`
	SecurityGroups []gcorecloud.ItemIDName `json:"security_groups"`
}

func ExtractAIClusterPorts

func ExtractAIClusterPorts(r pagination.Page) ([]AIClusterPort, error)

ExtractAIClusterPorts accepts a Page struct, specifically a AIClusterPortsPage struct, and extracts the elements into a slice of cluster porst structs. In other words, a generic collection is mapped into a relevant slice.

func ListPortsAll

func ListPortsAll(client *gcorecloud.ServiceClient, id string) ([]AIClusterPort, error)

ListPortsAll is a convenience function that returns all AI Cluster ports.

type AIClusterPortsPage

type AIClusterPortsPage struct {
	pagination.LinkedPageBase
}

AIClusterPortsPage is the page returned by a pager when traversing over a collection of ai cluster ports.

func (AIClusterPortsPage) IsEmpty

func (r AIClusterPortsPage) IsEmpty() (bool, error)

IsEmpty checks whether a AIClusterPortsPage struct is empty.

func (AIClusterPortsPage) NextPageURL

func (r AIClusterPortsPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of ai cluster ports has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type AIClusterTaskResult

type AIClusterTaskResult struct {
	AIClusters []string `mapstructure:"ai_clusters"`
}

type AIInstanceActionResult

type AIInstanceActionResult struct {
	// contains filtered or unexported fields
}

AIInstanceActionResult represents the result of an cluster instance operation. Call its Extract method to interpret it as a AI Cluster instance actions.

func PowerCycleAIInstance

func PowerCycleAIInstance(client *gcorecloud.ServiceClient, instance_id string) (r AIInstanceActionResult)

PowerCycle AI instance.

func RebootAIInstance

func RebootAIInstance(client *gcorecloud.ServiceClient, instance_id string) (r AIInstanceActionResult)

Reboot AI instance.

func (AIInstanceActionResult) Extract

func (r AIInstanceActionResult) Extract() (*instances.Instance, error)

Extract is a function that accepts a result and extracts a AI instance action resource.

func (AIInstanceActionResult) ExtractInto

func (r AIInstanceActionResult) ExtractInto(v interface{}) error

type AttachInterfaceOpts

type AttachInterfaceOpts struct {
	Type      types.InterfaceType `json:"type,omitempty" validate:"omitempty,enum"`
	NetworkID string              `json:"network_id,omitempty" validate:"rfe=Type:any_subnet,omitempty,uuid4"`
	SubnetID  string              `json:"subnet_id,omitempty" validate:"rfe=Type:subnet,omitempty,uuid4"`
	PortID    string              `json:"port_id,omitempty" validate:"rfe=Type:reserved_fixed_ip,allowed_without_all=NetworkID SubnetID,omitempty,uuid4"`
	IpAddress string              `json:"ip_address,omitempty" validate:"allowed_without_all=Type NetworkID SubnetID FloatingIP,omitempty"`
}

func (AttachInterfaceOpts) ToInterfaceAttachMap

func (opts AttachInterfaceOpts) ToInterfaceAttachMap() (map[string]interface{}, error)

ToInterfaceAttachMap builds a request body from AttachInterfaceOpts.

func (AttachInterfaceOpts) Validate

func (opts AttachInterfaceOpts) Validate() error

Validate

type AttachInterfaceOptsBuilder

type AttachInterfaceOptsBuilder interface {
	ToInterfaceAttachMap() (map[string]interface{}, error)
}

AttachInterfaceOptsBuilder allows extensions to add parameters to the interface request.

type CreateOpts

type CreateOpts struct {
	Flavor         string                                  `json:"flavor" validate:"required,min=1"`
	Name           string                                  `json:"name" validate:"required,min=3,max=63"`
	ImageID        string                                  `json:"image_id" validate:"required,uuid4"`
	Interfaces     []instances.InterfaceInstanceCreateOpts `json:"interfaces" validate:"required,dive"`
	Volumes        []instances.CreateVolumeOpts            `json:"volumes,omitempty" validate:"omitempty,required,dive"`
	SecurityGroups []gcorecloud.ItemID                     `json:"security_groups,omitempty" validate:"omitempty,dive,uuid4"`
	Keypair        string                                  `json:"keypair_name,omitempty"`
	Password       string                                  `json:"password" validate:"omitempty,required_with=Username"`
	Username       string                                  `json:"username" validate:"omitempty,required_with=Password"`
	UserData       string                                  `json:"user_data,omitempty" validate:"omitempty,base64"`
	Metadata       map[string]string                       `json:"metadata,omitempty" validate:"omitempty,dive"`
}

CreateOpts represents options used to create a AI Cluster.

func (CreateOpts) ToAIClusterCreateMap

func (opts CreateOpts) ToAIClusterCreateMap() (map[string]interface{}, error)

ToAIClusterCreateMap builds a request body from CreateOpts.

func (CreateOpts) Validate

func (opts CreateOpts) Validate() error

Validate

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToAIClusterCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

type CreateResult struct {
	// contains filtered or unexported fields
}

CreateResult represents the result of a create operation. Call its Extract method to interpret it as a AI Cluster.

func (CreateResult) Extract

func (r CreateResult) Extract() (*AICluster, error)

Extract is a function that accepts a result and extracts a AI Cluster resource.

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

type DeleteOpts

type DeleteOpts struct {
	Volumes          []string `q:"volumes" validate:"omitempty,dive,uuid4" delimiter:"comma"`
	DeleteFloatings  bool     `q:"delete_floatings" validate:"omitempty,allowed_without=FloatingIPs"`
	FloatingIPs      []string `q:"floatings" validate:"omitempty,allowed_without=DeleteFloatings,dive,uuid4" delimiter:"comma"`
	ReservedFixedIPs []string `q:"reserved_fixed_ips" validate:"omitempty,dive,uuid4" delimiter:"comma"`
}

DeleteOpts. Set parameters for delete operation

func (DeleteOpts) ToAIClusterDeleteQuery

func (opts DeleteOpts) ToAIClusterDeleteQuery() (string, error)

ToIAClusterDeleteQuery formats a DeleteOpts into a query string.

func (*DeleteOpts) Validate

func (opts *DeleteOpts) Validate() error

type DeleteOptsBuilder

type DeleteOptsBuilder interface {
	ToAIClusterDeleteQuery() (string, error)
}

DeleteOptsBuilder allows extensions to add additional parameters to the Delete request.

type DeleteResult

type DeleteResult struct {
	// contains filtered or unexported fields
}

DeleteResult represents the result of a delete operation

func (DeleteResult) Extract

func (r DeleteResult) Extract() (*AICluster, error)

Extract is a function that accepts a result and extracts a AI Cluster resource.

func (DeleteResult) ExtractInto

func (r DeleteResult) ExtractInto(v interface{}) error

type DetachInterfaceOpts

type DetachInterfaceOpts struct {
	PortID    string `json:"port_id" validate:"required,uuid4"`
	IpAddress string `json:"ip_address" validate:"required,ip"`
}

func (DetachInterfaceOpts) ToInterfaceDetachMap

func (opts DetachInterfaceOpts) ToInterfaceDetachMap() (map[string]interface{}, error)

ToInterfaceDetachMap builds a request body from InterfaceOpts.

func (DetachInterfaceOpts) Validate

func (opts DetachInterfaceOpts) Validate() error

Validate

type DetachInterfaceOptsBuilder

type DetachInterfaceOptsBuilder interface {
	ToInterfaceDetachMap() (map[string]interface{}, error)
}

DetachInterfaceOptsBuilder allows extensions to add parameters to the interface request.

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

GetResult represents the result of a get operation. Call its Extract method to interpret it as a AI Cluster.

func Get

func Get(client *gcorecloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific AI Cluster based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*AICluster, error)

Extract is a function that accepts a result and extracts a AI Cluster resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type Interface

type Interface struct {
	PortID              string                  `json:"port_id"`
	MacAddress          gcorecloud.MAC          `json:"mac_address"`
	NetworkID           string                  `json:"network_id"`
	PortSecurityEnabled bool                    `json:"port_security_enabled"`
	IPAssignments       []instances.PortIP      `json:"ip_assignments"`
	NetworkDetails      instances.NetworkDetail `json:"network_details"`
	FloatingIPDetails   []instances.FloatingIP  `json:"floatingip_details"`
	SubPorts            []instances.SubPort     `json:"sub_ports"`
}

Interface represents a AI Cluster interface.

func ExtractAIClusterInterfaces

func ExtractAIClusterInterfaces(r pagination.Page) ([]Interface, error)

ExtractAIClusterInterfaces accepts a Page struct, specifically a AIClusterInterfacePage struct, and extracts the elements into a slice of AI Cluster interface structs. In other words, a generic collection is mapped into a relevant slice.

func ListInterfacesAll

func ListInterfacesAll(client *gcorecloud.ServiceClient, id string) ([]Interface, error)

ListInterfacesAll is a convenience function that returns all AI Cluster interfaces.

type MetadataActionResult

type MetadataActionResult struct {
	gcorecloud.ErrResult
}

MetadataActionResult represents the result of a create, delete or update operation

func MetadataCreateOrUpdate

func MetadataCreateOrUpdate(client *gcorecloud.ServiceClient, id string, opts map[string]interface{}) (r MetadataActionResult)

MetadataCreateOrUpdate creates or update a metadata for an AI.

func MetadataDelete

func MetadataDelete(client *gcorecloud.ServiceClient, id string, key string) (r MetadataActionResult)

MetadataDelete deletes defined metadata key for a AI Cluster.

func MetadataReplace

func MetadataReplace(client *gcorecloud.ServiceClient, id string, opts map[string]interface{}) (r MetadataActionResult)

MetadataReplace replace a metadata for an AI Cluster.

type MetadataPage

type MetadataPage struct {
	pagination.LinkedPageBase
}

MetadataPage is the page returned by a pager when traversing over a collection of AI Cluster metadata objects.

func (MetadataPage) IsEmpty

func (r MetadataPage) IsEmpty() (bool, error)

IsEmpty checks whether a MetadataPage struct is empty.

func (MetadataPage) NextPageURL

func (r MetadataPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of AI Cluster metadata objects has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type MetadataResult

type MetadataResult struct {
	// contains filtered or unexported fields
}

MetadataResult represents the result of a get operation

func MetadataGet

func MetadataGet(client *gcorecloud.ServiceClient, id string, key string) (r MetadataResult)

MetadataGet gets defined metadata key for a AI Cluster.

func (MetadataResult) Extract

func (r MetadataResult) Extract() (*metadata.Metadata, error)

Extract is a function that accepts a result and extracts a AI Clsuter metadata resource.

func (MetadataResult) ExtractInto

func (r MetadataResult) ExtractInto(v interface{}) error

type PoplarInterfaceSecGrop

type PoplarInterfaceSecGrop struct {
	PortID         string   `json:"port_id"`
	NetworkID      string   `json:"network_id"`
	SecurityGroups []string `json:"security_groups"`
}

type RemoteConsole

type RemoteConsole struct {
	URL      string `json:"url"`
	Type     string `json:"type"`
	Protocol string `json:"protocol"`
}

type RemoteConsoleResult

type RemoteConsoleResult struct {
	gcorecloud.Result
}

func GetInstanceConsole

func GetInstanceConsole(client *gcorecloud.ServiceClient, id string) (r RemoteConsoleResult)

GetInstanceConsole retrieves a specific spice console based on instance unique ID.

func (RemoteConsoleResult) Extract

func (r RemoteConsoleResult) Extract() (*RemoteConsole, error)

Extract is a function that accepts a result and extracts a remote console resource.

func (RemoteConsoleResult) ExtractInto

func (r RemoteConsoleResult) ExtractInto(v interface{}) error

type ResizeAIClusterOpts

type ResizeAIClusterOpts struct {
	Flavor         string                                  `json:"flavor" validate:"omitempty,min=1"`
	ImageID        string                                  `json:"image_id" validate:"omitempty,uuid4"`
	Interfaces     []instances.InterfaceInstanceCreateOpts `json:"interfaces" validate:"required,dive"`
	Volumes        []instances.CreateVolumeOpts            `json:"volumes,omitempty" validate:"omitempty,dive"`
	SecurityGroups []gcorecloud.ItemID                     `json:"security_groups,omitempty" validate:"omitempty,dive,uuid4"`
	Keypair        string                                  `json:"keypair_name,omitempty"`
	Password       string                                  `json:"password" validate:"omitempty,required_with=Username"`
	Username       string                                  `json:"username" validate:"omitempty,required_with=Password"`
	UserData       string                                  `json:"user_data,omitempty" validate:"omitempty,base64"`
	Metadata       map[string]string                       `json:"metadata,omitempty" validate:"omitempty,dive"`
}

ResizeAIClusterOpts represents options used to resize AI Clsuter.

func (ResizeAIClusterOpts) ToResizeAIClusterActionMap

func (opts ResizeAIClusterOpts) ToResizeAIClusterActionMap() (map[string]interface{}, error)

ToResizeAIClusterActionMap builds a request body from ResizeAIClusterOpts.

func (ResizeAIClusterOpts) Validate

func (opts ResizeAIClusterOpts) Validate() error

Validate

type ResizeAIClusterOptsBuilder

type ResizeAIClusterOptsBuilder interface {
	ToResizeAIClusterActionMap() (map[string]interface{}, error)
}

ResizeAIClusterOptsBuilder builds parameters or change flavor request.

type SecurityGroupActionResult

type SecurityGroupActionResult struct {
	gcorecloud.ErrResult
}

SecurityGroupActionResult represents the result of a actions operation

func AssignSecurityGroup

AssignSecurityGroup adds a security groups to the AI Cluster

func UnAssignSecurityGroup

UnAssignSecurityGroup removes a security groups from the AI Cluster

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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