public static string ResolveVariable()

in Amazon.KinesisTap.Core/Utility.cs [431:476]


        public static string ResolveVariable(string variable)
        {
            if (variable != null && variable.StartsWith("{"))
            {
                if (variable.EndsWith("}"))
                {
                    variable = variable.Substring(1, variable.Length - 2);
                }
                else
                {
                    throw new ArgumentException("variable must be in the format of \"{variable}\" or \"{prefix:variable}\".");
                }
            }

            if (string.IsNullOrWhiteSpace(variable))
            {
                throw new ArgumentException("Missing variable name.");
            }

            if (string.Equals("uniformtimestamp", variable, StringComparison.CurrentCultureIgnoreCase))
                return GetUniformTimeStamp().ToString("yyyy-MM-ddTHH:mm:ss.fff UTC");

            (string prefix, string variableNoPrefix) = SplitPrefix(variable, ':');
            if (!string.IsNullOrWhiteSpace(prefix) && !"env".Equals(prefix, StringComparison.CurrentCultureIgnoreCase))
            {
                //I don't know the prefix. Return the original form to let others resolve
                return $"{{{variable}}}";
            }

            string value = ResolveEnvironmentVariable(variableNoPrefix);
            if ("env".Equals(prefix, StringComparison.CurrentCultureIgnoreCase))
            {
                //User specifically asking for environment variable
                return value;
            }
            else
            {
                if (variableNoPrefix.Contains(ConfigConstants.CURRENT_USER))
                {
                    value = CurrentLoggedInUser;
                    return value;
                }
                //return the variable itself for the next step in the pipeline to resolve
                return string.IsNullOrWhiteSpace(value) ? $"{{{variable}}}" : value;
            }
        }