public static PSRoutingRule ToPSRoutingRule(this SdkRoutingRule sdkRoutingRule)
 {
     return(new PSRoutingRule
     {
         Name = sdkRoutingRule.Name,
         Type = sdkRoutingRule.Type,
         AcceptedProtocols = sdkRoutingRule.AcceptedProtocols?.Select(x => (PSProtocol)Enum.Parse(typeof(PSProtocol), x)).ToList(),
         PatternsToMatch = sdkRoutingRule.PatternsToMatch?.ToList(),
         FrontendEndpointIds = sdkRoutingRule.FrontendEndpoints?.Select(x => x.Id).ToList(),
         RouteConfiguration = ToPSRouteConfiguration(sdkRoutingRule.RouteConfiguration),
         EnabledState = sdkRoutingRule.EnabledState == null ? (PSEnabledState?)null : (PSEnabledState)Enum.Parse(typeof(PSEnabledState), sdkRoutingRule.EnabledState)
     });
 }
Пример #2
0
 public static PSRoutingRule ToPSRoutingRule(this SdkRoutingRule sdkRoutingRule)
 {
     return(new PSRoutingRule
     {
         Name = sdkRoutingRule.Name,
         Type = sdkRoutingRule.Type,
         AcceptedProtocols = sdkRoutingRule.AcceptedProtocols?.Select(x => (PSProtocol)Enum.Parse(typeof(PSProtocol), x)).ToList(),
         PatternsToMatch = sdkRoutingRule.PatternsToMatch?.ToList(),
         FrontendEndpointIds = sdkRoutingRule.FrontendEndpoints?.Select(x => x.Id).ToList(),
         ForwardingProtocol = sdkRoutingRule.ForwardingProtocol == null ? (PSForwardingProtocol?)null : (PSForwardingProtocol)Enum.Parse(typeof(PSForwardingProtocol), sdkRoutingRule.ForwardingProtocol),
         BackendPoolId = sdkRoutingRule.BackendPool?.Id,
         EnableCaching = sdkRoutingRule.CacheConfiguration != null,
         QueryParameterStripDirective = sdkRoutingRule.CacheConfiguration == null ? (PSQueryParameterStripDirective?)null : (PSQueryParameterStripDirective)Enum.Parse(typeof(PSQueryParameterStripDirective), sdkRoutingRule.CacheConfiguration.QueryParameterStripDirective),
         DynamicCompression = sdkRoutingRule.CacheConfiguration == null ? (PSEnabledState?)null : (PSEnabledState)Enum.Parse(typeof(PSEnabledState), sdkRoutingRule.CacheConfiguration.DynamicCompression),
         EnabledState = sdkRoutingRule.EnabledState == null ? (PSEnabledState?)null : (PSEnabledState)Enum.Parse(typeof(PSEnabledState), sdkRoutingRule.EnabledState)
     });
 }