github.com/aldelo/common@v1.5.1/wrapper/cloudmap/sdhealthchecktype/sdhealthchecktype_enumer.go (about)

     1  // Code Generated By gen-enumer For "Enum Type: SdHealthCheckType" - DO NOT EDIT;
     2  
     3  /*
     4   * Copyright 2020-2023 Aldelo, LP
     5   *
     6   * Licensed under the Apache License, Version 2.0 (the "License");
     7   * you may not use this file except in compliance with the License.
     8   * You may obtain a copy of the License at
     9   *
    10   *     http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing, software
    13   * distributed under the License is distributed on an "AS IS" BASIS,
    14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15   * See the License for the specific language governing permissions and
    16   * limitations under the License.
    17   */
    18  
    19  package sdhealthchecktype
    20  
    21  import (
    22  	"fmt"
    23  	"strconv"
    24  )
    25  
    26  // enum names constants
    27  const (
    28  	_SdHealthCheckTypeName_0 = "UNKNOWN"
    29  	_SdHealthCheckTypeName_1 = "HTTP"
    30  	_SdHealthCheckTypeName_2 = "HTTPS"
    31  	_SdHealthCheckTypeName_3 = "TCP"
    32  )
    33  
    34  // var declares of enum indexes
    35  var (
    36  	_SdHealthCheckTypeIndex_0 = [...]uint8{0, 7}
    37  	_SdHealthCheckTypeIndex_1 = [...]uint8{0, 4}
    38  	_SdHealthCheckTypeIndex_2 = [...]uint8{0, 5}
    39  	_SdHealthCheckTypeIndex_3 = [...]uint8{0, 3}
    40  )
    41  
    42  func (i SdHealthCheckType) String() string {
    43  	switch {
    44  	case i == UNKNOWN:
    45  		return _SdHealthCheckTypeName_0
    46  	case i == HTTP:
    47  		return _SdHealthCheckTypeName_1
    48  	case i == HTTPS:
    49  		return _SdHealthCheckTypeName_2
    50  	case i == TCP:
    51  		return _SdHealthCheckTypeName_3
    52  	default:
    53  		return ""
    54  	}
    55  }
    56  
    57  var _SdHealthCheckTypeValues = []SdHealthCheckType{
    58  	0, // UNKNOWN
    59  	1, // HTTP
    60  	2, // HTTPS
    61  	3, // TCP
    62  }
    63  
    64  var _SdHealthCheckTypeNameToValueMap = map[string]SdHealthCheckType{
    65  	_SdHealthCheckTypeName_0[0:7]: 0, // UNKNOWN
    66  	_SdHealthCheckTypeName_1[0:4]: 1, // HTTP
    67  	_SdHealthCheckTypeName_2[0:5]: 2, // HTTPS
    68  	_SdHealthCheckTypeName_3[0:3]: 3, // TCP
    69  }
    70  
    71  var _SdHealthCheckTypeValueToKeyMap = map[SdHealthCheckType]string{
    72  	0: _SdHealthCheckTypeKey_0, // UNKNOWN
    73  	1: _SdHealthCheckTypeKey_1, // HTTP
    74  	2: _SdHealthCheckTypeKey_2, // HTTPS
    75  	3: _SdHealthCheckTypeKey_3, // TCP
    76  }
    77  
    78  var _SdHealthCheckTypeValueToCaptionMap = map[SdHealthCheckType]string{
    79  	0: _SdHealthCheckTypeCaption_0, // UNKNOWN
    80  	1: _SdHealthCheckTypeCaption_1, // HTTP
    81  	2: _SdHealthCheckTypeCaption_2, // HTTPS
    82  	3: _SdHealthCheckTypeCaption_3, // TCP
    83  }
    84  
    85  var _SdHealthCheckTypeValueToDescriptionMap = map[SdHealthCheckType]string{
    86  	0: _SdHealthCheckTypeDescription_0, // UNKNOWN
    87  	1: _SdHealthCheckTypeDescription_1, // HTTP
    88  	2: _SdHealthCheckTypeDescription_2, // HTTPS
    89  	3: _SdHealthCheckTypeDescription_3, // TCP
    90  }
    91  
    92  // Valid returns 'true' if the value is listed in the SdHealthCheckType enum map definition, 'false' otherwise
    93  func (i SdHealthCheckType) Valid() bool {
    94  	for _, v := range _SdHealthCheckTypeValues {
    95  		if i == v {
    96  			return true
    97  		}
    98  	}
    99  
   100  	return false
   101  }
   102  
   103  // ParseByName retrieves a SdHealthCheckType enum value from the enum string name,
   104  // throws an error if the param is not part of the enum
   105  func (i SdHealthCheckType) ParseByName(s string) (SdHealthCheckType, error) {
   106  	if val, ok := _SdHealthCheckTypeNameToValueMap[s]; ok {
   107  		// parse ok
   108  		return val, nil
   109  	}
   110  
   111  	// error
   112  	return -1, fmt.Errorf("Enum Name of %s Not Expected In SdHealthCheckType Values List", s)
   113  }
   114  
   115  // ParseByKey retrieves a SdHealthCheckType enum value from the enum string key,
   116  // throws an error if the param is not part of the enum
   117  func (i SdHealthCheckType) ParseByKey(s string) (SdHealthCheckType, error) {
   118  	for k, v := range _SdHealthCheckTypeValueToKeyMap {
   119  		if v == s {
   120  			// parse ok
   121  			return k, nil
   122  		}
   123  	}
   124  
   125  	// error
   126  	return -1, fmt.Errorf("Enum Key of %s Not Expected In SdHealthCheckType Keys List", s)
   127  }
   128  
   129  // Key retrieves a SdHealthCheckType enum string key
   130  func (i SdHealthCheckType) Key() string {
   131  	if val, ok := _SdHealthCheckTypeValueToKeyMap[i]; ok {
   132  		// found
   133  		return val
   134  	} else {
   135  		// not found
   136  		return ""
   137  	}
   138  }
   139  
   140  // Caption retrieves a SdHealthCheckType enum string caption
   141  func (i SdHealthCheckType) Caption() string {
   142  	if val, ok := _SdHealthCheckTypeValueToCaptionMap[i]; ok {
   143  		// found
   144  		return val
   145  	} else {
   146  		// not found
   147  		return ""
   148  	}
   149  }
   150  
   151  // Description retrieves a SdHealthCheckType enum string description
   152  func (i SdHealthCheckType) Description() string {
   153  	if val, ok := _SdHealthCheckTypeValueToDescriptionMap[i]; ok {
   154  		// found
   155  		return val
   156  	} else {
   157  		// not found
   158  		return ""
   159  	}
   160  }
   161  
   162  // IntValue gets the intrinsic enum integer value
   163  func (i SdHealthCheckType) IntValue() int {
   164  	return int(i)
   165  }
   166  
   167  // IntString gets the intrinsic enum integer value represented in string format
   168  func (i SdHealthCheckType) IntString() string {
   169  	return strconv.Itoa(int(i))
   170  }
   171  
   172  // ValueSlice returns all values of the enum SdHealthCheckType in a slice
   173  func (i SdHealthCheckType) ValueSlice() []SdHealthCheckType {
   174  	return _SdHealthCheckTypeValues
   175  }
   176  
   177  // NameMap returns all names of the enum SdHealthCheckType in a K:name,V:SdHealthCheckType map
   178  func (i SdHealthCheckType) NameMap() map[string]SdHealthCheckType {
   179  	return _SdHealthCheckTypeNameToValueMap
   180  }
   181  
   182  // KeyMap returns all keys of the enum SdHealthCheckType in a K:SdHealthCheckType,V:key map
   183  func (i SdHealthCheckType) KeyMap() map[SdHealthCheckType]string {
   184  	return _SdHealthCheckTypeValueToKeyMap
   185  }
   186  
   187  // CaptionMap returns all captions of the enum SdHealthCheckType in a K:SdHealthCheckType,V:caption map
   188  func (i SdHealthCheckType) CaptionMap() map[SdHealthCheckType]string {
   189  	return _SdHealthCheckTypeValueToCaptionMap
   190  }
   191  
   192  // DescriptionMap returns all descriptions of the enum SdHealthCheckType in a K:SdHealthCheckType,V:description map
   193  func (i SdHealthCheckType) DescriptionMap() map[SdHealthCheckType]string {
   194  	return _SdHealthCheckTypeValueToDescriptionMap
   195  }