GetItems() public static method

Return the list of items in the metadata at path.
public static GetItems ( string path ) : IEnumerable
path string Path at which to query the metadata
return IEnumerable
Example #1
0
        private IEnumerable <string> GetItems(string key)
        {
            if (null == _availableKeys)
            {
                _availableKeys = EC2Metadata.GetItems(_path);
            }

            if (_availableKeys.Contains(key))
            {
                return(EC2Metadata.GetItems(_path + key));
            }
            else
            {
                return(new List <string>());
            }
        }
Example #2
0
        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 = EC2Metadata.GetItems(_path);
            }

            if (_availableKeys.Contains(key))
            {
                _data[key] = EC2Metadata.GetData(_path + key);
                return(_data[key]);
            }
            else
            {
                return(null);
            }
        }
Example #3
0
 /// <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(EC2Metadata.GetItems(string.Format(CultureInfo.InvariantCulture, "{0}ipv4-associations/{1}", _path, publicIp)));
 }
Example #4
0
 /// <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(EC2Metadata.GetItems(String.Format("{0}ipv4-associations/{1}", _path, publicIp)));
 }