// The ccworkerid is a number on some systems that didn't have
// the filter mutate, and the hostid was a numeric value.  We need
// to handle both cases.
973638
func convertWorkerID(id interface{}) (string, error) {
	if id == nil {
		return "", nil
	}

	switch id.(type) {
	case int:
		num := id.(int)
		return fmt.Sprintf("%v",num), nil
	case uint64:
		num := id.(uint64)
		return fmt.Sprintf("%v",num), nil
	case float64:
		num := id.(float64)
		return fmt.Sprintf("%.0f",num), nil
	case json.Number:
		return string(id.(json.Number)), nil
	case string:
		return id.(string), nil
	}

	// An unexpected type. We'll get the type name for the error, but this
	// will fail the export.. so it only uses reflect once.
	name := reflect.TypeOf(id)
	return "", &UnknownElasticStructError{fmt.Sprintf("%v", name), "ccworkerid"}
}
649138
func (id *IdentityID) HostID() (string, error) {
	parts := strings.Split(id.HostUUID, ".")
	if len(parts) < 2 {
		return "", trace.BadParameter("expected 2 parts in %q", id.HostUUID)
	}
	return parts[0], nil
}
868310
func (s *BonusPayment) SetWorkerId(v string) *BonusPayment {
	s.WorkerId = &v
	return s
}
1050014
func NewRwSet(ccID string) *rwsetutil.NsRwSet {
	return &rwsetutil.NsRwSet{
		NameSpace:        ccID,
		KvRwSet:          &kvrwset.KVRWSet{},
		CollHashedRwSets: nil,
	}
}
1333844
func (a *HostAgent) GetHostID(_ string, hostID *string) error {
	glog.V(4).Infof("ControlCenterAgent.GetHostID(): %s", a.hostID)
	*hostID = a.hostID
	return nil
}
1047933
func (self *DefaultRequest) GetDownloaderID() int {
	self.once.Do(self.prepare)
	return self.DownloaderID
}
958302
func resyncPeriod(c *cloudcontrollerconfig.Config) func() time.Duration {
	return func() time.Duration {
		factor := rand.Float64() + 1
		return time.Duration(float64(c.ComponentConfig.Generic.MinResyncPeriod.Nanoseconds()) * factor)
	}
}
603269
func (s *CreateApiKeyInput) SetCustomerId(v string) *CreateApiKeyInput {
	s.CustomerId = &v
	return s
}
734442
func (r *RetryInfo) GetCurrAutoIncrementID() (int64, error) {
	if r.currRetryOff >= len(r.autoIncrementIDs) {
		return 0, errCantGetValidID
	}
	id := r.autoIncrementIDs[r.currRetryOff]
	r.currRetryOff++

	return id, nil
}
1270120
func (a *LBClient) GetHostID(hostID *string) error {
	glog.V(4).Infof("ControlCenterAgent.GetHostID()")
	return a.rpcClient.Call("ControlCenterAgent.GetHostID", "na", hostID, 0)
}
335460
func (s *SetRepositoryPolicyInput) SetRegistryId(v string) *SetRepositoryPolicyInput {
	s.RegistryId = &v
	return s
}
67118
func (s *NetworkService) GetNetworkServiceProviderID(name string, opts ...OptionFunc) (string, int, error) {
	p := &ListNetworkServiceProvidersParams{}
	p.p = make(map[string]interface{})

	p.p["name"] = name

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return "", -1, err
		}
	}

	l, err := s.ListNetworkServiceProviders(p)
	if err != nil {
		return "", -1, err
	}

	if l.Count == 0 {
		return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l)
	}

	if l.Count == 1 {
		return l.NetworkServiceProviders[0].Id, l.Count, nil
	}

	if l.Count > 1 {
		for _, v := range l.NetworkServiceProviders {
			if v.Name == name {
				return v.Id, l.Count, nil
			}
		}
	}
	return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
}
1227588
func (req IPRequest) IPID() string {
	return fmt.Sprintf("%s-%s", req.HostID, req.IPAddress)
}
849895
func (s *GetFolderInput) SetFolderId(v string) *GetFolderInput {
	s.FolderId = &v
	return s
}
517034
func GetLoadBalancerByID(loadBalancerId string) (*HostComputeLoadBalancer, error) {
	hcnQuery := defaultQuery()
	mapA := map[string]string{"ID": loadBalancerId}
	filter, err := json.Marshal(mapA)
	if err != nil {
		return nil, err
	}
	hcnQuery.Filter = string(filter)

	loadBalancers, err := ListLoadBalancersQuery(hcnQuery)
	if err != nil {
		return nil, err
	}
	if len(loadBalancers) == 0 {
		return nil, LoadBalancerNotFoundError{LoadBalancerId: loadBalancerId}
	}
	return &loadBalancers[0], err
}
312922
func HostToNetwork(b interface{}) interface{} {
	switch b.(type) {
	case uint16:
		return swap16(b.(uint16))
	case uint32:
		return swap32(b.(uint32))
	default:
		panic(unsupported(b))
	}
}
950810
func normalizeWorkdirUnix(current string, requested string) (string, error) {
	if requested == "" {
		return "", errors.New("cannot normalize nothing")
	}
	current = strings.Replace(current, string(os.PathSeparator), "/", -1)
	requested = strings.Replace(requested, string(os.PathSeparator), "/", -1)
	if !path.IsAbs(requested) {
		return path.Join(`/`, current, requested), nil
	}
	return requested, nil
}