Exemplo n.º 1
0
        internal string GetEKSCredentials(string path)
        {
            StringBuilder stringBuilder = new StringBuilder();

            using (var streamReader = ResourceDetectorUtils.GetStreamReader(path))
            {
                while (!streamReader.EndOfStream)
                {
                    stringBuilder.Append(streamReader.ReadLine().Trim());
                }
            }

            return("Bearer " + stringBuilder.ToString());
        }
Exemplo n.º 2
0
        internal string GetEKSContainerId(string path)
        {
            string containerId = null;

            using (var streamReader = ResourceDetectorUtils.GetStreamReader(path))
            {
                while (!streamReader.EndOfStream)
                {
                    var trimmedLine = streamReader.ReadLine().Trim();
                    if (trimmedLine.Length > 64)
                    {
                        containerId = trimmedLine.Substring(trimmedLine.Length - 64);
                        return(containerId);
                    }
                }
            }

            return(containerId);
        }
        internal string GetEKSContainerId(string path)
        {
            try
            {
                using (var streamReader = ResourceDetectorUtils.GetStreamReader(path))
                {
                    while (!streamReader.EndOfStream)
                    {
                        var trimmedLine = streamReader.ReadLine().Trim();
                        if (trimmedLine.Length > 64)
                        {
                            return(trimmedLine.Substring(trimmedLine.Length - 64));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AWSXRayEventSource.Log.ResourceAttributesExtractException($"{nameof(AWSEKSResourceDetector)} : Failed to get Container Id", ex);
            }

            return(null);
        }
        internal string GetEKSCredentials(string path)
        {
            try
            {
                StringBuilder stringBuilder = new StringBuilder();

                using (var streamReader = ResourceDetectorUtils.GetStreamReader(path))
                {
                    while (!streamReader.EndOfStream)
                    {
                        stringBuilder.Append(streamReader.ReadLine().Trim());
                    }
                }

                return("Bearer " + stringBuilder.ToString());
            }
            catch (Exception ex)
            {
                AWSXRayEventSource.Log.ResourceAttributesExtractException($"{nameof(AWSEKSResourceDetector)} : Failed to load client token", ex);
            }

            return(null);
        }