/// <summary> /// Initializes a new instance of the StatefulServiceUpdateDescription class. /// </summary> /// <param name="flags">Flags indicating whether other properties are set. Each of the associated properties /// corresponds to a flag, specified below, which, if set, indicate that the property is specified. /// This property can be a combination of those flags obtained using bitwise 'OR' operator. /// For example, if the provided value is 6 then the flags for ReplicaRestartWaitDuration (2) and /// QuorumLossWaitDuration (4) are set. /// /// - None - Does not indicate any other properties are set. The value is zero. /// - TargetReplicaSetSize/InstanceCount - Indicates whether the TargetReplicaSetSize property (for Stateful services) /// or the InstanceCount property (for Stateless services) is set. The value is 1. /// - ReplicaRestartWaitDuration - Indicates the ReplicaRestartWaitDuration property is set. The value is 2. /// - QuorumLossWaitDuration - Indicates the QuorumLossWaitDuration property is set. The value is 4. /// - StandByReplicaKeepDuration - Indicates the StandByReplicaKeepDuration property is set. The value is 8. /// - MinReplicaSetSize - Indicates the MinReplicaSetSize property is set. The value is 16. /// - PlacementConstraints - Indicates the PlacementConstraints property is set. The value is 32. /// - PlacementPolicyList - Indicates the ServicePlacementPolicies property is set. The value is 64. /// - Correlation - Indicates the CorrelationScheme property is set. The value is 128. /// - Metrics - Indicates the ServiceLoadMetrics property is set. The value is 256. /// - DefaultMoveCost - Indicates the DefaultMoveCost property is set. The value is 512. /// - ScalingPolicy - Indicates the ScalingPolicies property is set. The value is 1024. /// </param> /// <param name="placementConstraints">The placement constraints as a string. Placement constraints are boolean /// expressions on node properties and allow for restricting a service to particular nodes based on the service /// requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == /// blue)".</param> /// <param name="correlationScheme">The correlation scheme.</param> /// <param name="loadMetrics">The service load metrics.</param> /// <param name="servicePlacementPolicies">The service placement policies.</param> /// <param name="defaultMoveCost">Specifies the move cost for the service. Possible values include: 'Zero', 'Low', /// 'Medium', 'High'</param> /// <param name="scalingPolicies">Scaling policies for this service.</param> /// <param name="targetReplicaSetSize">The target replica set size as a number.</param> /// <param name="minReplicaSetSize">The minimum replica set size as a number.</param> /// <param name="replicaRestartWaitDurationSeconds">The duration, in seconds, between when a replica goes down and when /// a new replica is created.</param> /// <param name="quorumLossWaitDurationSeconds">The maximum duration, in seconds, for which a partition is allowed to /// be in a state of quorum loss.</param> /// <param name="standByReplicaKeepDurationSeconds">The definition on how long StandBy replicas should be maintained /// before being removed.</param> public StatefulServiceUpdateDescription( string flags = default(string), string placementConstraints = default(string), IEnumerable <ServiceCorrelationDescription> correlationScheme = default(IEnumerable <ServiceCorrelationDescription>), IEnumerable <ServiceLoadMetricDescription> loadMetrics = default(IEnumerable <ServiceLoadMetricDescription>), IEnumerable <ServicePlacementPolicyDescription> servicePlacementPolicies = default(IEnumerable <ServicePlacementPolicyDescription>), MoveCost?defaultMoveCost = default(MoveCost?), IEnumerable <ScalingPolicyDescription> scalingPolicies = default(IEnumerable <ScalingPolicyDescription>), int?targetReplicaSetSize = default(int?), int?minReplicaSetSize = default(int?), string replicaRestartWaitDurationSeconds = default(string), string quorumLossWaitDurationSeconds = default(string), string standByReplicaKeepDurationSeconds = default(string)) : base( Common.ServiceKind.Stateful, flags, placementConstraints, correlationScheme, loadMetrics, servicePlacementPolicies, defaultMoveCost, scalingPolicies) { targetReplicaSetSize?.ThrowIfLessThan("targetReplicaSetSize", 1); minReplicaSetSize?.ThrowIfLessThan("minReplicaSetSize", 1); this.TargetReplicaSetSize = targetReplicaSetSize; this.MinReplicaSetSize = minReplicaSetSize; this.ReplicaRestartWaitDurationSeconds = replicaRestartWaitDurationSeconds; this.QuorumLossWaitDurationSeconds = quorumLossWaitDurationSeconds; this.StandByReplicaKeepDurationSeconds = standByReplicaKeepDurationSeconds; }
/// <summary> /// Initializes a new instance of the StatelessServiceUpdateDescription class. /// </summary> /// <param name="flags">Flags indicating whether other properties are set. Each of the associated properties /// corresponds to a flag, specified below, which, if set, indicate that the property is specified. /// This property can be a combination of those flags obtained using bitwise 'OR' operator. /// For example, if the provided value is 6 then the flags for ReplicaRestartWaitDuration (2) and /// QuorumLossWaitDuration (4) are set. /// /// - None - Does not indicate any other properties are set. The value is zero. /// - TargetReplicaSetSize/InstanceCount - Indicates whether the TargetReplicaSetSize property (for Stateful services) /// or the InstanceCount property (for Stateless services) is set. The value is 1. /// - ReplicaRestartWaitDuration - Indicates the ReplicaRestartWaitDuration property is set. The value is 2. /// - QuorumLossWaitDuration - Indicates the QuorumLossWaitDuration property is set. The value is 4. /// - StandByReplicaKeepDuration - Indicates the StandByReplicaKeepDuration property is set. The value is 8. /// - MinReplicaSetSize - Indicates the MinReplicaSetSize property is set. The value is 16. /// - PlacementConstraints - Indicates the PlacementConstraints property is set. The value is 32. /// - PlacementPolicyList - Indicates the ServicePlacementPolicies property is set. The value is 64. /// - Correlation - Indicates the CorrelationScheme property is set. The value is 128. /// - Metrics - Indicates the ServiceLoadMetrics property is set. The value is 256. /// - DefaultMoveCost - Indicates the DefaultMoveCost property is set. The value is 512. /// - ScalingPolicy - Indicates the ScalingPolicies property is set. The value is 1024. /// - ServicePlacementTimeLimit - Indicates the ServicePlacementTimeLimit property is set. The value is 2048. /// - MinInstanceCount - Indicates the MinInstanceCount property is set. The value is 4096. /// - MinInstancePercentage - Indicates the MinInstancePercentage property is set. The value is 8192. /// - InstanceCloseDelayDuration - Indicates the InstanceCloseDelayDuration property is set. The value is 16384. /// </param> /// <param name="placementConstraints">The placement constraints as a string. Placement constraints are boolean /// expressions on node properties and allow for restricting a service to particular nodes based on the service /// requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == /// blue)".</param> /// <param name="correlationScheme">The correlation scheme.</param> /// <param name="loadMetrics">The service load metrics.</param> /// <param name="servicePlacementPolicies">The service placement policies.</param> /// <param name="defaultMoveCost">The move cost for the service. Possible values include: 'Zero', 'Low', 'Medium', /// 'High', 'VeryHigh' /// /// Specifies the move cost for the service. /// </param> /// <param name="scalingPolicies">Scaling policies for this service.</param> /// <param name="instanceCount">The instance count.</param> /// <param name="minInstanceCount">MinInstanceCount is the minimum number of instances that must be up to meet the /// EnsureAvailability safety check during operations like upgrade or deactivate node. /// The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * InstanceCount) ). /// Note, if InstanceCount is set to -1, during MinInstanceCount computation -1 is first converted into the number of /// nodes on which the instances are allowed to be placed according to the placement constraints on the service. /// </param> /// <param name="minInstancePercentage">MinInstancePercentage is the minimum percentage of InstanceCount that must be /// up to meet the EnsureAvailability safety check during operations like upgrade or deactivate node. /// The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * InstanceCount) ). /// Note, if InstanceCount is set to -1, during MinInstancePercentage computation, -1 is first converted into the /// number of nodes on which the instances are allowed to be placed according to the placement constraints on the /// service. /// </param> /// <param name="instanceCloseDelayDurationSeconds">Duration in seconds, to wait before a stateless instance is closed, /// to allow the active requests to drain gracefully. This would be effective when the instance is closing during the /// application/cluster upgrade and disabling node. /// The endpoint exposed on this instance is removed prior to starting the delay, which prevents new connections to /// this instance. /// In addition, clients that have subscribed to service endpoint change /// events(https://docs.microsoft.com/dotnet/api/system.fabric.fabricclient.servicemanagementclient.registerservicenotificationfilterasync), /// can do /// the following upon receiving the endpoint removal notification: /// - Stop sending new requests to this instance. /// - Close existing connections after in-flight requests have completed. /// - Connect to a different instance of the service partition for future requests. /// </param> public StatelessServiceUpdateDescription( string flags = default(string), string placementConstraints = default(string), IEnumerable <ServiceCorrelationDescription> correlationScheme = default(IEnumerable <ServiceCorrelationDescription>), IEnumerable <ServiceLoadMetricDescription> loadMetrics = default(IEnumerable <ServiceLoadMetricDescription>), IEnumerable <ServicePlacementPolicyDescription> servicePlacementPolicies = default(IEnumerable <ServicePlacementPolicyDescription>), MoveCost?defaultMoveCost = default(MoveCost?), IEnumerable <ScalingPolicyDescription> scalingPolicies = default(IEnumerable <ScalingPolicyDescription>), int?instanceCount = default(int?), int?minInstanceCount = default(int?), int?minInstancePercentage = default(int?), string instanceCloseDelayDurationSeconds = default(string)) : base( Common.ServiceKind.Stateless, flags, placementConstraints, correlationScheme, loadMetrics, servicePlacementPolicies, defaultMoveCost, scalingPolicies) { instanceCount?.ThrowIfLessThan("instanceCount", -1); this.InstanceCount = instanceCount; this.MinInstanceCount = minInstanceCount; this.MinInstancePercentage = minInstancePercentage; this.InstanceCloseDelayDurationSeconds = instanceCloseDelayDurationSeconds; }
/// <summary> /// Initializes a new instance of the ServiceUpdateDescription class. /// </summary> /// <param name="serviceKind">The kind of service (Stateless or Stateful).</param> /// <param name="flags">Flags indicating whether other properties are set. Each of the associated properties /// corresponds to a flag, specified below, which, if set, indicate that the property is specified. /// This property can be a combination of those flags obtained using bitwise 'OR' operator. /// For example, if the provided value is 6 then the flags for ReplicaRestartWaitDuration (2) and /// QuorumLossWaitDuration (4) are set. /// /// - None - Does not indicate any other properties are set. The value is zero. /// - TargetReplicaSetSize/InstanceCount - Indicates whether the TargetReplicaSetSize property (for Stateful services) /// or the InstanceCount property (for Stateless services) is set. The value is 1. /// - ReplicaRestartWaitDuration - Indicates the ReplicaRestartWaitDuration property is set. The value is 2. /// - QuorumLossWaitDuration - Indicates the QuorumLossWaitDuration property is set. The value is 4. /// - StandByReplicaKeepDuration - Indicates the StandByReplicaKeepDuration property is set. The value is 8. /// - MinReplicaSetSize - Indicates the MinReplicaSetSize property is set. The value is 16. /// - PlacementConstraints - Indicates the PlacementConstraints property is set. The value is 32. /// - PlacementPolicyList - Indicates the ServicePlacementPolicies property is set. The value is 64. /// - Correlation - Indicates the CorrelationScheme property is set. The value is 128. /// - Metrics - Indicates the ServiceLoadMetrics property is set. The value is 256. /// - DefaultMoveCost - Indicates the DefaultMoveCost property is set. The value is 512. /// - ScalingPolicy - Indicates the ScalingPolicies property is set. The value is 1024. /// - ServicePlacementTimeLimit - Indicates the ServicePlacementTimeLimit property is set. The value is 2048. /// - MinInstanceCount - Indicates the MinInstanceCount property is set. The value is 4096. /// - MinInstancePercentage - Indicates the MinInstancePercentage property is set. The value is 8192. /// - InstanceCloseDelayDuration - Indicates the InstanceCloseDelayDuration property is set. The value is 16384. /// - InstanceRestartWaitDuration - Indicates the InstanceCloseDelayDuration property is set. The value is 32768. /// - DropSourceReplicaOnMove - Indicates the DropSourceReplicaOnMove property is set. The value is 65536. /// - ServiceDnsName - Indicates the ServiceDnsName property is set. The value is 131072. /// - TagsForPlacement - Indicates the TagsForPlacement property is set. The value is 1048576. /// - TagsForRunning - Indicates the TagsForRunning property is set. The value is 2097152. /// </param> /// <param name="placementConstraints">The placement constraints as a string. Placement constraints are boolean /// expressions on node properties and allow for restricting a service to particular nodes based on the service /// requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == /// blue)".</param> /// <param name="correlationScheme">The correlation scheme.</param> /// <param name="loadMetrics">The service load metrics.</param> /// <param name="servicePlacementPolicies">The service placement policies.</param> /// <param name="defaultMoveCost">The move cost for the service. Possible values include: 'Zero', 'Low', 'Medium', /// 'High', 'VeryHigh' /// /// Specifies the move cost for the service. /// </param> /// <param name="scalingPolicies">Scaling policies for this service.</param> /// <param name="serviceDnsName">The DNS name of the service.</param> /// <param name="tagsForPlacement">Tags for placement of this service.</param> /// <param name="tagsForRunning">Tags for running of this service.</param> protected ServiceUpdateDescription( ServiceKind?serviceKind, string flags = default(string), string placementConstraints = default(string), IEnumerable <ServiceCorrelationDescription> correlationScheme = default(IEnumerable <ServiceCorrelationDescription>), IEnumerable <ServiceLoadMetricDescription> loadMetrics = default(IEnumerable <ServiceLoadMetricDescription>), IEnumerable <ServicePlacementPolicyDescription> servicePlacementPolicies = default(IEnumerable <ServicePlacementPolicyDescription>), MoveCost?defaultMoveCost = default(MoveCost?), IEnumerable <ScalingPolicyDescription> scalingPolicies = default(IEnumerable <ScalingPolicyDescription>), string serviceDnsName = default(string), NodeTagsDescription tagsForPlacement = default(NodeTagsDescription), NodeTagsDescription tagsForRunning = default(NodeTagsDescription)) { serviceKind.ThrowIfNull(nameof(serviceKind)); this.ServiceKind = serviceKind; this.Flags = flags; this.PlacementConstraints = placementConstraints; this.CorrelationScheme = correlationScheme; this.LoadMetrics = loadMetrics; this.ServicePlacementPolicies = servicePlacementPolicies; this.DefaultMoveCost = defaultMoveCost; this.ScalingPolicies = scalingPolicies; this.ServiceDnsName = serviceDnsName; this.TagsForPlacement = tagsForPlacement; this.TagsForRunning = tagsForRunning; }
/// <summary> /// Initializes a new instance of the StatefulServiceDescription class. /// </summary> /// <param name="serviceName">The full name of the service with 'fabric:' URI scheme.</param> /// <param name="serviceTypeName">Name of the service type as specified in the service manifest.</param> /// <param name="partitionDescription">The partition description as an object.</param> /// <param name="targetReplicaSetSize">The target replica set size as a number.</param> /// <param name="minReplicaSetSize">The minimum replica set size as a number.</param> /// <param name="hasPersistedState">A flag indicating whether this is a persistent service which stores states on the /// local disk. If it is then the value of this property is true, if not it is false.</param> /// <param name="applicationName">The name of the application, including the 'fabric:' URI scheme.</param> /// <param name="initializationData">The initialization data as an array of bytes. Initialization data is passed to /// service instances or replicas when they are created.</param> /// <param name="placementConstraints">The placement constraints as a string. Placement constraints are boolean /// expressions on node properties and allow for restricting a service to particular nodes based on the service /// requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == /// blue)".</param> /// <param name="correlationScheme">The correlation scheme.</param> /// <param name="serviceLoadMetrics">The service load metrics.</param> /// <param name="servicePlacementPolicies">The service placement policies.</param> /// <param name="defaultMoveCost">The move cost for the service. Possible values include: 'Zero', 'Low', 'Medium', /// 'High', 'VeryHigh' /// /// Specifies the move cost for the service. /// </param> /// <param name="isDefaultMoveCostSpecified">Indicates if the DefaultMoveCost property is specified.</param> /// <param name="servicePackageActivationMode">The activation mode of service package to be used for a service. /// Possible values include: 'SharedProcess', 'ExclusiveProcess' /// /// The activation mode of service package to be used for a Service Fabric service. This is specified at the time of /// creating the Service. /// </param> /// <param name="serviceDnsName">The DNS name of the service. It requires the DNS system service to be enabled in /// Service Fabric cluster.</param> /// <param name="scalingPolicies">Scaling policies for this service.</param> /// <param name="flags">Flags indicating whether other properties are set. Each of the associated properties /// corresponds to a flag, specified below, which, if set, indicate that the property is specified. /// This property can be a combination of those flags obtained using bitwise 'OR' operator. /// For example, if the provided value is 6 then the flags for QuorumLossWaitDuration (2) and /// StandByReplicaKeepDuration(4) are set. /// /// - None - Does not indicate any other properties are set. The value is zero. /// - ReplicaRestartWaitDuration - Indicates the ReplicaRestartWaitDuration property is set. The value is 1. /// - QuorumLossWaitDuration - Indicates the QuorumLossWaitDuration property is set. The value is 2. /// - StandByReplicaKeepDuration - Indicates the StandByReplicaKeepDuration property is set. The value is 4. /// - ServicePlacementTimeLimit - Indicates the ServicePlacementTimeLimit property is set. The value is 8. /// - DropSourceReplicaOnMove - Indicates the DropSourceReplicaOnMove property is set. The value is 16. /// </param> /// <param name="replicaRestartWaitDurationSeconds">The duration, in seconds, between when a replica goes down and when /// a new replica is created.</param> /// <param name="quorumLossWaitDurationSeconds">The maximum duration, in seconds, for which a partition is allowed to /// be in a state of quorum loss.</param> /// <param name="standByReplicaKeepDurationSeconds">The definition on how long StandBy replicas should be maintained /// before being removed.</param> /// <param name="servicePlacementTimeLimitSeconds">The duration for which replicas can stay InBuild before reporting /// that build is stuck.</param> /// <param name="dropSourceReplicaOnMove">Indicates whether to drop source Secondary replica even if the target replica /// has not finished build. If desired behavior is to drop it as soon as possible the value of this property is true, /// if not it is false.</param> public StatefulServiceDescription( ServiceName serviceName, string serviceTypeName, PartitionSchemeDescription partitionDescription, int?targetReplicaSetSize, int?minReplicaSetSize, bool?hasPersistedState, ApplicationName applicationName = default(ApplicationName), byte[] initializationData = default(byte[]), string placementConstraints = default(string), IEnumerable <ServiceCorrelationDescription> correlationScheme = default(IEnumerable <ServiceCorrelationDescription>), IEnumerable <ServiceLoadMetricDescription> serviceLoadMetrics = default(IEnumerable <ServiceLoadMetricDescription>), IEnumerable <ServicePlacementPolicyDescription> servicePlacementPolicies = default(IEnumerable <ServicePlacementPolicyDescription>), MoveCost?defaultMoveCost = default(MoveCost?), bool?isDefaultMoveCostSpecified = default(bool?), ServicePackageActivationMode?servicePackageActivationMode = default(ServicePackageActivationMode?), string serviceDnsName = default(string), IEnumerable <ScalingPolicyDescription> scalingPolicies = default(IEnumerable <ScalingPolicyDescription>), int?flags = default(int?), long?replicaRestartWaitDurationSeconds = default(long?), long?quorumLossWaitDurationSeconds = default(long?), long?standByReplicaKeepDurationSeconds = default(long?), long?servicePlacementTimeLimitSeconds = default(long?), bool?dropSourceReplicaOnMove = default(bool?)) : base( serviceName, serviceTypeName, partitionDescription, Common.ServiceKind.Stateful, applicationName, initializationData, placementConstraints, correlationScheme, serviceLoadMetrics, servicePlacementPolicies, defaultMoveCost, isDefaultMoveCostSpecified, servicePackageActivationMode, serviceDnsName, scalingPolicies) { targetReplicaSetSize.ThrowIfNull(nameof(targetReplicaSetSize)); minReplicaSetSize.ThrowIfNull(nameof(minReplicaSetSize)); hasPersistedState.ThrowIfNull(nameof(hasPersistedState)); targetReplicaSetSize?.ThrowIfLessThan("targetReplicaSetSize", 1); minReplicaSetSize?.ThrowIfLessThan("minReplicaSetSize", 1); replicaRestartWaitDurationSeconds?.ThrowIfOutOfInclusiveRange("replicaRestartWaitDurationSeconds", 0, 4294967295); quorumLossWaitDurationSeconds?.ThrowIfOutOfInclusiveRange("quorumLossWaitDurationSeconds", 0, 4294967295); standByReplicaKeepDurationSeconds?.ThrowIfOutOfInclusiveRange("standByReplicaKeepDurationSeconds", 0, 4294967295); servicePlacementTimeLimitSeconds?.ThrowIfOutOfInclusiveRange("servicePlacementTimeLimitSeconds", 0, 4294967295); this.TargetReplicaSetSize = targetReplicaSetSize; this.MinReplicaSetSize = minReplicaSetSize; this.HasPersistedState = hasPersistedState; this.Flags = flags; this.ReplicaRestartWaitDurationSeconds = replicaRestartWaitDurationSeconds; this.QuorumLossWaitDurationSeconds = quorumLossWaitDurationSeconds; this.StandByReplicaKeepDurationSeconds = standByReplicaKeepDurationSeconds; this.ServicePlacementTimeLimitSeconds = servicePlacementTimeLimitSeconds; this.DropSourceReplicaOnMove = dropSourceReplicaOnMove; }
/// <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, MoveCost?value) { switch (value) { case MoveCost.Zero: writer.WriteStringValue("Zero"); break; case MoveCost.Low: writer.WriteStringValue("Low"); break; case MoveCost.Medium: writer.WriteStringValue("Medium"); break; case MoveCost.High: writer.WriteStringValue("High"); break; case MoveCost.VeryHigh: writer.WriteStringValue("VeryHigh"); break; default: throw new ArgumentException($"Invalid value {value.ToString()} for enum type MoveCost"); } }
/// <summary> /// Initializes a new instance of the StatelessServiceDescription class. /// </summary> /// <param name="serviceName">The full name of the service with 'fabric:' URI scheme.</param> /// <param name="serviceTypeName">Name of the service type as specified in the service manifest.</param> /// <param name="partitionDescription">The partition description as an object.</param> /// <param name="instanceCount">The instance count.</param> /// <param name="applicationName">The name of the application, including the 'fabric:' URI scheme.</param> /// <param name="initializationData">The initialization data as an array of bytes. Initialization data is passed to /// service instances or replicas when they are created.</param> /// <param name="placementConstraints">The placement constraints as a string. Placement constraints are boolean /// expressions on node properties and allow for restricting a service to particular nodes based on the service /// requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == /// blue)".</param> /// <param name="correlationScheme">The correlation scheme.</param> /// <param name="serviceLoadMetrics">The service load metrics.</param> /// <param name="servicePlacementPolicies">The service placement policies.</param> /// <param name="defaultMoveCost">The move cost for the service. Possible values include: 'Zero', 'Low', 'Medium', /// 'High', 'VeryHigh' /// /// Specifies the move cost for the service. /// </param> /// <param name="isDefaultMoveCostSpecified">Indicates if the DefaultMoveCost property is specified.</param> /// <param name="servicePackageActivationMode">The activation mode of service package to be used for a service. /// Possible values include: 'SharedProcess', 'ExclusiveProcess' /// /// The activation mode of service package to be used for a Service Fabric service. This is specified at the time of /// creating the Service. /// </param> /// <param name="serviceDnsName">The DNS name of the service. It requires the DNS system service to be enabled in /// Service Fabric cluster.</param> /// <param name="scalingPolicies">Scaling policies for this service.</param> /// <param name="tagsRequiredToPlace">Tags for placement of this service.</param> /// <param name="tagsRequiredToRun">Tags for running of this service.</param> /// <param name="minInstanceCount">MinInstanceCount is the minimum number of instances that must be up to meet the /// EnsureAvailability safety check during operations like upgrade or deactivate node. /// The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * InstanceCount) ). /// Note, if InstanceCount is set to -1, during MinInstanceCount computation -1 is first converted into the number of /// nodes on which the instances are allowed to be placed according to the placement constraints on the service. /// </param> /// <param name="minInstancePercentage">MinInstancePercentage is the minimum percentage of InstanceCount that must be /// up to meet the EnsureAvailability safety check during operations like upgrade or deactivate node. /// The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * InstanceCount) ). /// Note, if InstanceCount is set to -1, during MinInstancePercentage computation, -1 is first converted into the /// number of nodes on which the instances are allowed to be placed according to the placement constraints on the /// service. /// </param> /// <param name="flags">Flags indicating whether other properties are set. Each of the associated properties /// corresponds to a flag, specified below, which, if set, indicate that the property is specified. /// This property can be a combination of those flags obtained using bitwise 'OR' operator. /// For example, if the provided value is 1 then the flags for InstanceCloseDelayDuration is set. /// /// - None - Does not indicate any other properties are set. The value is zero. /// - InstanceCloseDelayDuration - Indicates the InstanceCloseDelayDuration property is set. The value is 1. /// - InstanceRestartWaitDuration - Indicates the InstanceRestartWaitDurationSeconds property is set. The value is 2. /// </param> /// <param name="instanceCloseDelayDurationSeconds">Duration in seconds, to wait before a stateless instance is closed, /// to allow the active requests to drain gracefully. This would be effective when the instance is closing during the /// application/cluster upgrade and disabling node. /// The endpoint exposed on this instance is removed prior to starting the delay, which prevents new connections to /// this instance. /// In addition, clients that have subscribed to service endpoint change /// events(https://docs.microsoft.com/dotnet/api/system.fabric.fabricclient.servicemanagementclient.registerservicenotificationfilterasync), /// can do /// the following upon receiving the endpoint removal notification: /// - Stop sending new requests to this instance. /// - Close existing connections after in-flight requests have completed. /// - Connect to a different instance of the service partition for future requests. /// Note, the default value of InstanceCloseDelayDuration is 0, which indicates that there won't be any delay or /// removal of the endpoint prior to closing the instance. /// </param> /// <param name="instanceLifecycleDescription">Defines how instances of this service will behave during their /// lifecycle.</param> /// <param name="instanceRestartWaitDurationSeconds">When a stateless instance goes down, this timer starts. When it /// expires Service Fabric will create a new instance on any node in the cluster. /// This configuration is to reduce unnecessary creation of a new instance in situations where the instance going down /// is likely to recover in a short time. For example, during an upgrade. /// The default value is 0, which indicates that when stateless instance goes down, Service Fabric will immediately /// start building its replacement. /// </param> public StatelessServiceDescription( ServiceName serviceName, string serviceTypeName, PartitionSchemeDescription partitionDescription, int?instanceCount, ApplicationName applicationName = default(ApplicationName), byte[] initializationData = default(byte[]), string placementConstraints = default(string), IEnumerable <ServiceCorrelationDescription> correlationScheme = default(IEnumerable <ServiceCorrelationDescription>), IEnumerable <ServiceLoadMetricDescription> serviceLoadMetrics = default(IEnumerable <ServiceLoadMetricDescription>), IEnumerable <ServicePlacementPolicyDescription> servicePlacementPolicies = default(IEnumerable <ServicePlacementPolicyDescription>), MoveCost?defaultMoveCost = default(MoveCost?), bool?isDefaultMoveCostSpecified = default(bool?), ServicePackageActivationMode?servicePackageActivationMode = default(ServicePackageActivationMode?), string serviceDnsName = default(string), IEnumerable <ScalingPolicyDescription> scalingPolicies = default(IEnumerable <ScalingPolicyDescription>), NodeTagsDescription tagsRequiredToPlace = default(NodeTagsDescription), NodeTagsDescription tagsRequiredToRun = default(NodeTagsDescription), int?minInstanceCount = default(int?), int?minInstancePercentage = default(int?), int?flags = default(int?), long?instanceCloseDelayDurationSeconds = default(long?), InstanceLifecycleDescription instanceLifecycleDescription = default(InstanceLifecycleDescription), long?instanceRestartWaitDurationSeconds = default(long?)) : base( serviceName, serviceTypeName, partitionDescription, Common.ServiceKind.Stateless, applicationName, initializationData, placementConstraints, correlationScheme, serviceLoadMetrics, servicePlacementPolicies, defaultMoveCost, isDefaultMoveCostSpecified, servicePackageActivationMode, serviceDnsName, scalingPolicies, tagsRequiredToPlace, tagsRequiredToRun) { instanceCount.ThrowIfNull(nameof(instanceCount)); instanceCount?.ThrowIfLessThan("instanceCount", -1); instanceCloseDelayDurationSeconds?.ThrowIfOutOfInclusiveRange("instanceCloseDelayDurationSeconds", 0, 4294967295); instanceRestartWaitDurationSeconds?.ThrowIfOutOfInclusiveRange("instanceRestartWaitDurationSeconds", 0, 4294967295); this.InstanceCount = instanceCount; this.MinInstanceCount = minInstanceCount; this.MinInstancePercentage = minInstancePercentage; this.Flags = flags; this.InstanceCloseDelayDurationSeconds = instanceCloseDelayDurationSeconds; this.InstanceLifecycleDescription = instanceLifecycleDescription; this.InstanceRestartWaitDurationSeconds = instanceRestartWaitDurationSeconds; }
/// <summary> /// Initializes a new instance of the StatefulServiceUpdateDescription class. /// </summary> /// <param name="flags">Flags indicating whether other properties are set. Each of the associated properties /// corresponds to a flag, specified below, which, if set, indicate that the property is specified. /// This property can be a combination of those flags obtained using bitwise 'OR' operator. /// For example, if the provided value is 6 then the flags for ReplicaRestartWaitDuration (2) and /// QuorumLossWaitDuration (4) are set. /// /// - None - Does not indicate any other properties are set. The value is zero. /// - TargetReplicaSetSize/InstanceCount - Indicates whether the TargetReplicaSetSize property (for Stateful services) /// or the InstanceCount property (for Stateless services) is set. The value is 1. /// - ReplicaRestartWaitDuration - Indicates the ReplicaRestartWaitDuration property is set. The value is 2. /// - QuorumLossWaitDuration - Indicates the QuorumLossWaitDuration property is set. The value is 4. /// - StandByReplicaKeepDuration - Indicates the StandByReplicaKeepDuration property is set. The value is 8. /// - MinReplicaSetSize - Indicates the MinReplicaSetSize property is set. The value is 16. /// - PlacementConstraints - Indicates the PlacementConstraints property is set. The value is 32. /// - PlacementPolicyList - Indicates the ServicePlacementPolicies property is set. The value is 64. /// - Correlation - Indicates the CorrelationScheme property is set. The value is 128. /// - Metrics - Indicates the ServiceLoadMetrics property is set. The value is 256. /// - DefaultMoveCost - Indicates the DefaultMoveCost property is set. The value is 512. /// - ScalingPolicy - Indicates the ScalingPolicies property is set. The value is 1024. /// - ServicePlacementTimeLimit - Indicates the ServicePlacementTimeLimit property is set. The value is 2048. /// - MinInstanceCount - Indicates the MinInstanceCount property is set. The value is 4096. /// - MinInstancePercentage - Indicates the MinInstancePercentage property is set. The value is 8192. /// - InstanceCloseDelayDuration - Indicates the InstanceCloseDelayDuration property is set. The value is 16384. /// - InstanceRestartWaitDuration - Indicates the InstanceCloseDelayDuration property is set. The value is 32768. /// - DropSourceReplicaOnMove - Indicates the DropSourceReplicaOnMove property is set. The value is 65536. /// - ServiceDnsName - Indicates the ServiceDnsName property is set. The value is 131072. /// - TagsForPlacement - Indicates the TagsForPlacement property is set. The value is 1048576. /// - TagsForRunning - Indicates the TagsForRunning property is set. The value is 2097152. /// </param> /// <param name="placementConstraints">The placement constraints as a string. Placement constraints are boolean /// expressions on node properties and allow for restricting a service to particular nodes based on the service /// requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == /// blue)".</param> /// <param name="correlationScheme">The correlation scheme.</param> /// <param name="loadMetrics">The service load metrics.</param> /// <param name="servicePlacementPolicies">The service placement policies.</param> /// <param name="defaultMoveCost">The move cost for the service. Possible values include: 'Zero', 'Low', 'Medium', /// 'High', 'VeryHigh' /// /// Specifies the move cost for the service. /// </param> /// <param name="scalingPolicies">Scaling policies for this service.</param> /// <param name="serviceDnsName">The DNS name of the service.</param> /// <param name="tagsForPlacement">Tags for placement of this service.</param> /// <param name="tagsForRunning">Tags for running of this service.</param> /// <param name="targetReplicaSetSize">The target replica set size as a number.</param> /// <param name="minReplicaSetSize">The minimum replica set size as a number.</param> /// <param name="replicaRestartWaitDurationSeconds">The duration, in seconds, between when a replica goes down and when /// a new replica is created.</param> /// <param name="quorumLossWaitDurationSeconds">The maximum duration, in seconds, for which a partition is allowed to /// be in a state of quorum loss.</param> /// <param name="standByReplicaKeepDurationSeconds">The definition on how long StandBy replicas should be maintained /// before being removed.</param> /// <param name="servicePlacementTimeLimitSeconds">The duration for which replicas can stay InBuild before reporting /// that build is stuck.</param> /// <param name="dropSourceReplicaOnMove">Indicates whether to drop source Secondary replica even if the target replica /// has not finished build. If desired behavior is to drop it as soon as possible the value of this property is true, /// if not it is false.</param> /// <param name="replicaLifecycleDescription">Defines how replicas of this service will behave during ther /// lifecycle.</param> /// <param name="auxiliaryReplicaCount">The auxiliary replica count as a number. To use Auxiliary replicas, the /// following must be true: AuxiliaryReplicaCount < (TargetReplicaSetSize+1)/2 and TargetReplicaSetSize >=3.</param> public StatefulServiceUpdateDescription( string flags = default(string), string placementConstraints = default(string), IEnumerable <ServiceCorrelationDescription> correlationScheme = default(IEnumerable <ServiceCorrelationDescription>), IEnumerable <ServiceLoadMetricDescription> loadMetrics = default(IEnumerable <ServiceLoadMetricDescription>), IEnumerable <ServicePlacementPolicyDescription> servicePlacementPolicies = default(IEnumerable <ServicePlacementPolicyDescription>), MoveCost?defaultMoveCost = default(MoveCost?), IEnumerable <ScalingPolicyDescription> scalingPolicies = default(IEnumerable <ScalingPolicyDescription>), string serviceDnsName = default(string), NodeTagsDescription tagsForPlacement = default(NodeTagsDescription), NodeTagsDescription tagsForRunning = default(NodeTagsDescription), int?targetReplicaSetSize = default(int?), int?minReplicaSetSize = default(int?), string replicaRestartWaitDurationSeconds = default(string), string quorumLossWaitDurationSeconds = default(string), string standByReplicaKeepDurationSeconds = default(string), string servicePlacementTimeLimitSeconds = default(string), bool?dropSourceReplicaOnMove = default(bool?), ReplicaLifecycleDescription replicaLifecycleDescription = default(ReplicaLifecycleDescription), int?auxiliaryReplicaCount = default(int?)) : base( Common.ServiceKind.Stateful, flags, placementConstraints, correlationScheme, loadMetrics, servicePlacementPolicies, defaultMoveCost, scalingPolicies, serviceDnsName, tagsForPlacement, tagsForRunning) { targetReplicaSetSize?.ThrowIfLessThan("targetReplicaSetSize", 1); minReplicaSetSize?.ThrowIfLessThan("minReplicaSetSize", 1); auxiliaryReplicaCount?.ThrowIfLessThan("auxiliaryReplicaCount", 0); this.TargetReplicaSetSize = targetReplicaSetSize; this.MinReplicaSetSize = minReplicaSetSize; this.ReplicaRestartWaitDurationSeconds = replicaRestartWaitDurationSeconds; this.QuorumLossWaitDurationSeconds = quorumLossWaitDurationSeconds; this.StandByReplicaKeepDurationSeconds = standByReplicaKeepDurationSeconds; this.ServicePlacementTimeLimitSeconds = servicePlacementTimeLimitSeconds; this.DropSourceReplicaOnMove = dropSourceReplicaOnMove; this.ReplicaLifecycleDescription = replicaLifecycleDescription; this.AuxiliaryReplicaCount = auxiliaryReplicaCount; }
/// <summary> /// Initializes a new instance of the ServiceDescription class. /// </summary> /// <param name="serviceName">The full name of the service with 'fabric:' URI scheme.</param> /// <param name="serviceTypeName">Name of the service type as specified in the service manifest.</param> /// <param name="partitionDescription">The partition description as an object.</param> /// <param name="serviceKind">The kind of service (Stateless or Stateful).</param> /// <param name="applicationName">The name of the application, including the 'fabric:' URI scheme.</param> /// <param name="initializationData">The initialization data as an array of bytes. Initialization data is passed to /// service instances or replicas when they are created.</param> /// <param name="placementConstraints">The placement constraints as a string. Placement constraints are boolean /// expressions on node properties and allow for restricting a service to particular nodes based on the service /// requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == /// blue)".</param> /// <param name="correlationScheme">The correlation scheme.</param> /// <param name="serviceLoadMetrics">The service load metrics.</param> /// <param name="servicePlacementPolicies">The service placement policies.</param> /// <param name="defaultMoveCost">The move cost for the service. Possible values include: 'Zero', 'Low', 'Medium', /// 'High', 'VeryHigh' /// /// Specifies the move cost for the service. /// </param> /// <param name="isDefaultMoveCostSpecified">Indicates if the DefaultMoveCost property is specified.</param> /// <param name="servicePackageActivationMode">The activation mode of service package to be used for a service. /// Possible values include: 'SharedProcess', 'ExclusiveProcess' /// /// The activation mode of service package to be used for a Service Fabric service. This is specified at the time of /// creating the Service. /// </param> /// <param name="serviceDnsName">The DNS name of the service. It requires the DNS system service to be enabled in /// Service Fabric cluster.</param> /// <param name="scalingPolicies">Scaling policies for this service.</param> /// <param name="tagsRequiredToPlace">Tags for placement of this service.</param> /// <param name="tagsRequiredToRun">Tags for running of this service.</param> protected ServiceDescription( ServiceName serviceName, string serviceTypeName, PartitionSchemeDescription partitionDescription, ServiceKind?serviceKind, ApplicationName applicationName = default(ApplicationName), byte[] initializationData = default(byte[]), string placementConstraints = default(string), IEnumerable <ServiceCorrelationDescription> correlationScheme = default(IEnumerable <ServiceCorrelationDescription>), IEnumerable <ServiceLoadMetricDescription> serviceLoadMetrics = default(IEnumerable <ServiceLoadMetricDescription>), IEnumerable <ServicePlacementPolicyDescription> servicePlacementPolicies = default(IEnumerable <ServicePlacementPolicyDescription>), MoveCost?defaultMoveCost = default(MoveCost?), bool?isDefaultMoveCostSpecified = default(bool?), ServicePackageActivationMode?servicePackageActivationMode = default(ServicePackageActivationMode?), string serviceDnsName = default(string), IEnumerable <ScalingPolicyDescription> scalingPolicies = default(IEnumerable <ScalingPolicyDescription>), NodeTagsDescription tagsRequiredToPlace = default(NodeTagsDescription), NodeTagsDescription tagsRequiredToRun = default(NodeTagsDescription)) { serviceName.ThrowIfNull(nameof(serviceName)); serviceTypeName.ThrowIfNull(nameof(serviceTypeName)); partitionDescription.ThrowIfNull(nameof(partitionDescription)); serviceKind.ThrowIfNull(nameof(serviceKind)); this.ServiceName = serviceName; this.ServiceTypeName = serviceTypeName; this.PartitionDescription = partitionDescription; this.ServiceKind = serviceKind; this.ApplicationName = applicationName; this.InitializationData = initializationData; this.PlacementConstraints = placementConstraints; this.CorrelationScheme = correlationScheme; this.ServiceLoadMetrics = serviceLoadMetrics; this.ServicePlacementPolicies = servicePlacementPolicies; this.DefaultMoveCost = defaultMoveCost; this.IsDefaultMoveCostSpecified = isDefaultMoveCostSpecified; this.ServicePackageActivationMode = servicePackageActivationMode; this.ServiceDnsName = serviceDnsName; this.ScalingPolicies = scalingPolicies; this.TagsRequiredToPlace = tagsRequiredToPlace; this.TagsRequiredToRun = tagsRequiredToRun; }
/// <summary> /// Initializes a new instance of the StatelessServiceDescription class. /// </summary> /// <param name="serviceName">The full name of the service with 'fabric:' URI scheme.</param> /// <param name="serviceTypeName">Name of the service type as specified in the service manifest.</param> /// <param name="partitionDescription">The partition description as an object.</param> /// <param name="instanceCount">The instance count.</param> /// <param name="applicationName">The name of the application, including the 'fabric:' URI scheme.</param> /// <param name="initializationData">The initialization data as an array of bytes. Initialization data is passed to /// service instances or replicas when they are created.</param> /// <param name="placementConstraints">The placement constraints as a string. Placement constraints are boolean /// expressions on node properties and allow for restricting a service to particular nodes based on the service /// requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == /// blue)".</param> /// <param name="correlationScheme">The correlation scheme.</param> /// <param name="serviceLoadMetrics">The service load metrics.</param> /// <param name="servicePlacementPolicies">The service placement policies.</param> /// <param name="defaultMoveCost">Specifies the move cost for the service. Possible values include: 'Zero', 'Low', /// 'Medium', 'High'</param> /// <param name="isDefaultMoveCostSpecified">Indicates if the DefaultMoveCost property is specified.</param> /// <param name="servicePackageActivationMode">The activation mode of service package to be used for a Service Fabric /// service. This is specified at the time of creating the Service. Possible values include: 'SharedProcess', /// 'ExclusiveProcess'</param> /// <param name="serviceDnsName">The DNS name of the service. It requires the DNS system service to be enabled in /// Service Fabric cluster.</param> /// <param name="scalingPolicies">Scaling policies for this service.</param> public StatelessServiceDescription( ServiceName serviceName, string serviceTypeName, PartitionSchemeDescription partitionDescription, int?instanceCount, ApplicationName applicationName = default(ApplicationName), byte[] initializationData = default(byte[]), string placementConstraints = default(string), IEnumerable <ServiceCorrelationDescription> correlationScheme = default(IEnumerable <ServiceCorrelationDescription>), IEnumerable <ServiceLoadMetricDescription> serviceLoadMetrics = default(IEnumerable <ServiceLoadMetricDescription>), IEnumerable <ServicePlacementPolicyDescription> servicePlacementPolicies = default(IEnumerable <ServicePlacementPolicyDescription>), MoveCost?defaultMoveCost = default(MoveCost?), bool?isDefaultMoveCostSpecified = default(bool?), ServicePackageActivationMode?servicePackageActivationMode = default(ServicePackageActivationMode?), string serviceDnsName = default(string), IEnumerable <ScalingPolicyDescription> scalingPolicies = default(IEnumerable <ScalingPolicyDescription>)) : base( serviceName, serviceTypeName, partitionDescription, Common.ServiceKind.Stateless, applicationName, initializationData, placementConstraints, correlationScheme, serviceLoadMetrics, servicePlacementPolicies, defaultMoveCost, isDefaultMoveCostSpecified, servicePackageActivationMode, serviceDnsName, scalingPolicies) { instanceCount.ThrowIfNull(nameof(instanceCount)); instanceCount?.ThrowIfLessThan("instanceCount", -1); this.InstanceCount = instanceCount; }