Example #1
0
 internal AfdSecurityPolicyData(ResourceIdentifier id, string name, Core.ResourceType resourceType, SystemData systemData, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus, string profileName, SecurityPolicyPropertiesParameters parameters) : base(id, name, resourceType, systemData)
 {
     ProvisioningState = provisioningState;
     DeploymentStatus  = deploymentStatus;
     ProfileName       = profileName;
     Parameters        = parameters;
 }
        /// <summary>
        /// Serializes the enum value.
        /// </summary>
        /// <param name="writer">The <see cref="T: Newtonsoft.Json.JsonWriter" /> to write to.</param>
        /// <param name="value">The object to serialize to JSON.</param>
        public static void Serialize(JsonWriter writer, DeploymentStatus?value)
        {
            switch (value)
            {
            case DeploymentStatus.Invalid:
                writer.WriteStringValue("Invalid");
                break;

            case DeploymentStatus.Downloading:
                writer.WriteStringValue("Downloading");
                break;

            case DeploymentStatus.Activating:
                writer.WriteStringValue("Activating");
                break;

            case DeploymentStatus.Active:
                writer.WriteStringValue("Active");
                break;

            case DeploymentStatus.Upgrading:
                writer.WriteStringValue("Upgrading");
                break;

            case DeploymentStatus.Deactivating:
                writer.WriteStringValue("Deactivating");
                break;

            default:
                throw new ArgumentException($"Invalid value {value.ToString()} for enum type DeploymentStatus");
            }
        }
Example #3
0
 internal AfdEndpointData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, string location, IDictionary <string, string> tags, int?originResponseTimeoutSeconds, EnabledState?enabledState, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus, string hostName) : base(id, name, type, systemData, location, tags)
 {
     OriginResponseTimeoutSeconds = originResponseTimeoutSeconds;
     EnabledState      = enabledState;
     ProvisioningState = provisioningState;
     DeploymentStatus  = deploymentStatus;
     HostName          = hostName;
 }
 internal AfdEndpointData(ResourceIdentifier id, string name, Core.ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string profileName, EnabledState?enabledState, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus, string hostName, AutoGeneratedDomainNameLabelScope?autoGeneratedDomainNameLabelScope) : base(id, name, resourceType, systemData, tags, location)
 {
     ProfileName       = profileName;
     EnabledState      = enabledState;
     ProvisioningState = provisioningState;
     DeploymentStatus  = deploymentStatus;
     HostName          = hostName;
     AutoGeneratedDomainNameLabelScope = autoGeneratedDomainNameLabelScope;
 }
 internal AfdRuleData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, int?order, IList <DeliveryRuleCondition> conditions, IList <DeliveryRuleActionAutoGenerated> actions, MatchProcessingBehavior?matchProcessingBehavior, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus) : base(id, name, type, systemData)
 {
     Order      = order;
     Conditions = conditions;
     Actions    = actions;
     MatchProcessingBehavior = matchProcessingBehavior;
     ProvisioningState       = provisioningState;
     DeploymentStatus        = deploymentStatus;
 }
Example #6
0
 internal AfdOriginGroupData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, LoadBalancingSettingsParameters loadBalancingSettings, HealthProbeParameters healthProbeSettings, int?trafficRestorationTimeToHealedOrNewEndpointsInMinutes, ResponseBasedOriginErrorDetectionParameters responseBasedAfdOriginErrorDetectionSettings, EnabledState?sessionAffinityState, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus) : base(id, name, type, systemData)
 {
     LoadBalancingSettings = loadBalancingSettings;
     HealthProbeSettings   = healthProbeSettings;
     TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = trafficRestorationTimeToHealedOrNewEndpointsInMinutes;
     ResponseBasedAfdOriginErrorDetectionSettings          = responseBasedAfdOriginErrorDetectionSettings;
     SessionAffinityState = sessionAffinityState;
     ProvisioningState    = provisioningState;
     DeploymentStatus     = deploymentStatus;
 }
Example #7
0
 internal AfdCustomDomainData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, AfdCustomDomainHttpsParameters tlsSettings, WritableSubResource azureDnsZone, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus, DomainValidationState?domainValidationState, string hostName, DomainValidationProperties validationProperties) : base(id, name, type, systemData)
 {
     TlsSettings           = tlsSettings;
     AzureDnsZone          = azureDnsZone;
     ProvisioningState     = provisioningState;
     DeploymentStatus      = deploymentStatus;
     DomainValidationState = domainValidationState;
     HostName             = hostName;
     ValidationProperties = validationProperties;
 }
Example #8
0
 internal AfdOriginGroupData(ResourceIdentifier id, string name, Core.ResourceType resourceType, SystemData systemData, string profileName, LoadBalancingSettingsParameters loadBalancingSettings, HealthProbeParameters healthProbeSettings, int?trafficRestorationTimeToHealedOrNewEndpointsInMinutes, EnabledState?sessionAffinityState, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus) : base(id, name, resourceType, systemData)
 {
     ProfileName           = profileName;
     LoadBalancingSettings = loadBalancingSettings;
     HealthProbeSettings   = healthProbeSettings;
     TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = trafficRestorationTimeToHealedOrNewEndpointsInMinutes;
     SessionAffinityState = sessionAffinityState;
     ProvisioningState    = provisioningState;
     DeploymentStatus     = deploymentStatus;
 }
 /// <summary>
 /// Initializes a new instance of the DeployedServicePackageInfo class.
 /// </summary>
 /// <param name="name">The name of the service package as specified in the service manifest.</param>
 /// <param name="version">The version of the service package specified in service manifest.</param>
 /// <param name="status">Specifies the status of a deployed application or service package on a Service Fabric node.
 /// . Possible values include: 'Invalid', 'Downloading', 'Activating', 'Active', 'Upgrading', 'Deactivating'</param>
 /// <param name="servicePackageActivationId">The ActivationId of a deployed service package. If
 /// ServicePackageActivationMode specified at the time of creating the service
 /// is 'SharedProcess' (or if it is not specified, in which case it defaults to 'SharedProcess'), then value of
 /// ServicePackageActivationId
 /// is always an empty string.
 /// </param>
 public DeployedServicePackageInfo(
     string name                       = default(string),
     string version                    = default(string),
     DeploymentStatus?status           = default(DeploymentStatus?),
     string servicePackageActivationId = default(string))
 {
     this.Name    = name;
     this.Version = version;
     this.Status  = status;
     this.ServicePackageActivationId = servicePackageActivationId;
 }
 internal AfdOriginData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, WritableSubResource azureOrigin, string hostName, int?httpPort, int?httpsPort, string originHostHeader, int?priority, int?weight, object sharedPrivateLinkResource, EnabledState?enabledState, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus) : base(id, name, type, systemData)
 {
     AzureOrigin               = azureOrigin;
     HostName                  = hostName;
     HttpPort                  = httpPort;
     HttpsPort                 = httpsPort;
     OriginHostHeader          = originHostHeader;
     Priority                  = priority;
     Weight                    = weight;
     SharedPrivateLinkResource = sharedPrivateLinkResource;
     EnabledState              = enabledState;
     ProvisioningState         = provisioningState;
     DeploymentStatus          = deploymentStatus;
 }
Example #11
0
 internal AfdOriginData(ResourceIdentifier id, string name, Core.ResourceType resourceType, SystemData systemData, string originGroupName, WritableSubResource azureOrigin, string hostName, int?httpPort, int?httpsPort, string originHostHeader, int?priority, int?weight, SharedPrivateLinkResourceProperties sharedPrivateLinkResource, EnabledState?enabledState, bool?enforceCertificateNameCheck, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus) : base(id, name, resourceType, systemData)
 {
     OriginGroupName             = originGroupName;
     AzureOrigin                 = azureOrigin;
     HostName                    = hostName;
     HttpPort                    = httpPort;
     HttpsPort                   = httpsPort;
     OriginHostHeader            = originHostHeader;
     Priority                    = priority;
     Weight                      = weight;
     SharedPrivateLinkResource   = sharedPrivateLinkResource;
     EnabledState                = enabledState;
     EnforceCertificateNameCheck = enforceCertificateNameCheck;
     ProvisioningState           = provisioningState;
     DeploymentStatus            = deploymentStatus;
 }
 internal AfdRouteData(ResourceIdentifier id, string name, Core.ResourceType resourceType, SystemData systemData, string endpointName, IList <ActivatedResourceReference> customDomains, WritableSubResource originGroup, string originPath, IList <WritableSubResource> ruleSets, IList <AfdEndpointProtocols> supportedProtocols, IList <string> patternsToMatch, AfdRouteCacheConfiguration cacheConfiguration, ForwardingProtocol?forwardingProtocol, LinkToDefaultDomain?linkToDefaultDomain, HttpsRedirect?httpsRedirect, EnabledState?enabledState, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus) : base(id, name, resourceType, systemData)
 {
     EndpointName        = endpointName;
     CustomDomains       = customDomains;
     OriginGroup         = originGroup;
     OriginPath          = originPath;
     RuleSets            = ruleSets;
     SupportedProtocols  = supportedProtocols;
     PatternsToMatch     = patternsToMatch;
     CacheConfiguration  = cacheConfiguration;
     ForwardingProtocol  = forwardingProtocol;
     LinkToDefaultDomain = linkToDefaultDomain;
     HttpsRedirect       = httpsRedirect;
     EnabledState        = enabledState;
     ProvisioningState   = provisioningState;
     DeploymentStatus    = deploymentStatus;
 }
 internal AfdRouteData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IList <WritableSubResource> customDomains, WritableSubResource originGroup, string originPath, IList <WritableSubResource> ruleSets, IList <AfdEndpointProtocols> supportedProtocols, IList <string> patternsToMatch, object compressionSettings, AfdQueryStringCachingBehavior?queryStringCachingBehavior, ForwardingProtocol?forwardingProtocol, LinkToDefaultDomain?linkToDefaultDomain, HttpsRedirect?httpsRedirect, EnabledState?enabledState, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus) : base(id, name, type, systemData)
 {
     CustomDomains              = customDomains;
     OriginGroup                = originGroup;
     OriginPath                 = originPath;
     RuleSets                   = ruleSets;
     SupportedProtocols         = supportedProtocols;
     PatternsToMatch            = patternsToMatch;
     CompressionSettings        = compressionSettings;
     QueryStringCachingBehavior = queryStringCachingBehavior;
     ForwardingProtocol         = forwardingProtocol;
     LinkToDefaultDomain        = linkToDefaultDomain;
     HttpsRedirect              = httpsRedirect;
     EnabledState               = enabledState;
     ProvisioningState          = provisioningState;
     DeploymentStatus           = deploymentStatus;
 }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the DeployedCodePackageInfo class.
 /// </summary>
 /// <param name="name">The name of the code package.</param>
 /// <param name="version">The version of the code package specified in service manifest.</param>
 /// <param name="serviceManifestName">The name of service manifest that specified this code package.</param>
 /// <param name="servicePackageActivationId">The ActivationId of a deployed service package. If
 /// ServicePackageActivationMode specified at the time of creating the service
 /// is 'SharedProcess' (or if it is not specified, in which case it defaults to 'SharedProcess'), then value of
 /// ServicePackageActivationId
 /// is always an empty string.
 /// </param>
 /// <param name="hostType">Specifies the type of host for main entry point of a code package as specified in service
 /// manifest. Possible values include: 'Invalid', 'ExeHost', 'ContainerHost'</param>
 /// <param name="hostIsolationMode">Specifies the isolation mode of main entry point of a code package when it's host
 /// type is ContainerHost. This is specified as part of container host policies in application manifest while importing
 /// service manifest. Possible values include: 'None', 'Process', 'HyperV'</param>
 /// <param name="status">Specifies the status of a deployed application or service package on a Service Fabric node.
 /// . Possible values include: 'Invalid', 'Downloading', 'Activating', 'Active', 'Upgrading', 'Deactivating',
 /// 'RanToCompletion', 'Failed'</param>
 /// <param name="runFrequencyInterval">The interval at which code package is run. This is used for periodic code
 /// package.</param>
 /// <param name="setupEntryPoint">Information about setup or main entry point of a code package deployed on a Service
 /// Fabric node.</param>
 /// <param name="mainEntryPoint">Information about setup or main entry point of a code package deployed on a Service
 /// Fabric node.</param>
 public DeployedCodePackageInfo(
     string name                           = default(string),
     string version                        = default(string),
     string serviceManifestName            = default(string),
     string servicePackageActivationId     = default(string),
     HostType?hostType                     = default(HostType?),
     HostIsolationMode?hostIsolationMode   = default(HostIsolationMode?),
     DeploymentStatus?status               = default(DeploymentStatus?),
     string runFrequencyInterval           = default(string),
     CodePackageEntryPoint setupEntryPoint = default(CodePackageEntryPoint),
     CodePackageEntryPoint mainEntryPoint  = default(CodePackageEntryPoint))
 {
     this.Name                       = name;
     this.Version                    = version;
     this.ServiceManifestName        = serviceManifestName;
     this.ServicePackageActivationId = servicePackageActivationId;
     this.HostType                   = hostType;
     this.HostIsolationMode          = hostIsolationMode;
     this.Status                     = status;
     this.RunFrequencyInterval       = runFrequencyInterval;
     this.SetupEntryPoint            = setupEntryPoint;
     this.MainEntryPoint             = mainEntryPoint;
 }
 internal AfdSecurityPolicyData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus, SecurityPolicyParameters parameters) : base(id, name, type, systemData)
 {
     ProvisioningState = provisioningState;
     DeploymentStatus  = deploymentStatus;
     Parameters        = parameters;
 }
Example #16
0
 internal AfdRuleSetData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus) : base(id, name, type, systemData)
 {
     ProvisioningState = provisioningState;
     DeploymentStatus  = deploymentStatus;
 }
        public async Task <ActionResult <IEnumerable <ApplicationDeploymentDto> > > GetDeployments([FromQuery(Name = "application")] string applicationName, [FromQuery(Name = "status")] DeploymentStatus?status)
        {
            try
            {
                Application application = null;
                if (!string.IsNullOrEmpty(applicationName))
                {
                    application = _applicationService.GetApplication(applicationName);
                }

                var deployments = await _deploymentService.GetDeployments(application, status);

                var result = deployments.Select(ConvertFromModel).ToList();

                return(Ok(result.AsEnumerable()));
            }
            catch (Exception e)
            {
                return(NotFound());
            }
        }
Example #18
0
 internal AfdRuleSetData(ResourceIdentifier id, string name, Core.ResourceType resourceType, SystemData systemData, AfdProvisioningState?provisioningState, DeploymentStatus?deploymentStatus, string profileName) : base(id, name, resourceType, systemData)
 {
     ProvisioningState = provisioningState;
     DeploymentStatus  = deploymentStatus;
     ProfileName       = profileName;
 }
Example #19
0
        public Task <IEnumerable <Deployment> > GetDeployments(Application?application, DeploymentStatus?status)
        {
            var deploymentsDbSet = _deploymentsDbContextConfigurator.Set <Dao.Deployment>();

            var query = (IQueryable <Dao.Deployment>)deploymentsDbSet;

            if (application != null)
            {
                query = query.Where(x => x.ApplicationId == application.Name);
            }

            if (status != null)
            {
                // NOTE: the conversion from Models.DeploymentStatus to Dao.DeploymentStatus is done
                // here outside of the Where clause due to a bug in EFCore as described in this
                // post: https://stackoverflow.com/questions/55182602/efcore-enum-to-string-value-conversion-not-used-in-where-clause

                var daoStatus = (Dao.DeploymentStatus)status;
                query = query.Where(x => x.Status == daoStatus);
            }

            var applicationDeploymentDaos = query.ToList();

            // var imageMap = application.Images.ToDictionary(
            //     x => $"{x.Repository}-{x.TagProperty.Path}"
            // );

            var result = new List <Deployment>();

            foreach (var deploymentDao in applicationDeploymentDaos)
            {
                // var image = imageMap[$"{deploymentDao.ImageRepository}-{deploymentDao.UpdatePath}"];
                result.Add(deploymentDao.ConvertToDeploymentModel());
            }

            return(Task.FromResult(result.AsEnumerable()));
        }