public static GetItems ( string path ) : IEnumerable |
||
path | string | Path at which to query the metadata; may be relative or absolute. |
Результат | IEnumerable |
private IEnumerable <string> GetItems(string key) { if (null == _availableKeys) { _availableKeys = EC2InstanceMetadata.GetItems(_path); } if (_availableKeys.Contains(key)) { return(EC2InstanceMetadata.GetItems(_path + key)); } else { return(new List <string>()); } }
private string GetData(string key) { if (_data.ContainsKey(key)) { return(_data[key]); } // Since the keys are variable, cache a list of which ones are available // to prevent unnecessary trips to the service. if (null == _availableKeys) { _availableKeys = EC2InstanceMetadata.GetItems(_path); } if (_availableKeys.Contains(key)) { _data[key] = EC2InstanceMetadata.GetData(_path + key); return(_data[key]); } else { return(null); } }
/// <summary> /// Get the private IPv4 address(es) that are associated with the public-ip address and assigned to that interface. /// </summary> /// <param name="publicIp">The public IP address</param> /// <returns>Private IPv4 address(es) associated with the public IP address</returns> public IEnumerable <string> GetIpV4Association(string publicIp) { return(EC2InstanceMetadata.GetItems(string.Format(CultureInfo.InvariantCulture, "{0}ipv4-associations/{1}", _path, publicIp))); }