// Delete Network by sending NetworkRequest to HNS
324263
func (network *HNSNetwork) Delete() (*HNSNetwork, error) {
	operation := "Delete"
	title := "hcsshim::HNSNetwork::" + operation
	logrus.Debugf(title+" id=%s", network.Id)

	return HNSNetworkRequest("DELETE", network.Id, "")
}
1190522
func (c *CloudAPI) DeleteFabricNetwork(vlanID int16, networkID string) error {
	vlan, err := c.getFabricWrapper(vlanID)
	if err != nil {
		return err
	}

	_, present := vlan.Networks[networkID]
	if !present {
		return fmt.Errorf("Network %s not found", networkID)
	}

	delete(vlan.Networks, networkID)
	return nil
}
1275245
func (_m *APIClient) NodeRemove(ctx context.Context, nodeID string, options types.NodeRemoveOptions) error {
	ret := _m.Called(ctx, nodeID, options)

	var r0 error
	if rf, ok := ret.Get(0).(func(context.Context, string, types.NodeRemoveOptions) error); ok {
		r0 = rf(ctx, nodeID, options)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
285724
func (s *NetworkService) NewDeleteNetworkParams(id string) *DeleteNetworkParams {
	p := &DeleteNetworkParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	return p
}
115528
func HNSListNetworkRequest(method, path, request string) ([]HNSNetwork, error) {
	return hns.HNSListNetworkRequest(method, path, request)
}
1033124
func (api *DNSAPI) DeleteDNSRecord(zoneName string, hostName string, ip string) error {
	dnsItem, err := api.findOrCreateBy(zoneName)
	if err != nil {
		return err
	}
	dnsItem.Settings.DNS.DeleteDNSRecordSet(hostName, ip)

	if dnsItem.HasDNSRecord() {
		_, err = api.updateDNSRecord(dnsItem)
		if err != nil {
			return err
		}

	} else {
		_, err = api.Delete(dnsItem.ID)
		if err != nil {
			return err
		}

	}
	return nil
}
982616
func (w *Wrapper) DeleteTunnelConnection(clusterName, connName string) error {
	return w.Write.DeleteTunnelConnection(clusterName, connName)
}
1082543
func (daemon *Daemon) DeleteManagedNetwork(networkID string) error {
	n, err := daemon.GetNetworkByID(networkID)
	if err != nil {
		return err
	}
	return daemon.deleteNetwork(n, true)
}
603755
func (c *Cluster) RemoveNetwork(input string) error {
	return c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
		network, err := getNetwork(ctx, state.controlClient, input)
		if err != nil {
			return err
		}

		_, err = state.controlClient.RemoveNetwork(ctx, &swarmapi.RemoveNetworkRequest{NetworkID: network.ID})
		return err
	})
}
587701
func (daemon *Daemon) ForceEndpointDelete(name string, networkName string) error {
	n, err := daemon.FindNetwork(networkName)
	if err != nil {
		return err
	}

	ep, err := n.EndpointByName(name)
	if err != nil {
		return err
	}
	return ep.Delete(true)
}
57678
func deleteNetworkHelper(networkID string) error {
	dnet, err := docknet.FindDocknetByUUID(networkID)
	if err == nil {
		// delete the dnet oper state
		err = docknet.DeleteDockNetState(dnet.TenantName, dnet.NetworkName, dnet.ServiceName)
		if err != nil {
			msg := fmt.Sprintf("Could not delete docknet for nwID %s: %s", networkID, err.Error())
			log.Errorf(msg)
			return errors.New(msg)
		}
		log.Infof("Deleted docker network mapping for %v", networkID)
	} else {
		msg := fmt.Sprintf("Could not find Docker network %s: %s", networkID, err.Error())
		log.Errorf(msg)
	}

	netID := networkID + ".default"
	_, err = utils.GetNetwork(netID)
	if err == nil {
		// if we find a contiv network with the ID hash, then it must be
		// a docker created network (from the libnetwork create api).
		// build key and URL
		keyStr := "default" + ":" + networkID
		url := "/api/v1/networks/" + keyStr + "/"

		err = cluster.MasterDelReq(url)
		if err != nil {
			msg := fmt.Sprintf("Failed to delete network: %s", err.Error())
			log.Errorf(msg)
			return errors.New(msg)
		}
		log.Infof("Deleted contiv network %v", networkID)
	} else {
		log.Infof("Could not find contiv network %v", networkID)
	}

	return nil
}
1134914
func httpDeleteNetwork(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	log.Debugf("Received httpDeleteNetwork: %+v", vars)

	key := vars["key"]

	// Delete the object
	err := DeleteNetwork(key)
	if err != nil {
		log.Errorf("DeleteNetwork error for: %s. Err: %v", key, err)
		return nil, err
	}

	// Return the obj
	return key, nil
}
393539
func (c *Client) DeleteNetworkOffering(p *DeleteNetworkOfferingParameter) (*Result, error) {
	obj, err := c.Request("deleteNetworkOffering", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Result), err
}
178921
func (s *NetworkOfferingService) DeleteNetworkOffering(p *DeleteNetworkOfferingParams) (*DeleteNetworkOfferingResponse, error) {
	resp, err := s.cs.newRequest("deleteNetworkOffering", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r DeleteNetworkOfferingResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
1246912
func (namespace *HostComputeNamespace) Delete() error {
	logrus.Debugf("hcn::HostComputeNamespace::Delete id=%s", namespace.Id)

	if err := deleteNamespace(namespace.Id); err != nil {
		return err
	}
	return nil
}
719594
func (sw *OvsSwitch) DeleteNetwork(pktTag uint16, extPktTag uint32, gateway string, Vrf string) error {
	// Delete vlan/vni mapping
	if sw.ofnetAgent != nil {
		err := sw.ofnetAgent.RemoveNetwork(pktTag, extPktTag, gateway, Vrf)
		if err != nil {
			log.Errorf("Error removing vlan/vni %d/%d. Err: %v", pktTag, extPktTag, err)
			return err
		}
	}
	return nil
}
215632
func (s *NetworkACLService) DeleteNetworkACL(p *DeleteNetworkACLParams) (*DeleteNetworkACLResponse, error) {
	resp, err := s.cs.newRequest("deleteNetworkACL", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r DeleteNetworkACLResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}