Exemplo n.º 1
0
// VirtualMachine Delete.  Caller must initialize the VirtualMachine ID (vp.ID)
func (vm *VirtualMachine) Delete(c *nuage.Connection) error {

	if vm.ID == "" {
		err := fmt.Errorf("VirtualMachine Delete: Empty VirtualMachine ID, nothing to do")
		return err
	}

	_, err := nuage.DeleteEntity(c, "vms", vm.ID)

	if err != nil {
		log.Debugf("VirtualMachine Delete: Unable to delete VirtualMachine with ID: [%s] . Error: %s ", vm.ID, err)
		return err
	}

	log.Debugf("VirtualMachine Delete: Deleted VirtualMachine with ID: [%s]", vm.ID)
	return nil

}
Exemplo n.º 2
0
// VPort Delete.  Caller must initialize the VPort ID (vp.ID)
func (vp *VPort) Delete(c *nuage.Connection) error {

	if vp.ID == "" {
		err := fmt.Errorf("VPort Delete: Empty VPort ID, nothing to do")
		return err
	}

	_, err := nuage.DeleteEntity(c, "vports", vp.ID)

	if err != nil {
		log.Debugf("VPort Delete: Unable to delete VPort with ID: [%s] . Error: %s ", vp.ID, err)
		return err
	}

	log.Debugf("VPort Delete: Deleted VPort with ID: [%s]", vp.ID)
	return nil

}
Exemplo n.º 3
0
// VMInterface Delete.  Caller must initialize the VMInterface ID (vmi.ID)
func (vmi *VMInterface) Delete(c *nuage.Connection) error {

	if vmi.ID == "" {
		err := fmt.Errorf("VMInterface Delete: Empty VMInterface ID, nothing to do")
		return err
	}

	_, err := nuage.DeleteEntity(c, "vminterfaces", vmi.ID)

	if err != nil {
		log.Debugf("VMInterface Delete: Unable to delete VMInterface with ID: [%s] . Error: %s ", vmi.ID, err)
		return err
	}

	log.Debugf("VMInterface Delete: Deleted VMInterface with ID: [%s]", vmi.ID)
	return nil

}
Exemplo n.º 4
0
// Assumes the method receiver was allocated using "new(Domaintemplate)"
// Caller must populate the ID (dt.ID)
func (dt *Domaintemplate) Delete(c *nuage.Connection) error {
	if dt == nil {
		err := fmt.Errorf("Domain template Delete: Empty method receiver, nothing to do")
		return err
	}

	if dt.ID == "" {
		err := fmt.Errorf("Domain template Delete: Empty ID, nothing to do")
		return err
	}
	_, err := nuage.DeleteEntity(c, "domaintemplates", dt.ID)

	if err != nil {
		log.Debugf("Domain template Delete: Unable to delete Domain template with ID: [%s] . Error: %s ", dt.ID, err)
		return err
	}

	log.Debugf("Domain template Delete: Deleted domain template with ID: [%s] ", dt.ID)
	return nil
}
Exemplo n.º 5
0
// Caller must populate Zone ID (z.ID)
func (z *Zone) Delete(c *nuage.Connection) error {
	if z == nil {
		err := fmt.Errorf("Zone Delete: Empty method receiver, nothing to do")
		return err
	}

	if z.ID == "" {
		err := fmt.Errorf("Zone Delete: Empty ID, nothing to do")
		return err
	}
	_, err := nuage.DeleteEntity(c, "zones", z.ID)

	if err != nil {
		log.Debugf("Zone Delete: Unable to delete Zone with ID: [%s] . Error: %s ", z.ID, err)
		return err
	}

	log.Debugf("Zone Delete: Deleted zone with ID: [%s] ", z.ID)
	return nil
}
Exemplo n.º 6
0
// Caller must populate Subnet ID (s.ID)
func (s *Subnet) Delete(c *nuage.Connection) error {
	if s == nil {
		err := fmt.Errorf("Subnet Delete: Empty method receiver, nothing to do")
		return err
	}

	if s.ID == "" {
		err := fmt.Errorf("Subnet Delete: Empty ID, nothing to do")
		return err
	}
	_, err := nuage.DeleteEntity(c, "subnets", s.ID)

	if err != nil {
		log.Debugf("Subnet Delete: Unable to delete Subnet with ID: [%s] . Error: %s ", s.ID, err)
		return err
	}

	log.Debugf("Subnet Delete: Deleted subnet with ID: [%s] ", s.ID)
	return nil
}
Exemplo n.º 7
0
// Must have a valid ID (org.ID)
func (org *Enterprise) Delete(c *nuage.Connection) error {
	if org == nil {
		err := fmt.Errorf("Enterprise Delete: Empty method receiver, nothing to do")
		return err
	}

	if org.ID == "" {
		err := fmt.Errorf("Enterprise Delete: Empty Enterprise ID, nothing to do")
		return err
	}

	_, err := nuage.DeleteEntity(c, "enterprises", org.ID)

	if err != nil {
		log.Debugf("Enterprise Delete: Unable to delete Enterprise with name %s . Error: %s ", org.Name, err)
		return err
	}

	log.Debugf("Enterprise Delete: Deleted Enterprise [%s] with ID: [%s] ", org.Name, org.ID)
	return nil

}