// AddVirtualSwitch wraps methods.AddVirtualSwitch
503148
func (o HostNetworkSystem) AddVirtualSwitch(ctx context.Context, vswitchName string, spec *types.HostVirtualSwitchSpec) error {
	req := types.AddVirtualSwitch{
		This:        o.Reference(),
		VswitchName: vswitchName,
		Spec:        spec,
	}

	_, err := methods.AddVirtualSwitch(ctx, o.c, &req)
	if err != nil {
		return err
	}

	return nil
}
229743
func (c *ALIModelContext) LinkToVSwitchSNAT(subnetName string) *alitasks.VSwitch {
	return &alitasks.VSwitch{Name: s(c.GetNameForVSwitch(subnetName))}
}
1234172
func (b *serverBuilder) AddExistsSwitchConnectedNICWithDisplayIP(switchID, displayIP string) {
	b.nicConnections = append(b.nicConnections, switchID)
	b.displayIPAddresses = append(b.displayIPAddresses, displayIP)
}
1059483
func (c *Client) AddMachinesV2(args params.AddMachines) (params.AddMachinesResults, error) {
	results := params.AddMachinesResults{
		Machines: make([]params.AddMachinesResult, len(args.MachineParams)),
	}
	if err := c.check.ChangeAllowed(); err != nil {
		return results, errors.Trace(err)
	}
	for i, p := range args.MachineParams {
		m, err := c.addOneMachine(p)
		results.Machines[i].Error = common.ServerError(err)
		if err == nil {
			results.Machines[i].Machine = m.Id()
		}
	}
	return results, nil
}
848628
func (p *propConnectedSwitches) AddExistsSwitchConnectedParam(switchID string) {
	if p.ConnectedSwitches == nil {
		p.ClearConnectedSwitches()
	}
	p.ConnectedSwitches = append(p.ConnectedSwitches, map[string]interface{}{"ID": switchID})
}
290071
func (s *VirtualMachineService) NewAddNicToVirtualMachineParams(networkid string, virtualmachineid string) *AddNicToVirtualMachineParams {
	p := &AddNicToVirtualMachineParams{}
	p.p = make(map[string]interface{})
	p.p["networkid"] = networkid
	p.p["virtualmachineid"] = virtualmachineid
	return p
}
837158
func (r Ticket) AddAttachedVirtualGuest(guestId *int, callCommit *bool) (resp datatypes.Ticket_Attachment_Virtual_Guest, err error) {
	params := []interface{}{
		guestId,
		callCommit,
	}
	err = r.Session.DoRequest("SoftLayer_Ticket", "addAttachedVirtualGuest", params, &r.Options, &resp)
	return
}
1688
func (api *API) CreateVirtualDNS(v *VirtualDNS) (*VirtualDNS, error) {
	res, err := api.makeRequest("POST", "/user/virtual_dns", v)
	if err != nil {
		return nil, errors.Wrap(err, errMakeRequestError)
	}

	response := &VirtualDNSResponse{}
	err = json.Unmarshal(res, &response)
	if err != nil {
		return nil, errors.Wrap(err, errUnmarshalError)
	}

	return response.Result, nil
}
435568
func (p *ProxyLB) AddBindPort(mode string, port int) {
	p.Settings.ProxyLB.AddBindPort(mode, port)
}
14906
func (s *VirtualServiceRef) SetVirtualServiceName(v string) *VirtualServiceRef {
	s.VirtualServiceName = &v
	return s
}
1277780
func (g *Mutable) Add(v, w int) {
	g.AddCost(v, w, 0)
}
947413
func (s *VirtualMachineService) NewAssignVirtualMachineParams(virtualmachineid string) *AssignVirtualMachineParams {
	p := &AssignVirtualMachineParams{}
	p.p = make(map[string]interface{})
	p.p["virtualmachineid"] = virtualmachineid
	return p
}
780781
func restAddVirtualHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) {
	glog.V(1).Infof("Add VHost with %s %#v", r.URL.Path, r)

	serviceid, application, vhostname, err := getVHostContext(r)
	if err != nil {
		restServerError(w, err)
		return
	}

	// Disallow adding a vhost with the same name as the hostname being used
	// to view CC (do not lock them out of the CC ui from this hostname)
	if strings.Compare(strings.ToLower(r.Host), strings.ToLower(vhostname)) == 0 {
		restServerError(w, errInvalidVhostUsedCCHostname{})
		return
	}

	var request endpointRequest
	err = r.DecodeJsonPayload(&request)
	if err != nil {
		restBadRequest(w, err)
		return
	}

	facade := ctx.getFacade()
	dataCtx := ctx.getDatastoreContext()

	_, err = facade.AddPublicEndpointVHost(dataCtx, serviceid, application, vhostname, true, true)
	if err != nil {
		glog.Errorf("Error adding vhost to service (%s): %v", request.ServiceName, err)
		restServerError(w, err)
		return
	}

	glog.V(2).Infof("VHost (%s) added to service (%s)", vhostname, request.ServiceName)
	restSuccess(w)
}
1251449
func (client *Client) DescribeVSwitches(args *DescribeVSwitchesArgs) (vswitches []VSwitchSetType, pagination *common.PaginationResult, err error) {
	args.Validate()
	response, err := client.DescribeVSwitchesWithRaw(args)
	if err == nil {
		return response.VSwitches.VSwitch, &response.PaginationResult, nil
	}

	return nil, nil, err
}
706100
func NewSwitchMultilevelV4(data []byte) (*SwitchMultilevelV4, error) {
	if len(data) != 3 {
		return nil, fmt.Errorf("Wrong length, expected 3 byte got %d", len(data))
	}

	return &SwitchMultilevelV4{
		CurrentValue: math.Min(float64(data[0]), 100),
		TargetValue:  math.Min(float64(data[1]), 100),
		Duration:     commands.Duration(data[2]),
		Valid:        data[0] != 0xFE,
		TargetValid:  data[1] != 0xFE,
		data:         data,
	}, nil
}
198351
func (d *OvsDriver) AddPeerHost(node core.ServiceInfo) error {
	// Nothing to do if this is our own IP
	if node.HostAddr == d.localIP {
		return nil
	}

	log.Infof("CreatePeerHost for %+v", node)

	// Add the VTEP for the peer in vxlan switch.
	err := d.switchDb["vxlan"].CreateVtep(node.HostAddr)
	if err != nil {
		log.Errorf("Error adding the VTEP %s. Err: %s", node.HostAddr, err)
		return err
	}

	return nil
}
994734
func OptionSwitchKeyBindMode(m KeyBindMode) Option {
	return func(p *Prompt) error {
		p.keyBindMode = m
		return nil
	}
}