github.com/Venafi/vcert/v5@v5.10.2/pkg/certificate/customFieldType.go (about)

     1  package certificate
     2  
     3  type CustomFieldType int
     4  
     5  const (
     6  	CustomFieldPlain CustomFieldType = 0 + iota
     7  	CustomFieldOrigin
     8  	CustomFieldUnknown
     9  
    10  	// String representations of the CustomFieldType types
    11  	strCFTypeOrigin  = "origin"
    12  	strCFTypePlain   = "plain"
    13  	strCFTypeUnknown = "unknown"
    14  )
    15  
    16  // String returns a string representation of this object
    17  func (cft *CustomFieldType) String() string {
    18  	switch *cft {
    19  	case CustomFieldOrigin:
    20  		return strCFTypeOrigin
    21  	case CustomFieldPlain:
    22  		return strCFTypePlain
    23  	default:
    24  		return strCFTypeUnknown
    25  	}
    26  }
    27  
    28  // MarshalYAML customizes the behavior of ChainOption when being marshaled into a YAML document.
    29  // The returned value is marshaled in place of the original value implementing Marshaller
    30  func (cft CustomFieldType) MarshalYAML() (interface{}, error) {
    31  	return cft.String(), nil
    32  }