// GetKeyValuePair ...
355278
func (env EnvironmentItemModel) GetKeyValuePair() (string, string, error) {
	// Collect keys and values
	keys := []string{}
	values := []interface{}{}

	for key, value := range env {
		keys = append(keys, key)
		values = append(values, value)
	}

	if len(keys) == 0 {
		return "", "", errors.New("no environment key specified")
	} else if len(keys) > 2 {
		sort.Strings(keys)
		return "", "", fmt.Errorf("more than 2 keys specified: %v", keys)
	}

	// Collect env key and value
	key := ""
	var value interface{}
	optionsFound := false

	for i := 0; i < len(keys); i++ {
		k := keys[i]
		if k != OptionsKey {
			key = k
			value = values[i]
		} else {
			optionsFound = true
		}
	}

	if key == "" {
		sort.Strings(keys)
		return "", "", fmt.Errorf("no environment key found, keys: %v", keys)
	}
	if len(keys) > 1 && !optionsFound {
		sort.Strings(keys)
		return "", "", fmt.Errorf("more than 1 environment key specified: %v", keys)
	}

	// Cast env value to string
	valueStr := ""

	if value != nil {
		if str, ok := value.(string); ok {
			valueStr = str
		} else if str := parseutil.CastToString(value); str != "" {
			valueStr = str
		} else {
			return "", "", fmt.Errorf("value (%#v) is not a string for key (%s)", value, key)
		}
	}

	return key, valueStr, nil
}
113957
func (g *Game) GetTagPair(k string) *TagPair {
	for _, tag := range g.tagPairs {
		if tag.Key == k {
			return tag
		}
	}
	return nil
}
1168543
func (v *KeyValue_SetValue_Args) GetValue() (o string) {
	if v != nil && v.Value != nil {
		return *v.Value
	}

	return
}
983542
func NewKeyValuePair(pos position, key, ws string, value *string, comment *Comment) *KeyValuePair {
	return &KeyValuePair{
		pos: pos,

		key:     key,
		ws:      ws,
		value:   value,
		comment: comment,
	}
}
1173497
func (mk MergeKeys) GetMergeKeyValue(i interface{}) (MergeKeyValue, error) {
	result := MergeKeyValue{}
	if len(mk) <= 0 {
		return result, fmt.Errorf("merge key must have at least 1 value to merge")
	}
	m, ok := i.(map[string]interface{})
	if !ok {
		return result, fmt.Errorf("cannot use mergekey %v for primitive item in list %v", mk, i)
	}
	for _, field := range mk {
		if value, found := m[field]; !found {
			result[field] = ""
		} else {
			result[field] = fmt.Sprintf("%v", value)
		}
	}
	return result, nil
}
1215347
func (vdb *VersionedDB) ValidateKeyValue(key string, value []byte) error {
	err := validateKey(key)
	if err != nil {
		return err
	}
	return validateValue(value)
}
1116643
func (e *Extractions) GetValue(key string) string {
	if val, ok := e.Extractions[key]; ok {
		return val.Value
	}
	return ""
}
175682
func (arc *ConfigFactory) GetValue(key string) cast.Value {
	if arc.initSuccess == false {
		return nil
	}

	var confValue cast.Value
	val := arc.GetConfigurationByKey(key)
	if val == nil {
		confValue = cast.NewValue(nil, errors.New("key does not exist"))
	} else {
		confValue = cast.NewValue(val, nil)
	}

	return confValue
}
386164
func (v *KeyValue_SetValue_Args) GetKey() (o string) {
	if v != nil && v.Key != nil {
		return *v.Key
	}

	return
}
587227
func (s *CreateServerInput) SetKeyPair(v string) *CreateServerInput {
	s.KeyPair = &v
	return s
}
619346
func (api *PublicWhisperAPI) DeleteKeyPair(ctx context.Context, key string) (bool, error) {
	if ok := api.w.DeleteKeyPair(key); ok {
		return true, nil
	}
	return false, fmt.Errorf("key pair %s not found", key)
}
1153770
func (r *ProtoKeyValWrapper) GetValue(value proto.Message) error {
	err := r.ProtoKeyVal.GetValue(value)
	if err != nil {
		return err
	}
	_, err = r.decrypter.Decrypt(value, r.decryptFunc)
	return err
}
205568
func KeyPair(domain string, expiration time.Time) ([]byte, []byte, error) {
	rsaPrivKey, err := rsa.GenerateKey(rand.Reader, 2048)
	if err != nil {
		return nil, nil, err
	}
	keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(rsaPrivKey)})

	certPEM, err := PemCert(rsaPrivKey, domain, expiration)
	if err != nil {
		return nil, nil, err
	}
	return certPEM, keyPEM, nil
}
174927
func (r *Request) GetValue(key int) (value interface{}) {
	value, _ = r.In.Get(key)
	return
}
809220
func (list *SkipList) GetValue(key interface{}) (interface{}, bool) {
	element := list.Get(key)

	if element == nil {
		return nil, false
	}

	return element.Value, true
}
523650
func getBridgedDeviceKV(keyname, propname string) ([]ifKeyValue, error) {
	kvs := []ifKeyValue{}
	if keyname == "" || propname == "" {
		return kvs, nil
	}

	stdout, _, err := runner.Run("list", "bridgedifs")
	if err != nil {
		return kvs, err
	}
	matches := networkRegexp.FindAllString(stdout, -1)
	if len(matches) < 1 {
		return kvs, nil
	}

	keyid := strings.TrimSuffix(keyname, ":") + ":"
	propid := strings.TrimSuffix(propname, ":") + ":"
	// Each match is a device
	for _, device := range matches {
		var kv ifKeyValue
		// Find the record that contains keyname and retrieve propname value.
		for _, line := range strings.Split(device, "\n") {
			if strings.Contains(line, keyid) {
				kv.k = strings.TrimSpace(strings.TrimPrefix(line, keyid))
			} else if strings.Contains(line, propid) {
				kv.v = strings.TrimSpace(strings.TrimPrefix(line, propid))
			}
			if kv.k != "" && kv.v != "" {
				kvs = append(kvs, kv)
				break
			}
		}
	}
	return kvs, nil
}
866886
func (surface *Surface) GetColorKey() (key uint32, err error) {
	_key := (*C.Uint32)(unsafe.Pointer(&key))
	if C.SDL_GetColorKey(surface.cptr(), _key) != 0 {
		return key, GetError()
	}
	return key, nil
}