github.com/hashicorp/vault/sdk@v0.13.0/helper/testcluster/generaterootkind_enumer.go (about)

     1  // Code generated by "enumer -type=GenerateRootKind -trimprefix=GenerateRoot"; DO NOT EDIT.
     2  
     3  package testcluster
     4  
     5  import (
     6  	"fmt"
     7  )
     8  
     9  const _GenerateRootKindName = "RegularDRGenerateRecovery"
    10  
    11  var _GenerateRootKindIndex = [...]uint8{0, 7, 9, 25}
    12  
    13  func (i GenerateRootKind) String() string {
    14  	if i < 0 || i >= GenerateRootKind(len(_GenerateRootKindIndex)-1) {
    15  		return fmt.Sprintf("GenerateRootKind(%d)", i)
    16  	}
    17  	return _GenerateRootKindName[_GenerateRootKindIndex[i]:_GenerateRootKindIndex[i+1]]
    18  }
    19  
    20  var _GenerateRootKindValues = []GenerateRootKind{0, 1, 2}
    21  
    22  var _GenerateRootKindNameToValueMap = map[string]GenerateRootKind{
    23  	_GenerateRootKindName[0:7]:  0,
    24  	_GenerateRootKindName[7:9]:  1,
    25  	_GenerateRootKindName[9:25]: 2,
    26  }
    27  
    28  // GenerateRootKindString retrieves an enum value from the enum constants string name.
    29  // Throws an error if the param is not part of the enum.
    30  func GenerateRootKindString(s string) (GenerateRootKind, error) {
    31  	if val, ok := _GenerateRootKindNameToValueMap[s]; ok {
    32  		return val, nil
    33  	}
    34  	return 0, fmt.Errorf("%s does not belong to GenerateRootKind values", s)
    35  }
    36  
    37  // GenerateRootKindValues returns all values of the enum
    38  func GenerateRootKindValues() []GenerateRootKind {
    39  	return _GenerateRootKindValues
    40  }
    41  
    42  // IsAGenerateRootKind returns "true" if the value is listed in the enum definition. "false" otherwise
    43  func (i GenerateRootKind) IsAGenerateRootKind() bool {
    44  	for _, v := range _GenerateRootKindValues {
    45  		if i == v {
    46  			return true
    47  		}
    48  	}
    49  	return false
    50  }