github.com/drone/go-convert@v0.0.0-20240307072510-6bd371c65e61/convert/travis/yaml/enum_arch.go (about)

     1  // Copyright 2022 Harness, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package yaml
    16  
    17  // import "encoding/json"
    18  
    19  // // List of cpu architectures.
    20  // type Arch int
    21  
    22  // // Arch enumeration.
    23  // const (
    24  // 	ArchNone Arch = iota
    25  // 	ArchAmd64
    26  // 	ArchArm64
    27  // 	ArchPpc64le
    28  // 	ArchS390x
    29  // )
    30  
    31  // // String returns the Arch as a string.
    32  // func (e Arch) String() string {
    33  // 	switch e {
    34  // 	case ArchAmd64:
    35  // 		return "amd64"
    36  // 	case ArchArm64:
    37  // 		return "arm64"
    38  // 	case ArchPpc64le:
    39  // 		return "ppc64le"
    40  // 	case ArchS390x:
    41  // 		return "s390x"
    42  // 	default:
    43  // 		return ""
    44  // 	}
    45  // }
    46  
    47  // // MarshalJSON marshals the type as a JSON string.
    48  // func (e Arch) MarshalJSON() ([]byte, error) {
    49  // 	return json.Marshal(e.String())
    50  // }
    51  
    52  // // UnmarshalJSON unmashals a quoted json string to the enum value.
    53  // func (e *Arch) UnmarshalJSON(b []byte) error {
    54  // 	var v string
    55  // 	json.Unmarshal(b, &v)
    56  // 	switch v {
    57  // 	case "amd64":
    58  // 		*e = ArchAmd64
    59  // 	case "arm64", "arm", "arm32":
    60  // 		*e = ArchArm64
    61  // 	case "ppc64le", "ppc", "ppc64":
    62  // 		*e = ArchPpc64le
    63  // 	case "s390x", "s390":
    64  // 		*e = ArchS390x
    65  // 	default:
    66  // 		*e = ArchNone
    67  // 	}
    68  // 	return nil
    69  // }
    70  
    71  // // UnmarshalJSON unmashals a quoted json string to the enum value.
    72  // // UnmarshalYAML implements the unmarshal interface.
    73  // func (e *Arch) UnmarshalYAML(unmarshal func(interface{}) error) error {
    74  // 	var v string
    75  // 	unmarshal(v)
    76  // 	switch v {
    77  // 	case "amd64":
    78  // 		*e = ArchAmd64
    79  // 	case "arm64", "arm", "arm32":
    80  // 		*e = ArchArm64
    81  // 	case "ppc64le", "ppc", "ppc64":
    82  // 		*e = ArchPpc64le
    83  // 	case "s390x", "s390":
    84  // 		*e = ArchS390x
    85  // 	default:
    86  // 		*e = ArchNone
    87  // 	}
    88  // 	return nil
    89  // }