// GetHandleFromFolderNameAndType returns a TLFHandle given a folder
// name (e.g., "u1,u2#u3") and a TLF type.
169137
func GetHandleFromFolderNameAndType(
	ctx context.Context, kbpki KBPKI, idGetter tlfhandle.IDGetter,
	syncGetter syncedTlfGetterSetter, tlfName string,
	t tlf.Type) (*tlfhandle.Handle, error) {
	for {
		tlfHandle, err := tlfhandle.ParseHandle(
			ctx, kbpki, idGetter, syncGetter, tlfName, t)
		switch e := errors.Cause(err).(type) {
		case idutil.TlfNameNotCanonical:
			tlfName = e.NameToTry
		case nil:
			return tlfHandle, nil
		default:
			return nil, err
		}
	}
}
52601
func (ss *scaleSet) GetInstanceTypeByNodeName(name string) (string, error) {
	managedByAS, err := ss.isNodeManagedByAvailabilitySet(name)
	if err != nil {
		klog.Errorf("Failed to check isNodeManagedByAvailabilitySet: %v", err)
		return "", err
	}
	if managedByAS {
		// vm is managed by availability set.
		return ss.availabilitySet.GetInstanceTypeByNodeName(name)
	}

	_, _, vm, err := ss.getVmssVM(name)
	if err != nil {
		return "", err
	}

	if vm.Sku != nil && vm.Sku.Name != nil {
		return *vm.Sku.Name, nil
	}

	return "", nil
}
1303641
func (t *Template) GetAWSECRRepositoryWithName(name string) (*resources.AWSECRRepository, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSECRRepository:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSECRRepository not found", name)
}
405010
func (m *Manifest) GetAdapterNames(dir Direction) []string {
	switch dir {
	case Upload:
		return m.GetUploadAdapterNames()
	case Download:
		return m.GetDownloadAdapterNames()
	}
	return nil
}
1156472
func (fbo *folderBranchOps) GetTLFHandle(ctx context.Context, _ Node) (
	*tlfhandle.Handle, error) {
	lState := makeFBOLockState()
	md, _ := fbo.getHead(ctx, lState, mdNoCommit)
	return md.GetTlfHandle(), nil
}
437415
func (t *Template) GetAWSGlueCrawlerWithName(name string) (*resources.AWSGlueCrawler, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSGlueCrawler:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSGlueCrawler not found", name)
}
1334342
func (t *Template) GetAWSEC2NetworkInterfacePermissionWithName(name string) (*resources.AWSEC2NetworkInterfacePermission, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSEC2NetworkInterfacePermission:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSEC2NetworkInterfacePermission not found", name)
}
224869
func IdentifyHandle(
	ctx context.Context, nug idutil.NormalizedUsernameGetter,
	identifier idutil.Identifier, osg idutil.OfflineStatusGetter,
	h *Handle) error {
	offline := keybase1.OfflineAvailability_NONE
	if osg != nil {
		offline = osg.OfflineAvailabilityForID(h.tlfID)
	}
	return identifyUsersForTLF(
		ctx, nug, identifier, h.ResolvedUsersMap(), h.Type(), offline)
}
569600
func NameOf(v interface{}) string {
	elemTyp := di.IndirectType(di.ValueOf(v).Type())

	typName := elemTyp.Name()
	pkgPath := elemTyp.PkgPath()
	fullname := pkgPath[strings.LastIndexByte(pkgPath, '/')+1:] + "." + typName

	return fullname
}
1198047
func (p *MetaProject) GetIssueTypeWithName(name string) *MetaIssueType {
	for _, m := range p.IssueTypes {
		if strings.ToLower(m.Name) == strings.ToLower(name) {
			return m
		}
	}
	return nil
}
956674
func NewSharedFolderNestType(Description string) *SharedFolderNestType {
	s := new(SharedFolderNestType)
	s.Description = Description
	return s
}
1125296
func GetTokenizerForFilename(name string) (Tokenizer, error) {
	for _, tokenizer := range tokenizers {
		if matched, err := tokenizer.AcceptsFilename(name); err != nil {
			return nil, err
		} else if matched {
			return tokenizer, nil
		}
	}
	return nil, nil
}
285281
func (f *Folder) FindFolder(name string) (tree.Tree, error) {
	sub := f.findFolder(strings.Split(strings.TrimSuffix(name, sep), sep))
	if sub == nil {
		return nil, errors.Errorf("Entry not found")
	}
	return sub, nil
}
982792
func (client *GCSBlobstore) getObjectHandle(gcs *storage.Client, src string) *storage.ObjectHandle {
	handle := gcs.Bucket(client.config.BucketName).Object(src)
	if client.config.EncryptionKey != nil {
		handle = handle.Key(client.config.EncryptionKey)
	}
	return handle
}
253072
func (t *Template) GetAWSEC2EgressOnlyInternetGatewayWithName(name string) (*resources.AWSEC2EgressOnlyInternetGateway, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSEC2EgressOnlyInternetGateway:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSEC2EgressOnlyInternetGateway not found", name)
}
665970
func (t *Template) GetAWSServiceDiscoveryServiceWithName(name string) (*resources.AWSServiceDiscoveryService, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSServiceDiscoveryService:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSServiceDiscoveryService not found", name)
}
355998
func (t *Template) GetAWSEC2VolumeWithName(name string) (*resources.AWSEC2Volume, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSEC2Volume:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSEC2Volume not found", name)
}