Exemple #1
0
        private bool IsEKSProcess(string credentials)
        {
            var httpClientHandler = this.CreateHttpClientHandler();
            var awsAuth           = ResourceDetectorUtils.SendOutRequest(AWSAuthUrl, "GET", new KeyValuePair <string, string>("Authorization", credentials), httpClientHandler).Result;

            return(string.IsNullOrEmpty(awsAuth));
        }
Exemple #2
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());
        }
        private bool IsEKSProcess(string credentials)
        {
            string awsAuth = null;

            try
            {
                var httpClientHandler = this.CreateHttpClientHandler();
                awsAuth = ResourceDetectorUtils.SendOutRequest(AWSAuthUrl, "GET", new KeyValuePair <string, string>("Authorization", credentials), httpClientHandler).Result;
            }
            catch (Exception ex)
            {
                AWSXRayEventSource.Log.ResourceAttributesExtractException($"{nameof(AWSEKSResourceDetector)} : Failed to get EKS information", ex);
            }

            return(!string.IsNullOrEmpty(awsAuth));
        }
Exemple #4
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);
        }
Exemple #7
0
 private string GetAWSEC2HostName(string token)
 {
     return(ResourceDetectorUtils.SendOutRequest(AWSEC2HostNameUrl, "GET", new KeyValuePair <string, string>(AWSEC2MetadataTokenHeader, token)).Result);
 }
Exemple #8
0
 private string GetIdentityResponse(string token)
 {
     return(ResourceDetectorUtils.SendOutRequest(AWSEC2IdentityDocumentUrl, "GET", new KeyValuePair <string, string>(AWSEC2MetadataTokenHeader, token)).Result);
 }
Exemple #9
0
 private string GetAWSEC2Token()
 {
     return(ResourceDetectorUtils.SendOutRequest(AWSEC2MetadataTokenUrl, "PUT", new KeyValuePair <string, string>(AWSEC2MetadataTokenTTLHeader, "60")).Result);
 }
Exemple #10
0
 internal AWSEC2IdentityDocumentModel DeserializeResponse(string response)
 {
     return(ResourceDetectorUtils.DeserializeFromString <AWSEC2IdentityDocumentModel>(response));
 }
Exemple #11
0
 internal AWSEBSMetadataModel GetEBSMetadata(string filePath)
 {
     return(ResourceDetectorUtils.DeserializeFromFile <AWSEBSMetadataModel>(filePath));
 }
Exemple #12
0
        private string GetEKSClusterInfo(string credentials)
        {
            var httpClientHandler = this.CreateHttpClientHandler();

            return(ResourceDetectorUtils.SendOutRequest(AWSClusterInfoUrl, "GET", new KeyValuePair <string, string>("Authorization", credentials), httpClientHandler).Result);
        }
Exemple #13
0
 internal AWSEKSClusterInformationModel DeserializeResponse(string response)
 {
     return(ResourceDetectorUtils.DeserializeFromString <AWSEKSClusterInformationModel>(response));
 }