Documentation ¶
Index ¶
- Variables
- func ConvertVM(config onecloudv1.VirtualMachineSpec) comapi.ServerCreateInput
- func ConvertVMConfig(config onecloudv1.VirtualMachineConfig) comapi.ServerConfigs
- func ConvertVMDisk(config onecloudv1.VMDiskSpec) comapi.DiskConfig
- func ConvertVMNetwork(config onecloudv1.VMNetworkSpec) comapi.NetworkConfig
- func Register(resource Resource, manager modulebase.ResourceManager)
- type APCreateParams
- type AnsiblePlaybook
- func (an AnsiblePlaybook) Create(ctx context.Context, params interface{}) (onecloudv1.ExternalInfoBase, error)
- func (an AnsiblePlaybook) Delete(ctx context.Context) (onecloudv1.ExternalInfoBase, error)
- func (ap AnsiblePlaybook) GetIResource() onecloudv1.IResource
- func (ap AnsiblePlaybook) GetResourceName() Resource
- func (an AnsiblePlaybook) GetStatus(ctx context.Context) (onecloudv1.IResourceStatus, error)
- func (an AnsiblePlaybook) Reconcile(ctx context.Context) (*onecloudv1.AnsiblePlaybookStatus, error)
- type AnsiblePlaybookHost
- type DiskInfo
- type Endpoint
- func (ep Endpoint) Create(ctx context.Context, params interface{}) (onecloudv1.ExternalInfoBase, error)
- func (ep Endpoint) Delete(ctx context.Context) (onecloudv1.ExternalInfoBase, error)
- func (ep Endpoint) GetIResource() onecloudv1.IResource
- func (ep Endpoint) GetResourceName() Resource
- func (ep Endpoint) GetStatus(ctx context.Context) (onecloudv1.IResourceStatus, error)
- func (ep Endpoint) Reconcile(ctx context.Context) (*onecloudv1.EndpointStatus, error)
- func (ep Endpoint) Url(ctx context.Context) (string, error)
- type EndpointCreateParams
- type EndpointUpdateField
- type OCResource
- type OperatorDesc
- type OperatorFunc
- type ReconcileOper
- type Resource
- type ResourceOperation
- type SRequest
- func (r SRequest) Apply(ctx context.Context, id string, params *jsonutils.JSONDict) (jsonutils.JSONObject, onecloudv1.ExternalInfoBase, error)
- func (r SRequest) DefaultParams(dict *jsonutils.JSONDict) SRequest
- func (r SRequest) GetId(ctx context.Context, name string) (string, error)
- func (r SRequest) List(ctx context.Context, params *jsonutils.JSONDict) ([]jsonutils.JSONObject, error)
- func (r SRequest) Operation(oper ResourceOperation) SRequest
- func (r SRequest) Resource(resource Resource) SRequest
- func (r SRequest) ResourceAction() string
- type SRequestErr
- type VirtualMachine
- func (vi VirtualMachine) Create(ctx context.Context, _ interface{}) (onecloudv1.ExternalInfoBase, error)
- func (vi VirtualMachine) DefaultRecreatePolicy() *onecloudv1.RecreatePolicy
- func (vi VirtualMachine) Delete(ctx context.Context) (onecloudv1.ExternalInfoBase, error)
- func (vi VirtualMachine) GetIResource() onecloudv1.IResource
- func (vi VirtualMachine) GetResourceName() Resource
- func (vi VirtualMachine) GetStatus(ctx context.Context) (rs onecloudv1.IResourceStatus, err error)
- func (vi VirtualMachine) Reconcile(ctx context.Context) (oper *ReconcileOper, vmInfo *onecloudv1.VMInfo, err error)
- func (vi VirtualMachine) Start(ctx context.Context) (onecloudv1.ExternalInfoBase, error)
- func (vi VirtualMachine) Stop(ctx context.Context) (onecloudv1.ExternalInfoBase, error)
Constants ¶
This section is empty.
Variables ¶
var ( RequestEndpoint = Request.Resource(ResourceEndpoint) RequestService = Request.Resource(ResourceSevice) RequestRegion = Request.Resource(ResourceRegion) )
var ( Service = "external-service" ServiceID = "" Interface = "console" )
var Modules = make(map[Resource]modulebase.ResourceManager)
Modules describe the correspondence between Resource and modulebase.ResourceManager, which is equivalent to onecloud resource client.
var (
RequestAP = Request.Resource(ResourceAP)
)
var (
True = true
)
Functions ¶
func ConvertVM ¶
func ConvertVM(config onecloudv1.VirtualMachineSpec) comapi.ServerCreateInput
func ConvertVMConfig ¶
func ConvertVMConfig(config onecloudv1.VirtualMachineConfig) comapi.ServerConfigs
func ConvertVMDisk ¶
func ConvertVMDisk(config onecloudv1.VMDiskSpec) comapi.DiskConfig
func ConvertVMNetwork ¶
func ConvertVMNetwork(config onecloudv1.VMNetworkSpec) comapi.NetworkConfig
func Register ¶
func Register(resource Resource, manager modulebase.ResourceManager)
Every Resource should call Register to register their modulebase.ResourceManager.
Types ¶
type APCreateParams ¶
type APCreateParams struct { Hosts []AnsiblePlaybookHost Apt *onecloudv1.AnsiblePlaybookTemplate CommonVars map[string]interface{} }
type AnsiblePlaybook ¶
type AnsiblePlaybook struct { AnsiblePlaybook *onecloudv1.AnsiblePlaybook // contains filtered or unexported fields }
func NewAnisblePlaybook ¶
func NewAnisblePlaybook(ap *onecloudv1.AnsiblePlaybook, logger logr.Logger) AnsiblePlaybook
func (AnsiblePlaybook) Create ¶
func (an AnsiblePlaybook) Create(ctx context.Context, params interface{}) (onecloudv1.ExternalInfoBase, error)
func (AnsiblePlaybook) Delete ¶
func (an AnsiblePlaybook) Delete(ctx context.Context) (onecloudv1.ExternalInfoBase, error)
func (AnsiblePlaybook) GetIResource ¶
func (ap AnsiblePlaybook) GetIResource() onecloudv1.IResource
func (AnsiblePlaybook) GetResourceName ¶
func (ap AnsiblePlaybook) GetResourceName() Resource
func (AnsiblePlaybook) GetStatus ¶
func (an AnsiblePlaybook) GetStatus(ctx context.Context) (onecloudv1.IResourceStatus, error)
func (AnsiblePlaybook) Reconcile ¶
func (an AnsiblePlaybook) Reconcile(ctx context.Context) (*onecloudv1.AnsiblePlaybookStatus, error)
type AnsiblePlaybookHost ¶
type AnsiblePlaybookHost struct { VM *onecloudv1.VirtualMachine Vars map[string]interface{} }
type Endpoint ¶
type Endpoint struct { Endpoint *onecloudv1.Endpoint // contains filtered or unexported fields }
func NewEndpoint ¶
func NewEndpoint(ep *onecloudv1.Endpoint, logger logr.Logger) Endpoint
func (Endpoint) Create ¶
func (ep Endpoint) Create(ctx context.Context, params interface{}) (onecloudv1.ExternalInfoBase, error)
func (Endpoint) Delete ¶
func (ep Endpoint) Delete(ctx context.Context) (onecloudv1.ExternalInfoBase, error)
func (Endpoint) GetIResource ¶
func (ep Endpoint) GetIResource() onecloudv1.IResource
func (Endpoint) GetResourceName ¶
func (Endpoint) GetStatus ¶
func (ep Endpoint) GetStatus(ctx context.Context) (onecloudv1.IResourceStatus, error)
func (Endpoint) Reconcile ¶
func (ep Endpoint) Reconcile(ctx context.Context) (*onecloudv1.EndpointStatus, error)
type EndpointCreateParams ¶
type EndpointUpdateField ¶
type OCResource ¶
type OCResource interface { GetResourceName() Resource GetIResource() onecloudv1.IResource Create(ctx context.Context, params interface{}) (onecloudv1.ExternalInfoBase, error) Delete(ctx context.Context) (onecloudv1.ExternalInfoBase, error) GetStatus(ctx context.Context) (onecloudv1.IResourceStatus, error) }
type OperatorDesc ¶
type OperatorDesc struct { Name string // contains filtered or unexported fields }
func (*OperatorDesc) Append ¶
func (ad *OperatorDesc) Append(resource, from, to string)
func (*OperatorDesc) Appendf ¶
func (ad *OperatorDesc) Appendf(desc string, params ...interface{})
func (*OperatorDesc) Merge ¶
func (ad *OperatorDesc) Merge(desc OperatorDesc)
func (*OperatorDesc) String ¶
func (ad *OperatorDesc) String() string
type OperatorFunc ¶
type OperatorFunc func(ctx context.Context) (onecloudv1.ExternalInfoBase, error)
type ReconcileOper ¶
type ReconcileOper struct { Operator OperatorFunc OperDesc OperatorDesc PrePhase []onecloudv1.ResourcePhase }
ReconcileOper describe a Operation about reconcile process. It invovles a func, desc and the phase needed.
type Resource ¶
type Resource string
Resoruce describe a onecloud resource, such as: VM: SGuest in onecloud EIP: SElasticip in onecloud AP: AnsiblePlaybook in onecloud ...
type ResourceOperation ¶
type ResourceOperation string
ResourceOperation describe the operation for onecloud resource like create, update, delete and so on.
const ( OperCreate ResourceOperation = "Create" OperDelete ResourceOperation = "Delete" OperUpdate ResourceOperation = "Update" OperPatch ResourceOperation = "Patch" OperGet ResourceOperation = "Get" OperList ResourceOperation = "List" OperGetDetails ResourceOperation = "GetDetails" OperGetStatus ResourceOperation = "GetStatus" OperChangeConfig ResourceOperation = "ChangeConfig" OperSyncstatus ResourceOperation = "Syncstatus" OperResize ResourceOperation = "Resize" OperChangeBw ResourceOperation = "ChangeBandwidth" OperSetSecgroups ResourceOperation = "SetSecgroups" OperStart ResourceOperation = "Start" OperStop ResourceOperation = "Stop" )
It is clearer to write each ResourceOperation as a constant
type SRequest ¶
type SRequest struct {
// contains filtered or unexported fields
}
SRequest encapsulates HTTP requests to perform operations on onecloud resources
var Request SRequest
Request itself is meaningless, a meaningful Request is generated by calling Resource, Operation and DefaultParams. A example:
Request.Resource(ResourceVM).Operation(OperGet).Apply(...)
func (SRequest) Apply ¶
func (r SRequest) Apply(ctx context.Context, id string, params *jsonutils.JSONDict) (jsonutils.JSONObject, onecloudv1.ExternalInfoBase, error)
func (SRequest) Operation ¶
func (r SRequest) Operation(oper ResourceOperation) SRequest
func (SRequest) ResourceAction ¶
type SRequestErr ¶
SRequestErr encapsulates the error returned by SRequest and implement the interface error
func (SRequestErr) Error ¶
func (re SRequestErr) Error() string
func (SRequestErr) IsClientErr ¶
func (re SRequestErr) IsClientErr() bool
func (SRequestErr) IsNotFound ¶
func (re SRequestErr) IsNotFound(resource Resource) bool
func (SRequestErr) IsServerErr ¶
func (re SRequestErr) IsServerErr() bool
type VirtualMachine ¶
type VirtualMachine struct { VirtualMachine *onecloudv1.VirtualMachine // contains filtered or unexported fields }
func NewVirtualMachine ¶
func NewVirtualMachine(vm *onecloudv1.VirtualMachine, logger logr.Logger) VirtualMachine
func (VirtualMachine) Create ¶
func (vi VirtualMachine) Create(ctx context.Context, _ interface{}) (onecloudv1.ExternalInfoBase, error)
func (VirtualMachine) DefaultRecreatePolicy ¶
func (vi VirtualMachine) DefaultRecreatePolicy() *onecloudv1.RecreatePolicy
func (VirtualMachine) Delete ¶
func (vi VirtualMachine) Delete(ctx context.Context) (onecloudv1.ExternalInfoBase, error)
func (VirtualMachine) GetIResource ¶
func (vi VirtualMachine) GetIResource() onecloudv1.IResource
func (VirtualMachine) GetResourceName ¶
func (vi VirtualMachine) GetResourceName() Resource
func (VirtualMachine) GetStatus ¶
func (vi VirtualMachine) GetStatus(ctx context.Context) (rs onecloudv1.IResourceStatus, err error)
func (VirtualMachine) Reconcile ¶
func (vi VirtualMachine) Reconcile(ctx context.Context) (oper *ReconcileOper, vmInfo *onecloudv1.VMInfo, err error)
func (VirtualMachine) Start ¶
func (vi VirtualMachine) Start(ctx context.Context) (onecloudv1.ExternalInfoBase, error)
func (VirtualMachine) Stop ¶
func (vi VirtualMachine) Stop(ctx context.Context) (onecloudv1.ExternalInfoBase, error)