github.com/profzone/eden-framework@v1.0.10/internal/project/drone/enums/drone_ci_step_pull__generated.go (about)

     1  package enums
     2  
     3  import (
     4  	"bytes"
     5  	"encoding"
     6  	"errors"
     7  
     8  	github_com_profzone_eden_framework_pkg_enumeration "github.com/profzone/eden-framework/pkg/enumeration"
     9  )
    10  
    11  var InvalidDroneCiStepPull = errors.New("invalid DroneCiStepPull")
    12  
    13  func init() {
    14  	github_com_profzone_eden_framework_pkg_enumeration.RegisterEnums("DroneCiStepPull", map[string]string{
    15  		"always":        "always",
    16  		"if_not_exists": "if not exists",
    17  		"never":         "never",
    18  	})
    19  }
    20  
    21  func ParseDroneCiStepPullFromString(s string) (DroneCiStepPull, error) {
    22  	switch s {
    23  	case "":
    24  		return DRONE_CI_STEP_PULL_UNKNOWN, nil
    25  	case "always":
    26  		return DRONE_CI_STEP_PULL__always, nil
    27  	case "if-not-exists":
    28  		return DRONE_CI_STEP_PULL__if_not_exists, nil
    29  	case "never":
    30  		return DRONE_CI_STEP_PULL__never, nil
    31  	}
    32  	return DRONE_CI_STEP_PULL_UNKNOWN, InvalidDroneCiStepPull
    33  }
    34  
    35  func ParseDroneCiStepPullFromLabelString(s string) (DroneCiStepPull, error) {
    36  	switch s {
    37  	case "":
    38  		return DRONE_CI_STEP_PULL_UNKNOWN, nil
    39  	case "always":
    40  		return DRONE_CI_STEP_PULL__always, nil
    41  	case "if not exists":
    42  		return DRONE_CI_STEP_PULL__if_not_exists, nil
    43  	case "never":
    44  		return DRONE_CI_STEP_PULL__never, nil
    45  	}
    46  	return DRONE_CI_STEP_PULL_UNKNOWN, InvalidDroneCiStepPull
    47  }
    48  
    49  func (DroneCiStepPull) EnumType() string {
    50  	return "DroneCiStepPull"
    51  }
    52  
    53  func (DroneCiStepPull) Enums() map[int][]string {
    54  	return map[int][]string{
    55  		int(DRONE_CI_STEP_PULL__always):        {"always", "always"},
    56  		int(DRONE_CI_STEP_PULL__if_not_exists): {"if_not_exists", "if not exists"},
    57  		int(DRONE_CI_STEP_PULL__never):         {"never", "never"},
    58  	}
    59  }
    60  
    61  func (v DroneCiStepPull) String() string {
    62  	switch v {
    63  	case DRONE_CI_STEP_PULL_UNKNOWN:
    64  		return ""
    65  	case DRONE_CI_STEP_PULL__always:
    66  		return "always"
    67  	case DRONE_CI_STEP_PULL__if_not_exists:
    68  		return "if-not-exists"
    69  	case DRONE_CI_STEP_PULL__never:
    70  		return "never"
    71  	}
    72  	return "UNKNOWN"
    73  }
    74  
    75  func (v DroneCiStepPull) Label() string {
    76  	switch v {
    77  	case DRONE_CI_STEP_PULL_UNKNOWN:
    78  		return ""
    79  	case DRONE_CI_STEP_PULL__always:
    80  		return "always"
    81  	case DRONE_CI_STEP_PULL__if_not_exists:
    82  		return "if not exists"
    83  	case DRONE_CI_STEP_PULL__never:
    84  		return "never"
    85  	}
    86  	return "UNKNOWN"
    87  }
    88  
    89  var _ interface {
    90  	encoding.TextMarshaler
    91  	encoding.TextUnmarshaler
    92  } = (*DroneCiStepPull)(nil)
    93  
    94  func (v DroneCiStepPull) MarshalText() ([]byte, error) {
    95  	str := v.String()
    96  	if str == "UNKNOWN" {
    97  		return nil, InvalidDroneCiStepPull
    98  	}
    99  	return []byte(str), nil
   100  }
   101  
   102  func (v *DroneCiStepPull) UnmarshalText(data []byte) (err error) {
   103  	*v, err = ParseDroneCiStepPullFromString(string(bytes.ToUpper(data)))
   104  	return
   105  }