// WithMac adds the mac to the delete dhcp lease mac params
492739
func (o *DeleteDhcpLeaseMacParams) WithMac(mac string) *DeleteDhcpLeaseMacParams {
	o.Mac = mac
	return o
}
23593
func (e *Event) MACAddr(key string, ha net.HardwareAddr) *Event {
	if e == nil {
		return e
	}
	e.buf = enc.AppendMACAddr(enc.AppendKey(e.buf, key), ha)
	return e
}
570615
func (builder *UpdateSetCommandBuilder) WithKey(key string) *UpdateSetCommandBuilder {
	builder.protobuf.Key = []byte(key)
	return builder
}
876413
func (api *CoreAPI) WithOptions(opts ...options.ApiOption) (coreiface.CoreAPI, error) {
	settings := api.parentOpts // make sure to copy
	_, err := options.ApiOptionsTo(&settings, opts...)
	if err != nil {
		return nil, err
	}

	if api.nd == nil {
		return nil, errors.New("cannot apply options to api without node")
	}

	n := api.nd

	subApi := &CoreAPI{
		nctx: n.Context(),

		identity:   n.Identity,
		privateKey: n.PrivateKey,

		repo:       n.Repo,
		blockstore: n.Blockstore,
		baseBlocks: n.BaseBlocks,
		pinning:    n.Pinning,

		blocks: n.Blocks,
		dag:    n.DAG,

		peerstore:       n.Peerstore,
		peerHost:        n.PeerHost,
		namesys:         n.Namesys,
		recordValidator: n.RecordValidator,
		exchange:        n.Exchange,
		routing:         n.Routing,

		provider: n.Provider,

		pubSub: n.PubSub,

		nd:         n,
		parentOpts: settings,
	}

	subApi.checkOnline = func(allowOffline bool) error {
		if !n.IsOnline && !allowOffline {
			return coreiface.ErrOffline
		}
		return nil
	}

	subApi.checkPublishAllowed = func() error {
		if n.Mounts.Ipns != nil && n.Mounts.Ipns.IsActive() {
			return errors.New("cannot manually publish while IPNS is mounted")
		}
		return nil
	}

	if settings.Offline {
		cfg, err := n.Repo.Config()
		if err != nil {
			return nil, err
		}

		cs := cfg.Ipns.ResolveCacheSize
		if cs == 0 {
			cs = node.DefaultIpnsCacheSize
		}
		if cs < 0 {
			return nil, fmt.Errorf("cannot specify negative resolve cache size")
		}

		subApi.routing = offlineroute.NewOfflineRouter(subApi.repo.Datastore(), subApi.recordValidator)
		subApi.namesys = namesys.NewNameSystem(subApi.routing, subApi.repo.Datastore(), cs)
		subApi.provider = provider.NewOfflineProvider()

		subApi.peerstore = nil
		subApi.peerHost = nil
		subApi.recordValidator = nil
	}

	if settings.Offline || !settings.FetchBlocks {
		subApi.exchange = offlinexch.Exchange(subApi.blockstore)
		subApi.blocks = bserv.New(subApi.blockstore, subApi.exchange)
		subApi.dag = dag.NewDAGService(subApi.blocks)
	}

	return subApi, nil
}
610413
func (d *HypervPS4Driver) Mac(vmName string) (string, error) {
	res, err := hyperv.Mac(vmName)

	if err != nil {
		return res, err
	}

	if res == "" {
		err := fmt.Errorf("%s", "No mac address.")
		return res, err
	}

	return res, err
}
454338
func ResolveSubnetWithMAC(ctx types.Context, mac string) (string, error) {
	subnetID, err := getSubnetID(ctx, mac)
	if err != nil {
		return "", err
	}
	return subnetID, nil
}
405476
func WithOption(key, value string) func(*types.NetworkCreate) {
	return func(n *types.NetworkCreate) {
		if n.Options == nil {
			n.Options = map[string]string{}
		}
		n.Options[key] = value
	}
}
119378
func setMacVlanMode(mode string) (netlink.MacvlanMode, error) {
	switch mode {
	case modePrivate:
		return netlink.MACVLAN_MODE_PRIVATE, nil
	case modeVepa:
		return netlink.MACVLAN_MODE_VEPA, nil
	case modeBridge:
		return netlink.MACVLAN_MODE_BRIDGE, nil
	case modePassthru:
		return netlink.MACVLAN_MODE_PASSTHRU, nil
	default:
		return 0, fmt.Errorf("unknown macvlan mode: %s", mode)
	}
}
1352790
func (o *DeleteJSONWebKeySetParams) WithSet(set string) *DeleteJSONWebKeySetParams {
	o.SetSet(set)
	return o
}
1028065
func (options PoolOptions) WithAddress(address string) PoolOptions {
	options.Address = address
	return options
}
1197621
func NewMAC() (string, error) {
	mac := make([]byte, 6)
	n, err := io.ReadFull(rand.Reader, mac)
	if n != len(mac) || err != nil {
		return "", err
	}
	e := hex.EncodeToString(mac)

	return fmt.Sprintf("%s:%s:%s:%s:%s:%s", e[0:2], e[2:4], e[4:6], e[6:8], e[8:10], e[10:12]), nil
}
186628
func parseMAC48s(macs []string) ([]uint64, error) {
	mac48s := make([]uint64, len(macs))
	for i, mac := range macs {
		mac48, err := common.ParseMAC48(mac)
		if err != nil {
			return nil, status.Errorf(codes.InvalidArgument, "invalid MAC-48 address %q", mac)
		}
		mac48s[i] = uint64(mac48)
	}
	return mac48s, nil
}
249708
func verifyMAC(key, b, mac []byte) bool {
	m := hmac.New(sha256.New, key)
	m.Write(b)
	return hmac.Equal(m.Sum(nil), mac)
}
537704
func WithIPvlan(parent, mode string) func(*types.NetworkCreate) {
	return func(n *types.NetworkCreate) {
		n.Driver = "ipvlan"
		if n.Options == nil {
			n.Options = map[string]string{}
		}
		if parent != "" {
			n.Options["parent"] = parent
		}
		if mode != "" {
			n.Options["ipvlan_mode"] = mode
		}
	}
}
1051138
func (s *FakeAWSServices) WithAz(az string) *FakeAWSServices {
	if s.selfInstance.Placement == nil {
		s.selfInstance.Placement = &ec2.Placement{}
	}
	s.selfInstance.Placement.AvailabilityZone = aws.String(az)
	return s
}
992993
func (a *Client) DeleteNodesMacaddressDhcpWhitelist(params *DeleteNodesMacaddressDhcpWhitelistParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteNodesMacaddressDhcpWhitelistNoContent, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteNodesMacaddressDhcpWhitelistParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "DeleteNodesMacaddressDhcpWhitelist",
		Method:             "DELETE",
		PathPattern:        "/nodes/{macaddress}/dhcp/whitelist",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeleteNodesMacaddressDhcpWhitelistReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*DeleteNodesMacaddressDhcpWhitelistNoContent), nil
}
818465
func WithExpiration(d time.Duration) Opt {
	return func(l *Lease) error {
		if l.Labels == nil {
			l.Labels = map[string]string{}
		}
		l.Labels["containerd.io/gc.expire"] = time.Now().Add(d).Format(time.RFC3339)

		return nil
	}
}