예제 #1
0
 internal UrlRewriteActionParameters(UrlRewriteActionParametersOdataType odataType, string sourcePattern, string destination, bool?preserveUnmatchedPath)
 {
     OdataType             = odataType;
     SourcePattern         = sourcePattern;
     Destination           = destination;
     PreserveUnmatchedPath = preserveUnmatchedPath;
 }
예제 #2
0
        public UrlRewriteActionParameters(UrlRewriteActionParametersOdataType odataType, string sourcePattern, string destination)
        {
            if (sourcePattern == null)
            {
                throw new ArgumentNullException(nameof(sourcePattern));
            }
            if (destination == null)
            {
                throw new ArgumentNullException(nameof(destination));
            }

            OdataType     = odataType;
            SourcePattern = sourcePattern;
            Destination   = destination;
        }
예제 #3
0
        internal static UrlRewriteActionParameters DeserializeUrlRewriteActionParameters(JsonElement element)
        {
            UrlRewriteActionParametersOdataType odataType = default;
            string          sourcePattern         = default;
            string          destination           = default;
            Optional <bool> preserveUnmatchedPath = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("@odata.type"))
                {
                    odataType = new UrlRewriteActionParametersOdataType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("sourcePattern"))
                {
                    sourcePattern = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("destination"))
                {
                    destination = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("preserveUnmatchedPath"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    preserveUnmatchedPath = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new UrlRewriteActionParameters(odataType, sourcePattern, destination, Optional.ToNullable(preserveUnmatchedPath)));
        }