// NewUniterAPIV5 creates an instance of the V5 uniter API.
775212
func NewUniterAPIV5(context facade.Context) (*UniterAPIV5, error) {
	uniterAPI, err := NewUniterAPIV6(context)
	if err != nil {
		return nil, err
	}
	return &UniterAPIV5{
		UniterAPIV6: *uniterAPI,
	}, nil
}
809438
func NewPaperExternalViewDefaultTeamDetails(EventUuid string) *PaperExternalViewDefaultTeamDetails {
	s := new(PaperExternalViewDefaultTeamDetails)
	s.EventUuid = EventUuid
	return s
}
712778
func NewV1() UUID {
	u := UUID{}

	timeNow, clockSeq, hardwareAddr := getStorage()

	binary.BigEndian.PutUint32(u[0:], uint32(timeNow))
	binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32))
	binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48))
	binary.BigEndian.PutUint16(u[8:], clockSeq)

	copy(u[10:], hardwareAddr)

	u.SetVersion(1)
	u.SetVariant()

	return u
}
1064978
func NewUnitUpgraderAPI(
	st *state.State,
	resources facade.Resources,
	authorizer facade.Authorizer,
) (*UnitUpgraderAPI, error) {
	if !authorizer.AuthUnitAgent() {
		return nil, common.ErrPerm
	}

	getCanWrite := func() (common.AuthFunc, error) {
		return authorizer.AuthOwner, nil
	}
	return &UnitUpgraderAPI{
		ToolsSetter: common.NewToolsSetter(st, getCanWrite),
		st:          st,
		resources:   resources,
		authorizer:  authorizer,
	}, nil
}
155428
func NewV3(ns UUID, name string) UUID {
	return global.NewV3(ns, name)
}
838144
func (l VirtualDeviceList) newUnitNumber(c types.BaseVirtualController) int32 {
	units := make([]bool, 30)

	switch sc := c.(type) {
	case types.BaseVirtualSCSIController:
		//  The SCSI controller sits on its own bus
		units[sc.GetVirtualSCSIController().ScsiCtlrUnitNumber] = true
	}

	key := c.GetVirtualController().Key

	for _, device := range l {
		d := device.GetVirtualDevice()

		if d.ControllerKey == key && d.UnitNumber != nil {
			units[int(*d.UnitNumber)] = true
		}
	}

	for unit, used := range units {
		if !used {
			return int32(unit)
		}
	}

	return -1
}
410544
func NewV5(ns UUID, name string) UUID {
	return global.NewV5(ns, name)
}
1309837
func NewFacadeV4(context facade.Context) (*CloudAPIV4, error) {
	v5, err := NewFacadeV5(context)
	if err != nil {
		return nil, err
	}
	return &CloudAPIV4{v5}, nil
}
149262
func NewGroupJoinPolicyUpdatedType(Description string) *GroupJoinPolicyUpdatedType {
	s := new(GroupJoinPolicyUpdatedType)
	s.Description = Description
	return s
}
1223824
func (o *Generator) NewV5(namespace Implementation, names ...interface{}) UUID {
	id := UUID{}
	id.unmarshal(digest(sha1.New(), namespace.Bytes(), names...))
	id.setRFC4122Version(VersionFive)
	return id
}
1094760
func (o *Generator) NewV3(namespace Implementation, names ...interface{}) UUID {
	id := UUID{}
	id.unmarshal(digest(md5.New(), namespace.Bytes(), names...))
	id.setRFC4122Version(VersionThree)
	return id
}
606996
func NewProviderIDNotUniqueError(providerIDs ...network.Id) error {
	stringIDs := make([]string, len(providerIDs))
	for i, providerID := range providerIDs {
		stringIDs[i] = string(providerID)
	}
	return newProviderIDNotUniqueErrorFromStrings(stringIDs)
}
547151
func NewPUPolicyWithDefaults() *PUPolicy {
	return NewPUPolicy("", AllowAll, nil, nil, nil, nil, nil, nil, nil, nil, 0, nil, nil, []string{})
}
532865
func newUniverse() *universeScope {
	sc := &universeScope{&Scope{nil, 0}, make(map[string]*Scope)}
	sc.block = &block{
		offset: 0,
		scope:  sc.Scope,
		global: true,
		defs:   make(map[string]Def),
	}
	return sc
}
337969
func NewV4() (UUID, error) {
	u := UUID{}
	if _, err := randomReader.Read(u[:]); err != nil {
		return Nil, err
	}
	u.setVersion(V4)
	u.setVariant(VariantRFC4122)

	return u, nil
}
1340739
func NewUUIDv1() (UUID, error) {
	uuid := UUID{}
	epoch := int64(0x01b21dd213814000)
	now := uint64(time.Now().UnixNano()/100 + epoch)

	clockSeqRand := [2]byte{}
	rand.Read(clockSeqRand[:])
	clockSeq := binary.LittleEndian.Uint16(clockSeqRand[:])

	timeLow := uint32(now & (0x100000000 - 1))
	timeMid := uint16((now >> 32) & 0xffff)
	timeHighVer := uint16((now >> 48) & 0x0fff)
	clockSeq &= 0x3fff

	binary.LittleEndian.PutUint32(uuid[0:4], timeLow)
	binary.LittleEndian.PutUint16(uuid[4:6], timeMid)
	binary.LittleEndian.PutUint16(uuid[6:8], timeHighVer)
	binary.LittleEndian.PutUint16(uuid[8:10], clockSeq)
	copy(uuid[10:16], cachedMACAddress)

	uuid.setVersion(UUIDv1)
	uuid.setVariant(UUIDVariantRFC4122)
	return uuid, nil
}
607548
func NewUniterAPIV11(context facade.Context) (*UniterAPIV11, error) {
	uniterAPI, err := NewUniterAPI(context)
	if err != nil {
		return nil, err
	}
	authorizer := context.Auth()
	st := context.State()
	resources := context.Resources()
	accessUnit := unitAccessor(authorizer, st)
	return &UniterAPIV11{
		LXDProfileAPI: NewExternalLXDProfileAPI(st, resources, authorizer, accessUnit, logger),
		UniterAPI:     *uniterAPI,
	}, nil
}