protected void CreateServiceGroupFromTemplate( Uri applicationName, Uri serviceName, string serviceTypeName, ServicePackageActivationMode servicePackageActivationMode) { var clusterConnection = this.GetClusterConnection(); try { clusterConnection.CreateServiceGroupFromTemplateAsync( applicationName, serviceName, serviceTypeName, servicePackageActivationMode, null, this.GetTimeout(), this.GetCancellationToken()).Wait(); this.WriteObject(StringResources.Info_CreateServiceGroupFromTemplateSucceeded); } catch (AggregateException aggregateException) { aggregateException.Handle((ae) => { this.ThrowTerminatingError( ae, Constants.CreateServiceErrorId, clusterConnection); return(true); }); } }
public StatefulServiceGroupDescriptionBuilder( Uri applicationName, ServiceCmdletBase.PartitionSchemeDescriptionBuilder partitionSchemeDescriptionBuilder, bool hasPersistentState, int targetReplicaSetSize, int minReplicaSetSize, Uri serviceName, string serviceTypeName, string placementConstraints, string[] metrics, string[] correlations, string[] placementPolicies, Hashtable[] memberDescriptions, TimeSpan?replicaRestartWaitDuration, TimeSpan?quorumLossWaitDuration, ServicePackageActivationMode servicePackageActivationMode) : base( true, applicationName, partitionSchemeDescriptionBuilder, serviceName, serviceTypeName, placementConstraints, metrics, correlations, placementPolicies, memberDescriptions, servicePackageActivationMode) { this.HasPersistentState = hasPersistentState; this.TargetReplicaSetSize = targetReplicaSetSize; this.MinReplicaSetSize = minReplicaSetSize; this.ReplicaRestartWaitDuration = replicaRestartWaitDuration; this.QuorumLossWaitDuration = quorumLossWaitDuration; }
public StatelessServiceDescriptionBuilder( Uri applicationName, PartitionSchemeDescriptionBuilder partitionSchemeDescriptionBuilder, int instanceCount, Uri serviceName, string serviceTypeName, string placementConstraints, string[] metrics, string[] correlations, string[] placementPolicies, string defaultMoveCost, ServicePackageActivationMode servicePackageActivationMode, string serviceDnsName, List <ScalingPolicyDescription> scalingPolicies) : base( false, applicationName, partitionSchemeDescriptionBuilder, serviceName, serviceTypeName, placementConstraints, metrics, correlations, placementPolicies, defaultMoveCost, servicePackageActivationMode, serviceDnsName, scalingPolicies) { this.InstanceCount = instanceCount; }
public StatelessServiceGroupDescriptionBuilder( Uri applicationName, ServiceCmdletBase.PartitionSchemeDescriptionBuilder partitionSchemeDescriptionBuilder, int instanceCount, Uri serviceName, string serviceTypeName, string placementConstraints, string[] metrics, string[] correlations, string[] placementPolicies, Hashtable[] memberDescriptions, ServicePackageActivationMode servicePackageActivationMode) : base( false, applicationName, partitionSchemeDescriptionBuilder, serviceName, serviceTypeName, placementConstraints, metrics, correlations, placementPolicies, memberDescriptions, servicePackageActivationMode) { this.InstanceCount = instanceCount; }
internal static NativeTypes.FABRIC_SERVICE_PACKAGE_ACTIVATION_MODE ToNativeServicePackageActivationMode( ServicePackageActivationMode activationMode) { switch (activationMode) { case ServicePackageActivationMode.SharedProcess: return(NativeTypes.FABRIC_SERVICE_PACKAGE_ACTIVATION_MODE.FABRIC_ISOLATION_LEVEL_SHARED_PROCESS); case ServicePackageActivationMode.ExclusiveProcess: return(NativeTypes.FABRIC_SERVICE_PACKAGE_ACTIVATION_MODE.FABRIC_ISOLATION_LEVEL_EXCLUSIVE_PROCESS); default: var errorMessage = string.Format( CultureInfo.CurrentCulture, StringResources.Error_EnumInvalid_Formatted, activationMode, "ServicePackageActivationMode"); AppTrace.TraceSource.WriteError( TraceComponent, "InteropHelpersToNativeServicePackageActivationMode(): " + errorMessage, activationMode); throw new ArgumentException(errorMessage); } }
public ServiceDescriptionBuilder( bool isStateful, Uri applicationName, PartitionSchemeDescriptionBuilder partitionSchemeDescriptionBuilder, Uri serviceName, string serviceTypeName, string placementConstraints, string[] metrics, string[] correlations, string[] placementPolicies, string defaultMoveCost, ServicePackageActivationMode servicePackageActivationMode, string serviceDnsName, List <ScalingPolicyDescription> scalingPolicies) { this.IsStateful = isStateful; this.ApplicationName = applicationName; this.PartitionSchemeDescriptionBuilder = partitionSchemeDescriptionBuilder; this.ServiceName = serviceName; this.ServiceTypeName = serviceTypeName; this.PlacementConstraints = placementConstraints; this.Metrics = metrics; this.Correlations = correlations; this.PlacementPolicies = placementPolicies; this.DefaultMoveCost = defaultMoveCost; this.ServicePackageActivationMode = servicePackageActivationMode; this.ServiceDnsName = serviceDnsName; this.ScalingPolicies = scalingPolicies; }
/// <summary> /// Creates an instance of <see cref="System.Fabric.Description.ServiceGroupFromTemplateDescription"/> with specified parameter. /// </summary> /// <param name="applicationName">Application name for the Service Group.</param> /// <param name="serviceName">>Service name for the Service Group.</param> /// <param name="serviceTypeName">Service Type Name for the Service Group.</param> /// <param name="servicePackageActivationMode"> /// <see cref="System.Fabric.Description.ServicePackageActivationMode"/> to use for service group creation. /// </param> /// <param name="initializationData">Initialization data that will be passed to Service Group.</param> public ServiceGroupFromTemplateDescription( Uri applicationName, Uri serviceName, string serviceTypeName, ServicePackageActivationMode servicePackageActivationMode, byte[] initializationData) { Requires.Argument("applicationName", applicationName).NotNull(); Requires.Argument("serviceName", serviceName).NotNull(); Requires.Argument("serviceTypeName", serviceTypeName).NotNullOrWhiteSpace(); this.ApplicationName = applicationName; this.ServiceName = serviceName; this.ServiceTypeName = serviceTypeName; this.ServicePackageActivationMode = servicePackageActivationMode; this.InitializationData = initializationData; }
private void CopyFrom(ServiceDescription other) { // Copy basic types this.PlacementConstraints = other.PlacementConstraints; this.ServiceTypeName = other.ServiceTypeName; this.ApplicationName = other.ApplicationName; this.ServiceName = other.ServiceName; this.InitializationData = other.InitializationData == null ? null : other.InitializationData.ToArray(); this.isDefaultMoveCostSpecified = other.IsDefaultMoveCostSpecified; this.defaultMoveCost = other.defaultMoveCost; this.ServiceDnsName = other.ServiceDnsName; this.ServicePackageActivationMode = other.ServicePackageActivationMode; ServiceLoadMetricDescription.CopyFrom(other.Metrics, this.Metrics); this.correlations.AddRange(other.Correlations.Select(c => new ServiceCorrelationDescription(c))); this.PartitionSchemeDescription = other.PartitionSchemeDescription.GetCopy(); this.placementPolicies.AddRange(other.placementPolicies.Select(p => p.GetCopy())); this.scalingPolicies.AddRange(other.ScalingPolicies.Select(p => ScalingPolicyDescription.GetCopy(p))); }
public StatefulServiceDescriptionBuilder( Uri applicationName, PartitionSchemeDescriptionBuilder partitionSchemeDescriptionBuilder, bool hasPersistentState, int targetReplicaSetSize, int minReplicaSetSize, Uri serviceName, string serviceTypeName, string placementConstraints, string[] metrics, string[] correlations, string[] placementPolicies, TimeSpan?replicaRestartWaitDuration, TimeSpan?quorumLossWaitDuration, TimeSpan?standByReplicaKeepDuration, string defaultMoveCost, ServicePackageActivationMode servicePackageActivationMode, string serviceDnsName, List <ScalingPolicyDescription> scalingPolicies) : base( true, applicationName, partitionSchemeDescriptionBuilder, serviceName, serviceTypeName, placementConstraints, metrics, correlations, placementPolicies, defaultMoveCost, servicePackageActivationMode, serviceDnsName, scalingPolicies) { this.HasPersistentState = hasPersistentState; this.TargetReplicaSetSize = targetReplicaSetSize; this.MinReplicaSetSize = minReplicaSetSize; this.ReplicaRestartWaitDuration = replicaRestartWaitDuration; this.QuorumLossWaitDuration = quorumLossWaitDuration; this.StandByReplicaKeepDuration = standByReplicaKeepDuration; }
public ServiceGroupDescriptionBuilder( bool isStateful, Uri applicationName, ServiceCmdletBase.PartitionSchemeDescriptionBuilder partitionSchemeDescriptionBuilder, Uri serviceName, string serviceTypeName, string placementConstraints, string[] metrics, string[] correlations, string[] placementPolicies, Hashtable[] memberDescriptions, ServicePackageActivationMode servicePackageActivationMode) : base( isStateful, applicationName, partitionSchemeDescriptionBuilder, serviceName, serviceTypeName, placementConstraints, metrics, correlations, placementPolicies, null, servicePackageActivationMode, string.Empty, null) { this.IsStateful = isStateful; this.ApplicationName = applicationName; this.PartitionSchemeDescriptionBuilder = partitionSchemeDescriptionBuilder; this.ServiceName = serviceName; this.ServiceTypeName = serviceTypeName; this.PlacementConstraints = placementConstraints; this.Metrics = metrics; this.Correlations = correlations; this.PlacementPolicies = placementPolicies; this.MemberDescriptions = memberDescriptions; }
public CreateServiceFromTemplateRequest( IFabricClient fabricClient, Uri applicationName, Uri serviceName, string serviceDnsName, string serviceTypeName, ServicePackageActivationMode servicePackageActivationMode, byte[] initializationData, TimeSpan timeout) : base(fabricClient, timeout) { ThrowIf.Null(applicationName, "applicationName"); ThrowIf.Null(serviceName, "serviceName"); ThrowIf.NullOrEmpty(serviceTypeName, "serviceTypeName"); this.ApplicationName = applicationName; this.ServiceName = serviceName; this.ServiceDnsName = serviceDnsName; this.ServiceTypeName = serviceTypeName; this.ServicePackageActivationMode = servicePackageActivationMode; this.InitializationData = initializationData; this.ConfigureErrorCodes(); }