github.com/profzone/eden-framework@v1.0.10/internal/project/drone/enums/drone_ci_platform_arch__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 InvalidDroneCiPlatformArch = errors.New("invalid DroneCiPlatformArch")
    12  
    13  func init() {
    14  	github_com_profzone_eden_framework_pkg_enumeration.RegisterEnums("DroneCiPlatformArch", map[string]string{
    15  		"amd64": "amd64",
    16  		"arm":   "arm32",
    17  		"arm64": "arm64",
    18  	})
    19  }
    20  
    21  func ParseDroneCiPlatformArchFromString(s string) (DroneCiPlatformArch, error) {
    22  	switch s {
    23  	case "":
    24  		return DRONE_CI_PLATFORM_ARCH_UNKNOWN, nil
    25  	case "amd64":
    26  		return DRONE_CI_PLATFORM_ARCH__amd64, nil
    27  	case "arm":
    28  		return DRONE_CI_PLATFORM_ARCH__arm, nil
    29  	case "arm64":
    30  		return DRONE_CI_PLATFORM_ARCH__arm64, nil
    31  	}
    32  	return DRONE_CI_PLATFORM_ARCH_UNKNOWN, InvalidDroneCiPlatformArch
    33  }
    34  
    35  func ParseDroneCiPlatformArchFromLabelString(s string) (DroneCiPlatformArch, error) {
    36  	switch s {
    37  	case "":
    38  		return DRONE_CI_PLATFORM_ARCH_UNKNOWN, nil
    39  	case "amd64":
    40  		return DRONE_CI_PLATFORM_ARCH__amd64, nil
    41  	case "arm32":
    42  		return DRONE_CI_PLATFORM_ARCH__arm, nil
    43  	case "arm64":
    44  		return DRONE_CI_PLATFORM_ARCH__arm64, nil
    45  	}
    46  	return DRONE_CI_PLATFORM_ARCH_UNKNOWN, InvalidDroneCiPlatformArch
    47  }
    48  
    49  func (DroneCiPlatformArch) EnumType() string {
    50  	return "DroneCiPlatformArch"
    51  }
    52  
    53  func (DroneCiPlatformArch) Enums() map[int][]string {
    54  	return map[int][]string{
    55  		int(DRONE_CI_PLATFORM_ARCH__amd64): {"amd64", "amd64"},
    56  		int(DRONE_CI_PLATFORM_ARCH__arm):   {"arm", "arm32"},
    57  		int(DRONE_CI_PLATFORM_ARCH__arm64): {"arm64", "arm64"},
    58  	}
    59  }
    60  
    61  func (v DroneCiPlatformArch) String() string {
    62  	switch v {
    63  	case DRONE_CI_PLATFORM_ARCH_UNKNOWN:
    64  		return ""
    65  	case DRONE_CI_PLATFORM_ARCH__amd64:
    66  		return "amd64"
    67  	case DRONE_CI_PLATFORM_ARCH__arm:
    68  		return "arm"
    69  	case DRONE_CI_PLATFORM_ARCH__arm64:
    70  		return "arm64"
    71  	}
    72  	return "UNKNOWN"
    73  }
    74  
    75  func (v DroneCiPlatformArch) Label() string {
    76  	switch v {
    77  	case DRONE_CI_PLATFORM_ARCH_UNKNOWN:
    78  		return ""
    79  	case DRONE_CI_PLATFORM_ARCH__amd64:
    80  		return "amd64"
    81  	case DRONE_CI_PLATFORM_ARCH__arm:
    82  		return "arm32"
    83  	case DRONE_CI_PLATFORM_ARCH__arm64:
    84  		return "arm64"
    85  	}
    86  	return "UNKNOWN"
    87  }
    88  
    89  var _ interface {
    90  	encoding.TextMarshaler
    91  	encoding.TextUnmarshaler
    92  } = (*DroneCiPlatformArch)(nil)
    93  
    94  func (v DroneCiPlatformArch) MarshalText() ([]byte, error) {
    95  	str := v.String()
    96  	if str == "UNKNOWN" {
    97  		return nil, InvalidDroneCiPlatformArch
    98  	}
    99  	return []byte(str), nil
   100  }
   101  
   102  func (v *DroneCiPlatformArch) UnmarshalText(data []byte) (err error) {
   103  	*v, err = ParseDroneCiPlatformArchFromString(string(bytes.ToUpper(data)))
   104  	return
   105  }