Ejemplo n.º 1
0
 public static bool TryParse(string value, out ApiGatewayArn methodArn)
 {
     try
     {
         methodArn = Parse(value);
         return(true);
     }
     catch
     {
         methodArn = null;
         return(false);
     }
 }
Ejemplo n.º 2
0
        public static ApiGatewayArn Parse(string value)
        {
            var result = new ApiGatewayArn();

            string[] arnSplit = value.Split(':');

            result.Partition = arnSplit[1];
            result.Service   = arnSplit[2];

            result.Region       = arnSplit[3];
            result.AwsAccountId = arnSplit[4];

            string[] pathSplit = arnSplit[5].Split('/');
            result.RestApiId = pathSplit[0];
            result.Stage     = pathSplit[1];
            result.Verb      = pathSplit[2];

            if (pathSplit.Length > 3)
            {
                result.Resource = string.Join("/", pathSplit.Skip(3));
            }

            return(result);
        }