Exemplo n.º 1
0
        public static PSEndpoint ToPsEndpoint(this SdkEndpoint sdkEndpoint)
        {
            Debug.Assert(sdkEndpoint.ProvisioningState != null, "sdkEndpoint.ProvisioningState != null");
            Debug.Assert(sdkEndpoint.ResourceState != null, "sdkEndpoint.ResourceState != null");
            Debug.Assert(sdkEndpoint.IsCompressionEnabled != null, "sdkEndpoint.IsCompressionEnabled != null");
            Debug.Assert(sdkEndpoint.IsHttpAllowed != null, "sdkEndpoint.IsHttpAllowed != null");
            Debug.Assert(sdkEndpoint.IsHttpsAllowed != null, "sdkEndpoint.IsHttpsAllowed != null");
            Debug.Assert(sdkEndpoint.QueryStringCachingBehavior != null, "sdkEndpoint.QueryStringCachingBehavior != null");

            return(new PSEndpoint
            {
                Id = sdkEndpoint.Id,
                Name = sdkEndpoint.Name,
                Type = sdkEndpoint.Type,
                ProvisioningState = sdkEndpoint.ProvisioningState.Value.CastEnum <SdkProvisioningState, PSProvisioningState>(),
                Tags = sdkEndpoint.Tags.ToHashTableTags(),
                Location = sdkEndpoint.Location,
                ResourceState = sdkEndpoint.ResourceState.Value.CastEnum <SdkEndpointResourceState, PSEndpointResourceState>(),

                // Entity specific properties
                HostName = sdkEndpoint.HostName,
                OriginHostHeader = sdkEndpoint.OriginHostHeader,
                OriginPath = sdkEndpoint.OriginPath,
                ContentTypesToCompress = sdkEndpoint.ContentTypesToCompress.ToArray(),
                IsCompressionEnabled = sdkEndpoint.IsCompressionEnabled.Value,
                IsHttpAllowed = sdkEndpoint.IsHttpAllowed.Value,
                IsHttpsAllowed = sdkEndpoint.IsHttpsAllowed.Value,
                QueryStringCachingBehavior = sdkEndpoint.QueryStringCachingBehavior.Value.CastEnum <SdkQueryStringCachingBehavior, PSQueryStringCachingBehavior>(),
                Origins = sdkEndpoint.Origins.Select(o => o.ToPsDeepCreatedOrigin()).ToList()
            });
        }
Exemplo n.º 2
0
        public static PSEndpoint ToPsEndpoint(this SdkEndpoint sdkEndpoint)
        {
            Debug.Assert(sdkEndpoint.ProvisioningState != null, "sdkEndpoint.ProvisioningState != null");
            Debug.Assert(sdkEndpoint.ResourceState != null, "sdkEndpoint.ResourceState != null");
            Debug.Assert(sdkEndpoint.IsCompressionEnabled != null, "sdkEndpoint.IsCompressionEnabled != null");
            Debug.Assert(sdkEndpoint.IsHttpAllowed != null, "sdkEndpoint.IsHttpAllowed != null");
            Debug.Assert(sdkEndpoint.IsHttpsAllowed != null, "sdkEndpoint.IsHttpsAllowed != null");
            Debug.Assert(sdkEndpoint.QueryStringCachingBehavior != null, "sdkEndpoint.QueryStringCachingBehavior != null");

            return(new PSEndpoint
            {
                Id = sdkEndpoint.Id,
                Name = sdkEndpoint.Name,
                Type = sdkEndpoint.Type,
                ProvisioningState = (PSProvisioningState)Enum.Parse(typeof(PSProvisioningState), sdkEndpoint.ProvisioningState),
                Tags = sdkEndpoint.Tags.ToHashTableTags(),
                Location = sdkEndpoint.Location,
                ResourceState = (PSEndpointResourceState)Enum.Parse(typeof(PSEndpointResourceState), sdkEndpoint.ResourceState),

                // Entity specific properties
                HostName = sdkEndpoint.HostName,
                OriginHostHeader = sdkEndpoint.OriginHostHeader,
                OriginPath = sdkEndpoint.OriginPath,
                ContentTypesToCompress = sdkEndpoint.ContentTypesToCompress.ToArray(),
                IsCompressionEnabled = sdkEndpoint.IsCompressionEnabled.Value,
                IsHttpAllowed = sdkEndpoint.IsHttpAllowed.Value,
                IsHttpsAllowed = sdkEndpoint.IsHttpsAllowed.Value,
                QueryStringCachingBehavior = sdkEndpoint.QueryStringCachingBehavior.Value.CastEnum <SdkQueryStringCachingBehavior, PSQueryStringCachingBehavior>(),
                Origins = sdkEndpoint.Origins.Select(o => o.ToPsDeepCreatedOrigin()).ToList(),
                OptimizationType = sdkEndpoint.OptimizationType,
                ProbePath = sdkEndpoint.ProbePath,
                GeoFilters = sdkEndpoint.GeoFilters.Select(ToPsGeoFilter).ToList(),
                DeliveryPolicy = sdkEndpoint.DeliveryPolicy?.ToPsDeliveryPolicy(),
                DefaultOriginGroup = sdkEndpoint.DefaultOriginGroup
            });
        }